Initial Commit
Some checks failed
LXC-ImageBuilder/Debian/pipeline/head There was a failure building this commit

This commit is contained in:
2021-02-21 15:51:59 +00:00
parent c6388726e8
commit e75b256a39
2 changed files with 232 additions and 0 deletions

89
Jenkinsfile vendored Normal file
View File

@@ -0,0 +1,89 @@
pipeline {
agent { label 'LXCBuilder' }
parameters {
booleanParam defaultValue: true, description: 'Builds Default images', name: 'BuildDefault'
booleanParam defaultValue: false, description: 'Builds Extra images', name: 'BuildExtra'
}
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 'buster'
}
axis {
name 'ImgVariant'
values 'Default-minmal', 'Default-default'
}
}
// //Exclude unwanted conbinatinations
// excludes {
// exclude {
// axis {
// name 'ImgRelease'
// values 'edge'
// }
// axis {
// name 'ImgVariant'
// //use notValues to invert
// values 'Extra-extended'
// }
// }
// }
stages {
stage('Build image') {
when {
//ImgTypeTest
anyOf {
allOf {
expression { return (env.ImgVariant).startsWith('Default-') }
environment name: 'BuildDefault', value: 'true'
}
allOf {
expression { return (env.ImgVariant).startsWith('Extra-') }
environment name: 'BuildExtra', value: 'true'
}
}
}
steps {
// Build script
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh '''echo "$(date) Do Build for $ImgRelease - $ImgVariant"
ImgVariantName=${ImgVariant#Default-} && ImgVariantName=${ImgVariantName#Extra-}
sudo $WORKSPACE/distrobuilder build-lxc Debian.yaml $WORKSPACE/REL/$ImgRelease-$ImgVariant/ -o image.release=$ImgRelease -o image.variant=$ImgVariantName
sudo chown jenkins:jenkins -R $WORKSPACE/REL
mv $WORKSPACE/REL/$ImgRelease-$ImgVariant/rootfs.tar.xz Debian-$ImgRelease-$ImgVariant.tar.xz
'''
}
}
}
}
}
}
stage('Finish') {
steps {
// Save generated files
archiveArtifacts artifacts: '*.tar.xz', followSymlinks: false
// Cleaning WorkSpace
//cleanWs()
}
}
}
}