From 4929efc523fd1312456b8096fce93297e3b922bc Mon Sep 17 00:00:00 2001 From: Ryota MIBU Date: Mon, 6 Jul 2015 19:05:09 +0900 Subject: [promise] upload under-review documents This patch configures Jenkins to upload under-review documents built in verify jobs, so that reviewers can check how document would be changed. The config and script are copied from those of Doctor. JIRA: PROMISE-5 Change-Id: I096a82e8b1cc0b89db0a03c79ae28f1419dbf752 Signed-off-by: Ryota MIBU --- jjb/promise/docu-build.sh | 53 ++++++++++++++++++++++++++++++++++------------- 1 file changed, 39 insertions(+), 14 deletions(-) (limited to 'jjb/promise/docu-build.sh') diff --git a/jjb/promise/docu-build.sh b/jjb/promise/docu-build.sh index c635a115e..aafcb2f66 100644 --- a/jjb/promise/docu-build.sh +++ b/jjb/promise/docu-build.sh @@ -2,21 +2,46 @@ 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=( - 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/requirements/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 -- cgit 1.2.3-korg