jenkinsci / ghprb-plugin

github pull requests builder plugin for Jenkins
https://plugins.jenkins.io/ghprb/
MIT License
506 stars 612 forks source link

The plugin does not respect the job quiet period #752

Open slavik57 opened 5 years ago

slavik57 commented 5 years ago

We have 2 jobs triggering from a single pull request (A and B). Job B depends on job A, meaning job A has to finish before job B starts. We have configured a blocking job for B to be A, but it can only block if job A is in the queue.

Some of the times job B is added to the queue faster than job A and because job A is not in the queue, job B starts (and fails).

We wanted to use a quiet period for job B to make sure job A is put to the queue before job B is considered for starting. There are 2 places to set the job quiet time, on a global Jenkins configuration and on the Job itself.

The plugin respects the global configuration but doesn't respect the job quiet period configuration as can be seen from this line: https://github.com/jenkinsci/ghprb-plugin/blob/4e86ed47a96a01eeaa51a479ff604252109635f6/src/main/java/org/jenkinsci/plugins/ghprb/GhprbTrigger.java#L458

The job object also has a getQuietPeriod() function which can be used in combination with the global settings. (if the job quiet period is not set, use the global, otherwise use the job setting)