zoukankan      html  css  js  c++  java
  • 获取阿里云镜像仓库中镜像的tag

    一、安装阿里云linux客户端工具

    选择官网下载地址

    # wget wget https://aliyuncli.alicdn.com/aliyun-cli-linux-latest-amd64.tgz
    ​
    # tar -xf aliyun-cli-linux-latest-amd64.tgz
    ​
    # cp aliyun /usr/local/bin
    

      

    二、使用RAM进行子账号权限管理

    创建RAM子账号,并对该子账号授权,记录账号的AccessKey ID等信息

    权限名称
    AliyunContainerRegistryFullAccess
    AliyunContainerRegistryReadOnlyAccess

     

    三、配置客户端工具

    # aliyun configure
    Configuring profile 'default' in 'AK' authenticate mode...
    Access Key Id [*********************kCg]: 
    Access Key Secret [***************************2w7]: 
    Default Region Id [cn-hangzhou]: 
    Default Output Format [json]: json (Only support json)
    Default Language [zh|en] zh: 
    Saving profile[default] ...Done.
    • Access ID:RAM子账号的ID

    • Access Secret:RAM子账号的Secret

    • Region ID:阿里云账号中镜像仓库的区位(这边是cn-hangzhou)

    • Language:zh

    四、获取镜像信息

    # aliyun cr GetRepoTags --help
    阿里云CLI命令行工具 3.0.64
    ​
    Product:     cr (容器镜像服务)
    Method:      GET
    PathPattern: /repos/[RepoNamespace]/[RepoName]/tags
    ​
    Parameters:
      --RepoName      String  Required 
      --RepoNamespace String  Required 
      --Page          Integer Optional 
      --PageSize      Integer Optional
    

      

    • 使用--help 查看使用方法,cr为容器镜像服务

    # aliyun cr GetRepoTags --RepoNamespace xxxx --RepoName xxxxxxx
    {
        "data": {
            "page": 1,
            "pageSize": 30,
            "tags": [
                {
                    "digest": "c06e0fe7ca4759dc15c517007a21465cfce16cc35ac3f83058c306880f804ea9",
                    "imageCreate": 1606813621000,
                    "imageId": "878046fe77276fe5ff5883537a5435734c9d21a953b271534df8d01f4da14e1e",
                    "imageSize": 154166831,
                    "imageUpdate": 1606813621000,
                    "status": "NORMAL",
                    "tag": "1.0.2"
                }
            ],
            "total": 1
        }
    }
    ​
    • --RepoNamespace:阿里云容器镜像服务中的命名空间

    • --RepoName:阿里云容器镜像服务中的镜像仓库名称

       

    只获取tag,需要提前安装jq命令

    # aliyun cr GetRepoTags --RepoNamespace xxxx --RepoName xxxxxxxxx | jq ".data.tags[].tag"
    "1.0.2"
    

      

    如果有多个镜像,会将所有镜像全部显示,可以在jenkins中作为参数选择要发布的镜像版本号

     

  • 相关阅读:
    AlphaToCoverage solution
    PhyreEngine3.8 MSAA resolution
    渲染错误
    tomcat
    Jupyter
    Flask
    Highcharts20151130
    CodeMirror
    响应式
    import
  • 原文地址:https://www.cnblogs.com/bigberg/p/14069857.html
Copyright © 2011-2022 走看看