1
votes

I have an existing Azure Devops pipeline and I would like to change the branch that contains the yaml file. The pipeline has a lot of variables, so I would prefer to not have to create a new one from scratch. When editing the pipeline, I see that I can change the location of the yaml file within the branch. And I also see the dropdown that can be used to switch branches. But I don't see a way to save that new branch configuration.

Has anyone else had this problem?

1
You should be able to just check in the same yaml file to your other branch to the same path and the build pipeline will use it. - Anthony Klotz
@AnthonyKlotz, In my case I am using multi-repo triggers and would like to use the yml file from a specific branch. However, the corresponding pipeline in ADO does not let me save the selected branch. - walkerrandophsmith

1 Answers

1
votes

1.If those variables are defined in xx.yml file, to reuse those variables in another branch(Call it Y branch) that doesn't contain the xx.yaml file, you only need to check in that file to Y branch like Anthony suggests above. Then the pipeline will locate that file(if it matches Yaml File path), and you can choose to run the pipeline with configuration from the branch you want.

In addition: After that, don't forget to modify the triggers cause you're now in another branch.

2.And if you already have one xx.yml file in Y branch, you only need to copy the content of variables: part from current yaml file to yaml file in Y branch and commit the change.

Hope it helps :)