-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Jenkinsfile now store its artifacts correctly
- Loading branch information
Showing
5 changed files
with
226 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
#!groovy | ||
|
||
// Part of https://github.com/VitexSoftware/BuildImages | ||
|
||
String[] architectures = [] // 'amd64', 'aarch64', 'arm', 'i386' | ||
String[] distributions = ['debian:buster', 'debian:bullseye', 'debian:bookworm', 'ubuntu:focal', 'ubuntu:jammy'] | ||
|
||
String vendor = 'vitexsoftware' | ||
String distribution = '' | ||
String architecture = '' | ||
//String distroFamily = '' | ||
String distroCodename = '' | ||
String ver = '' | ||
|
||
properties([ | ||
copyArtifactPermission('*') | ||
]) | ||
node() { | ||
ansiColor('xterm') { | ||
stage('SCM Checkout') { | ||
checkout scm | ||
def control = readFile(file: env.WORKSPACE + '/debian/control') | ||
def lines = control.readLines() | ||
for (line in lines) { | ||
if (line.trim()) { | ||
def (key,value) = line.split(': ').collect { it.trim() } | ||
if (key == 'Architecture') { | ||
if (value == 'any') { | ||
architectures = ['amd64', 'armhf', 'aarch64'] | ||
} else { | ||
architectures = [value] | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
architectures.each { | ||
architecture = it | ||
|
||
println 'Arch: ' + architecture | ||
|
||
distributions.each { | ||
distribution = it | ||
|
||
println 'Dist:' + distribution | ||
|
||
def dist = distribution.split(':') | ||
// distroFamily = dist[0] | ||
distroCodename = dist[1] | ||
|
||
def buildImage = '' | ||
|
||
node(architecture) { | ||
ansiColor('xterm') { | ||
stage('Checkout ' + architecture + ' ' + distribution) { | ||
buildImage = docker.image(vendor + '/' + distribution) | ||
sh 'git checkout debian/changelog' | ||
def version = sh( | ||
script: 'dpkg-parsechangelog --show-field version', | ||
returnStdout: true | ||
).trim() | ||
ver = version + '.' + env.BUILD_NUMBER + '~' + distroCodename | ||
} | ||
stage('Build ' + architecture + ' ' + distribution) { | ||
buildImage.inside { | ||
sh 'dch -b -v ' + ver + ' "' + env.BUILD_TAG + '"' | ||
sh 'sudo apt-get update --allow-releaseinfo-change' | ||
sh 'sudo chown jenkins:jenkins ..' | ||
sh 'debuild-pbuilder -i -us -uc -b' | ||
sh 'mkdir -p $WORKSPACE/dist/debian/ ; rm -rf $WORKSPACE/dist/debian/* ; for deb in $(cat debian/files | awk \'{print $1}\'); do mv "../$deb" $WORKSPACE/dist/debian/; done' | ||
} | ||
} | ||
|
||
stage('Test ' + architecture + ' ' + distribution) { | ||
buildImage.inside { | ||
def debconf_debug = 0 //Set to "5" or "developer" to debug debconf | ||
sh 'cd $WORKSPACE/dist/debian/ ; dpkg-scanpackages . /dev/null | gzip -9c > Packages.gz; cd $WORKSPACE' | ||
sh 'echo "deb [trusted=yes] file://///$WORKSPACE/dist/debian/ ./" | sudo tee /etc/apt/sources.list.d/local.list' | ||
sh 'sudo apt-get update --allow-releaseinfo-change' | ||
sh 'echo "INSTALATION"' | ||
|
||
// File insinc = new File('./InstallDebs.groovy') | ||
// if (file.exists()) { | ||
// evaluate(insinc) | ||
// def installer = new InstallDebs() | ||
// installer.aptInstall('debian/files') | ||
// } | ||
|
||
sh 'IFS="\n\b"; for package in `cat debian/files | awk -F_ \'{print \$1}\'` ; do echo -e "${GREEN} installing ${package} on `lsb_release -sc` ${ENDCOLOR} " ; sudo DEBIAN_FRONTEND=noninteractive DEBCONF_DEBUG=' + debconf_debug + ' apt-get -y install $WORKSPACE/dist/debian/$package ; done;' | ||
stash includes: 'dist/**', name: 'dist-' + distroCodename | ||
} | ||
} | ||
stage('Copy artifacts ' + architecture + ' ' + distribution ) { | ||
buildImage.inside { | ||
sh 'mv $WORKSPACE/dist/debian/*.deb $WORKSPACE' | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.