Jenkins ver. 2.150.3
I have a multi-branch pipeline set up. I am using a declarative Jenkinsfile. I have a set of jobs which take a long time to run. I want these to run over night for any branches which have changes.
In the past, one could use the 'Suppress automatic SCM triggering' option along with a cron trigger to achieve the nightly build for branches with changes. (See Run nightly jobs on multibranch pipeline with declarative Jenkinsfile
I no longer have access to the 'Suppress automatic SCM triggering' option.
The following trigger will run even if there are no changes to the code in the branch.
triggers {
cron('H 0 * * * *')
}
The following code runs if there are changes in the branch. However, the Jenkins multibranch project seems to trigger from the push rather than the pollSCM. This doesn't seem to achieve my desired outcome of running once nightly per branch if there are changes.
triggers {
pollSCM('H 0 * * * *')
}
How do I configure Jenkins to achieve the nightly jobs per branch only if changes exist in that branch?

ignorePostCommitHooksin your pollSCM? I'm not sure how you can access it via Declaretive pipeline, but we use it in a scripted pipeline like this:[$class: "SCMTrigger", scmpoll_spec: "H 0 * * * *", ignorePostCommitHooks: true]- Unforgettable631pipeline-syntaxfor declarative Directive Generator the syntax looks almost the same:triggers { pollSCM ignorePostCommitHooks: true, scmpoll_spec: 'H H * * * ' }. Can you try that? More options available at<yourJenkinsurl>/directive-generator/. - Unforgettable631