Files
HomeServerCTs/CT-Build/Debian.Jenkinsfile
Bram Prieshof 201b880eae CT ElkarBackup: Removed debian version
The project is discontinued and deb repo's are disabled

Unable to run the package on Debian 12 due to unmet "deprecated"  dependencies

keeping the Alpine version for now since it is ran form source code
2023-11-18 02:24:23 +01:00

81 lines
4.4 KiB
Plaintext

pipeline {
agent { label 'LXCBuilder' }
parameters {
booleanParam description: 'Will only update Jenkins piplinefile (jenkinsfile)', name: 'OnlyUpdatePipeline'
booleanParam defaultValue: true, description: 'Enable muticore support for ZX compression', name: 'ZX_Multicore'
string defaultValue: '0', description: 'Set amount of core\'s ZX is allowed when compressing (use 0 for all cores)', name: 'ZX_Cores'
string defaultValue: '192.168.200.11', description: 'Proxy server for packages, when enabled', name: 'ProxyServer'
booleanParam description: 'will disable use of proxy server', name: 'DisProxy'
checkboxParameter(name: 'ImgVariantList', format: 'JSON', displayNodePath: "//Variants/Variant", valueNodePath: "//Variants/Variant", description: 'Select the variant(s) that should be build',
pipelineSubmitContent: '{"Variants": [{"Variant": "minimal"},{"Variant": "default"},{"Variant": "jenkinsbuilder"},{"Variant": "imgbuilder"},{"Variant": "jenkins"},{"Variant": "mysql"},{"Variant": "pihole"},{"Variant": "collabora"},{"Variant": "jellyfin"},{"Variant": "domoticz"},{"Variant": "omadaV3"},{"Variant": "docker"},{"Variant": "smb"},{"Variant": "x2go"},{"Variant": "aptcacherng"},{"Variant": "nfs"},{"Variant": "duplicati"},{"Variant": "fileshelter"},{"Variant": "esphome"}]}')
}
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: 'distrobuilder-BrampCustom', fingerprintArtifacts: true, flatten: true, projectName: 'LXC-ImgBuilder/DistroBuilder', selector: lastSuccessful()
// Setup Env
sh '''mkdir $WORKSPACE/REL
mv distrobuilder-* distrobuilder
'''
//Check if Proxy is disabled
script{
if (env.DisProxy == 'true') {
sh '''bash Scripts/UpdateIMGBuildFile-CacheAndRepo.sh -d'''
} else {
env.ProxyServer = ProxyServer
sh '''bash Scripts/UpdateIMGBuildFile-CacheAndRepo.sh -e $ProxyServer'''
}
if (env.OnlyUpdatePipeline == 'true') {
error 'Build ended early, only updated jenkins file'
}
}
}
}
stage('Image Configs'){
steps{
script{
//Run build for requested variants
for(ImgVariant in ImgVariantList.split(',')){
env.ZX_Multicore = ZX_Multicore
env.ZX_Cores = ZX_Cores
env.ImgVariant = ImgVariant
stage("Build ${ImgVariant}") {
catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE') {
sh '''echo "$(date) Do Build for $ImgVariant"
if $ZX_Multicore; then
export XZ_DEFAULTS="-T $ZX_Cores"
fi
sudo $WORKSPACE/distrobuilder build-lxc CT-Build/Debian.yaml $WORKSPACE/REL/$ImgVariant/ -o image.variant=$ImgVariant
sudo chown jenkins:jenkins -R $WORKSPACE/REL
mv $WORKSPACE/REL/$ImgVariant/rootfs.tar.xz Debian-$ImgVariant.tar.xz
'''
}
}
}
}
}
}
stage('Finish') {
steps {
// Save generated files
archiveArtifacts artifacts: '*.tar.xz', followSymlinks: false
// Copy artifacts to /LXCBuild folder
sh '''
mkdir -p /LXCBuild/template/cache
cp -f *.tar.xz /LXCBuild/template/cache
'''
// Cleaning WorkSpace when build successfully
cleanWs cleanWhenAborted: false, cleanWhenFailure: false, cleanWhenNotBuilt: false, cleanWhenUnstable: false
}
}
}
}