GitLab CICD Day 07 - 指定分支
原创
©著作权归作者所有:来自51CTO博客作者qq58490fd3ddf1c的原创作品,请联系作者获取转载授权,否则将追究法律责任
- 新建dev分支
- only限制执行分支
stages:
- testing # stage编排
- build
- deploy
run_test: #Job
stage: testing
only: #只有main分支才会执行,dev会跳过此job(不会执行)
- main
tags:
- shell #Gitlab-runner
script:
- echo "执行测试"
- chmod +x ./run.sh # 给run.sh加可执行权限
- ./run.sh # 运行外部文件./run.sh
build_image:
stage: build
tags:
- shell
script:
- echo "打包镜像"
deploy_to_qa:
stage: deploy
tags:
- shell
script:
- echo "部署到QA"
- dev执行结果: