Make RTD docs job build correct branch 97/50697/2
authorThanh Ha <thanh.ha@linuxfoundation.org>
Fri, 20 Jan 2017 03:08:46 +0000 (22:08 -0500)
committerThanh Ha <thanh.ha@linuxfoundation.org>
Fri, 20 Jan 2017 03:17:41 +0000 (22:17 -0500)
We can use version_slug post data to pass in the docs version to build
in ReadTheDocs.

Change-Id: I0ed5176a3216b6a115bd2bae527df4bb5b1d2c45
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
jjb/docs/docs-post-rtd.sh [new file with mode: 0644]
jjb/docs/docs-rtd.yaml

diff --git a/jjb/docs/docs-post-rtd.sh b/jjb/docs/docs-post-rtd.sh
new file mode 100644 (file)
index 0000000..3725377
--- /dev/null
@@ -0,0 +1,7 @@
+#!/bin/bash
+if [ $GERRIT_BRANCH == "master" ]; then
+    RTD_BUILD_VERSION=latest
+else
+    RTD_BUILD_VERSION=${GERRIT_BRANCH/\//-}
+fi
+curl -X POST --data "version_slug=$RTD_BUILD_VERSION" https://readthedocs.org/build/{rtdproject}
index 5ad9ee2ea91223113c70889ea8243ce3621aca80..e35f8aec826604f646d87ead69ab820e642faf74 100644 (file)
@@ -55,8 +55,7 @@
                       pattern: docs/**/*.rst
 
     builders:
-        - shell: |
-            curl -X POST https://readthedocs.org/build/{rtdproject}
+        - shell: !include-raw-escape: docs-post-rtd.sh
 
     publishers:
         - email-notification: