Namrata Shilpi
Namrata Shilpi

Reputation: 139

How to give a Build Name to your Pipeline job?

I want to give specific names to every Pipeline Job that I build. Eg. #Build_number parameter1 parameter2

I have done it in the freestyle project job, but can't find how to do it in Pipeline project.

Upvotes: 0

Views: 120

Answers (1)

Amit Nanaware
Amit Nanaware

Reputation: 3346

you can use below script section in any stage inside your pipeline

pipeline {
    agent any
    stages {
        stage("Any stage"){
            steps {
                script {
                    currentBuild.displayName = '#' + currentBuild.number + 
                                               '-' + params.parameter1 +
                                               '-' + params.parameter2

                    currentBuild.description = "The best description."
                }
            }
        }
    }
}

Upvotes: 3

Related Questions