-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
Major
-
Component/s: job-dsl-plugin, workflow-multibranch-plugin
-
Environment:Jenkins ver. 2.138
Pipeline: Multibranch 2.20
Hi,
Â
I'm using multiBranchPipeline DSL to create a jobs like that:
multibranchPipelineJob('${jobName}') {
branchSources {
git {
remote('${repo}')
credentialsId('${credentialsId}')
includes('${branches}')
}
}
orphanedItemStrategy {
discardOldItems {
numToKeep(20)
}
}
configure {
it / factory(class: 'org.jenkinsci.plugins.workflow.multibranch.WorkflowBranchProjectFactory') {
owner(class: 'org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject', reference: '../..')
scriptPath('${jenkinsfilePath}')
}
}
}
Everything works fine, but now I want to trigger job automatically by cron.
According to docs I can use https://jenkinsci.github.io/job-dsl-plugin/#path/multibranchPipelineJob-triggers-cron
But it doesnt work for me. I'm adding this to DSL snippet:
triggers { cron('@daily')}
But Build Triggers section for the job is completely virgin.
Am I missing something there? How can I debug this problem?
Â
UPDATE
In job's config.xml I found this section:
<triggers>
<hudson.triggers.TimerTrigger>
<spec>@daily</spec>
</hudson.triggers.TimerTrigger>
</triggers>