From ae3ae05d2948ac527ce7e39db30f0a99e53340af Mon Sep 17 00:00:00 2001 From: Bram Prieshof Date: Fri, 19 Feb 2021 04:01:20 +0100 Subject: [PATCH] Try building in paralell --- Jenkinsfile | 3 +- Jenkinsfile-Sequential | 67 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 Jenkinsfile-Sequential diff --git a/Jenkinsfile b/Jenkinsfile index 0ac1e22..c15abd8 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -43,8 +43,9 @@ pipeline { } // all the stages here will run in parallel stages { - stage('Build ${$ImgRelease} - ${ImgVariant}') { + stage('Build image') { steps { + echo "Do Build for ${$ImgRelease} - ${ImgVariant}" // Build script sh '''sudo $WORKSPACE/distrobuilder build-lxc Alpine.yaml $WORKSPACE/REL/$ImgRelease-$ImgVariant/ -o image.release=$ImgRelease -o image.variant=$ImgVariant sudo chown jenkins:jenkins -R $WORKSPACE/REL diff --git a/Jenkinsfile-Sequential b/Jenkinsfile-Sequential new file mode 100644 index 0000000..75626bf --- /dev/null +++ b/Jenkinsfile-Sequential @@ -0,0 +1,67 @@ +pipeline { + agent { label 'LXCBuilder' } + options { + skipDefaultCheckout() + buildDiscarder(logRotator(numToKeepStr: '2', artifactNumToKeepStr: '1')) + } + stages { + stage('Prepare') { + steps { + // Cleanup before starting + cleanWs() + // Checkout the repository + checkout scm + // Get distrobuilder + copyArtifacts filter: 'bin/distrobuilder', fingerprintArtifacts: true, flatten: true, projectName: '/Public/DistroBuilder/BuildConfig=BrampCustom', selector: lastSuccessful() + // Setup Env + sh '''mkdir $WORKSPACE/REL''' + } + } + stage("Image Configs") { + matrix { + axes { + axis { + name 'ImgRelease' + values '3.13', 'edge' + } + axis { + name 'ImgVariant' + values 'default', 'extended' + } + } + excludes { + exclude { + axis { + name 'ImgRelease' + values 'edge' + } + axis { + name 'ImgVariant' + notValues 'default' + } + } + } + // all the stages here will run in parallel + parallel { + stage('Build image') { + steps { + echo "Do Build for ${$ImgRelease} - ${ImgVariant}" + // Build script + sh '''sudo $WORKSPACE/distrobuilder build-lxc Alpine.yaml $WORKSPACE/REL/$ImgRelease-$ImgVariant/ -o image.release=$ImgRelease -o image.variant=$ImgVariant + sudo chown jenkins:jenkins -R $WORKSPACE/REL + ''' + } + } + } + } + } + stage('Finish') { + steps { + // Save generated files + archiveArtifacts artifacts: 'REL/**', followSymlinks: false + // Cleaning WorkSpace + //cleanWs() + } + } + } +} \ No newline at end of file