Devops Tutorial 28 - Custom Build Name for pipeline jobs
What you will Learn:
Create and display custom build name in a pipeline
Create and display custom build name in a pipeline
Click any pipeline job (or create a new one)
On the left hand side, you would see ‘Pipeline Syntax’ option as shown below. Please note that you would not see option for a freestyle job
Click the above option.
On the left hand side, you would see ‘Global Variables Reference’ option as shown below
Click the above option.
Search for ‘currentBuild’. Notice that this variable can be used to refer the currently running build
Also, notice above. There is a ‘displayName’ method that we can use to change the display name.
See below. We have another method ‘number’ to display the build number
We will use both these methods.
Go back, you would see ‘Configure’ on left hand side as shown below
Click it and go to pipeline section
Add line#1 as shown below.
On the left hand side, we have created a global variable.
On the right hand side, we have given some display name and have appended it with build number
Apply and save.
Build Now
Notice above that the current build number is now ‘LoginFeature-#3’ instead of just #3
Build once more.
Notice below that the current build number is now ‘LoginFeature-#4’ instead of just #4
So this is how we can create custom build names for our pipeline jobs.
Similarly, you can explore other methods that are part of this variable
Thank you for reading!