If I understand correctly the following happens:
- in git, create and push a new branch
foo. This branch is created without a commit, so the branch label is still on
master, say commit
- The pre-existing pipeline, watching the
master branch, had already built commit
- You create the new pipeline, watching branch
foo. It picks up the current tip of the branch, which happens to be commit
N. From here the double build you mention.
At this point, since you don’t want to use the manual
unpause approach I suggested before, you have two possibilities:
- Before pushing for the first time branch
foo, add at least a commit on it. This commit will be built only by the new pipeline and not by the pipeline watching the master branch (as long as you keep the default value and don’t set
every on check).
- Assuming you know the name of the branch before it is created, create and set the new pipeline before the creation of the branch. You can immediately unpause it. It will stay orange because the git branch doesn’t exist. As soon as the branch appears, the git resource will transition from orange to normal and the pipeline will trigger. Also in this case you need the
foo branch to have at least one commit to avoid double build.
If for any reason you cannot enforce that the branch should appear with at least one commit, well, you have to live with the double build. This is not fault of Concourse, it is inevitable due to your workflow, any other CI system would do the same.