Jenkins pipeline plugin: set the build description

后端 未结 4 1526
自闭症患者
自闭症患者 2021-02-02 05:51

I\'m trying to replace our current build pipeline, currently hacked together using old-school Jenkins jobs, with a new job that uses the Jenkins pipeline plugin, and loads a

4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-02-02 06:33

    The answer from @jjst describes how to set the build description in "scripted pipelines". In declarative pipelines you can do the same, but need to place it inside a script { } block. Here an example taken from comments on the Cloudbees article:

    pipeline {
        agent any
        stages {
            stage("1st stage") {
                steps {
                    script {
                        currentBuild.displayName = "My custom build name"
                        currentBuild.description = "My custom build description"
                    }
                }
            }
        }
    }
    

提交回复
热议问题