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

时间:2018-05-27 20:37:13

标签: jenkins jenkins-plugins jenkins-pipeline

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

电流: enter image description here

预期:

enter image description here

1 个答案:

答案 0 :(得分:0)

解决:

    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