即使在失败时,也可以绕行一个有条件的步骤
即使其中一个测试失败,我也尝试将上传测试结果作为执行测试的单独步骤。但我只想上传特定分支的结果。
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
可以,我只是在使用错误的语法。
It can, I was just using the wrong syntax.