Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-29711

Snippet Generator: missing attribute names in single-entry forms

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Component/s: pipeline
    • Labels:
      None
    • Environment:
      workflow 1.4..1.8
    • Similar Issues:

      Description

      Using the snippet generator for the HTML publisher, the generated code, yields an exception:

      hudson.AbortException: Cannot publish the report. Target is not specified
      	at htmlpublisher.workflow.PublishHTMLStepExecution.run(PublishHTMLStepExecution.java:64)
      	at htmlpublisher.workflow.PublishHTMLStepExecution.run(PublishHTMLStepExecution.java:43)
      	at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousStepExecution.start(AbstractSynchronousStepExecution.java:40)
      

      Follow-up to https://github.com/jenkinsci/htmlpublisher-plugin/pull/15/files#r35805641 ...I suspect a bug in workflow, but probably it has been fixed.

      When a form/class contains only one entry, Snippet Generator provides a code without an attribute name :

      publishHtml([reportName : "", ...])
      

      After that the flow execution calls a constructor with null, because a target is missing. The right call is:

      publishHtml(target: [reportName : "", ...])```
      

      Has this bug been fixed in newer workflow versions? I suspect the answer is "no", but probably I'm doing something wrong in the code

        Attachments

          Issue Links

            Activity

            oleg_nenashev Oleg Nenashev created issue -
            Hide
            jglick Jesse Glick added a comment -

            I seem to recall something like this affecting ServerEndpointStep/RegistryEndpointStep in docker-workflow: these steps require the parameter name to be specified. The issue here is that there is exactly one (mandatory) parameter, and it is monomorphic. For a polymorphic parameter, this code disambiguates the Map passed by Groovy, deciding whether it is the value of one parameter, or the set of all parameters. Probably that trick just does not work for the monomorphic case, yet Snippetizer assumes that it will. If I am right, either DSL or Snippetizer need to be fixed—preferably the former, so that you can actually use the shorter syntax; but this might be impossible, in which case the latter.

            Show
            jglick Jesse Glick added a comment - I seem to recall something like this affecting ServerEndpointStep / RegistryEndpointStep in docker-workflow : these steps require the parameter name to be specified . The issue here is that there is exactly one (mandatory) parameter, and it is monomorphic. For a polymorphic parameter, this code disambiguates the Map passed by Groovy, deciding whether it is the value of one parameter, or the set of all parameters. Probably that trick just does not work for the monomorphic case, yet Snippetizer assumes that it will. If I am right, either DSL or Snippetizer need to be fixed—preferably the former, so that you can actually use the shorter syntax; but this might be impossible, in which case the latter.
            jglick Jesse Glick made changes -
            Field Original Value New Value
            Link This issue is blocking JENKINS-30519 [ JENKINS-30519 ]
            oleg_nenashev Oleg Nenashev made changes -
            Link This issue is related to JENKINS-26343 [ JENKINS-26343 ]
            oleg_nenashev Oleg Nenashev made changes -
            Assignee Jesse Glick [ jglick ] Oleg Nenashev [ oleg_nenashev ]
            cruftex Jens Wilke made changes -
            Description Follow-up to https://github.com/jenkinsci/htmlpublisher-plugin/pull/15/files#r35805641 ...I suspect a bug in workflow, but probably it has been fixed.

            When a form/class contains only one entry, Snippet Generator provides a code without an attribute name :
            {noformat}
            publishHtml([reportName : "", ...])
            {noformat}

            After that the flow execution calls a constructor with null, because a target is missing. The right call is:
            {noformat}
            publishHtml(target: [reportName : "", ...])```
            {noformat}

            Has this bug been fixed in newer workflow versions? I suspect the answer is "no", but probably I'm doing something wrong in the code
            Using the snippet generator for the HTML publisher, the generated code yields in an exception:
            {noformat}
            hudson.AbortException: Cannot publish the report. Target is not specified
            at htmlpublisher.workflow.PublishHTMLStepExecution.run(PublishHTMLStepExecution.java:64)
            at htmlpublisher.workflow.PublishHTMLStepExecution.run(PublishHTMLStepExecution.java:43)
            at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousStepExecution.start(AbstractSynchronousStepExecution.java:40)
            {noformat}

            Follow-up to https://github.com/jenkinsci/htmlpublisher-plugin/pull/15/files#r35805641 ...I suspect a bug in workflow, but probably it has been fixed.

            When a form/class contains only one entry, Snippet Generator provides a code without an attribute name :
            {noformat}
            publishHtml([reportName : "", ...])
            {noformat}

            After that the flow execution calls a constructor with null, because a target is missing. The right call is:
            {noformat}
            publishHtml(target: [reportName : "", ...])```
            {noformat}

            Has this bug been fixed in newer workflow versions? I suspect the answer is "no", but probably I'm doing something wrong in the code
            cruftex Jens Wilke made changes -
            Description Using the snippet generator for the HTML publisher, the generated code yields in an exception:
            {noformat}
            hudson.AbortException: Cannot publish the report. Target is not specified
            at htmlpublisher.workflow.PublishHTMLStepExecution.run(PublishHTMLStepExecution.java:64)
            at htmlpublisher.workflow.PublishHTMLStepExecution.run(PublishHTMLStepExecution.java:43)
            at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousStepExecution.start(AbstractSynchronousStepExecution.java:40)
            {noformat}

            Follow-up to https://github.com/jenkinsci/htmlpublisher-plugin/pull/15/files#r35805641 ...I suspect a bug in workflow, but probably it has been fixed.

            When a form/class contains only one entry, Snippet Generator provides a code without an attribute name :
            {noformat}
            publishHtml([reportName : "", ...])
            {noformat}

            After that the flow execution calls a constructor with null, because a target is missing. The right call is:
            {noformat}
            publishHtml(target: [reportName : "", ...])```
            {noformat}

            Has this bug been fixed in newer workflow versions? I suspect the answer is "no", but probably I'm doing something wrong in the code
            Using the snippet generator for the HTML publisher, the generated code, yields an exception:
            {noformat}
            hudson.AbortException: Cannot publish the report. Target is not specified
            at htmlpublisher.workflow.PublishHTMLStepExecution.run(PublishHTMLStepExecution.java:64)
            at htmlpublisher.workflow.PublishHTMLStepExecution.run(PublishHTMLStepExecution.java:43)
            at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousStepExecution.start(AbstractSynchronousStepExecution.java:40)
            {noformat}

            Follow-up to https://github.com/jenkinsci/htmlpublisher-plugin/pull/15/files#r35805641 ...I suspect a bug in workflow, but probably it has been fixed.

            When a form/class contains only one entry, Snippet Generator provides a code without an attribute name :
            {noformat}
            publishHtml([reportName : "", ...])
            {noformat}

            After that the flow execution calls a constructor with null, because a target is missing. The right call is:
            {noformat}
            publishHtml(target: [reportName : "", ...])```
            {noformat}

            Has this bug been fixed in newer workflow versions? I suspect the answer is "no", but probably I'm doing something wrong in the code
            jglick Jesse Glick made changes -
            Link This issue is related to JENKINS-26126 [ JENKINS-26126 ]
            jglick Jesse Glick made changes -
            Link This issue is duplicated by JENKINS-32674 [ JENKINS-32674 ]
            Hide
            jglick Jesse Glick added a comment -

            Reported to affect properties too.

            Show
            jglick Jesse Glick added a comment - Reported to affect properties too.
            jglick Jesse Glick made changes -
            Link This issue is duplicated by JENKINS-34261 [ JENKINS-34261 ]
            jglick Jesse Glick made changes -
            Epic Link JENKINS-35393 [ 171186 ]
            jglick Jesse Glick made changes -
            Link This issue is duplicated by JENKINS-36173 [ JENKINS-36173 ]
            rtyler R. Tyler Croy made changes -
            Workflow JNJira [ 164694 ] JNJira + In-Review [ 181681 ]
            jglick Jesse Glick made changes -
            Link This issue relates to JENKINS-29922 [ JENKINS-29922 ]
            jglick Jesse Glick made changes -
            Link This issue is related to JENKINS-37477 [ JENKINS-37477 ]
            abayer Andrew Bayer made changes -
            Assignee Oleg Nenashev [ oleg_nenashev ] Andrew Bayer [ abayer ]
            abayer Andrew Bayer made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            abayer Andrew Bayer made changes -
            Status In Progress [ 3 ] In Review [ 10005 ]
            Hide
            abayer Andrew Bayer added a comment -

            PR up at https://github.com/jenkinsci/workflow-cps-plugin/pull/49 - still need to add testing for metasteps with monomorphic single parameters, but I'll get that shortly.

            Show
            abayer Andrew Bayer added a comment - PR up at https://github.com/jenkinsci/workflow-cps-plugin/pull/49 - still need to add testing for metasteps with monomorphic single parameters, but I'll get that shortly.
            abayer Andrew Bayer made changes -
            Remote Link This issue links to "PR #49 (Web Link)" [ 14761 ]
            abayer Andrew Bayer made changes -
            Component/s pipeline-general [ 21692 ]
            abayer Andrew Bayer made changes -
            Component/s workflow-plugin [ 18820 ]
            Hide
            abayer Andrew Bayer added a comment -

            The issue with properties was similar but not actually the same problem. That was happening because Snippetizer wasn't handling List parameters correctly, failing to put parentheses around the List.

            Anyway - end result, monomorphic single parameters are now handled cleanly in DSL - the syntax that Snippetizer has been generating for that case (i.e., publishHtml([reportName : "", ...]) from the description here) is now valid. And Snippetizer now correctly puts parentheses around List parameters when they're the only argument. Phew.

            Show
            abayer Andrew Bayer added a comment - The issue with properties was similar but not actually the same problem. That was happening because Snippetizer wasn't handling List parameters correctly, failing to put parentheses around the List . Anyway - end result, monomorphic single parameters are now handled cleanly in DSL - the syntax that Snippetizer has been generating for that case (i.e., publishHtml( [reportName : "", ...] ) from the description here) is now valid. And Snippetizer now correctly puts parentheses around List parameters when they're the only argument. Phew.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Andrew Bayer
            Path:
            src/test/java/org/jenkinsci/plugins/workflow/multibranch/JobPropertyStepTest.java
            http://jenkins-ci.org/commit/workflow-multibranch-plugin/debde517af80c551a86e17c14f7a6f2eb1ccab83
            Log:
            JENKINS-37477 Working test for snippet generator for triggers.

            Can't do round tripping due to JENKINS-29711, and StepConfigTester
            doesn't work due to this being a Pipeline-specific JobProperty, but
            the snippet generator test does what's expected.

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Andrew Bayer Path: src/test/java/org/jenkinsci/plugins/workflow/multibranch/JobPropertyStepTest.java http://jenkins-ci.org/commit/workflow-multibranch-plugin/debde517af80c551a86e17c14f7a6f2eb1ccab83 Log: JENKINS-37477 Working test for snippet generator for triggers. Can't do round tripping due to JENKINS-29711 , and StepConfigTester doesn't work due to this being a Pipeline-specific JobProperty, but the snippet generator test does what's expected.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Andrew Bayer
            Path:
            src/main/java/org/jenkinsci/plugins/workflow/cps/DSL.java
            src/test/java/org/jenkinsci/plugins/workflow/DSLTest.java
            src/test/java/org/jenkinsci/plugins/workflow/cps/SnippetizerTest.java
            src/test/java/org/jenkinsci/plugins/workflow/testMetaStep/MonomorphicData.java
            src/test/java/org/jenkinsci/plugins/workflow/testMetaStep/MonomorphicStep.java
            http://jenkins-ci.org/commit/workflow-cps-plugin/7857e23bfc9e404063a1e512287a0a735445d318
            Log:
            [FIXED JENKINS-29711] Handle monomorphic single-parameters to steps.

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Andrew Bayer Path: src/main/java/org/jenkinsci/plugins/workflow/cps/DSL.java src/test/java/org/jenkinsci/plugins/workflow/DSLTest.java src/test/java/org/jenkinsci/plugins/workflow/cps/SnippetizerTest.java src/test/java/org/jenkinsci/plugins/workflow/testMetaStep/MonomorphicData.java src/test/java/org/jenkinsci/plugins/workflow/testMetaStep/MonomorphicStep.java http://jenkins-ci.org/commit/workflow-cps-plugin/7857e23bfc9e404063a1e512287a0a735445d318 Log: [FIXED JENKINS-29711] Handle monomorphic single-parameters to steps.
            abayer Andrew Bayer made changes -
            Resolution Fixed [ 1 ]
            Status In Review [ 10005 ] Resolved [ 5 ]
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Andrew Bayer
            Path:
            pom.xml
            http://jenkins-ci.org/commit/workflow-multibranch-plugin/2516ce8009cadc3cd77e66e1932b5c64ae86e3a1
            Log:
            We actually do need workflow-cps 2.14 for JENKINS-29711.

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Andrew Bayer Path: pom.xml http://jenkins-ci.org/commit/workflow-multibranch-plugin/2516ce8009cadc3cd77e66e1932b5c64ae86e3a1 Log: We actually do need workflow-cps 2.14 for JENKINS-29711 .
            jglick Jesse Glick made changes -
            Link This issue is blocked by JENKINS-38037 [ JENKINS-38037 ]
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Jesse Glick
            Path:
            pom.xml
            src/main/resources/org/jenkinsci/plugins/docker/workflow/Docker.groovy
            http://jenkins-ci.org/commit/docker-workflow-plugin/3ff3b8bfb06d722bc7f470ccf42b1016eb352fbb
            Log:
            May as well update a bit further and pick up the fix of JENKINS-29711 as well.

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: pom.xml src/main/resources/org/jenkinsci/plugins/docker/workflow/Docker.groovy http://jenkins-ci.org/commit/docker-workflow-plugin/3ff3b8bfb06d722bc7f470ccf42b1016eb352fbb Log: May as well update a bit further and pick up the fix of JENKINS-29711 as well.
            bitwiseman Liam Newman made changes -
            Link This issue relates to JENKINS-41456 [ JENKINS-41456 ]
            jglick Jesse Glick made changes -
            Link This issue depends on JENKINS-43073 [ JENKINS-43073 ]
            cloudbees CloudBees Inc. made changes -
            Remote Link This issue links to "CloudBees Internal OSS-157 (Web Link)" [ 19275 ]
            jglick Jesse Glick made changes -
            Link This issue relates to JENKINS-51395 [ JENKINS-51395 ]
            jglick Jesse Glick made changes -
            Link This issue relates to JENKINS-51405 [ JENKINS-51405 ]
            jglick Jesse Glick made changes -
            Link This issue relates to JENKINS-51395 [ JENKINS-51395 ]

              People

              Assignee:
              abayer Andrew Bayer
              Reporter:
              oleg_nenashev Oleg Nenashev
              Votes:
              12 Vote for this issue
              Watchers:
              19 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: