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)

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • job-dsl-plugin
    • Jenkins 1.619
      job-dsl-plugin 1.39
      workflow-plugin 1.10

      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)
      

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

          Frédéric Chuong created issue -
          R. Tyler Croy made changes -
          Workflow Original: JNJira [ 167282 ] New: JNJira + In-Review [ 182671 ]
          Andrew Bayer made changes -
          Labels Original: job-dsl workflow New: job-dsl pipeline workflow
          Andrew Bayer made changes -
          Labels Original: job-dsl pipeline workflow New: job-dsl pipeline
          Daniel Spilker made changes -
          Link New: This issue is duplicated by JENKINS-51044 [ JENKINS-51044 ]
          Daniel Spilker made changes -
          Link New: This issue relates to JENKINS-49820 [ JENKINS-49820 ]

          Daniel Spilker added a comment - PR: https://github.com/jenkinsci/job-dsl-plugin/pull/1131
          Daniel Spilker made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: Open [ 1 ] New: Resolved [ 5 ]
          Daniel Spilker made changes -
          Status Original: Resolved [ 5 ] New: Closed [ 6 ]

          Basil Crow added a comment -

          Hi daspilker,

          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.

          Basil Crow added a comment - Hi daspilker , 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.

            jamietanna Jamie Tanna
            fchuong Frédéric Chuong
            Votes:
            0 Vote for this issue
            Watchers:
            16 Start watching this issue

              Created:
              Updated:
              Resolved: