仅当 test-job1 成功时,我才想执行 test-job2 。我如何配置,以便 test-job2 在 test-job1 完成并成功后立即被解雇。
build-job:
stage: build
script:
- echo "Hello, $GITLAB_USER_LOGIN!"
test-job1:
stage: test
script:
- python3 mydumbscript.py $arg1 $arg2 $arg3
test-job2:
stage: test
script:
- echo "This job tests something, but takes more time than test-job1."
- echo "After the echo commands complete, it runs the sleep command for 20 seconds"
- echo "which simulates a test that runs 20 seconds longer than test-job1"
- sleep 20
jobs.<job_id>.needs
来设置依赖关系。
例如,在下面,
job2
等待job1
成功完成才开始。
jobs:
job1:
job2:
needs: job1
job3:
needs: [job1, job2]
就您而言,我想您需要在
needs: test-job1
下添加 test-job2
。