jenkins - 如何使用声明性管道更改多分支项目的上下文消息?

标签 jenkins jenkins-plugins jenkins-pipeline

目前我知道可以使用 GitHub pull request builder plugin 更改上下文消息.但由于目前,由于我们拥有大量存储库,我只在 Jenkins 上使用 GitHub Organization 项目,是否可以通过声明性管道更改上下文消息?

当前: enter image description here

预期:

enter image description here

最佳答案

解决方法:

    pipeline {
    agent any
    stages {
        stage("Stage #1") {
            steps {
                sh 'ls'
                githubNotify gitApiUrl: 'https://github.mycompany.com/api/v3', context: 'something test', description: 'This commit is being built',  status: 'PENDING'
            }
        }
    }
    post {
        success {
          githubNotify gitApiUrl: 'https://github.mycompany.com/api/v3', context: 'something test', description: 'It works',  status: 'SUCCESS'
        }
        failure {
          githubNotify gitApiUrl: 'https://github.mycompany.com/api/v3', context: 'something test', description: 'This commit cannot be built',  status: 'FAILED'
        }
    }
}

使用的插件:https://github.com/jenkinsci/pipeline-githubnotify-step-plugin

关于jenkins - 如何使用声明性管道更改多分支项目的上下文消息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50556292/

相关文章:

jenkins - 展开 Jenkins 的所有“高级…”选项

windows - 为什么 exit/b 从 Jenkins(但其他任何地方)调用时不能正常工作?

jenkins - 如何获取触发特定作业的项目详细信息?

Jenkins:在两次作业运行之间存储变量的好方法是什么?

github - 使用 jenkins 管道构建 github 拉取请求

linux - 如何配置 Jenkins Publish over SSH 以使用 SSH key

bash - 设置可执行文件的 bash TAB 自动完成参数候选

git - Jenkins 在从 Git 获取代码时挂起

linux - 使 Jenkins 元数据可用于项目

git - 我怎样才能 git fetch --unshallow 在 Jenkins ?