'Can CircleCI run a conditional step even on failure
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$'
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
Solution 1:[1]
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>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Stev |
