Continuous integration (CI) triggers can only trigger the pipeline to run against its own branch, which means if you enable ci triggers for adf_publish branch(place this script in the "adf_publish" branch), whenever you push an update to adf_publish, the pipeline will be executed against adf_publish branch(not develop branch).
Pipeline completion triggers won't work. The reason is stated as below:
If the two pipelines are in the same repository, the triggered pipeline version in the same branch as the triggering pipeline is run, even if that branch is different than the Default branch for manual and scheduled builds, and even if that version does not have branch filters that match the completed pipeline's branch.
So if you set up the pipeline to run on the completion of the build of adf_publish
branch. The same branch adf_publish
branch will be used as the triggered pipeline source branch.
If you want the pipeline to build develop
branch, when there are changes being pushed to branch "adf_publish". You can try below workaround using Trigger build task.
1, Enable CI trigger for adf_publish branch.(In your pipeline edit page, switch to adf_publish branch to add below in the azure-pipelines.yaml file in adf_publish branch)

2,Add Trigger build task
to the the build definition of adf_publish branch( edit the azure-pipelines.yaml file in adf_publish branch). See below example:
- task: TriggerBuild@3
inputs:
definitionIsInCurrentTeamProject: true
buildDefinition: '$(Build.DefinitionName)' # builddefintion name
queueBuildForUserThatTriggeredBuild: true
useSameBranch: false
branchToUse: 'develop'
authenticationMethod: 'Personal Access Token'
enableBuildInQueueCondition: false
password: $(system.accesstoken)
Note: The parameter useSameBranch
need to set to false
. And branchToUse
need to set to develop
in order to trigger the same pipeline to build on develop branch.
You can also run rest api in a script task to trigger the pipeline to build against develop branch.