Skip to content

[JENKINS-29711] Snippet Generator: missing attribute names in single-entry forms #284

Closed

Description

@jenkins-infra-bot

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


Originally reported by oleg_nenashev, imported from: Snippet Generator: missing attribute names in single-entry forms
  • assignee: abayer
  • status: Resolved
  • priority: Major
  • component(s): pipeline
  • resolution: Fixed
  • resolved: 2016-08-28T16:55:08+00:00
  • votes: 12
  • watchers: 19
  • imported: 2025-12-08
Raw content of original issue

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

  • environment: workflow 1.4..1.8

Activity

  1. jenkins-infra-bot commented on Jul 29, 2015

    @jenkins-infra-bot
    Author
  2. jenkins-infra-bot commented on Aug 3, 2015

    @jenkins-infra-bot
    Author
    jglick:
    • Original comment link
    • Raw content of original 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.

    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.

  3. jenkins-infra-bot commented on Mar 4, 2016

    @jenkins-infra-bot
    Author
    jglick:
    • Original comment link
    • Raw content of original comment:

      Reported to affect properties too.

    Reported to affect properties too.

  4. jenkins-infra-bot commented on Aug 24, 2016

    @jenkins-infra-bot
    Author
    abayer:

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

  5. jenkins-infra-bot commented on Aug 26, 2016

    @jenkins-infra-bot
    Author
    abayer:
    • Original comment link
    • Raw content of original 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.

    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.

  6. jenkins-infra-bot commented on Aug 28, 2016

    @jenkins-infra-bot
    Author
    scm_issue_link:

    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">JENKINS-37477 Working test for snippet generator for triggers.

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

  7. jenkins-infra-bot commented on Aug 28, 2016

    @jenkins-infra-bot
    Author
    scm_issue_link:
    • Original comment link
    • Raw content of original 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.

    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.

  8. jenkins-infra-bot commented on Sep 6, 2016

    @jenkins-infra-bot
    Author
    scm_issue_link:

    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">JENKINS-29711.

  9. jenkins-infra-bot commented on Oct 31, 2016

    @jenkins-infra-bot
    Author
    scm_issue_link:

    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">JENKINS-29711 as well.

  10. jenkins-infra-bot commented on Dec 8, 2025

    @jenkins-infra-bot
    Author

    [Original is_duplicated_by from Jira: JENKINS-34261]

  11. jenkins-infra-bot commented on Dec 8, 2025

    @jenkins-infra-bot
    Author

    [Original is_duplicated_by from Jira: JENKINS-32674]

  12. jenkins-infra-bot commented on Dec 8, 2025

    @jenkins-infra-bot
    Author

    [Original is_duplicated_by from Jira: JENKINS-36173]

  13. jenkins-infra-bot commented on Dec 8, 2025

    @jenkins-infra-bot
    Author

    [Original relates_to from Jira: JENKINS-37477]

  14. jenkins-infra-bot commented on Dec 8, 2025

    @jenkins-infra-bot
    Author

    [Original relates_to from Jira: JENKINS-26126]

  15. jenkins-infra-bot commented on Dec 8, 2025

    @jenkins-infra-bot
    Author

    [Original relates_to from Jira: JENKINS-26343]

  16. jenkins-infra-bot commented on Dec 8, 2025

    @jenkins-infra-bot
    Author

    [Original epic from Jira: JENKINS-35393]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions