Reputation: 574
I have a pipeline for automated project's build. Build is triggered from github webhook.
The problem is that our developers can push changes to git several times during couple hours. We don't need to build so frequently. The idea is that 30 min should have passed since last commit, in this case we decide that it was last commit.
So how I can trigger build after 30 min of last webhook ?
Upvotes: 0
Views: 1249
Reputation: 4203
You can get to the closest of this behaviour by using the quietperiod()
option as follows:
pipeline {
agent any
options {
quietPeriod(1800) // Quiet period in seconds
}
stages {
stage('1') {
steps {
println("Hello")
}
}
}
}
Or from the job configuration page:
From the plugin description:
When this option non-zero, newly triggered builds of this project will be added to the queue, but Jenkins will wait for the specified period of time (in seconds) before actually starting the build. For example, if your builds take a long time to execute, you may want to prevent multiple source control commits that are made at approximately the same time from triggering multiple builds. Enabling the quiet period would prevent a build from being started as soon as Jenkins discovers the first commit; this would give the developer the chance to push more commits which would be included in the build when it starts. This reduces the size of the queue, meaning that developers would get feedback faster for their series of commits, and the load on the Jenkins system would be reduced. If a new build of this project is triggered while a build is already sitting in the queue, waiting for its quiet period to end, the quiet period will not be reset. The newly triggered build will not be added to the queue, unless this project is parameterized and the build has different parameters than the build already in the queue.
Upvotes: 2