Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. 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)

    Details

    • Similar Issues:

      Description

      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)
      

        Attachments

          Issue Links

            Activity

            fchuong Frédéric Chuong created issue -
            rtyler R. Tyler Croy made changes -
            Field Original Value New Value
            Workflow JNJira [ 167282 ] JNJira + In-Review [ 182671 ]
            abayer Andrew Bayer made changes -
            Labels job-dsl workflow job-dsl pipeline workflow
            abayer Andrew Bayer made changes -
            Labels job-dsl pipeline workflow job-dsl pipeline
            daspilker Daniel Spilker made changes -
            Link This issue is duplicated by JENKINS-51044 [ JENKINS-51044 ]
            daspilker Daniel Spilker made changes -
            Link This issue relates to JENKINS-49820 [ JENKINS-49820 ]
            Show
            daspilker Daniel Spilker added a comment - PR: https://github.com/jenkinsci/job-dsl-plugin/pull/1131
            daspilker Daniel Spilker made changes -
            Status Open [ 1 ] Resolved [ 5 ]
            Resolution Fixed [ 1 ]
            daspilker Daniel Spilker made changes -
            Status Resolved [ 5 ] Closed [ 6 ]
            Hide
            basil Basil Crow added a comment -

            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.

            Show
            basil Basil Crow added a comment - 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.
            Hide
            tianon Tianon Gravi added a comment -

            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.)

            Show
            tianon Tianon Gravi added a comment - 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.)
            Hide
            jdreaver David Reaver added a comment -

            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")
            }
            
            Show
            jdreaver David Reaver added a comment - 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" ) }
            Hide
            redeamer Michael Musenbrock added a comment -

            As authenticationToken is still configurable in the GUI, what is the new equivalent in the JobDSL?

            Show
            redeamer Michael Musenbrock added a comment - As authenticationToken is still configurable in the GUI, what is the new equivalent in the JobDSL?
            Hide
            daspilker Daniel Spilker added a comment -

            The next release will fix support for authenticationToken.

            Show
            daspilker Daniel Spilker added a comment - The next release will fix support for authenticationToken .
            daspilker Daniel Spilker made changes -
            Resolution Fixed [ 1 ]
            Status Closed [ 6 ] Reopened [ 4 ]
            daspilker Daniel Spilker made changes -
            Status Reopened [ 4 ] Fixed but Unreleased [ 10203 ]
            Resolution Fixed [ 1 ]
            Hide
            basil Basil Crow added a comment -

            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.

            Show
            basil Basil Crow added a comment - 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.
            daspilker Daniel Spilker made changes -
            Status Fixed but Unreleased [ 10203 ] Reopened [ 4 ]
            manus manus made changes -
            Link This issue is duplicated by JENKINS-52743 [ JENKINS-52743 ]
            markus_b_b Markus Baur made changes -
            Link This issue is duplicated by JENKINS-53246 [ JENKINS-53246 ]
            Hide
            franknarf888 Frank Gen added a comment -

            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

            Show
            franknarf888 Frank Gen added a comment - 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
            daspilker Daniel Spilker made changes -
            Link This issue relates to JENKINS-56739 [ JENKINS-56739 ]

              People

              • Assignee:
                daspilker Daniel Spilker
                Reporter:
                fchuong Frédéric Chuong
              • Votes:
                0 Vote for this issue
                Watchers:
                16 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: