Jenkinsfile: abort tests if unstash fails

This likely means that we did not build the x86-64 target, so we abort
since our test stage does not support other targets yet.
This commit is contained in:
Martin Weinelt 2020-05-03 17:17:11 +02:00
parent 815c457abb
commit d1dd82cc85
No known key found for this signature in database
GPG Key ID: BD4AA0528F63F17E

View File

@ -122,15 +122,21 @@ pipeline {
} }
stage('test') { stage('test') {
agent { label 'gluon-docker-v2' } agent { label 'gluon-docker-v2' }
environment {
TMUX = "notmux"
}
steps { steps {
sh label: 'Identify runner', script: 'echo $SLAVE_NAME' sh label: 'Identify runner', script: 'echo $SLAVE_NAME'
script {
try {
unstash 'gluon-x86-64-factory' unstash 'gluon-x86-64-factory'
} catch (err) {
echo err.getMessage()
// Abort here, if we don't have an x86-64 factory image we can't run tests
currentBuild.result = 'ABORTED'
return
}
sh label: 'Unpack image', script: 'gunzip -cd ./output/images/factory/*x86-64*.img.gz > ./image.img' sh label: 'Unpack image', script: 'gunzip -cd ./output/images/factory/*x86-64*.img.gz > ./image.img'
sh label: 'Print python environment', script: 'python3 -m pip freeze' sh label: 'Print python environment', script: 'python3 -m pip freeze'
script {
for (f in findFiles(glob: 'tests/*.py')) { for (f in findFiles(glob: 'tests/*.py')) {
timeout(time: 10, unit: "MINUTES") { timeout(time: 10, unit: "MINUTES") {
sh label: "Test ${f.name}", script: "python3 tests/${f.name} --use-tmp-workdir" sh label: "Test ${f.name}", script: "python3 tests/${f.name} --use-tmp-workdir"