tRuEsAtM
tRuEsAtM

Reputation: 3668

Unable to trigger pull request release in Azure DevOps

I have set up a pull request release trigger in the following way.

I want to deploy Artifacts from VerifyApiTestEnvironment branch whenever pull request into that branch is successfully completed.

enter image description here

This is how my artifacts look.

enter image description here

This is how my CD trigger looks like.

enter image description here

This is how my pre-deployment conditions look like.

enter image description here

This is how my policy screen looks.

enter image description here

This is how my branch structure looks. I am always getting an error in the build saying source branch missing the changes from master when I complete the pull request targeting the VerifyApiTestEnvironment branch. What could be the reason behind this?

Every time I am committing my changes to a featureBranch and then I open a pull request for it to merge into VerifyApiTestEnvironment branch. I expect to trigger a release and then a deployment every time I do this, but the release is not getting triggered.

Am I missing something related to configuring PR triggers?

Upvotes: 0

Views: 879

Answers (1)

Mengdi Liang
Mengdi Liang

Reputation: 18978

The setting of yours has some problem. As Daniel said, it is used to set as deploy with a PR created. In addition, if you want to deploy just after PR is completed, the source of this release should be Repository instead of build pipeline.

So, first, you need to change your release source as Azure Repository:

enter image description here

And then, enable Continuous deployment trigger. While the PR completed, it means that code change are merged into the target branch of Repository. So, this need to be enabled, or the deploy will not be triggered while the PR is completed.

enter image description here

In addition, you need to set branch filter, or the deploy will be triggered no matter which branch is changed. Here I set just merge into master branch( PR target branch is master) can trigger this CD.

enter image description here

For this option, it just be use for the PR created trigger deploy. Since you just want deploy triggered by the PR completed, so you do not need enable it.

Now, if your master has policy that the code change applied successfully only after PR created and verified, the CD will be executed only after PR completed.

For some configuration of policy, build policy is used to set build trigger, and status policy used to trigger the release.

So, according to your policy setting, it's used to trigger the build first, and then the build will trigger the release. It's not directly trigger the deploy just after the PR completed.

enter image description here

Upvotes: 4

Related Questions