問題描述
Concourse 流水線:如何讓嵌入式腳本使流水線失敗 (Concourse Pipeline: How to have an Embedded Script Fail the Pipeline)
當我在運行參數中運行帶有嵌套 Python 腳本的 Concourse 管道時,如下所示:
‑ task: some‑task
params:
...
config:
platform: linux
...
run:
path: bash
args:
‑ "‑c"
‑ |
python my_failing_python_code.py
當 python 腳本失敗時,拋出退出 1,錯誤似乎不會冒泡我期望的管道。總體而言,管道“成功”結束。
我應該如何設置管道以讀取管道內運行的腳本的退出狀態?
謝謝
參考解法
方法 1:
If that is the whole content of the script, then you can replace it with
run:
path: python
args:
‑ my_failing_python_code.py
See https://concourse‑ci.org/hello‑world‑example.html
if the shell script does also other things, you are missing a set ‑e
, to tell the shell to report an error:
run:
path: bash
args:
‑ "‑c"
‑ |
set ‑e
python my_failing_python_code.py
See https://concourse‑ci.org/tasks.html