首页 > 其他分享 > GitLab CICD Day 17 - Image自动递增版本号

GitLab CICD Day 17 - Image自动递增版本号

时间:2023-02-11 17:01:15浏览次数:48  
标签:17 版本号 CICD Image testing version tsinghua edu image

  1. 新建deno.json

 GitLab CICD Day 17 - Image自动递增版本号_docker

  1. Gitlab-runner上安装jq
[root@qa onpremise]# yum -y install jq
Loaded plugins: fastestmirror, langpacks, product-id, search-disabled-repos, subscription-manager

This system is not registered with an entitlement server. You can use subscription-manager to register.

Loading mirror speeds from cached hostfile
epel/x86_64/metalink | 4.0 kB 00:00:00
* base: mirrors.tuna.tsinghua.edu.cn
* epel: ftp.riken.jp
* extras: mirrors.tuna.tsinghua.edu.cn
* updates: mirrors.tuna.tsinghua.edu.cn
WANdisco-git


[root@qa onpremise]# cat deno.json |jq -r .version
1.0.0
  1. 配置gitlab.yaml
variables:
user: eric
pwd: Admin@1234
harbor: http://172.16.128.215:8080
image: 172.16.128.215:8080/hive/hellocat:1.0


stages:
- testing
- build

image: denoland/deno


testing:
stage: testing
tags:
- shell
script:
- echo "testing"

build_image:
stage: build
tags:
- shell
before_script:
- export Image_version =$(cat deno.json | jq -r .version) # 待验证
- echo $Image_version
script:
- docker login -u $user -p $pwd $harbor
- docker build -t $image:Image_version .
- docker push $image:Image_version



标签:17,版本号,CICD,Image,testing,version,tsinghua,edu,image
From: https://blog.51cto.com/u_12391275/6050906

相关文章