How to create a Build Chain with conditional build configurations by branch

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

 

2 comments
Comment actions Permalink

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:

Build Feature -> Test Feature

and

Build Master -> Test Master -> Deploy -> Smoke Test

This means you will have a total of six build configurations and two build configuration templates in your project.

1
Comment actions Permalink

Thanks Eric for your response.
Yes, the visual representation is important so I will just use the suggested approach.
Thanks again!

0

Please sign in to leave a comment.