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

Add an `includes` directive to matrix

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      This reddit question has convinced me that we need an "includes" directive for matrix. 

      User wanted a very sparse matrix: 

      Arch Platform OS Variant Device Debug
      aarch64 pine64 mobile pinephone y
      aarch64 pine64 mobile pinephone n
      x86_64 pc desktop generic y
      x86_64 pc desktop generic n

       

      In order to achieve that we had to do this:  

       

          pipeline {
              agent none
              stages {
                  stage('Build') {
                      matrix {
                          agent any
                          axes {
                              axis {
                                  name 'ARCH'
                                  values 'aarch64', 'x86_64'
                              }
                              axis {
                                  name 'PLATFORM'
                                  values 'pine64', 'pc'
                              }
                              axis {
                                  name 'VARIANT'
                                  values 'mobile', 'desktop'
                              }
                              axis {
                                  name 'DEVICE'
                                  values 'pinephone', 'generic'
                              }
                              axis {
                                  name 'DEBUG'
                                  values 'y', 'n'
                              }
                          }
                          excludes {
                              exclude {
                                  axis {
                                      name 'ARCH'
                                      values 'aarch64'
                                  }
                                  axis {
                                      name 'PLATFORM'
                                      notValues 'pine64'
                                  }
                              }
                              exclude {
                                  axis {
                                      name 'ARCH'
                                      values 'aarch64'
                                  }
                                  axis {
                                      name 'VARIANT'
                                      notValues 'mobile'
                                  }
                              }
                              exclude {
                                  axis {
                                      name 'ARCH'
                                      values 'aarch64'
                                  }
                                  axis {
                                      name 'DEVICE'
                                      notValues 'pinephone'
                                  }
                              }
                              exclude {
                                  axis {
                                      name 'ARCH'
                                      values 'x86_64'
                                  }
                                  axis {
                                      name 'PLATFORM'
                                      notValues 'pc'
                                  }
                              }
                              exclude {
                                  axis {
                                      name 'ARCH'
                                      values 'x86_64'
                                  }
                                  axis {
                                      name 'VARIANT'
                                      notValues 'desktop'
                                  }
                              }
                              exclude {
                                  axis {
                                      name 'ARCH'
                                      values 'x86_64'
                                  }
                                  axis {
                                      name 'DEVICE'
                                      notValues 'generic'
                                  }
                              }
                          }
                          stages {
                              stage('Build') {
                                  steps {
                                      sh "bash ./scripts/build.sh x86_64 ${PLATFORM} ${VARIANT} TARGET_DEVICE=${DEVICE} DEBUG=${DEBUG} TIDY=y"
                                  }
                              }
                          }
                      }
                  }
              }
          }
      

       

      This is admittedly an extreme case but it seem like it isn't so unusual

       

      https://www.reddit.com/r/jenkinsci/comments/fzlfmb/jenkinsfile_matrix/

        Attachments

          Activity

          There are no comments yet on this issue.

            People

            Assignee:
            bitwiseman Liam Newman
            Reporter:
            bitwiseman Liam Newman
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated: