bash - 忽略 GitLab CI 管道脚本中的某些退出代码

标签 bash gitlab-ci

我在 GitLab CI 中有一个脚本,但一个命令有时以退出代码 101 结尾,这在我的用例中是可以的,我想忽略它。

我会使用 true:

failing_script || true

但它会忽略所有退出代码,所以当出现其他错误时我不会收到通知。

我需要这样的东西:

failing_script || (true only if exit code 101)

最佳答案

这似乎是您要找的:

failing_script|| [ $? -eq 101 ]

关于bash - 忽略 GitLab CI 管道脚本中的某些退出代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59700097/

相关文章:

bash 真/假重定向错误

docker - Gitlab CI : Docker connect to remote MySQL via SSH Portforwarding before running tests

gitlab - 如何仅发送 GitLab 计划管道失败电子邮件?

java - Gradle 缓存不适用于 GitLab-CI

Gitlab CI SAST 在后续阶段访问 gl-sast-report.json 工件

gitlab - .gitlab-ci.yml after_script 部分 : how can I tell whether the task succeeded or failed?

bash - awk 匹配,合并两个文件,同时修改列输入并向输出文件添加额外的列

ruby - OS 10.9 上的 rvm 出现一些问题 : second export path to . bash_profile、缺少 2.0 路径和缺少文件

bash - bash脚本中的mvn if语句

bash - 使用 GNU parallel 拆分命令行参数