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

Cannot use Matrix Combination parameter from pipeline

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      I would like to build only some combinations of a matrix job from a pipeline job using the groovy API build.

      There is a class called MatrixCombinationsParameterValue in this API but the axis are not taken into account.

      For instance if I use this code

      JenkinsFile.groovy
      def MatrixConfig = "(MyAxis == 'MyAxisValue')"
      build job: "$jobname", propagate: false, wait: true, parameters: [[$class: 'MatrixCombinationsParameterValue', name: 'MatrixConfig', value: "$MatrixConfig"]]
      

      The job which name is contained inside the variable jobname is correctly built but without any combination (so basically nothing is done except starting and exiting the job)...
      (MatrixConfig is the name of the MatrixCombinationsParameter in the job $jobname)

      Moreover, when I look into the environment variables of this build of the matrix job the value of MatrixConfig is empty.

      Is the trigger from a pipeline job not supported or am I doing something wrong?

      This is quite blocking as we cannot use other jobs than pipeline jobs.

      EDIT: I found a "workaround" with this code:

      JenkinsFile.groovy
      build job: "$jobname", propagate: false, wait: true, parameters: [
                  new hudson.plugins.matrix_configuration_parameter.MatrixCombinationsParameterValue
                  ("MatrixConfig",
                  "description",
                  ['MyAxis=MyAxisValue'])
                  ]
      

      Isn't the first solution supposed to work also?

        Attachments

          Activity

          Hide
          ikedam ikedam added a comment -

          No, the first one never work for type mismatch.
          "value" should be a list of strings.

          Show
          ikedam ikedam added a comment - No, the first one never work for type mismatch. "value" should be a list of strings.
          Hide
          thomasb Thomas Bétous added a comment -

          ikedam Oh ok. As the "workaround" is the way to do it then I think we can close this ticket.
          Thank you for the confirmation.

          Show
          thomasb Thomas Bétous added a comment - ikedam Oh ok. As the "workaround" is the way to do it then I think we can close this ticket. Thank you for the confirmation.
          Hide
          thomasb Thomas Bétous added a comment -

          The "workaround" given in the description is the correct way of executing this use case.

          Show
          thomasb Thomas Bétous added a comment - The "workaround" given in the description is the correct way of executing this use case.

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            thomasb Thomas Bétous
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: