- 局部/全局环境变量
stages:
- testing # stage编排
- build
- deploy
variables:
global_var: "全部变量" #全部变量
build_image:
stage: build
variables: #局部环境变量
my_name: "局部环境变量"
tags:
- shell
script:
- echo "打包镜像"
- echo "$my_name" #打印局部环境变量
- echo "$global_var" #打印全局环境变量
deploy_to_qa:
stage: deploy
tags:
- shell
script:
- echo "部署到QA"
运行结果:
- 系统默认全局变量
https://docs.gitlab.com/ee/ci/variables/predefined_variables.html
3. 判断语句