X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=jjb%2Freleng-macros.yaml;h=5d95707054ff96d25e0063181fee5d961c9a9cef;hb=7d07e223f5a5ff18de1bc83377b7be345a2ef01f;hp=1f091b9732eb87b1993d7d1c2f278ed86608f727;hpb=d71ea5fba2ad0ff933d9e8301953e5205c851bf4;p=releng.git diff --git a/jjb/releng-macros.yaml b/jjb/releng-macros.yaml index 1f091b973..5d9570705 100644 --- a/jjb/releng-macros.yaml +++ b/jjb/releng-macros.yaml @@ -7,6 +7,14 @@ name: PROJECT default: '{project}' description: "JJB configured PROJECT parameter to identify an opnfv Gerrit project" + - string: + name: GS_BASE + default: artifacts.opnfv.org/$PROJECT + description: "URL to Google Storage." + - string: + name: GS_BASE_PROXY + default: build.opnfv.org/artifacts/$PROJECT + description: "URL to Google Storage proxy" - parameter: name: gerrit-parameter @@ -48,6 +56,16 @@ timeout: 360 fail: true +- trigger: + name: 'brahmaputra-trigger-daily-disabled' + triggers: + - timed: '' + +- trigger: + name: 'brahmaputra-trigger-daily-enabled' + triggers: + - timed: '0 2 * * *' + - trigger: name: gerrit-trigger-patch-submitted triggers: @@ -151,75 +169,25 @@ name: build-html-and-pdf-docs-output builders: - shell: | - #!/bin/bash -e - set -o pipefail + #!/bin/bash + set -o errexit + set -o xtrace export PATH=$PATH:/usr/local/bin/ - - [[ $GERRIT_CHANGE_NUMBER =~ .+ ]] - - _get_title_script=" - import os - from docutils import core - with open('index.rst', 'r') as file: - data = file.read() - doctree = core.publish_doctree(data, - settings_overrides={'report_level': 5, - 'halt_level': 5}) - print doctree[0].astext()" - _git_sha1="$(git rev-parse HEAD)" - - find docs/ -name 'index.rst' -printf '%h\n' | while read dir - do - _name="${dir##*/}" - _build="$dir/build" - _output="docs/output/$_name" - - echo - echo "#################${dir//?/#}" - echo "Building DOCS in $dir" - echo "#################${dir//?/#}" - echo - - sed -i "s/_sha1_/$_git_sha1/g" "$dir/index.rst" - - if [[ ! -f "$dir/conf.py" ]] ; then - cp "docs/etc/conf.py" "$dir/conf.py" - _title=$(cd $dir; python -c "$_get_title_script") - echo "latex_documents = [('index', '$_name.tex', '$_title', 'OPNFV', 'manual'),]" >> "$dir/conf.py" - fi - cp -f "docs/etc/opnfv-logo.png" "$dir/opnfv-logo.png" - - mkdir -p "$_output" - - sphinx-build -b html -E "$dir" "$_output" - - # Note: PDF creation may fail in project doc builds. - # We allow this test to be marked as succeeded with - # failure in PDF creation, but leave message to fix it. - # Any failure has to be fixed before B release. - { - sphinx-build -b latex -E "$dir" "$_build" - make -C "$_build" LATEXOPTS='--interaction=nonstopmode' all-pdf - mv "$_build/$_name.pdf" "$_output" - } || { - _msg="Error: PDF creation for $dir has failed, please fix source rst file(s)." - echo - echo "$_msg" - echo - echo "$_msg" >> gerrit_comment.txt - } - done + git clone ssh://gerrit.opnfv.org:29418/releng + GERRIT_COMMENT=gerrit_comment.txt ./releng/utils/docs-build.sh - builder: name: upload-under-review-docs-to-opnfv-artifacts builders: - shell: | - #!/bin/bash -e + #!/bin/bash + set -o errexit set -o pipefail + set -o xtrace export PATH=$PATH:/usr/local/bin/ [[ $GERRIT_CHANGE_NUMBER =~ .+ ]] - [[ -d docs/output ]] + [[ -d docs_output ]] || exit 0 echo echo "###########################" @@ -227,9 +195,13 @@ echo "###########################" echo - gs_path="artifacts.opnfv.org/review/$GERRIT_CHANGE_NUMBER" + gs_base="artifacts.opnfv.org/review" + gs_path="$gs_base/$GERRIT_CHANGE_NUMBER" + local_path="upload/$GERRIT_CHANGE_NUMBER" - gsutil -m cp -r docs/output "gs://$gs_path" + mkdir -p upload + mv docs_output "$local_path" + gsutil -m cp -r "$local_path" "gs://$gs_base" if gsutil ls "gs://$gs_path" | grep -e 'html$' > /dev/null 2>&1 ; then gsutil -m setmeta \ @@ -239,32 +211,33 @@ fi echo "Document link(s):" >> gerrit_comment.txt - find docs/output | grep -e 'index.html$' -e 'pdf$' | \ - sed -e "s|^docs/output| http://$gs_path|" >> gerrit_comment.txt + find "$local_path" | grep -e 'index.html$' -e 'pdf$' | \ + sed -e "s|^$local_path| http://$gs_path|" >> gerrit_comment.txt - builder: - name: upload-merged-docs-to-opnfv-artifacts + name: upload-generated-docs-to-opnfv-artifacts builders: - shell: | - #!/bin/bash -e + #!/bin/bash + set -o errexit set -o pipefail + set -o xtrace export PATH=$PATH:/usr/local/bin/ - [[ -d docs/output ]] + [[ -d docs_output ]] || exit 0 echo - echo "#####################" - echo "UPLOADING MERGED DOCS" - echo "#####################" + echo "########################" + echo "UPLOADING GENERATED DOCS" + echo "########################" echo - if [[ "$GERRIT_BRANCH" == "master" ]] ; then - gs_path="artifacts.opnfv.org/$GERRIT_PROJECT/docs" - else - gs_path="artifacts.opnfv.org/$GERRIT_PROJECT/$GERRIT_BRANCH/docs" - fi + gs_path="$GS_URL/docs" + local_path="upload/docs" - gsutil -m cp -r docs/output/* "gs://$gs_path" + mkdir -p upload + mv docs_output "$local_path" + gsutil -m cp -r "$local_path" "gs://$GS_URL" if gsutil ls "gs://$gs_path" | grep -e 'html$' > /dev/null 2>&1 ; then gsutil -m setmeta \ @@ -274,14 +247,17 @@ fi echo "Document link(s):" >> gerrit_comment.txt - find docs/output | grep -e 'index.html$' -e 'pdf$' | \ - sed -e "s|^docs/output| http://$gs_path|" >> gerrit_comment.txt + find "$local_path" | grep -e 'index.html$' -e 'pdf$' | \ + sed -e "s|^$local_path| http://$gs_path|" >> gerrit_comment.txt - builder: name: report-docs-build-result-to-gerrit builders: - shell: | - #!/bin/bash -e + #!/bin/bash + set -o errexit + set -o pipefail + set -o xtrace export PATH=$PATH:/usr/local/bin/ if [[ -e gerrit_comment.txt ]] ; then echo @@ -299,7 +275,10 @@ name: remove-old-docs-from-opnfv-artifacts builders: - shell: | - #!/bin/bash -e + #!/bin/bash + set -o errexit + set -o pipefail + set -o xtrace export PATH=$PATH:/usr/local/bin/ [[ $GERRIT_CHANGE_NUMBER =~ .+ ]] @@ -323,6 +302,6 @@ name: upload-merged-docs builders: - build-html-and-pdf-docs-output - - upload-merged-docs-to-opnfv-artifacts + - upload-generated-docs-to-opnfv-artifacts - report-docs-build-result-to-gerrit - remove-old-docs-from-opnfv-artifacts