GitLab CICD Day 17 - Image递增版本号 - 2

阅读 97

2023-02-11

  1. 新增build版本号

variables:
user: eric
pwd: Admin@1234
harbor: http://172.16.128.215:8080
image_hellocat: 172.16.128.215:8080/hive/hellocat


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_hellocat:$Image_Version-build$CI_PIPELINE_IID . # 增加build小版本号(CI_PIPELINE_IID)默认全局变量
- docker push $image_hellocat:$Image_Version-build$CI_PIPELINE_IID

  1. 上传结果:

       GitLab CICD Day 17 - Image递增版本号 - 2_全局变量

精彩评论(0)

0 0 举报