Added Default and extra image defention

This commit is contained in:
2021-02-21 02:23:34 +01:00
parent bce5685e1f
commit e25cef0da6
3 changed files with 56 additions and 8 deletions

View File

@@ -107,9 +107,6 @@ packages:
sets: sets:
- packages: - packages:
- alpine-base - alpine-base
- mariadb
- nginx
- samba
action: install action: install
- packages: - packages:

29
Jenkinsfile vendored
View File

@@ -1,5 +1,9 @@
pipeline { pipeline {
agent { label 'LXCBuilder' } agent { label 'LXCBuilder' }
parameters {
booleanParam defaultValue: true, description: 'Builds Default images', name: 'BuildDefault'
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'))
@@ -26,7 +30,7 @@ pipeline {
} }
axis { axis {
name 'ImgVariant' name 'ImgVariant'
values 'default', 'extended' values 'Default-default', 'Extra-extended'
} }
} }
excludes { excludes {
@@ -43,12 +47,27 @@ pipeline {
} }
stages { stages {
stage('Build image') { stage('Build image') {
when {
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 { steps {
// Build script // Build script
sh '''echo "$(date) Do Build for $ImgRelease - $ImgVariant" catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sudo $WORKSPACE/distrobuilder build-lxc Alpine.yaml $WORKSPACE/REL/$ImgRelease-$ImgVariant/ -o image.release=$ImgRelease -o image.variant=$ImgVariant sh '''echo "$(date) Do Build for $ImgRelease - $ImgVariant"
sudo chown jenkins:jenkins -R $WORKSPACE/REL 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
'''
}
} }
} }
} }

View File

@@ -0,0 +1,32 @@
when {
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'
}
}
}
stage('Build Check') {
steps {
script {
if (env.BuildDefault == 'true' && (env.ImgVariant).startsWith('Default-')) {
echo 'Building Default'
BuildThisLocal = true
} else if (env.BuildExtra == 'true' && (env.ImgVariant).startsWith('Extra-')) {
BuildThisLocal = true
echo 'Building Extra'
} else {
BuildThisLocal = false
echo 'not building'
}
env.BuildThis = BuildThisLocal
}
}
}