Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to specify a different branch for a new pipeline

I have a branch that id like to use to do builds from. When work on a feature branch is done and Im ready to build to dev, I will just merge into the "dev" branch.

When I first start with the pipeline wizard, it wants to use the master branch for the source. I see nowhere to specify a different branch. Do I have to just go through the rest of the steps then edit the yaml file to use a different branch?

[update]
So should I keep the yaml file in the same branch that I want to build/release from? In my yaml file, I see a spot for the CI trigger, where I have put:

trigger:

  • dev

but the yaml file itself is in the master branch

I see this in the job step for getting the source:

From repo-url-here....
 * [new branch]      dev        -> origin/dev
 * [new branch]      master     -> origin/master
like image 454
bitshift Avatar asked Sep 15 '25 20:09

bitshift


1 Answers

Do I have to just go through the rest of the steps then edit the yaml file to use a different branch?

The answer is yes.

There is an option Existing Azure pipelineYAML file when you Configure your pipeline:

enter image description here

Only the yaml file exists only on a specific branch, we can use this option to use specify a different branch.

If the yaml file exists on the master and specify branch, Azure pipeline use the master branch for the source by default. In this case, we have to just go through the rest of the steps then edit the yaml file to change the Default branch for manual and scheduled builds to use a different branch.

Update:

So should I keep the yaml file in the same branch that I want to build/release from? In my yaml file, I see a spot for the CI trigger, where I have put:

trigger:

dev

but the yaml file itself is in the master branch

The answer is yes. In this case, we need also keep the yaml file in the Dev branch, so we could change the Default branch for manual and scheduled builds

enter image description here

Now, we change the Default branch for manual and scheduled builds, More action-> Triggers -> Select YAML tab:

enter image description here

enter image description here

When we execute the pipeline (No interface for editing YAML files), it execute the YAML in the DEV branch:

enter image description here

So, we could specify a different branch for this pipeline. And we could not directly choose different branches when choosing a template.

Note: When we edit the pipeline, it still show the YAML file in the master by default.

like image 118
Leo Liu-MSFT Avatar answered Sep 19 '25 14:09

Leo Liu-MSFT