azure-devopsazure-yaml-pipelines

Starting a build number from a specific number


I just migrated some builds from bamboo over to azure devops and I need to get the build numbers in ado to start from a specific number, for example last build in bamboo was 50, I need the first build in ado to be 51. How can I accomplish this via yaml pipeline?

Can I do someting like name: $(last.bamboo.build)+$(Rev:r)?

Thanks all in advance.


Solution

  • If you want to have simple number versioning and continue it from certain number you can do it like this:

    name: $(Rev:r)
    
    steps:
    - script: echo '$(Build.BuildNumber)'
    - pwsh: |
        $buildId = 50 + $(Build.BuildNumber)
        Write-Host "##vso[build.updatebuildnumber]$buildId"
    - script: echo '$(Build.BuildNumber)'