• Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • job-dsl-plugin
    • Jenkins 2.12, Job DSL 1.48

      Currently Job DSL has neat support for running as a Pipeline step: https://github.com/jenkinsci/job-dsl-plugin/wiki/User-Power-Moves#use-job-dsl-in-pipeline-scripts. However, if attempting to add this from the snippet generator (https://jenkins.io/doc/pipeline/#using-snippet-generator) you end up with an unhelpful generated groovy: "step <object of type javaposse.jobdsl.plugin.ExecuteDslScripts>". I'm not positive if this needs a different constructor or how exactly Job DSL can better support this, but if it helps I found a related issue+PR for another plugin with the same problem: https://github.com/dblock/jenkins-ansicolor-plugin/issues/65

          [JENKINS-36502] compatibility with snippet generator

          Liam Newman added a comment -

          Liam Newman added a comment - daspilker I've implemented a fix for this. https://github.com/jenkinsci/job-dsl-plugin/pull/880

          The problem seems to be the @DataBoundConstructor parameter with type javaposse.jobdsl.plugin.ExecuteDslScripts.ScriptLocation.

          https://github.com/jenkinsci/job-dsl-plugin/blob/job-dsl-1.48/job-dsl-plugin/src/main/groovy/javaposse/jobdsl/plugin/ExecuteDslScripts.java#L143

          jglick: is there a chance to improve the snippet generator?

          Daniel Spilker added a comment - The problem seems to be the @DataBoundConstructor parameter with type javaposse.jobdsl.plugin.ExecuteDslScripts.ScriptLocation . https://github.com/jenkinsci/job-dsl-plugin/blob/job-dsl-1.48/job-dsl-plugin/src/main/groovy/javaposse/jobdsl/plugin/ExecuteDslScripts.java#L143 jglick : is there a chance to improve the snippet generator?

          Liam Newman added a comment -

          jglick,daspilker
          Actually, it isn't the constructor that's the issue exactly. It is the fact that the constructor takes a field that doesn't exist as a "public final" field or a public get/set databound member. I have a PR (noted above) that fixes this.

          Liam Newman added a comment - jglick , daspilker Actually, it isn't the constructor that's the issue exactly. It is the fact that the constructor takes a field that doesn't exist as a "public final" field or a public get/set databound member. I have a PR (noted above) that fixes this.

          Jesse Glick added a comment -

          As noted in the PR, I think the problem is not Snippet Generator, but the nonstandard and probably overly complicated databinding idioms.

          Jesse Glick added a comment - As noted in the PR, I think the problem is not Snippet Generator, but the nonstandard and probably overly complicated databinding idioms.

          Daniel Spilker added a comment - New PR: https://github.com/jenkinsci/job-dsl-plugin/pull/893

            daspilker Daniel Spilker
            mcrooney mcrooney
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: