Note: Triggers have been deprecated and replaced by pipelineTriggers. For more details, refer to JENKINS-53775.
If you want to use disableConcurrentBuilds, Triggers (with pollSCM and cron) for a DSL job, you can achieve it using the following configuration:
pipelineJob(repoName) {
properties {
disableConcurrentBuilds()
pipelineTriggers {
triggers {
pollSCM {
scmpoll_spec('* * * * *') // Adjust the schedule as needed
ignorePostCommitHooks(true)
}
cron {
spec(cronTime) // Replace 'cronTime' with your desired cron schedule
}
}
}
}
}
Credit: Special thanks to Catrobat for providing the original implementation. You can find more details in their repository: https://github.com/Catrobat/Jenkins/blob/master/job_dsl/src/main/lib/JobBuilder.groovy