大厅管道:如何让嵌入式脚本使管道失败



当我在运行参数中使用嵌套的 Python 脚本运行 Concourse 管道时,如下所示:

- task: some-task
params:
...
config:
platform: linux
...
run:
path: bash
args:
- "-c"
- |
python my_failing_python_code.py

当 python 脚本失败并抛出出口 1 时,错误似乎并没有像我预期的那样冒泡到管道中。总体而言,管道"成功"结束。

应如何设置管道以读取管道中运行的脚本的退出状态?

谢谢

如果这是脚本的全部内容,那么您可以将其替换为

run:
path: python
args:
- my_failing_python_code.py

请参阅 https://concourse-ci.org/hello-world-example.html

如果 shell 脚本还执行其他操作,则缺少一个set -e,以告诉 shell 报告错误:

run:
path: bash
args:
- "-c"
- |
set -e
python my_failing_python_code.py

见 https://concourse-ci.org/tasks.html

最新更新