Search code examples
azure-devopscontinuous-integrationazure-pipelinescicdbuild-pipeline

Update build number of a pipeline with respect to another pipeline


I have a build pipeline, say, Pipeline 1 whose build number is in $(Year:yy)$(DayOfYear)$(Rev:.r) format. I've created a copy of Pipeline 1, say Pipeline 2.

Now, when I push anything to those pipelines, build number is independent of each other, obviously. So, it might be possible that both pipelines have the same build number. Now, I'm looking for a solution to increment the revision of Pipeline 1 w.r.t Pipeline 2 and vice-versa so that the build number doesn't overlap. Is there any way to do that?


Solution

  • From the out-of-box perspective, no. You have to add your custom logic (with powershell or python) to the following:

    1. Get the last builds: Builds - List REST API or az pipelines build list
    2. Generate your build number
    3. Update a current build number: UpdateBuildNumber: Override the automatically generated build number