ci: in case of a failure, return error after logging system status

It seems that it is required to re-throw the error after a catch{..}
block. Without this, and a successful execution of system-status.sh, the
CI jobs get marked as SUCCESS, even when there was a failure.

Fixes: e36155283 "ci: run system-status.sh in case a job fails"
Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
Niels de Vos 2021-05-11 15:05:05 +02:00 committed by mergify[bot]
parent 5b03721a58
commit e599e95f25
4 changed files with 28 additions and 0 deletions

View File

@ -10,6 +10,7 @@ def doc_change = 0
def k8s_release = 'latest'
def namespace = 'k8s-e2e-storage-' + UUID.randomUUID().toString().split('-')[-1]
def ci_registry = 'registry-ceph-csi.apps.ocp.ci.centos.org'
def failure = null
def ssh(cmd) {
sh "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root@${CICO_NODE} '${cmd}'"
@ -182,6 +183,8 @@ node('cico-workspace') {
}
catch (err) {
failure = err
stage('log system status') {
ssh './system-status.sh'
}
@ -191,5 +194,9 @@ node('cico-workspace') {
stage('return bare-metal machine') {
sh 'cico node done ${CICO_SSID}'
}
if (failure) {
throw failure
}
}
}

View File

@ -10,6 +10,7 @@ def doc_change = 0
def k8s_release = 'latest'
def ci_registry = 'registry-ceph-csi.apps.ocp.ci.centos.org'
def namespace = 'cephcsi-e2e-' + UUID.randomUUID().toString().split('-')[-1]
def failure = null
// ssh executes a given command on the reserved bare-metal machine
// NOTE: do not pass " symbols on the command line, use ' only.
@ -189,6 +190,8 @@ node('cico-workspace') {
}
catch (err) {
failure = err
stage('log system status') {
ssh './system-status.sh'
}
@ -198,5 +201,9 @@ node('cico-workspace') {
stage('return bare-metal machine') {
sh 'cico node done ${CICO_SSID}'
}
if (failure) {
throw failure
}
}
}

View File

@ -9,6 +9,7 @@ def skip_e2e = 0
def doc_change = 0
def k8s_release = 'latest'
def ci_registry = 'registry-ceph-csi.apps.ocp.ci.centos.org'
def failure = null
def ssh(cmd) {
sh "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root@${CICO_NODE} '${cmd}'"
@ -172,6 +173,8 @@ node('cico-workspace') {
}
catch (err) {
failure = err
stage('log system status') {
ssh './system-status.sh'
}
@ -181,5 +184,9 @@ node('cico-workspace') {
stage('return bare-metal machine') {
sh 'cico node done ${CICO_SSID}'
}
if (failure) {
throw failure
}
}
}

View File

@ -9,6 +9,7 @@ def skip_e2e = 0
def doc_change = 0
def k8s_release = 'latest'
def ci_registry = 'registry-ceph-csi.apps.ocp.ci.centos.org'
def failure = null
def ssh(cmd) {
sh "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root@${CICO_NODE} '${cmd}'"
@ -176,6 +177,8 @@ node('cico-workspace') {
}
catch (err) {
failure = err
stage('log system status') {
ssh './system-status.sh'
}
@ -185,5 +188,9 @@ node('cico-workspace') {
stage('return bare-metal machine') {
sh 'cico node done ${CICO_SSID}'
}
if (failure) {
throw failure
}
}
}