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

A parameterized buildstep in a matrix project causes IllegalArgumentException

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Critical Critical
    • None
    • Plugin version 2.15 Jenkins ver. 1.447.2

      Started by upstream project "Experimental_bobby_MatrixParameterized" build number 2
      Building on master
      [nisse] $ /bin/sh -xe /srv/hudson/tomcat/latest/temp/hudson5741840414633660975.sh
      + echo another
      FATAL: Can't parse test2
      java.lang.IllegalArgumentException: Can't parse test2
      at hudson.matrix.Combination.fromString(Combination.java:218)
      at hudson.matrix.MatrixProject.getItem(MatrixProject.java:442)
      at hudson.matrix.MatrixProject.getItem(MatrixProject.java:91)
      at jenkins.model.Jenkins.getItem(Jenkins.java:2142)
      at jenkins.model.Jenkins.getItem(Jenkins.java:2163)
      at hudson.model.Items.fromNameList(Items.java:100)
      at hudson.plugins.parameterizedtrigger.BuildTriggerConfig.getProjectList(BuildTriggerConfig.java:132)
      at hudson.plugins.parameterizedtrigger.BuildTriggerConfig.perform2(BuildTriggerConfig.java:241)
      at hudson.plugins.parameterizedtrigger.BlockableBuildTriggerConfig.perform2(BlockableBuildTriggerConfig.java:56)
      at hudson.plugins.parameterizedtrigger.TriggerBuilder.perform(TriggerBuilder.java:96)
      at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19)
      at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:697)
      at hudson.model.Build$RunnerImpl.build(Build.java:178)
      at hudson.model.Build$RunnerImpl.doRun(Build.java:139)
      at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:467)
      at hudson.model.Run.run(Run.java:1404)
      at hudson.matrix.MatrixRun.run(MatrixRun.java:146)
      at hudson.model.ResourceController.execute(ResourceController.java:88)
      at hudson.model.Executor.run(Executor.java:238)

          [JENKINS-14278] A parameterized buildstep in a matrix project causes IllegalArgumentException

          cjo9900 added a comment -

          I have also seen this while trying to test other behaviour for the conditional buildstep plugin.

          However in this case I do not see the exception as this is consumed by the conditional buildstep Runner.
          however I do see the the following
          "ERROR: Build aborted. No projects to trigger. Check your configuration!"

          Looking at the code it points to the function at hudson.plugins.parameterizedtrigger.BuildTriggerConfig.getProjectList(BuildTriggerConfig.java:132)
          returning an empty list.

          This is called as
          List<AbstractProject> projectList = config.getProjectList(build.getProject().getParent(),env);

          However when this is a Matrix project
          build is a MatrixBuild, and get Project gets the MatrixConfiguration and the parent of that is the MatrixProject which implements the ItemGroup<MatrixConfiguration>

          So when Items.fromNameList(context, projectNames.toString(), AbstractProject.class) is called in the context is the MatrixProject so tries to get the project from that.

          public List<AbstractProject> getProjectList(ItemGroup context, EnvVars env)

          Possible solution would be to do
          build.getRootBuild().getProject().getParent()
          which should give the topbuild item in the tree

          cjo9900 added a comment - I have also seen this while trying to test other behaviour for the conditional buildstep plugin. However in this case I do not see the exception as this is consumed by the conditional buildstep Runner. however I do see the the following "ERROR: Build aborted. No projects to trigger. Check your configuration!" Looking at the code it points to the function at hudson.plugins.parameterizedtrigger.BuildTriggerConfig.getProjectList(BuildTriggerConfig.java:132) returning an empty list. This is called as List<AbstractProject> projectList = config.getProjectList(build.getProject().getParent(),env); However when this is a Matrix project build is a MatrixBuild, and get Project gets the MatrixConfiguration and the parent of that is the MatrixProject which implements the ItemGroup<MatrixConfiguration> So when Items.fromNameList(context, projectNames.toString(), AbstractProject.class) is called in the context is the MatrixProject so tries to get the project from that. public List<AbstractProject> getProjectList(ItemGroup context, EnvVars env) Possible solution would be to do build.getRootBuild().getProject().getParent() which should give the topbuild item in the tree

          cjo9900 added a comment -

          Test case and fix at
          https://github.com/cjo9900/parameterized-trigger-plugin/tree/JENKINS-14278

          Test cases still fail after fix but behaviour seems to work correctly when running on a proper Jenkins instance.
          Discussion on this started at
          https://groups.google.com/d/topic/jenkinsci-dev/wsvo2tGrmWs/discussion

          Will promote to a pull request when the test case issue can be resolved.

          cjo9900 added a comment - Test case and fix at https://github.com/cjo9900/parameterized-trigger-plugin/tree/JENKINS-14278 Test cases still fail after fix but behaviour seems to work correctly when running on a proper Jenkins instance. Discussion on this started at https://groups.google.com/d/topic/jenkinsci-dev/wsvo2tGrmWs/discussion Will promote to a pull request when the test case issue can be resolved.

          cjo9900 added a comment -

          cjo9900 added a comment - Pull request created. https://github.com/jenkinsci/parameterized-trigger-plugin/pull/22

          Code changed in jenkins
          User: c3johnso
          Path:
          src/test/java/hudson/plugins/parameterizedtrigger/test/TriggerBuilderTest.java
          http://jenkins-ci.org/commit/parameterized-trigger-plugin/f26766b3eca5ebdd3388b1a0ba2fdb86c338c9fc
          Log:
          Test cases to show JENKINS-14278 occuring.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: c3johnso Path: src/test/java/hudson/plugins/parameterizedtrigger/test/TriggerBuilderTest.java http://jenkins-ci.org/commit/parameterized-trigger-plugin/f26766b3eca5ebdd3388b1a0ba2fdb86c338c9fc Log: Test cases to show JENKINS-14278 occuring.

          Code changed in jenkins
          User: cjo9900
          Path:
          src/main/java/hudson/plugins/parameterizedtrigger/BuildTriggerConfig.java
          src/main/java/hudson/plugins/parameterizedtrigger/TriggerBuilder.java
          src/test/java/hudson/plugins/parameterizedtrigger/test/TriggerBuilderTest.java
          http://jenkins-ci.org/commit/parameterized-trigger-plugin/046294a3d96872d5eb99f559e60e8e3ba1b2eb27
          Log:
          Merge branch 'JENKINS-14278' of git://github.com/cjo9900/parameterized-trigger-plugin into 2.17-RC

          Resolved Conflicts:
          src/test/java/hudson/plugins/parameterizedtrigger/test/TriggerBuilderTest.java

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: cjo9900 Path: src/main/java/hudson/plugins/parameterizedtrigger/BuildTriggerConfig.java src/main/java/hudson/plugins/parameterizedtrigger/TriggerBuilder.java src/test/java/hudson/plugins/parameterizedtrigger/test/TriggerBuilderTest.java http://jenkins-ci.org/commit/parameterized-trigger-plugin/046294a3d96872d5eb99f559e60e8e3ba1b2eb27 Log: Merge branch ' JENKINS-14278 ' of git://github.com/cjo9900/parameterized-trigger-plugin into 2.17-RC Resolved Conflicts: src/test/java/hudson/plugins/parameterizedtrigger/test/TriggerBuilderTest.java

          seem fix of this issue already merged at 2.17 main line as per release log
          https://wiki.jenkins-ci.org/display/JENKINS/Parameterized+Trigger+Plugin

          please close this if release log says truth

          hiteswar kumar added a comment - seem fix of this issue already merged at 2.17 main line as per release log https://wiki.jenkins-ci.org/display/JENKINS/Parameterized+Trigger+Plugin please close this if release log says truth

          cjo9900 added a comment -

          included in 2.17

          cjo9900 added a comment - included in 2.17

            cjo9900 cjo9900
            rsandell rsandell
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: