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

Old syntax not honored for explicit single required parameter taking struct

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      Evaristo Gutierrez running plugin-compat-tester found that org.jenkinsci.plugins.configfiles.buildwrapper.ConfigFileBuildWrapperWorkflowTest.symbolWithTargetLocation fails when you update

      diff --git a/pom.xml b/pom.xml
      index 32c873b..6dd604e 100644
      --- a/pom.xml
      +++ b/pom.xml
      @@ -115,7 +115,7 @@
               <dependency>
                   <groupId>org.jenkins-ci.plugins.workflow</groupId>
                   <artifactId>workflow-cps</artifactId>
      -            <version>2.10</version>
      +            <version>2.14</version>
                   <scope>test</scope>
               </dependency>
               <dependency>
      

      with this kind of exception:

      java.lang.UnsupportedOperationException: must specify $class with an implementation of interface java.util.List
      	at org.jenkinsci.plugins.structs.describable.DescribableModel.resolveClass(DescribableModel.java:442)
      

      As of JENKINS-29711 this syntax is deprecated—the managedFiles: can be omitted—but for compatibility we need to continue supporting the old syntax. The workaround is to update the test to the new syntax:

      diff --git a/src/test/java/org/jenkinsci/plugins/configfiles/buildwrapper/ConfigFileBuildWrapperWorkflowTest.java b/src/test/java/org/jenkinsci/plugins/configfiles/buildwrapper/ConfigFileBuildWrapperWorkflowTest.java
      index b4790b2..da9e64e 100644
      --- a/src/test/java/org/jenkinsci/plugins/configfiles/buildwrapper/ConfigFileBuildWrapperWorkflowTest.java
      +++ b/src/test/java/org/jenkinsci/plugins/configfiles/buildwrapper/ConfigFileBuildWrapperWorkflowTest.java
      @@ -116,7 +116,7 @@ public class ConfigFileBuildWrapperWorkflowTest {
                       WorkflowJob p = story.j.jenkins.createProject(WorkflowJob.class, "p");
                       p.setDefinition(new CpsFlowDefinition(""
                               + "node {\n"
      -                        + "  configFileProvider(managedFiles: [configFile(fileId: '" + createConfig().id + "', targetLocation: 'myfile.txt')]) {sh 'cat myfile.txt'}\n"
      +                        + "  configFileProvider([configFile(fileId: '" + createConfig().id + "', targetLocation: 'myfile.txt')]) {sh 'cat myfile.txt'}\n"
                               + "}", true));
                       WorkflowRun b = story.j.assertBuildStatusSuccess(p.scheduleBuild2(0));
                       story.j.assertLogContains("some content", b);
      

        Attachments

          Issue Links

            Activity

            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Dominik Bartholdi
            Path:
            pom.xml
            src/test/java/org/jenkinsci/plugins/configfiles/buildwrapper/ConfigFileBuildWrapperWorkflowTest.java
            http://jenkins-ci.org/commit/config-file-provider-plugin/a756b9467c911327d9983e1ae80be46ea6ed2213
            Log:
            Merge pull request #41 from raul-arabaolaza/JENKINS-45110

            JENKINS-45110 Adapt ConfigFileBuildWrapperWorkflowTest due to JENKINS-43073

            Compare: https://github.com/jenkinsci/config-file-provider-plugin/compare/26bbe6089ee5...a756b9467c91

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Dominik Bartholdi Path: pom.xml src/test/java/org/jenkinsci/plugins/configfiles/buildwrapper/ConfigFileBuildWrapperWorkflowTest.java http://jenkins-ci.org/commit/config-file-provider-plugin/a756b9467c911327d9983e1ae80be46ea6ed2213 Log: Merge pull request #41 from raul-arabaolaza/ JENKINS-45110 JENKINS-45110 Adapt ConfigFileBuildWrapperWorkflowTest due to JENKINS-43073 Compare: https://github.com/jenkinsci/config-file-provider-plugin/compare/26bbe6089ee5...a756b9467c91
            Hide
            abayer Andrew Bayer added a comment -

            This was actually a dupe of JENKINS-38169, which was fixed in workflow-cps 2.17.

            Show
            abayer Andrew Bayer added a comment - This was actually a dupe of JENKINS-38169 , which was fixed in workflow-cps 2.17.

              People

              Assignee:
              abayer Andrew Bayer
              Reporter:
              jglick Jesse Glick
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: