[JIRA] [job-dsl-plugin] (JENKINS-31832) javaposse.jobdsl.dsl.Job is not a suitable parent class for javaposse.jobdsl.dsl.jobs.WorkflowJob (org.jenkinsci.plugins.workflow.job.WorkflowJob does not extend hudson.model.AbstractProject)

6 views
Skip to first unread message

frederic.chuong@gmail.com (JIRA)

unread,
Dec 1, 2015, 11:06:02 AM12/1/15
to jenkinsc...@googlegroups.com
Frédéric Chuong created an issue
 
Jenkins / Bug JENKINS-31832
javaposse.jobdsl.dsl.Job is not a suitable parent class for javaposse.jobdsl.dsl.jobs.WorkflowJob (org.jenkinsci.plugins.workflow.job.WorkflowJob does not extend hudson.model.AbstractProject)
Issue Type: Bug Bug
Assignee: Daniel Spilker
Components: job-dsl-plugin
Created: 01/Dec/15 4:05 PM
Environment: Jenkins 1.619
job-dsl-plugin 1.39
workflow-plugin 1.10
Labels: job-dsl workflow
Priority: Minor Minor
Reporter: Frédéric Chuong

javaposse.jobdsl.dsl.jobs.WorkflowJob (which matches org.jenkinsci.plugins.workflow.job.WorkflowJob) extends javaposse.jobdsl.dsl.Job (which mainly matches hudson.model.AbstractProject) whereas hudson.model.AbstractProject is not a parent class of org.jenkinsci.plugins.workflow.job.WorkflowJob.
That results in invalid configuration file being generated when using the javaposse.jobdsl.dsl.Job API combined with javaposse.jobdsl.dsl.DslFactory#workflowJob(java.lang.String, groovy.lang.Closure).
That means we cannot trust the delegate type to select which customization to apply.

Closure foo = {
  if (getDelegate() instanceof javaposse.jobdsl.dsl.Job) {
    // label will generate 'assignedNode' / 'canRoam' elements
    label('XXX')
  }
}
// below XML is OK, FreeStyleProject has 'assignedNode' / 'canRoam' via AbstractProject
freeStyleJob('A', foo)

// below resulting XML does not match org.jenkinsci.plugins.workflow.job.WorkflowJob (does not extend AbstractProject)
workflowJob('B', foo)
Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v6.4.2#64017-sha1:e244265)
Atlassian logo

mail@daniel-spilker.com (JIRA)

unread,
Jun 21, 2018, 5:35:03 PM6/21/18
to jenkinsc...@googlegroups.com

mail@daniel-spilker.com (JIRA)

unread,
Jun 25, 2018, 4:24:03 PM6/25/18
to jenkinsc...@googlegroups.com

mail@daniel-spilker.com (JIRA)

unread,
Jul 3, 2018, 4:25:04 PM7/3/18
to jenkinsc...@googlegroups.com

me@basilcrow.com (JIRA)

unread,
Jul 5, 2018, 11:37:02 PM7/5/18
to jenkinsc...@googlegroups.com
Basil Crow commented on Bug JENKINS-31832
 
Re: javaposse.jobdsl.dsl.Job is not a suitable parent class for javaposse.jobdsl.dsl.jobs.WorkflowJob (org.jenkinsci.plugins.workflow.job.WorkflowJob does not extend hudson.model.AbstractProject)

Hi Daniel Spilker,

After upgrading to 1.70 I get warnings like this when running Job DSL:

Processing DSL script blackbox_smoke.groovy
Warning: (blackbox_smoke.groovy, line 12) concurrentBuild is deprecated
Warning: (blackbox_smoke.groovy, line 14) authenticationToken is deprecated

Why are concurrentBuild and authenticationToken deprecated? I am using both of these features with Job DSL 1.69 and the latest version of the Pipeline plugin(s). I believe these two have been deprecated by mistake.

admwiggin+jenkins@gmail.com (JIRA)

unread,
Jul 9, 2018, 3:41:02 PM7/9/18
to jenkinsc...@googlegroups.com

Hitting the same using concurrentBuild(false) on my pipelineJob instances – updated to the following as a workaround:

configure { it / 'properties' << 'org.jenkinsci.plugins.workflow.job.properties.DisableConcurrentBuildsJobProperty' { } }

(Verified that after doing so, the generated jobs have "Do not allow concurrent builds" checked as expected.)

johndreaver@gmail.com (JIRA)

unread,
Jul 18, 2018, 2:02:02 PM7/18/18
to jenkinsc...@googlegroups.com

I see that {{authenticationToken }}is deprecated. What is the reasoning behind this? It seemed to work great before version 1.70. What are we supposed to use now to enable the remote triggering API?

I am using this workaround currently:

configure { Node project ->
    project / authToken("myToken")
}

redeamer@gmx.net (JIRA)

unread,
Jul 24, 2018, 10:19:02 AM7/24/18
to jenkinsc...@googlegroups.com

mail@daniel-spilker.com (JIRA)

unread,
Jul 25, 2018, 5:49:33 AM7/25/18
to jenkinsc...@googlegroups.com

mail@daniel-spilker.com (JIRA)

unread,
Jul 25, 2018, 3:14:03 PM7/25/18
to jenkinsc...@googlegroups.com

me@basilcrow.com (JIRA)

unread,
Jul 25, 2018, 3:20:02 PM7/25/18
to jenkinsc...@googlegroups.com
Basil Crow commented on Bug JENKINS-31832
 
Re: javaposse.jobdsl.dsl.Job is not a suitable parent class for javaposse.jobdsl.dsl.jobs.WorkflowJob (org.jenkinsci.plugins.workflow.job.WorkflowJob does not extend hudson.model.AbstractProject)

Hi Daniel Spilker,

I see that you've marked this bug as "Fixed but unreleased"; I'm afraid that it has not yet been fixed. As I wrote in my previous comment, it's not just authenticationToken that has regressed, but also concurrentBuild. Your PR addresses the former, but not the latter.

mail@daniel-spilker.com (JIRA)

unread,
Jul 30, 2018, 12:11:02 PM7/30/18
to jenkinsc...@googlegroups.com

frankgenerated@gmail.com (JIRA)

unread,
Nov 1, 2018, 4:15:02 PM11/1/18
to jenkinsc...@googlegroups.com
Frank Gen commented on Bug JENKINS-31832
 
Re: javaposse.jobdsl.dsl.Job is not a suitable parent class for javaposse.jobdsl.dsl.jobs.WorkflowJob (org.jenkinsci.plugins.workflow.job.WorkflowJob does not extend hudson.model.AbstractProject)

Hello,

Will this issue be resolved and released any time soon? We started having builds launched in parallel, even though they should have been queued.

Thanks

This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

me@basilcrow.com (JIRA)

unread,
Oct 29, 2019, 9:51:03 PM10/29/19
to jenkinsc...@googlegroups.com

We started having builds launched in parallel, even though they should have been queued.

Frank Gen You might want to take a look at JENKINS-53775, where I discuss how I solved a similar-sounding problem with Job DSL and concurrent builds.

This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages