I have a jenkins server (casc) which builds and tests a Github repository.
Currently the instance running behind a vpn, so it is not accessible to send webhooks to from Github. As a result, the way we have been able to verify changes has been to use ‘scm’ to poll the master branch for changes every few minutes.
i.e.
freeStyleJob('poll_scm_job') {
scm {
github('my-repo/test-jenkins', '*/main')
}
triggers {
scm('H/2 * * * *')
}
steps {
shell(readFileFromWorkspace('scripts/test/build-scm.sh'))
shell(readFileFromWorkspace('scripts/test/test-scm.sh'))
}
}
However, this only catches issues once they’ve been merged into Master. I want to be able to build and verify PR branches before they are merged.
Therefore I am wonder if there is a plugin or method of configuring Jenkins casc that would allow me to poll a github repository for changes and build any outstanding PR’s.
It would be great if there were also a way to:
- Build PR when a specific comment is made on the PR (i.e. “build-ci-test”)
- Build PR only if the comment is made by an authorized individual
- Provide the status of the job back to github.
Could anyone point me in the direction of any plugins / documentation / examples if such a set up is possible with Jenkins casc?