作业成功时需要上传工件binary.bin
,而作业失败时需要上传build_trace.log
。
看artifacts:when 我没有这种能力。
我想看到类似的东西
job:
artifacts:
- name: failed_trace_log
when: on_failure
paths:
- build_trace.log
- name: succeed
when: on_success
paths:
- binary.bin
当前解决方法是:
job:
artifacts:
when: always
paths:
- build_trace.log
- binary.bin
答案 0 :(得分:1)
一种选择是在第一个清理作业之后使用when:on_failure。
stages:
- build
- cleanup_build
job:
stage: build
script:
- make build
artifacts:
paths:
- binary.bin
cleanup_job:
when: on_failure
stage: cleanup_build
script:
- do cleanup
artifacts:
paths:
- build_trace.log