From 2ea9ba02c5fd60fbf6ae2bd1f63c2ef8967c4604 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Tue, 4 May 2021 13:47:53 +0800 Subject: [PATCH] ceph-pr-docs: add annotation to build result * do not "set -e", so the script does not exit immediately. instead use a variable of "succeed" to store true if the document is built successfully, and false otherwise * feed the output of the sphinx-build to github-check tool, so it is able to parse and call the GitHub Check API to update the Check web page on the PR if the test fails. Signed-off-by: Kefu Chai --- ceph-pr-docs/build/build | 34 +++++++++++++++++-- .../config/definitions/ceph-pr-docs.yml | 6 ++++ 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/ceph-pr-docs/build/build b/ceph-pr-docs/build/build index 604c562b..8294ec39 100644 --- a/ceph-pr-docs/build/build +++ b/ceph-pr-docs/build/build @@ -1,6 +1,6 @@ #!/bin/bash -set -ex +set -xo pipefail # make sure any shaman list file is removed. At some point if all nodes # are clean this will not be needed. @@ -12,4 +12,34 @@ sudo rm -f /etc/apt/sources.list.d/ceph-boost* sudo apt-get update -o Acquire::Languages=none -o Acquire::Translation=none sudo apt-get install -y gcc python3-dev python3-pip python3-virtualenv libxml2-dev libxslt-dev doxygen graphviz ant ditaa cython3 -timeout 3600 ./admin/build-doc +virtualenv -q --python python3 venv +. venv/bin/activate +pip install tox +pip install git+https://github.com/ceph/githubcheck.git +sha1=$(git rev-parse refs/remotes/origin/pr/${ghprbPullId}/head) + +output=$(mktemp $PWD/build-doc-XXX.out) + +if timeout 3600 ./admin/build-doc 2>&1 | tee ${output}; then + succeed=true +else + succeed=false +fi + +if ! $succeed; then + cat ${output} | github-check \ + --sphinx \ + --sphinx-root=. \ + --owner "ceph" \ + --repo "ceph" \ + --pkey-file $GITHUB_CHECK_PKEY_PEM \ + --app-id "62865" \ + --install-id "8465036" \ + --name "ceph-pr-docs" \ + --sha $sha1 \ + --external-id $BUILD_ID \ + --details-url $BUILD_URL \ + --title sphinx-build +fi + +$succeed diff --git a/ceph-pr-docs/config/definitions/ceph-pr-docs.yml b/ceph-pr-docs/config/definitions/ceph-pr-docs.yml index d2f24408..931ea001 100644 --- a/ceph-pr-docs/config/definitions/ceph-pr-docs.yml +++ b/ceph-pr-docs/config/definitions/ceph-pr-docs.yml @@ -48,3 +48,9 @@ builders: - shell: !include-raw: ../../build/build + + wrappers: + - credentials-binding: + - file: + credential-id: cephacheck.2020-04-29.private-key.pem + variable: GITHUB_CHECK_PKEY_PEM -- 2.39.5