Skip to content

Commit 622a0ac

Browse files
authored
Jenkins now store its artifacts
1 parent bdcaaa2 commit 622a0ac

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

debian/Jenkinsfile

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,12 @@ distributions.each {
2929

3030
def buildImage = ''
3131

32+
def artifacts = []
33+
3234
node {
3335
ansiColor('xterm') {
3436
stage('Checkout ' + distribution) {
37+
checkout scm
3538
buildImage = docker.image(vendor + '/' + distribution)
3639
sh 'git checkout debian/changelog'
3740
def version = sh (
@@ -45,25 +48,36 @@ distributions.each {
4548
sh 'dch -b -v ' + ver + ' "' + env.BUILD_TAG + '"'
4649
sh 'sudo apt-get update --allow-releaseinfo-change'
4750
sh 'sudo chown jenkins:jenkins ..'
48-
sh 'sudo apt install -y php-mbstring'
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

54-
stage('Package installation Test ' + distribution) {
60+
stage('Test ' + distribution) {
5561
buildImage.inside {
5662
def debconf_debug = 0 //Set to "5" or "developer" to debug debconf
5763
sh 'cd $WORKSPACE/dist/debian/ ; dpkg-scanpackages . /dev/null | gzip -9c > Packages.gz; cd $WORKSPACE'
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)