Commit f63920dc authored by Raphael Defosseux's avatar Raphael Defosseux

CI: taking care of the case if R2LAB is not available

Signed-off-by: default avatarRaphael Defosseux <raphael.defosseux@eurecom.fr>
parent 6a0e50c8
...@@ -62,6 +62,7 @@ def r2labUE0IpAddr = r2labBaseIpAddr + r2labUE0Idx ...@@ -62,6 +62,7 @@ def r2labUE0IpAddr = r2labBaseIpAddr + r2labUE0Idx
def r2labENB1Idx = '16' def r2labENB1Idx = '16'
def r2labENB1 = 'fit' + r2labENB1Idx def r2labENB1 = 'fit' + r2labENB1Idx
def r2labENB1IpAddr = r2labBaseIpAddr + r2labENB1Idx def r2labENB1IpAddr = r2labBaseIpAddr + r2labENB1Idx
def r2labDoAllOff = true
pipeline { pipeline {
agent { agent {
...@@ -136,15 +137,22 @@ pipeline { ...@@ -136,15 +137,22 @@ pipeline {
sh "python3 /home/eurecom/inria-scripts/booking-lease.py --book-lease --from ${BOOK_TIMESTAMP}T${r2labStartTime} --duration ${r2labDuration} --slice inria_oaici ${r2labuser} ${r2labpassword}" sh "python3 /home/eurecom/inria-scripts/booking-lease.py --book-lease --from ${BOOK_TIMESTAMP}T${r2labStartTime} --duration ${r2labDuration} --slice inria_oaici ${r2labuser} ${r2labpassword}"
sh "python3 /home/eurecom/inria-scripts/booking-lease.py --get-leases ${r2labuser} ${r2labpassword} | grep -v nightly" sh "python3 /home/eurecom/inria-scripts/booking-lease.py --get-leases ${r2labuser} ${r2labpassword} | grep -v nightly"
} }
// Adding a tempo after booking leases
sh "sleep 10"
LEASE_STATUS = sh returnStdout: true, script: "ssh -t inria_oaici@faraday.inria.fr 'rleases --check'"
LEASE_STATUS = LEASE_STATUS.trim()
if (LEASE_STATUS ==~ /.*Access currently denied to inria_oaici.*/) {
r2labDoAllOff = false
currentBuild.result = 'ABORTED'
error('Stopping early because R2LAB not available')
}
} }
} }
} }
stage ("Load Images") { stage ("Load Images") {
steps { steps {
script { script {
// Adding a tempo after booking leases
sh "sleep 10"
sh "ssh -t inria_oaici@faraday.inria.fr 'rleases --check'"
sh "ssh -t inria_oaici@faraday.inria.fr 'all-off'" sh "ssh -t inria_oaici@faraday.inria.fr 'all-off'"
sh "sleep 10" sh "sleep 10"
...@@ -441,10 +449,12 @@ pipeline { ...@@ -441,10 +449,12 @@ pipeline {
post { post {
always { always {
script { script {
if (r2labDoAllOff) {
echo '\u2705 \u001B[32mShutdown every node\u001B[0m' echo '\u2705 \u001B[32mShutdown every node\u001B[0m'
sh 'ssh -t inria_oaici@faraday.inria.fr "all-off"' sh 'ssh -t inria_oaici@faraday.inria.fr "all-off"'
sh 'ssh -t inria_oaici@faraday.inria.fr "all-off"' sh 'ssh -t inria_oaici@faraday.inria.fr "all-off"'
} }
} }
} }
}
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment