1

On the Azure DevOps, in we git we have a schema of branches where we create a branch per sprint, for sample:

  • sprint01
  • sprint02
  • sprint03 ...

We keep the 3 last sprint branches, and in this case when I create the sprint4 branch, we will drop the sprint01. Each sprint We publish a version of our product every week. On the build pipeline definition on our project, we have defined the trigger to run over a push on the sprint* branch because we don't want to change the definition on each new version.

It works but it runs a build for each sprint branch and a release for each one. I would like to have just for that branch (with prefix sprint) that was pushed on the git. Is there any way to configure it?

My current configuration:

enter image description here

  • What do you mean "it runs a build for each sprint branch"? – Shayki Abramczyk Apr 8 at 9:47
  • For sample, If I have branches called sprint01, sprint02, sprint03, the trigger will run a build for each branch. I wish to run just for the branch that was pushed. – Felipe Oriani Apr 8 at 12:25
  • If you push from sprint01 so 3 different builds will be executed? (3 build run in parallel?) – Shayki Abramczyk Apr 8 at 12:26
  • Yes, because I have configured sprint*. If I push sprint03 I wish to run just a build/release for this. I know I can configure a fixed branch, but we have a new sprint every monday, I would like to have this automatically. – Felipe Oriani Apr 8 at 12:30
  • I don't know if it is possible to configure. – Felipe Oriani Apr 8 at 12:34
0

It's recommended that you use a convention of prefixing your grouped references (like branches) with "folder" prefixes.

For example, when you create sprint branches, create them with the names:

sprints/sprint01
sprints/sprint02
sprints/sprint03

Then, configure your build trigger Include filters with this prefix:

sprints/*

... and then an Exclude filter for master, since by default it is also included.

Once configured, this should build only the sprint branch (topic branch) that was committed to.

Reference: https://docs.microsoft.com/en-us/azure/devops/pipelines/build/ci-build-git?view=azure-devops&tabs=designer

  • If i configure sprints/* and a developer make a push on the sprint03, will it build branches sprint01 and sprint02? – Felipe Oriani Apr 10 at 1:38
  • @FelipeOriani No, it should only build sprint03 as the trigger should see the specific branch that triggered it that matches the wildcard. I've only used similar wildcards when wanting to trigger builds when tags are created (refs/tags/*), but the filtering should be the same. Test it out and report back. – Sumo Apr 10 at 1:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.