diff --git a/Test/Jenkinsfile-parael b/Test/Jenkinsfile-parael index c28d483..4ee4992 100644 --- a/Test/Jenkinsfile-parael +++ b/Test/Jenkinsfile-parael @@ -28,39 +28,50 @@ parallel distributions.collectEntries { distribution -> def buildImage = '' stage('Checkout ' + distribution) { + checkout scm buildImage = docker.image(vendor + '/' + distribution) - sh 'ls -la' - sh 'if [ -d .git ]; then git status; fi' - sh 'git checkout -f' - def VERSION = sh( + sh 'git checkout debian/changelog' + def version = sh ( script: 'dpkg-parsechangelog --show-field Version', returnStdout: true ).trim() - ver = VERSION + '~' + distroCodename + '~' + env.BUILD_NUMBER + ver = version + '.' + env.BUILD_NUMBER + '~' + distroCodename } stage('Build ' + distribution) { buildImage.inside { - sh 'dch -b -v ' + ver + ' "' + env.BUILD_TAG + '"' + 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' + artifacts = sh ( + script: "cat debian/files | awk '{print \$1}'", + returnStdout: true + ).trim().split('\n') } } stage('Test ' + distribution) { buildImage.inside { - def debconf_debug = 0 // Set to "5" or "developer" to debug debconf + 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"' - 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 { - sh 'mv $WORKSPACE/dist/debian/*.deb $WORKSPACE' + artifacts.each { deb_file -> + println 'Copying artifact: ' + deb_file + archiveArtifacts artifacts: 'dist/debian/' + deb_file + sh 'mv $WORKSPACE/dist/debian/' + deb_file + '$WORKSPACE' + } } } }