How to create a build step only run when previous step is cancelled.
Answered
Hi,
I have noticed that there is a new feature: the “conditional build step”.
There are some built-in conditions, such as “If all previous steps finished successfully”.
What I need is the condition “If the previous step is cancelled”,
How can I create such customized condition in TeamCity 2021.2?
Thank you.
1 comment
Sort by
Date
Votes

Hello,
Can you please provide more details about the scenario that you are trying to build?
An option to build that kind of scenario would be to use Build step execution conditions based on a parameter that could be set on the previous build step using service messages:
- In the Build step configuration, there are some default Execute step conditions, such as "Even if some of the previous steps failed", that would include your scenario, that could be combine with a condition to be checked at the beginning of the step;
- You can add a parameter to your build configuration with a default value 'X';
- In the previous buildstep you set a parameter (before cancelling) to a certain value 'Y' if the build is successful;
- You set in the next build step a condition to be executed only if the value retains its original value.
Please let me know if this helps or you have any more questions.
Guilherme
Please sign in to leave a comment.