Skip to content

Commit 63af103

Browse files
committed
Jenkins now store artifacts
1 parent 7c888c8 commit 63af103

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

debian/Jenkinsfile

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,23 @@ distributions.each {
2525
println "Dist:" + distribution
2626

2727
def dist = distribution.split(':')
28-
// distroFamily = dist[0]
2928
distroCodename = dist[1]
3029

3130
def buildImage = ''
3231

32+
def artifacts = []
33+
3334
node {
3435
ansiColor('xterm') {
3536
stage('Checkout ' + distribution) {
37+
checkout scm
3638
buildImage = docker.image(vendor + '/' + distribution)
37-
sh 'git checkout debian/changelog'
38-
def VERSION = sh (
39+
sh 'git checkout debian/changelog'
40+
def version = sh (
3941
script: 'dpkg-parsechangelog --show-field Version',
4042
returnStdout: true
4143
).trim()
42-
ver = VERSION + '~' + distroCodename + '~' + env.BUILD_NUMBER
44+
ver = version + '.' + env.BUILD_NUMBER + '~' + distroCodename
4345
}
4446
stage('Build ' + distribution) {
4547
buildImage.inside {
@@ -48,6 +50,10 @@ distributions.each {
4850
sh 'sudo chown jenkins:jenkins ..'
4951
sh 'debuild-pbuilder -i -us -uc -b'
5052
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'
53+
artifacts = sh (
54+
script: "cat debian/files | awk '{print \$1}'",
55+
returnStdout: true
56+
).trim().split('\n')
5157
}
5258
}
5359

@@ -58,12 +64,20 @@ distributions.each {
5864
sh 'echo "deb [trusted=yes] file://///$WORKSPACE/dist/debian/ ./" | sudo tee /etc/apt/sources.list.d/local.list'
5965
sh 'sudo apt-get update --allow-releaseinfo-change'
6066
sh 'echo "INSTALATION"'
61-
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;'
62-
stash includes: 'dist/**', name: 'dist-' + distroCodename
67+
artifacts.each { deb_file ->
68+
if (deb_file.endsWith('.deb')) {
69+
sh 'echo -e "${GREEN} installing ' + deb_file + ' on `lsb_release -sc` ${ENDCOLOR} "'
70+
sh 'sudo DEBIAN_FRONTEND=noninteractive DEBCONF_DEBUG=' + debconf_debug + ' apt-get -y install $WORKSPACE/dist/debian/' + deb_file
71+
}
72+
}
6373
}
6474
}
6575
stage('Copy artifacts ' + distribution ) {
6676
buildImage.inside {
77+
artifacts.each { deb_file ->
78+
println "Copying artifact: " + deb_file
79+
archiveArtifacts artifacts: 'dist/debian/' + deb_file
80+
}
6781
sh 'mv $WORKSPACE/dist/debian/*.deb $WORKSPACE'
6882
}
6983
}

0 commit comments

Comments
 (0)