即使在失败时,也可以绕行一个有条件的步骤

发布于 2025-01-18 08:34:51 字数 607 浏览 1 评论 0原文

即使其中一个测试失败,我也尝试将上传测试结果作为执行测试的单独步骤。但我只想上传特定分支的结果。

when: 可以这样使用吗?有更好的选择吗?

- when: always
    condition:
      matches:
        pattern: '^dev$'
        value: << pipeline.git.branch >>
    steps:
      - run:
          name: Upload Test Results
          command: <code here>

上面的代码会导致构建错误:无法解析 YAMLmapping 值在“字符串”中不允许,条件:

https://circleci.com/docs/2.0/configuration-reference/#the-when-attribute

I'm attempting to upload test results as a separate step from executing tests even when one of the tests fails. But I only want to upload results from specific branches.

Can when: be used this way? Is there a better alternative?

- when: always
    condition:
      matches:
        pattern: '^dev

The code above results in a build error: Unable to parse YAMLmapping values are not allowed here in 'string', condition:

https://circleci.com/docs/2.0/configuration-reference/#the-when-attribute

value: << pipeline.git.branch >> steps: - run: name: Upload Test Results command: <code here>

The code above results in a build error: Unable to parse YAMLmapping values are not allowed here in 'string', condition:

https://circleci.com/docs/2.0/configuration-reference/#the-when-attribute

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

深巷少女 2025-01-25 08:34:51

可以,我只是在使用错误的语法。

- when:
    condition:
      matches:
        pattern: '^dev

        value: << pipeline.git.branch >>
    steps:
      - run:
          name: Upload Test Results
          when: always
          command: <code here>

It can, I was just using the wrong syntax.

- when:
    condition:
      matches:
        pattern: '^dev

        value: << pipeline.git.branch >>
    steps:
      - run:
          name: Upload Test Results
          when: always
          command: <code here>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文