美文网首页
【Jenkins pipeline】为流水线添加描述

【Jenkins pipeline】为流水线添加描述

作者: 87d6dc4b11a7 | 来源:发表于2025-01-15 09:19 被阅读0次
pipeline {
    agent any
    stages {
        stage('Example') {
            steps {
                script {
                    currentBuild.description = "first_description"
                    // 假设我们要追加的新描述是" - 这是一个示例描述"
                    def newDescription = " - 这是一个示例描述"
                    // 获取当前构建描述,如果是第一次运行,可能为null
                    def currentDescription = currentBuild.description ?: ""
                    // 将新描述追加到当前描述之后
                    currentBuild.description = "${currentDescription}\n${newDescription}"
                }
            }
        }
    }
}

相关文章

网友评论

      本文标题:【Jenkins pipeline】为流水线添加描述

      本文链接:https://www.haomeiwen.com/subject/jltksjtx.html