Initial Commit
All checks were successful
LXC-ImageBuilder/Alpine/pipeline/head This commit looks good
All checks were successful
LXC-ImageBuilder/Alpine/pipeline/head This commit looks good
This commit is contained in:
89
Jenkinsfile
vendored
Normal file
89
Jenkinsfile
vendored
Normal 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 '3.13', 'edge'
|
||||
}
|
||||
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 Alpine.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 Alpine-$ImgRelease-$ImgVariant.tar.xz
|
||||
'''
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Finish') {
|
||||
steps {
|
||||
// Save generated files
|
||||
archiveArtifacts artifacts: '*.tar.xz', followSymlinks: false
|
||||
// Cleaning WorkSpace
|
||||
//cleanWs()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user