Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to Rename or give a custom name to a Build in VSTS?

Is it possible to Rename or give a custom name to a Build in VSTS?

What I want to do is have my builds named after the version number. The version number is written in a .version file in the root directory.

The intended name would be: $(MyVersionNumber):$(Rev:rr)

like image 225
LMB Avatar asked Dec 13 '17 23:12

LMB


People also ask

How do I change my Azure Devops build name?

Just create a PowerShell or Bash task and print the new name string to stdout. This script renames the current build to contain the version and source branch name. Since in this case we know that versionNumber is unique (it's being changed on every run to something like 4.109.

Can you rename a Devops project?

Sign in to your organization. From the Projects page, choose actions for the project that you want to rename, and then choose Rename. Edit the name.

Can you rename an azure Devops organization?

You can change your organization name (URL) at any time in Azure DevOps.

How do I rename my pipeline?

Navigate to All > Tools > Pipeline Tools. Select a pipeline tool. In the Pipelines related link, rename the pipeline, and then run Discover.


2 Answers

You can update the build number for current build through Logging Command (e.g. Write-Host "##vso[build.updatebuildnumber]buildnumber").

Simple workflow of your code:

  1. Include $(rev:.r) in default build number format (Options), for example: $(date:yyyyMMdd)-$(rev:.r)
  2. Get current build number from pre-defined variable (Build.BuildNumber/BUILD_BUILDNUMBER)
  3. Get the rev value from this build number in your code
  4. Read version number from .version file
  5. Update build number through Logging Command
like image 75
starian chen-MSFT Avatar answered Oct 09 '22 17:10

starian chen-MSFT


Under your build definition you can customize the build name (Build number format):

For example, I added the date variable $(Date:dd.MM.yyyy) with a specific format to the field Build number format:

Build number format

Microsoft Docs, reference article

like image 41
adiii4 Avatar answered Oct 09 '22 15:10

adiii4