Issue
- How to change the default status checks for protected branches in GitHub with information from my Pipeline?
- I would like to set the status checks for protected branches in GitHub per stages of my Jenkinsfile.
Environment
- CloudBees CI (CloudBees Core)
- CloudBees CI (CloudBees Core) on modern cloud platforms - Managed Master
- CloudBees CI (CloudBees Core) on traditional platforms - Client Master
- CloudBees SCM Reporting Plugin
GitHub plugin - GitHub plugin
- GitHub Branch Source
Resolution
Prerequisite: GitHub Integration webhook for multibranch type of projects is configured as described in GitHub Integration: Webhooks – CloudBees Support
This issues is solved thanks to the CloudBees SCM Reporting Plugin which sends a GitHub Status check per Jenkinsfile stage definition
Example: The highlight of this example is that the remote status check depends on the build of a downstream job.
pipeline {
agent any
stages {
stage ("local"){
steps{
sh "exit 0"
}
}
stage("remote") {
steps{
build "my-team/folder-a/pipeline-1"
}
}
}
}
On CloudBees CI side
1/ Install CloudBees SCM Reporting Plugin
2/ Configuring CloudBees SCM Reporting notifications
On GitHub side
This section is optional in case you want to make the status checks Required.
After triggering the pipeline for the protected branches (the target branch for your Pull Request) following the configuration in (2/)
3/ Go to the repository Settings > protected branches > check Require status checks to pass before merging > Select the status check you wish to make required for your Pull request.
Note: Other status checks come from GitHub Integration: Webhooks
continuous-integration/jenkins/branch
continuous-integration/jenkins/pr-merge
Tested products/plugins version
The latest update of this article was tested with:
0 Comments