Reputation: 4203
I am using a Declarative Jenkinsfile with quiet period:
options {
quietPeriod(180)
// more options
}
Tool versions:
Now the issue is that on GitHub SCM changes, a standalone pipeline project respects the quiet period but a multibranch pipeline project does not. It returns no error either, just triggers the build immediately on receiving webhooks.
I am aware of the open issue JENKINS-37588 on this.
Using upstream wrapper jobs with build(job: 'my-job', quietPeriod: 180)
is not feasible since I have several hundred multibranch projects.
Has anyone been able to find a solution or workable alternative? Any help will be appreciated.
Upvotes: 11
Views: 6589
Reputation: 33
Quiet period was respected by multibranch pipeline after doing this:
In multi-branch pipeline, Configure > Branch sources > Property strategy > Add property > ‘Suppress automatic SCM triggering”
In Jenkinsfile, set build trigger to 'Poll SCM', but do not specify a schedule. This will only run due to SCM changes if triggered by a web hook. (I think if you are using GitHub you can select 'GitHub hook trigger for GITScm polling')
In Jenkinsfile, set quiet period.
Configure web hook on SCM.
pipeline{
agent{label "Linux" }
options {
quietPeriod(180)
// more options
}
triggers {
pollSCM ''
}
stages{
stage("Test"){
steps{
echo "Test"
}
}
}
}
Upvotes: 0
Reputation: 189
I think - unfortunately - this is currently not possible.
There is an unresolved ticket here: https://issues.jenkins-ci.org/browse/JENKINS-37588
Also there is already an open pull request for this issue: https://github.com/jenkinsci/branch-api-plugin/pull/190
Upvotes: 4