Reputation:
We have a multibranch pipeline for our Jenkins job configuration. We have three branches: develop
, master
and feature branch. Developers want to run feature branch periodically every day. We are using same Jenkinsfile for several projects.
For running periodically, I have added below lines to my feature branch.
properties([[$class: 'BuildDiscarderProperty', strategy: [$class: 'LogRotator', artifactDaysToKeepStr: '10',
artifactNumToKeepStr: '10', daysToKeepStr: '10', numToKeepStr: '10']], gitLabConnection('GitLab'), pipelineTriggers([[$class: 'TimerTrigger', spec: '0 5,12 * * *']])])
The problem is that we have 5 projects and all of them are being executed at the same time as they are using same Jenkinsfile. Is there any way that I can run those projects one by one?
Upvotes: 1
Views: 1858
Reputation: 627
You should try prefixing the trigger with 'H/' spec: spec: 'H 5,12 * * *'
instead of spec: '0 5,12 * * *'
Jenkins evenly distributes the jobs when multiple jobs have same pattern that trigger at same time.
Meaning of H prefix is explained here.
Upvotes: 0