diff options
author | 2017-07-12 15:36:40 +0800 | |
---|---|---|
committer | 2017-07-13 20:53:48 +0800 | |
commit | ec8a597ae8f8018ecd7f273470fa51d4ecc1da3c (patch) | |
tree | 58211970740d7def4a4d5c51d3b84285be52f23f /jjb | |
parent | 1dea2cad906da7da95ccd84f96ed49429e2b9c3d (diff) |
Add support for review jupyter notebook from nbviewer
It is done by uploading the notebook under reviewer to artifacts
and add the nbviewer link in gerrit comments
It is needed because reviewing jupyter notebook[1] directly in
gerrit is very difficult. See example in [2]. It will be much
easier if we can preview the result in nbviewer. See example in [3]
[1]: http://jupyter.org/
[2]: https://gerrit.opnfv.org/gerrit/#/c/37227/
[3]: https://nbviewer.jupyter.org/urls/git.opnfv.org/qtip/plain/examples/storage-qpi-report/storage-qpi.ipynb
Change-Id: I3e4c301f362ff6ac97aebc9d09c7103278efb136
Signed-off-by: Yujun Zhang <zhang.yujunz@zte.com.cn>
Diffstat (limited to 'jjb')
-rw-r--r-- | jjb/qtip/qtip-verify-jobs.yml | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/jjb/qtip/qtip-verify-jobs.yml b/jjb/qtip/qtip-verify-jobs.yml index dd444c7a5..197f32aec 100644 --- a/jjb/qtip/qtip-verify-jobs.yml +++ b/jjb/qtip/qtip-verify-jobs.yml @@ -7,6 +7,7 @@ project: qtip jobs: - 'qtip-verify-{stream}' + - 'qtip-merge-{stream}' stream: - master: branch: '{stream}' @@ -60,9 +61,51 @@ builders: - qtip-unit-tests-and-docs-build + - upload-under-review-notebooks-to-opnfv-artifacts publishers: - publish-coverage +- job-template: + name: 'qtip-merge-{stream}' + + disabled: '{obj:disabled}' + + parameters: + - project-parameter: + project: $GERRIT_PROJECT + branch: '{branch}' + - string: + name: GS_URL + default: '$GS_BASE{gs-pathname}' + description: "Directory where the build artifact will be located upon the completion of the build." + - string: + name: GERRIT_REFSPEC + default: 'refs/heads/{branch}' + description: "JJB configured GERRIT_REFSPEC parameter" + + scm: + - git-scm + + triggers: + - gerrit: + server-name: 'gerrit.opnfv.org' + trigger-on: + - change-merged-event + - comment-added-contains-event: + comment-contains-value: 'remerge' + projects: + - project-compare-type: 'ANT' + project-pattern: '*' + branches: + - branch-compare-type: 'ANT' + branch-pattern: '**/{branch}' + file-paths: + - compare-type: ANT + pattern: examples/** + + builders: + - remove-old-docs-from-opnfv-artifacts + ################################ ## job builders ################################# @@ -76,3 +119,35 @@ set -o xtrace tox + +# modified from upload-under-review-docs-to-opnfv-artifacts in global/releng-macro.yml +- builder: + name: upload-under-review-notebooks-to-opnfv-artifacts + builders: + - shell: | + #!/bin/bash + set -o errexit + set -o pipefail + set -o xtrace + export PATH=$PATH:/usr/local/bin/ + + [[ $GERRIT_CHANGE_NUMBER =~ .+ ]] + [[ -d examples ]] || exit 0 + + echo + echo "###########################" + echo "UPLOADING DOCS UNDER REVIEW" + echo "###########################" + echo + + gs_base="artifacts.opnfv.org/$PROJECT/review" + gs_path="$gs_base/$GERRIT_CHANGE_NUMBER" + local_path="upload/$GERRIT_CHANGE_NUMBER" + + mkdir -p upload + cp -r examples "$local_path" + gsutil -m cp -r "$local_path" "gs://$gs_base" + + echo "Document link(s):" >> gerrit_comment.txt + find "$local_path" | grep -e 'ipynb$' | \ + sed -e "s|^$local_path| https://nbviewer.jupyter.org/urls/$gs_path|" >> gerrit_comment.txt |