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

Cannot use Matrix Combination parameter from pipeline

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Not A Defect
    • Icon: Major Major
    • None
    • Plugin version: 1.1.0
      Jenkins version: 1.653

      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?

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

              Created:
              Updated:
              Resolved: