I have a YAML build pipeline which resides on the repo PipelineRepo
, branch master
.
It contains a reference to a second repo AppRepo
with a trigger on branch dev
.
When a commit is made on AppRepo/dev
, the build triggers and produces an artifact. The Build.SourceBranch
predefined variable available during the build is of course dev
as this was the triggering branch on AppRepo
. This is as per the docs here:
The specific part of the docs is this:
When an update to one of the repositories triggers a pipeline, then the following variables are set based on triggering repository:
- Build.Repository.ID
- Build.Repository.Name
- Build.Repository.Provider
- Build.Repository.Uri
- Build.SourceBranch
- Build.SourceBranchName
- Build.SourceVersion
- Build.SourceVersionMessage
I consume the artifact in a Release pipeline, where I have a "Dev" stage with an artifact filter for branch dev
:
I have a continuous deployment trigger on the artifact for branch dev
:
Now we come to the problem
Every time a new build artifact is produced from the AppRepo/dev
branch, the continuous deployment trigger doesn't fire because it thinks the build branch of the artifact was PipelineRepo/master
. This is also true of the artifact filter on the stage - I have tested it by changing the continuous deployment trigger to master
.
Note: you can see on the screenshot the build name contains the word "dev". This is because I use the Build.SourceBranch
var in my custom build name. This proves the artifact is definitely produced by the AppRepo/dev
triggering branch.