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

Declaring a Matrix Combination Parameter in declarative pipeline

      It would be great to be able to declare a Matrix Combination Parameter in declarative pipeline. Code like this (found at https://jenkinsci.github.io/job-dsl-plugin/#method/javaposse.jobdsl.dsl.helpers.BuildParametersContext.matrixCombinationsParam) does not work:

       

      pipeline {
         parameters {
           matrixCombinationsParam 'TARGET_ARCHS', description: 'Target platforms to build engine for'
         }
      }

       Or maybe it is currently somehow achievable via '$class' and 'MatrixCombinationsParameterDefinition' (if yes, then this should be documented)? 

      properties([
        [$class: 'ParametersDefinitionProperty',
         parameterDefinitions: [
           [$class: 'MatrixCombinationsParameterDefinition',
             name: 'TARGET_ARCHS',
             description: 'Target platforms to build engine for'
           ]
         ]
       ]
      ])
      
      pipeline {
         ...
      }

      The code above leads to:

       TARGET_ARCHSNot applicable. Applicable only to multi-configuration projects.

      Also don't know how to use the approach with 'properties' above to extend the set of parameters with a new MatrixCombinationsParameterDefinition one instead of overwriting the entire parameter list.

          [JENKINS-61504] Declaring a Matrix Combination Parameter in declarative pipeline

          Wszebor W. created issue -
          Wszebor W. made changes -
          Description Original: It would be great to be able to declare a Matrix Combination Parameter in declarative pipeline. Code like this (found at https://jenkinsci.github.io/job-dsl-plugin/#method/javaposse.jobdsl.dsl.helpers.BuildParametersContext.matrixCombinationsParam) does not work:

           
          {code:java}
          pipeline {
             parameters {
               matrixCombinationsParam 'TARGET_ARCHS', description: 'Target platforms to build engine for'
             }
          }{code}
           

          Or maybe it is currently somehow achievable via '$class' and 'MatrixCombinationsParameterDefinition' (if yes, then this should be documented)?
          New: It would be great to be able to declare a Matrix Combination Parameter in declarative pipeline. Code like this (found at [https://jenkinsci.github.io/job-dsl-plugin/#method/javaposse.jobdsl.dsl.helpers.BuildParametersContext.matrixCombinationsParam]) does not work:

           
          {code:java}
          pipeline {
             parameters {
               matrixCombinationsParam 'TARGET_ARCHS', description: 'Target platforms to build engine for'
             }
          }{code}
           Or maybe it is currently somehow achievable via '$class' and 'MatrixCombinationsParameterDefinition' (if yes, then this should be documented)?

           
          {code:java}
          properties([
            [$class: 'ParametersDefinitionProperty',
             parameterDefinitions: [
               [$class: 'MatrixCombinationsParameterDefinition',
                 name: 'TARGET_ARCHS',
                 description: 'Target platforms to build engine for'
               ]
             ]
           ]
          ])

          pipeline {
             ...
          }{code}
           

           
          Wszebor W. made changes -
          Description Original: It would be great to be able to declare a Matrix Combination Parameter in declarative pipeline. Code like this (found at [https://jenkinsci.github.io/job-dsl-plugin/#method/javaposse.jobdsl.dsl.helpers.BuildParametersContext.matrixCombinationsParam]) does not work:

           
          {code:java}
          pipeline {
             parameters {
               matrixCombinationsParam 'TARGET_ARCHS', description: 'Target platforms to build engine for'
             }
          }{code}
           Or maybe it is currently somehow achievable via '$class' and 'MatrixCombinationsParameterDefinition' (if yes, then this should be documented)?

           
          {code:java}
          properties([
            [$class: 'ParametersDefinitionProperty',
             parameterDefinitions: [
               [$class: 'MatrixCombinationsParameterDefinition',
                 name: 'TARGET_ARCHS',
                 description: 'Target platforms to build engine for'
               ]
             ]
           ]
          ])

          pipeline {
             ...
          }{code}
           

           
          New: It would be great to be able to declare a Matrix Combination Parameter in declarative pipeline. Code like this (found at [https://jenkinsci.github.io/job-dsl-plugin/#method/javaposse.jobdsl.dsl.helpers.BuildParametersContext.matrixCombinationsParam]) does not work:

           
          {code:java}
          pipeline {
             parameters {
               matrixCombinationsParam 'TARGET_ARCHS', description: 'Target platforms to build engine for'
             }
          }{code}
           Or maybe it is currently somehow achievable via '$class' and 'MatrixCombinationsParameterDefinition' (if yes, then this should be documented)? 
          {code:java}
          properties([
            [$class: 'ParametersDefinitionProperty',
             parameterDefinitions: [
               [$class: 'MatrixCombinationsParameterDefinition',
                 name: 'TARGET_ARCHS',
                 description: 'Target platforms to build engine for'
               ]
             ]
           ]
          ])

          pipeline {
             ...
          }{code}
          The code above leads to:
          {noformat}
           TARGET_ARCHSNot applicable. Applicable only to multi-configuration projects.{noformat}

          Also don't know how to use the approach with 'properties' above to extend the set of parameters with a new MatrixCombinationsParameterDefinition one instead of overwriting the entire parameter list.
          ikedam made changes -
          Issue Type Original: Bug [ 1 ] New: Improvement [ 4 ]

            Unassigned Unassigned
            wszebor Wszebor W.
            Votes:
            2 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: