Fail on exit status != 0 on every command in pipeline for build-docu scripts
[releng.git] / jjb / opnfvdocs / build-upload-docu.sh
index 23e7838..7b4321a 100644 (file)
@@ -1,4 +1,7 @@
 #!/bin/bash
+set -e
+set -o pipefail
+
 project="opnfvdocs"
 export PATH=$PATH:/usr/local/bin/
 
@@ -40,19 +43,18 @@ for file in "${{files[@]}}"; do
 
 done
 
-
 images=()
-
 while read -r -d ''; do
-        files+=("$REPLY")
+        images+=("$REPLY")
 done < <(find * -type f \( -iname \*.jpg -o -iname \*.png \) -print0)
 
 for img in "${{images[@]}}"; do
 
        # uploading found images
        echo "uploading $img"
+        cat "$img" | gsutil cp -L gsoutput.txt - \
         gs://artifacts.opnfv.org/"$project"/"$img"
-        gsutil setmeta -h "Content-Type:text/html" \
+        gsutil setmeta -h "Content-Type:image/jpeg" \
                         -h "Cache-Control:private, max-age=0, no-transform" \
                         gs://artifacts.opnfv.org/"$project"/"$img"
         cat gsoutput.txt