jjb: xci: bifrost-verify: Disable errexit when uploading logs 97/39397/1
authorMarkos Chandras <mchandras@suse.de>
Wed, 16 Aug 2017 07:55:47 +0000 (08:55 +0100)
committerMarkos Chandras <mchandras@suse.de>
Wed, 16 Aug 2017 08:01:00 +0000 (09:01 +0100)
The errexit option is there to catch failures when the job is executed.
We don't want to mark the entire job as failed when we have troubles
uploading the logs when the actual job has passed so we disable the
errexit option to make the whole process less aggressive. Moreover, we
move the build log upload to the end of the operation so we can catch
as much output as possible.

Change-Id: Ice126471a8c837c54c95c8ef0935c059d37ea91b
Signed-off-by: Markos Chandras <mchandras@suse.de>
jjb/xci/bifrost-verify.sh

index 14c8d37..03d9afc 100755 (executable)
@@ -57,16 +57,17 @@ EOF
 </html>
 EOF
 
+    # Upload landing page
+    echo "Uploading the landing page"
+    gsutil -q cp ${WORKSPACE}/index.html ${BIFROST_GS_URL}/index.html
+    rm -f ${WORKSPACE}/index.html
+
     # Finally, download and upload the entire build log so we can retain
     # as much build information as possible
     echo "Uploading the final console output"
     curl -s -L ${BIFROST_CONSOLE_LOG} > ${WORKSPACE}/build_log.txt
     gsutil -q cp -Z ${WORKSPACE}/build_log.txt ${BIFROST_GS_URL}/build_log.txt
-    rm ${WORKSPACE}/build_log.txt
-
-    # Upload landing page
-    gsutil -q cp ${WORKSPACE}/index.html ${BIFROST_GS_URL}/index.html
-    rm ${WORKSPACE}/index.html
+    rm -f ${WORKSPACE}/build_log.txt
 }
 
 function fix_ownership() {
@@ -83,6 +84,9 @@ function fix_ownership() {
 
 function cleanup_and_upload() {
     original_exit=$?
+    echo "Job exit code: $original_exit"
+    # Turn off errexit
+    set +o errexit
     fix_ownership
     upload_logs
     exit $original_exit