Matthias Müller
Matthias Müller

Reputation: 3473

Azure DevOps Build validation - use existing CI run

I have a small project set up in Azure DevOps with a feature / master workflow, in which the master is protected in two ways:

enter image description here

Unfortunately, this contradicts with the CI: My CI build is defined to run on every commit on the remote (which is the best practice to get fast feedback, as far as I know). The problem is, that Azure DevOps doesn't recognize the "Commit Trigger" CI Build and either starts another one or the developer needs to start the CI manually to fulfill the build policy. enter image description here

From what I remember from tools like Bamboo, this should be one workflow: A policy takes the last run without needing a specific source like Commit trigger of PR trigger. Did Microsoft change the concept here deliberately, or is there a workaround to have both triggers (PR and commit) in place without needing two runs?

Upvotes: 0

Views: 904

Answers (1)

Shayki Abramczyk
Shayki Abramczyk

Reputation: 41595

When you define a build policy in the PR, that build must to run when you create the PR regardless of whether this build is triggered either by the CI.

The reason is simple, the CI build run on the branch source code (for example feature branch), this is not enough in the PR because even the CI build is passes, he passed on the feature branch, you can't know if it will pass in the master branch.

So, when a PR is created, ADO is trigger a new build that run on the master branch with the changes of the feature branch, and when this build is passed you can know for sure that the merge will not break master code.

How ADO can check the master with the feature changes before the merge? behind the scenes, the build do a merge locally, and on this merge run the build.

Upvotes: 2

Related Questions