Forum Discussion

Ion1150's avatar
Ion1150
Copper Contributor
Jun 07, 2023

yaml pipeline needs tweaking every time a new collabopration branch is created

Hi

We have a pipeline that publishes ADF changes every time a pull request is merged in the current collaboration pipeline. At thee beginning of every sprint we create a new git branch and set it as default branch - for instance "collaboration-sprint-30". Currently this branch name is hardcoded in the pipeline and we need to modify the yaml file every time we start a new sprint. Is there any way to specify a "default" branch in the pipeline so we don't have to change it?

Thanks

  • Ion1150 

    Hey,

     

    I totally get the hassle of having to tweak the YAML pipeline every time you start a new sprint and create a new collaboration branch. The good news is that there's a way to avoid hardcoding the branch name and make it more dynamic.

     

    In Azure DevOps pipelines, you can utilize predefined variables to reference the default branch without manual modifications. By using $(Build.Repository.DefaultBranch), you'll always fetch the name of the default branch, eliminating the need to update the YAML file for each sprint.

     

    So, no worries about making those changes anymore! Your pipeline will automatically adapt to the default branch without any manual intervention.

     

    Let me know if you need further assistance!



Resources