Bug 1210467: Exit script if aws fails to list backup file. r=garndt
☠☠ backed out by e843ef367f35 ☠ ☠
authorWander Lairson Costa <wcosta@mozilla.com>
Thu, 01 Oct 2015 15:29:46 -0300
changeset 265656 19db5133d27c559a3fd9977dff10a989d1a35bcf
parent 265655 eb63a639d8526c9094665ef703513041989ab1ef
child 265657 051906f42649489490d50f26cb890dc87ffbb20c
push id66003
push usercbook@mozilla.com
push dateFri, 02 Oct 2015 11:37:40 +0000
treeherdermozilla-inbound@3fd732d24f46 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgarndt
bugs1210467
milestone44.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1210467: Exit script if aws fails to list backup file. r=garndt As the aws command line tool call is piped, its status is lost, but the net result is an empty variable assigment. We take advantage of this to detect errors in the aws tool.
testing/taskcluster/scripts/phone-builder/pre-build.sh
--- a/testing/taskcluster/scripts/phone-builder/pre-build.sh
+++ b/testing/taskcluster/scripts/phone-builder/pre-build.sh
@@ -26,16 +26,21 @@ tc-vcs repo-checkout $WORKSPACE/B2G http
 rm -f $WORKSPACE/B2G/gecko
 ln -s $WORKSPACE/gecko $WORKSPACE/B2G/gecko
 
 debug_flag=""
 if [ 0$B2G_DEBUG -ne 0 ]; then
   debug_flag='--debug'
 fi
 
+if ! aws --output=text s3 ls s3://b2g-phone-backups/$TARGET/; then
+    echo "The backup file is either invalid or missing! Are the AWS credentials ok?"
+    exit 1
+fi
+
 backup_file=$(aws --output=text s3 ls s3://b2g-phone-backups/$TARGET/ | tail -1 | awk '{print $NF}')
 
 if echo $backup_file | grep '\.tar\.bz2'; then
     aws s3 cp s3://b2g-phone-backups/$TARGET/$backup_file .
     tar -xjf $backup_file -C $WORKSPACE/B2G
     rm -f $backup_file
 fi