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 ]
            daspilker Daniel Spilker made changes -
            Status Open [ 1 ] Resolved [ 5 ]
            Resolution Fixed [ 1 ]
            daspilker Daniel Spilker made changes -
            Status Resolved [ 5 ] Closed [ 6 ]
            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 ]
            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 ]
            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: