Skip to content

Commit

Permalink
Jenkins now store artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitexus committed Oct 24, 2024
1 parent cc979fb commit a039cfe
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions debian/Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!groovy

String[] distributions = ['debian:bullseye', 'debian:bookworm', 'ubuntu:jammy']
String[] distributions = ['debian:bullseye', 'debian:bookworm', 'debian:trixie', 'ubuntu:focal', 'ubuntu:jammy', 'ubuntu:noble']

String vendor = 'vitexsoftware'
String distribution = ''
Expand All @@ -25,16 +25,18 @@ distributions.each {
println "Dist:" + distribution

def dist = distribution.split(':')
// distroFamily = dist[0]
distroCodename = dist[1]

def buildImage = ''

def artifacts = []

node {
ansiColor('xterm') {
stage('Checkout ' + distribution) {
checkout scm
buildImage = docker.image(vendor + '/' + distribution)
sh 'git checkout debian/changelog'
sh 'git checkout debian/changelog'
def version = sh (
script: 'dpkg-parsechangelog --show-field Version',
returnStdout: true
Expand All @@ -48,6 +50,10 @@ distributions.each {
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'
artifacts = sh (
script: "cat debian/files | awk '{print \$1}'",
returnStdout: true
).trim().split('\n')
}
}

Expand All @@ -58,12 +64,20 @@ distributions.each {
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"'
sh 'IFS="\n\b"; for package in `ls $WORKSPACE/dist/debian/ | grep .deb | 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 $package ; done;'
stash includes: 'dist/**', name: 'dist-' + distroCodename
artifacts.each { deb_file ->
if (deb_file.endsWith('.deb')) {
sh 'echo -e "${GREEN} installing ' + deb_file + ' on `lsb_release -sc` ${ENDCOLOR} "'
sh 'sudo DEBIAN_FRONTEND=noninteractive DEBCONF_DEBUG=' + debconf_debug + ' apt-get -y install $WORKSPACE/dist/debian/' + deb_file
}
}
}
}
stage('Copy artifacts ' + distribution ) {
buildImage.inside {
artifacts.each { deb_file ->
println "Copying artifact: " + deb_file
archiveArtifacts artifacts: 'dist/debian/' + deb_file
}
sh 'mv $WORKSPACE/dist/debian/*.deb $WORKSPACE'
}
}
Expand Down

0 comments on commit a039cfe

Please sign in to comment.