use gsutil m option to improve performance 69/3469/2
authorRyota MIBU <r-mibu@cq.jp.nec.com>
Fri, 20 Nov 2015 13:25:09 +0000 (22:25 +0900)
committerRyota MIBU <r-mibu@cq.jp.nec.com>
Mon, 23 Nov 2015 13:17:31 +0000 (22:17 +0900)
Change-Id: Ic76d5f0817208e923c60e8e24e531d5a761470f4
Signed-off-by: Ryota MIBU <r-mibu@cq.jp.nec.com>
jjb/releng-macros.yaml

index 1c79144..9e482dc 100644 (file)
 
             gs_path="artifacts.opnfv.org/review/$GERRIT_CHANGE_NUMBER"
 
-            gsutil cp -r docs/output/* "gs://$gs_path"
+            gsutil -m cp -r docs/output/* "gs://$gs_path"
 
-            gsutil ls "gs://$gs_path" | grep -e 'html$' | while read file
-            do
-                gsutil setmeta \
+            if gsutil ls "gs://$gs_path" | grep -e 'html$' > /dev/null 2>&1 ; then
+                gsutil -m setmeta \
                     -h "Content-Type:text/html" \
                     -h "Cache-Control:private, max-age=0, no-transform" \
-                    "$file"
-            done
+                    "gs://$gs_path"/**.html
+            fi
 
             gerrit_comment="Document link(s):
             $(gsutil ls "gs://$gs_path" | grep -e 'index.html$' -e 'pdf$' | sed 's/^gs/http/')"
                 gs_path="artifacts.opnfv.org/{project}/{branch}/docs"
             fi
 
-            gsutil cp -r docs/output/* "gs://$gs_path"
+            gsutil -m cp -r docs/output/* "gs://$gs_path"
 
-            gsutil ls "gs://$gs_path" | grep -e 'html$' | while read file
-            do
-                gsutil setmeta \
+            if gsutil ls "gs://$gs_path" | grep -e 'html$' > /dev/null 2>&1 ; then
+                gsutil -m setmeta \
                     -h "Content-Type:text/html" \
                     -h "Cache-Control:private, max-age=0, no-transform" \
-                    "$file"
-            done
+                    "gs://$gs_path"/**.html
+            fi
 
             gerrit_comment="Document link(s):
             $(gsutil ls "gs://$gs_path" | grep -e 'index.html$' -e 'pdf$' | sed 's/^gs/http/')"
             if gsutil ls "gs://$gs_path" > /dev/null 2>&1 ; then
                 echo
                 echo "Deleting Out-of-dated Documents..."
-                gsutil rm -r "gs://$gs_path_review"
+                gsutil -m rm -r "gs://$gs_path_review"
             fi