Redline1111
Redline1111

Reputation: 131

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.

Upvotes: 0

Views: 646

Answers (2)

Stanley G.
Stanley G.

Reputation: 145

To further elaborate on @Krzysztof's answer, the name property determines the build-number format, but this can be changed at run-time by updating the updatebuildnumber variable as shown.

According to the screenshot in this SO answer, this will actually update the pipeline run name as well.

Upvotes: 1

Krzysztof Madej
Krzysztof Madej

Reputation: 40583

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)'

Upvotes: 3

Related Questions