【问题标题】:How to set gitlab CI job to true?如何将 gitlab CI 作业设置为 true?
【发布时间】:2021-12-05 05:42:36
【问题描述】:

我想设置一个工作 - 即使它失败了! - 到 TRUE(工作成功)。使用以下行时:

script:
    - sleep 200
    - true && false

我从 CI 得到以下输出:

true : The term 'true' is not recognized as the name of a cmdlet, function, script file, or operable program. Check 
the spelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\WINDOWS\TEMP\build_script360729423\script.ps1:231 char:1
+ true
+ ~~~~
    + CategoryInfo          : ObjectNotFound: (true:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

问题: 如何使用上面的脚本将我的工作设置为始终为 TRUE?

【问题讨论】:

    标签: github gitlab continuous-integration yaml gitlab-ci


    【解决方案1】:

    Gitlab Shell 执行器正在使用数字返回来确定作业是失败还是成功。

    所以要成功完成一项工作,必须手动以 0 退出。

    script:
        - sleep 200
        - exit 0
    

    【讨论】:

      猜你喜欢
      • 2019-08-18
      • 2019-08-20
      • 1970-01-01
      • 1970-01-01
      • 2016-09-13
      • 2018-12-30
      • 2018-06-05
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多