Updating Azure CI Pipeline Build Number
Did you have requirement to update your Angular CI build number as your new Package.json version number and Branch name? Well this is a good practice to do in your Azure Build CI pipeline for JavaScript Front-end Project builds. Learn how to create and update Azure CI build Number in pattern like buildId-master or 1234-master or if it is feature branch then it becomes 1234-feature1.
Job running in Unix platform
Pool: Azure Pipelines
Image: Ubuntu16
Agent: Hosted Agent
Started: Today at 3:33 PM
Duration: 6s
Create New Build Number
- script: |
export newNumber=123-$(Build.SourceBranchName)
echo "##vso[task.setvariable variable=NEWBUILDNUMBER;]$newNumber"
displayName: 'Get New Build Number'
Display New Build Number
- script: |
echo new build number $(NEWBUILDNUMBER)
displayName: 'Display New Build Number'
Update build number with new Build Number
- script: |
echo "##vso[build.updatebuildnumber]$NEWBUILDNUMBER"
displayName: 'Update Build Number'
Display updated build number
- script: |
echo "New Build Number is: $(Build.BuildNumber)"
displayName: 'Display Updated Build Number'
Check Azure CI Pipeline
Complete azure-pipelines.yml file
trigger:
- main
steps:
- script: |
export newNumber=123-$(Build.SourceBranchName)
echo "===== creating new variable ====="
echo "##vso[task.setvariable variable=NEWBUILDNUMBER;]$newNumber"
echo "===== creating new variable ====="
displayName: 'Get New Build Number'
- script: |
echo new build number $(NEWBUILDNUMBER)
displayName: 'Display New Build Number'
- script: |
echo "===== updating buildnumber ====="
echo "##vso[build.updatebuildnumber]$NEWBUILDNUMBER"
echo "===== updating buildnumber ====="
displayName: 'Update Build Number'
- script: |
echo "New Build Number is: $(Build.BuildNumber)"
displayName: 'Display Updated Build Number'
Become full stack developer 💻
If you want to become full stack developer and grow your carrier as new software developer or Lead Developer/Architect. Consider subscribing to our full stack development training programs. We have All-Access Monthly membership plans and you will get unlimited access to all of our video courses, slides, source code & Monthly video calls.
- Please subscribe to All-Access Membership PRO plan to access current and future angular, node.js and related courses.
- Please subscribe to All-Access Membership ELITE plan to get everything from PRO plan. Additionally, you will get access to monthly live Q&A video call with Rupesh and you can ask doubts/questions and get more help, tips and tricks.
Your bright future is awaiting for you so visit today FullstackMaster and allow me to help you to board on your dream software company as a Developer,Architect or Lead Engineer role. 💖 Say 👋 to me!