GitLab CI/CD Pipeline与jobs的概念
在GitLab中 Pipeline 的流水管道包含多个stage(阶段), 每个stage 包含多个jobs。
每一次提交都会触发一次Pipeline, 而每一个Pipeline的内容定义的都是一个个jobs。
所有的jobs都是定义在.gitlab.ci.yml中的, 是.gitlab.ci.yml的最高等级的元素,
每一个job都属于某一个stage. 默认是test ,stage默认有三种选择, build => test => deploy
定义的多个job也是这样执行的, 不是按照你再.gitlab.ci.yml中写的顺序执行.
image: alpine:latest
pages:
stage: deploy
script:
- echo 'Nothing to do...'
artifacts:
paths:
- public
only:
- master
deploytest:
stage: deploy
script:
- echo 'deploy test'
artifacts:
paths:
- public
only:
- master
deployuat:
stage: deploy
script:
- echo 'deploy uat'
artifacts:
paths:
- public
only:
- master
myjobs:
stage: build
script:
- echo 'execute myjobs build'
testjob2:
stage: test
script:
- echo 'execute mytest jon test2'
testjob:
stage: test
script:
- echo 'execute mytest jon test'
firstBuild:
stage: build
script:
- echo 'firstBuild'
firstTest:
stage: test
script:
- echo 'first test'