我有一个像这样的 gitlab-ci:
stages:
- calculation
- execution
calculation-job:
stage: calculation
script: ./calculate_something_and_output_results.sh
tags:
- my-runner
execution-job:
stage: execution
script: ./execute_something_with_calculation_results.sh foo
tags:
- my-runner
The foo
论证中execution-job
是基于以下结果calculation-job
。我想通过变量将结果从一项工作传递到另一项工作。我怎样才能做到这一点?
如果您希望获得结果而不将文件存储在任何可以使用的地方artifacts: reports: dotenv
。这完全取自DarwinJS 跨作业共享变量存储库 https://gitlab.com/guided-explorations/cfg-data/sharing-job-created-variables-using-dotenv/share-variables-across-jobs/-/blob/master/.gitlab-ci.yml.
stages:
- calculation
- execution
calculation-job:
stage: calculation
script: - |
# stores new or updates existing env variables, ex. $OUTPUT_VAR1
./calculate_something_and_output_results.sh >> deploy.env
tags:
- my-runner
artifacts:
reports:
#propagates variables into the pipeline level, but never stores the actual file
dotenv: deploy.env
execution-job:
stage: execution
script: - |
echo "OUTPUT_VAR1: $OUTPUT_VAR1"
./execute_something_with_calculation_results.sh foo
tags:
- my-runner
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)