Open thorntonryan opened 3 years ago
We're seeing this problem with multi-branch Pipelines
multibranchPipelineJob('HelloWorld') {
triggers {
issueCommentTrigger {
commentPattern("test")
}
}
// ...
}
Error:
java.lang.ClassCastException: org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject cannot be cast to org.jenkinsci.plugins.workflow.job.WorkflowJob ...
This is very problematic because our Jenkinsfile
sets a comment pattern it will trigger to, which is injected into the job configuration on the first run, but if we re-run our Job DSL pipeline to update/populate jobs, it will break the triggering on any GitHub Pull Requests we have open.
EDIT
This triggering configuration should be available for multibranchPipelineJob's, because it appears in the introspective Job DSL API reference specific to our instance
Faced with the same issue using multibranchPipelineJob :(
@thorntonryan @NFollett89 @renanqts currently we don't support the JobDSL directly. You can try using the Configure block https://github.com/jenkinsci/job-dsl-plugin/blob/master/docs/The-Configure-Block.md
This is something we might add in the future though so I'll mark the as an enhancement. Also PRs welcome :)
@aaronwalker: do you have an example config block for this?
Hello,
According to the doc it looks like this plugin should be compatible with a GitHub Organization Folder ... somehow.
The Job DSL API viewer installed on my Jenkins instance dynamically detected the
issueCommentTrigger
and seems to think I can configure the plugin by adding it to my org underneath thetriggers
section:But if I run my Job DSL I get the following errors:
Is it possible to configure a
commentTrigger
for each job in anorganizationFolder
using the Job DSL plugin?Or is the plugin only meant to be used from within a pipeline ?
Thanks!
Additional Information