summaryrefslogtreecommitdiffstats
path: root/jjb/doctor/docu-build.sh
diff options
context:
space:
mode:
authorRyota MIBU <r-mibu@cq.jp.nec.com>2015-07-02 12:53:02 +0900
committerRyota MIBU <r-mibu@cq.jp.nec.com>2015-07-03 17:52:41 +0900
commite8dd11b81e3b20f68e47fce29a86e847e1d3560b (patch)
tree867e1911de40e7d32ed48c66721ada9a3f71d93b /jjb/doctor/docu-build.sh
parent0192c5c6abfc1f17eb292a7b8ee29a6859fc366e (diff)
[doctor] upload docs built in verify jobs
This patch configure jenkins doctor job to upload documents built in verify jobs, so that reviewers can check how document would be changed. This patch also clean up doctor.yml and delete script files. JIRA: DOCTOR-12 Change-Id: Ia57ced1f263f691bd288946dd44da37199b3bfc6 Signed-off-by: Ryota MIBU <r-mibu@cq.jp.nec.com>
Diffstat (limited to 'jjb/doctor/docu-build.sh')
-rw-r--r--jjb/doctor/docu-build.sh57
1 files changed, 41 insertions, 16 deletions
diff --git a/jjb/doctor/docu-build.sh b/jjb/doctor/docu-build.sh
index 39ecf3bb0..fde367b4c 100644
--- a/jjb/doctor/docu-build.sh
+++ b/jjb/doctor/docu-build.sh
@@ -2,23 +2,48 @@
set -e
set -o pipefail
-build_dir="build"
-project="$(git remote -v | head -n1 | awk '{{print $2}}' | sed -e 's,.*:\(.*/\)\?,,' -e 's/\.git$//')"
export PATH=$PATH:/usr/local/bin/
+echo
+echo "Build"
+echo "-----"
+echo
+
make
-# upload all built files
-files=(
- design_docs
- requirements/html
- requirements/latex/*.pdf
-)
-
-for file in "${{files[@]}}"; do
- gsutil cp -r -L gsoutput.txt $build_dir/$file gs://artifacts.opnfv.org/$project/
- #gsutil setmeta -h "Cache-Control:private, max-age=0, no-transform" \
- #-R gs://artifacts.opnfv.org/$project/$file
- cat gsoutput.txt
- rm -f gsoutput.txt
-done
+echo
+echo "Upload"
+echo "------"
+echo
+
+# NOTE: make sure source parameters for GS paths are not empty.
+[[ $GERRIT_CHANGE_NUMBER =~ .+ ]]
+[[ $GERRIT_PROJECT =~ .+ ]]
+[[ $GERRIT_BRANCH =~ .+ ]]
+
+gs_path_review="artifacts.opnfv.org/review/$GERRIT_CHANGE_NUMBER"
+if [[ $GERRIT_BRANCH = "master" ]] ; then
+ gs_path_branch="artifacts.opnfv.org/$GERRIT_PROJECT"
+else
+ gs_path_branch="artifacts.opnfv.org/$GERRIT_PROJECT/${{GERRIT_BRANCH##*/}}"
+fi
+
+if [[ $JOB_NAME =~ "verify" ]] ; then
+ gsutil cp -r build/* "gs://$gs_path_review/"
+ echo
+ echo "Document is available at http://$gs_path_review"
+else
+ gsutil cp -r build/design_docs "gs://$gs_path_branch/"
+ gsutil cp -r build/html "gs://$gs_path_branch/"
+ gsutil cp -r build/latex/*.pdf "gs://$gs_path_branch/"
+ echo
+ echo "Document is available at http://$gs_path_branch"
+fi
+
+if [[ $GERRIT_EVENT_TYPE = "change-merged" ]] ; then
+ echo
+ echo "Clean Out-of-dated Documents"
+ echo "----------------------------"
+ echo
+ gsutil rm -r "gs://$gs_path_review" || true
+fi