needs
依赖的作业一完成就立即运行,无需等待整个阶段结束。
支持: artifacts、pipeline:job、optional、parallel:matrix
不支持: project(跨项目)、pipeline(上游)
示例
从依赖作业下载产物
build:
stage: build
script:
- mkdir dist
- echo "artifact" > dist/output.txt
artifacts:
paths:
- dist/
test:
stage: test
script: echo "test"
needs:
- job: build
artifacts: true
不下载产物
build:
stage: build
script: echo "build"
test:
stage: test
script: echo "test"
needs:
- job: build
artifacts: false
可选依赖
build:
stage: build
script: echo "build"
test:
stage: test
script: echo "test"
needs:
- job: build
optional: true
并行矩阵依赖
linux:build:
stage: build
script: echo "build"
parallel:
matrix:
- PROVIDER: aws
STACK:
- app1
- app2
linux:rspec:
stage: test
script: echo "rspec"
needs:
- job: linux:build
parallel:
matrix:
- PROVIDER: aws
STACK: app1