kvmfornfv: Attempt removing outdated artifacts only if the exist 25/18825/1
authorFatih Degirmenci <fatih.degirmenci@ericsson.com>
Wed, 17 Aug 2016 10:50:04 +0000 (12:50 +0200)
committerFatih Degirmenci <fatih.degirmenci@ericsson.com>
Wed, 17 Aug 2016 10:50:04 +0000 (12:50 +0200)
Change-Id: I0a88dd8818cb11761bfd83fd37f41474ae698435
Signed-off-by: Fatih Degirmenci <fatih.degirmenci@ericsson.com>
jjb/kvmfornfv/kvmfornfv-upload-artifact.sh

index 48c0134..adf902e 100755 (executable)
@@ -1,7 +1,6 @@
 #!/bin/bash
 set -o errexit
 set -o nounset
-set -o pipefail
 
 if [[ "$JOB_NAME" =~ (verify|merge|daily|weekly) ]]; then
     JOB_TYPE=${BASH_REMATCH[0]}
@@ -15,7 +14,7 @@ case "$JOB_TYPE" in
         echo "Uploading artifacts for the change $GERRIT_CHANGE_NUMBER. This could take some time..."
         GS_UPLOAD_LOCATION="gs://artifacts.opnfv.org/$PROJECT/review/$GERRIT_CHANGE_NUMBER"
         echo "Removing artifacts produced for the previous patch for the change $GERRIT_CHANGE_NUMBER"
-        gsutil rm -r $GS_UPLOAD_LOCATION
+        gsutil ls $GS_UPLOAD_LOCATION > /dev/null 2>&1 && gsutil rm -r $GS_UPLOAD_LOCATION
         ;;
     daily)
         echo "Uploding daily artifacts This could take some time..."