使用帶有 powershell 的 shell 執行器,allow_failure:exit_codes 的行為不像記錄的 https://docs.gitlab.com/ee/ci/yaml/#allow_failureexit_codes
通過以下非常簡單的作業:
build:
script:
- exit 4
allow_failure:
exit_codes:
- 4
作業失敗,而不是通過警告標志。
它與 bash 完美配合。它與allow_failure: true.
我錯過了什么嗎?有解決辦法嗎?
uj5u.com熱心網友回復:
一般來說,這是 Powershell 作業方式的一個方面。請參閱:從 PowerShell 腳本回傳退出代碼
要為運行 powershell 的 shell 執行程式解決此問題,請使用以下命令:
script:
- $host.SetShouldExit(4); exit 4
# ...
請注意,但是此解決方法可能不適用于自定義shared-windows執行器,例如gitlab.com 上的 beta自動縮放執行器——在撰寫本文時,在這種情況下沒有解決方法。
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/495235.html
