[JIRA] (JENKINS-61876) Add an `includes` directive to matrix

3 views
Skip to first unread message

bitwiseman@gmail.com (JIRA)

unread,
Apr 12, 2020, 4:32:03 PM4/12/20
to jenkinsc...@googlegroups.com
Liam Newman created an issue
 
Jenkins / Improvement JENKINS-61876
Add an `includes` directive to matrix
Issue Type: Improvement Improvement
Assignee: Liam Newman
Components: pipeline-model-definition-plugin
Created: 2020-04-12 20:31
Priority: Minor Minor
Reporter: Liam Newman

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/

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.13.12#713012-sha1:6e07c38)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages