How to create a Build Chain with conditional build configurations by branch Follow
Answered
I am trying to create a pipeline using build chain and would like to understand if its possible to have conditional steps in the pipeline based on branch.
So for example:
feature/* branch should trigger: build->test
master should trigger: build->test->deploy->smoke test
Right now I just adding a condition in the deploy and smoke test build configurations to check the branch and skip if its not master. This works functionally but when I look at the visual representation of pipeline its a bit confusing to see deploy and smoke test steps even in the feature branch pipeline
Please sign in to leave a comment.
If I'm understanding correctly, it sounds like you'd like to have conditional build configurations in your build chain. It is entirely possible to create conditional build steps within the individual build configurations to skip steps if the branch is not master. However, this won't be reflected in the build chain diagram; just as you've already pointed out. If the visual representation is important, I think you'd need to create two build chains.
You can have the "Build" and "Test" build configurations based on templates to make it easier to manage any changes going forward, but the resultant build chains could be something like:
and
This means you will have a total of six build configurations and two build configuration templates in your project.
Thanks Eric for your response.
Yes, the visual representation is important so I will just use the suggested approach.
Thanks again!