From e3a690a8289c1a5ba14b8b0bdbc0fc642b2a84b5 Mon Sep 17 00:00:00 2001 From: Bram Prieshof Date: Fri, 19 Feb 2021 03:06:13 +0100 Subject: [PATCH] Updated matrix in Jenkinsfile --- Jenkinsfile | 104 +++++++++++++++++++++++++--------------------------- 1 file changed, 49 insertions(+), 55 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 0e31f80..3977bce 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -3,64 +3,58 @@ pipeline { options { buildDiscarder(logRotator(numToKeepStr: '2', artifactNumToKeepStr: '1')) } - matrix { - axes { - axis { - name 'ImgRelease' - values '3.13 edge' - } - axis { - name 'ImgVariant' - values 'default extended' - } - } - excludes { - exclude { - axis { - name 'ImgRelease' - values 'edge' + stages { + stage("Parallel Hello") { + matrix { + axes { + axis { + name 'ImgRelease' + values '3.13 edge' + } + axis { + name 'ImgVariant' + values 'default extended' + } } - axis { - name 'ImgVariant' - notValues 'default' + excludes { + exclude { + axis { + name 'ImgRelease' + values 'edge' + } + axis { + name 'ImgVariant' + notValues 'default' + } + } + } + // all the stages here will run in parallel + stages { + stage('Prepare') { + steps { + // Get distrobuilder + copyArtifacts filter: 'bin/distrobuilder', fingerprintArtifacts: true, flatten: true, projectName: '/Public/DistroBuilder/BuildConfig=BrampCustom', selector: lastSuccessful() + } + } + stage('Build') { + steps { + copyArtifacts filter: 'bin/distrobuilder', fingerprintArtifacts: true, flatten: true, projectName: '/Public/DistroBuilder/BuildConfig=BrampCustom', selector: lastSuccessful() + // Build SH script + sh '''sudo $WORKSPACE/distrobuilder build-lxc Alpine.yaml ./ -o image.release=$ImgRelease -o image.variant=$ImgVariant + sudo chown jenkins:jenkins $WORKSPACE/*.tar.xz + ''' + } + } + stage('Finish') { + steps { + // Save generated files + archiveArtifacts artifacts: '*.tar.xz', followSymlinks: false + // Cleaning WorkSpace + cleanWs() + } + } } } } - stages { - stage('Prepare') { - steps { - // Get distrobuilder - copyArtifacts filter: 'bin/distrobuilder', fingerprintArtifacts: true, flatten: true, projectName: '/Public/DistroBuilder/BuildConfig=BrampCustom', selector: lastSuccessful() - } - } - stage('Build') { - steps { - copyArtifacts filter: 'bin/distrobuilder', fingerprintArtifacts: true, flatten: true, projectName: '/Public/DistroBuilder/BuildConfig=BrampCustom', selector: lastSuccessful() - // Build SH script - sh '''sudo $WORKSPACE/distrobuilder build-lxc Alpine.yaml ./ -o image.release=$ImgRelease -o image.variant=$ImgVariant - sudo chown jenkins:jenkins $WORKSPACE/*.tar.xz - ''' - } - } - stage('Finish') { - steps { - // Save generated files - archiveArtifacts artifacts: '*.tar.xz', followSymlinks: false - // Cleaning WorkSpace - cleanWs() - } - } - } - post { - success { - echo 'Build successful' - } - failure { - echo 'Build Failed' - // Send To static addres - //emailext attachLog: true,body: '$DEFAULT_CONTENT', subject: '$DEFAULT_SUBJECT', to: 'bram@bprieshof.nl' - } - } } - } \ No newline at end of file