【问题标题】:Gitlab CI: Make pipeline report as passed if more than 90% of tests pass?Gitlab CI:如果超过 90% 的测试通过,则将管道报告为通过?
【发布时间】:2020-10-26 16:10:06
【问题描述】:

在使用 Jenkins 多年后,我是 gitlab CI 的新手。我正在尝试将我的旧项目转换为使用 Gitlab CI,但我想知道这是否可能?

在 Jenkins 中,我有获取测试数量并计算出通过百分比的代码,如果超过 90% 通过,我将 Jenkins 构建设置为成功,如果

在我的 Gitlab CI 管道中,我可以看到 gitlab 已经计算出成功率的百分比,我是否可以根据该值使用它来通过或失败作业?

【问题讨论】:

    标签: gitlab gitlab-ci gitlab-ci-runner


    【解决方案1】:

    这应该以类似于 Jenkins 的方式实现。基本上,您需要捕获测试工具的输出,然后对其进行处理并在条件下失败。 bash 是可能的,比如:

        - if [ $percentage -lt 90 ];
          then
            echo "Percentage of passed tests is less than 90";
            exit 1;
          fi;
    

    【讨论】:

      猜你喜欢
      • 2021-11-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-03-20
      • 2021-08-19
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多