Hi,
We have the same requirements and we have a big pipeline that runs different things depending of the trigger and we have nightly CI builds.
We use the conditional “when” to identify the trigger and run some portion of the pipeline depending of where it comes from:
stage('Deploys') {
when {
beforeAgent true
anyOf {
triggeredBy 'UpstreamCause'
triggeredBy 'BuildUpstreamCause'
triggeredBy 'UserIdCause'
}
}
The above is a portion of the pipeline we only want to build when triggered by an upstream job or someone manually run it.
This exclude all webhooks related to push code to our repository, just to mention one.
stage('Setup') {
The above is a part of the pipeline we want to run only when someone commented on GitHub and not on other webhooks.
And finally:
triggers {
We use the triggers option to setup nightly builds for the master branch only.
Hope that this is what you are looking for,
Cheers,
Gianluca.