Issue
When the Parameterized Scheduler plugin is used in an High Availability (HA) controller, it triggers each scheduled job once per replica, causing duplicated builds.
Context
In CloudBees CI 2.492.3.5, we resolved an issue that caused jobs using "Build periodically" to be triggered twice in an High Availability (HA) controller. However, the issue was still affecting jobs using "Build periodically with parameters", a feature provided by the Parameterized Scheduler plugin.
Parameterized Scheduler is a Tier 3 plugin. Thus its compatibility with CloudBees CI in general and High Availability (HA) in particular was not guaranteed. In CloudBees CI 2.516.3.29358, we adapted the product so each time slot scheduled with the plugin is processed by only one replica, similar to what happens with the built-in timer trigger.
Resolution
This issue is resolved in CloudBees CI version 2.516.3.29358. High Availability (HA) was ehanced to support Parameterized Scheduler plugin.
Workaround
If you are using a release between 2.492.3.5 and 2.516.3.29358, you can use the "Build periodically" trigger in a placeholder job.
This placeholder job can then use the build or triggerRemoteJob steps with parameters to trigger the actual job.
Refer to Cluster-wide job triggers for more information about the build and triggerRemoteJob steps and how to pass parameters.
See the following example:
pipeline { agent none triggers { cron '@daily' } stages { stage('Trigger Downstream Job') { steps { echo "Placeholder running. Triggering the worker's job now..." // Use the 'build' step to trigger the actual worker job. // We pass a parameter to let the worker's job know it was scheduled. build job: 'Actual-Work', parameters: [ string(name: 'PARAM1', value: 'VALUE1'), booleanParam(name: 'BOOLPARAM1', value: true) ], wait: false // Don't wait for the worker to finish } } } }
pipeline { agent any parameters { string(name: 'PARAM1', defaultValue: '', description: 'String parameter.') booleanParam(name: 'BOOLPARAM1', defaultValue: false, description: 'Boolean parameter.') } stages { stage('Execute Task') { steps { echo "Running scheduled job with parameters PARAM1: ${params.PARAM1} and BOOLPARAM1: ${params.BOOLPARAM1}" } } stage('Conditional Task') { when { expression { return params.BOOLPARAM1 } } steps { echo "Running a conditional stage based on BOOLPARAM1." } } } }
Tested product/plugin versions
-
CloudBees CI on modern cloud platforms - managed controller 2.528.2.34902
-
CloudBees CI on modern cloud platforms - managed controller 2.492.3.5