]> git.apps.os.sepia.ceph.com Git - ceph-build.git/commitdiff
ceph-pr-docs: add annotation to build result 1808/head
authorKefu Chai <kchai@redhat.com>
Tue, 4 May 2021 05:47:53 +0000 (13:47 +0800)
committerKefu Chai <kchai@redhat.com>
Wed, 5 May 2021 04:01:56 +0000 (12:01 +0800)
* 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 <kchai@redhat.com>
ceph-pr-docs/build/build
ceph-pr-docs/config/definitions/ceph-pr-docs.yml

index 604c562b00ba1488d2c13d261b12ddcf039a8457..8294ec398a473d2075b61617e046672735edf097 100644 (file)
@@ -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
index d2f2440810bd6d86cc8cba019624936465c8f250..931ea0012d4101f7271e8ade2819f91f6c7c3309 100644 (file)
@@ -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