Added debian 11
Some checks failed
LXC-ImageBuilder/Debian/pipeline/head There was a failure building this commit
Some checks failed
LXC-ImageBuilder/Debian/pipeline/head There was a failure building this commit
This commit is contained in:
156
Jenkinsfile
vendored
156
Jenkinsfile
vendored
@@ -1,79 +1,79 @@
|
|||||||
String[] ImgReleaseList = ['buster', 'jessie']
|
String[] ImgReleaseList = ['bullseye', 'buster', 'jessie']
|
||||||
String[] ImgVariantList = ['Default-minmal', 'Default-default', 'Extra-imgbuilder']
|
String[] ImgVariantList = ['Default-minmal', 'Default-default', 'Extra-imgbuilder']
|
||||||
|
|
||||||
pipeline {
|
pipeline {
|
||||||
agent { label 'LXCBuilder' }
|
agent { label 'LXCBuilder' }
|
||||||
triggers {
|
triggers {
|
||||||
cron '@monthly'
|
cron '@monthly'
|
||||||
}
|
}
|
||||||
parameters {
|
parameters {
|
||||||
booleanParam defaultValue: true, description: 'Builds Default images', name: 'BuildDefault'
|
booleanParam defaultValue: true, description: 'Builds Default images', name: 'BuildDefault'
|
||||||
booleanParam defaultValue: false, description: 'Builds Extra images', name: 'BuildExtra'
|
booleanParam defaultValue: false, description: 'Builds Extra images', name: 'BuildExtra'
|
||||||
}
|
}
|
||||||
options {
|
options {
|
||||||
skipDefaultCheckout()
|
skipDefaultCheckout()
|
||||||
buildDiscarder(logRotator(numToKeepStr: '2', artifactNumToKeepStr: '1'))
|
buildDiscarder(logRotator(numToKeepStr: '2', artifactNumToKeepStr: '1'))
|
||||||
}
|
}
|
||||||
stages {
|
stages {
|
||||||
stage('Prepare') {
|
stage('Prepare') {
|
||||||
steps {
|
steps {
|
||||||
// Cleanup before starting
|
// Cleanup before starting
|
||||||
cleanWs()
|
cleanWs()
|
||||||
// Checkout the repository
|
// Checkout the repository
|
||||||
checkout scm
|
checkout scm
|
||||||
// Get distrobuilder
|
// Get distrobuilder
|
||||||
copyArtifacts filter: 'bin/distrobuilder', fingerprintArtifacts: true, flatten: true, projectName: '/Public/DistroBuilder/BuildConfig=BrampCustom', selector: lastSuccessful()
|
copyArtifacts filter: 'bin/distrobuilder', fingerprintArtifacts: true, flatten: true, projectName: '/Public/DistroBuilder/BuildConfig=BrampCustom', selector: lastSuccessful()
|
||||||
// Setup Env
|
// Setup Env
|
||||||
sh '''mkdir $WORKSPACE/REL'''
|
sh '''mkdir $WORKSPACE/REL'''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Image Configs'){
|
stage('Image Configs'){
|
||||||
steps{
|
steps{
|
||||||
script{
|
script{
|
||||||
for(ImgRelease in ImgReleaseList){
|
for(ImgRelease in ImgReleaseList){
|
||||||
for(ImgVariant in ImgVariantList){
|
for(ImgVariant in ImgVariantList){
|
||||||
//ImgTypeTest
|
//ImgTypeTest
|
||||||
if (env.BuildDefault == 'true' && (ImgVariant).startsWith('Default-')) {
|
if (env.BuildDefault == 'true' && (ImgVariant).startsWith('Default-')) {
|
||||||
BuildThis = true
|
BuildThis = true
|
||||||
} else if (env.BuildExtra == 'true' && (ImgVariant).startsWith('Extra-')) {
|
} else if (env.BuildExtra == 'true' && (ImgVariant).startsWith('Extra-')) {
|
||||||
BuildThis = true
|
BuildThis = true
|
||||||
} else {
|
} else {
|
||||||
BuildThis = false
|
BuildThis = false
|
||||||
}
|
}
|
||||||
//Exclude unwanted conbinatinations
|
//Exclude unwanted conbinatinations
|
||||||
if (ImgRelease == 'jessie' && ImgVariant == 'Default-minmal' ){
|
if (ImgRelease == 'jessie' && ImgVariant == 'Default-minmal' ){
|
||||||
BuildThis = true
|
BuildThis = true
|
||||||
}else if (ImgRelease == 'jessie' ){
|
}else if (ImgRelease == 'jessie' ){
|
||||||
BuildThis = false
|
BuildThis = false
|
||||||
}
|
}
|
||||||
|
|
||||||
//Check if this combinations shoud be build
|
//Check if this combinations shoud be build
|
||||||
if (BuildThis == true) {
|
if (BuildThis == true) {
|
||||||
env.ImgRelease = ImgRelease
|
env.ImgRelease = ImgRelease
|
||||||
env.ImgVariant = ImgVariant
|
env.ImgVariant = ImgVariant
|
||||||
stage('Build image') {
|
stage('Build image') {
|
||||||
catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE') {
|
catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE') {
|
||||||
sh '''echo "$(date) Do Build for $ImgRelease - $ImgVariant"
|
sh '''echo "$(date) Do Build for $ImgRelease - $ImgVariant"
|
||||||
ImgVariantName=${ImgVariant#Default-} && ImgVariantName=${ImgVariantName#Extra-}
|
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 $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
|
sudo chown jenkins:jenkins -R $WORKSPACE/REL
|
||||||
mv $WORKSPACE/REL/$ImgRelease-$ImgVariant/rootfs.tar.xz Debian-$ImgRelease-$ImgVariant.tar.xz
|
mv $WORKSPACE/REL/$ImgRelease-$ImgVariant/rootfs.tar.xz Debian-$ImgRelease-$ImgVariant.tar.xz
|
||||||
'''
|
'''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Finish') {
|
stage('Finish') {
|
||||||
steps {
|
steps {
|
||||||
// Save generated files
|
// Save generated files
|
||||||
archiveArtifacts artifacts: '*.tar.xz', followSymlinks: false
|
archiveArtifacts artifacts: '*.tar.xz', followSymlinks: false
|
||||||
// Cleaning WorkSpace
|
// Cleaning WorkSpace
|
||||||
//cleanWs()
|
//cleanWs()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user