Concourse 流水線:如何讓嵌入式腳本使流水線失敗 (Concourse Pipeline: How to have an Embedded Script Fail the Pipeline)


問題描述

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

(by Austin Lmarco.m)

參考文件

  1. Concourse Pipeline: How to have an Embedded Script Fail the Pipeline (CC BY‑SA 2.5/3.0/4.0)

#concourse #Python #concourse-pipeline






相關問題

進行飛行同步時的未知目標 (unknown target when doing a fly sync)

從另一個大廳到達一個大廳任務的容器 (Reach one concourse task's container from another one)

從 Concourse 克隆 Bitbucket 上的 git 存儲庫的問題 (Issues cloning a git repo on Bitbucket from Concourse)

如果作業被取消,Concourse 會阻止後台進程停止 (Concourse prevent background processes from being stopped if job is canceled)

Concourse 流水線:如何讓嵌入式腳本使流水線失敗 (Concourse Pipeline: How to have an Embedded Script Fail the Pipeline)

將構建目錄 (/dist) 從一個作業傳遞到大廳中的下一個作業 (Pass build directory (/dist) from a job to next job in concourse)

Concourse CI 找不到 kubernetes 機密 (Concourse CI can't find kubernetes secrets)

大廳工作人員“找不到文件” (Concourse Worker "file not found")

windows系統需要安裝Concourse(CI/CD) (Need to Install Concourse(CI/CD) on windows system)

在管道任務中指定運行時參數 (Specify runtime parameter in a pipeline task)

如何遍歷大廳中的數組 (How to iterate through an array in concourse)







留言討論