<p>George Joseph has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/9529">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">CI:  Add wiki doc publish to periodics<br><br>Change-Id: I29ba26134e5083bc6788ede235f1a5d4383c148a<br>---<br>M tests/CI/periodics-daily.jenkinsfile<br>A tests/CI/publishAsteriskDocs.sh<br>2 files changed, 166 insertions(+), 2 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/29/9529/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/tests/CI/periodics-daily.jenkinsfile b/tests/CI/periodics-daily.jenkinsfile</span><br><span>index 8f53658..7676931 100644</span><br><span>--- a/tests/CI/periodics-daily.jenkinsfile</span><br><span>+++ b/tests/CI/periodics-daily.jenkinsfile</span><br><span>@@ -43,8 +43,8 @@</span><br><span>                                      def img = docker.image(randomImage)</span><br><span>                                  img.pull()</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-                                  stage ("Build") {</span><br><span style="color: hsl(0, 100%, 40%);">-                                             img.inside(dockerOptions + " --name ${bt}-build") {</span><br><span style="color: hsl(120, 100%, 40%);">+                                 img.inside(dockerOptions + " --name ${bt}-build") {</span><br><span style="color: hsl(120, 100%, 40%);">+                                         stage ("Build") {</span><br><span>                                                  echo 'Building..'</span><br><span>                                                    env.CCACHE_DIR = "/srv/cache/ccache"</span><br><span>                                                       sh "./tests/CI/buildAsterisk.sh --output-dir=${outputdir} --cache-dir=/srv/cache"</span><br><span>@@ -52,6 +52,28 @@</span><br><span>                                                     archiveArtifacts allowEmptyArchive: true, defaultExcludes: false, fingerprint: false,</span><br><span>                                                                artifacts: "${outputdir}/*"</span><br><span>                                                }</span><br><span style="color: hsl(120, 100%, 40%);">+                                             stage ("Docs") {</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+                                                  sh 'sudo ./tests/CI/installAsterisk.sh  --user-group=jenkins:users'</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+                                                 def docUrl = env.GIT_URL.replaceAll(/\/[^\/]+$/, "/publish-docs")</span><br><span style="color: hsl(120, 100%, 40%);">+                                                   checkout scm: [$class: 'GitSCM',</span><br><span style="color: hsl(120, 100%, 40%);">+                                                              branches: [[name: "master"]],</span><br><span style="color: hsl(120, 100%, 40%);">+                                                                       extensions: [</span><br><span style="color: hsl(120, 100%, 40%);">+                                                                         [$class: 'RelativeTargetDirectory', relativeTargetDir: "tests/CI/output/publish-docs"],</span><br><span style="color: hsl(120, 100%, 40%);">+                                                                             [$class: 'CloneOption',</span><br><span style="color: hsl(120, 100%, 40%);">+                                                                                       noTags: true,</span><br><span style="color: hsl(120, 100%, 40%);">+                                                                                 depth: 10,</span><br><span style="color: hsl(120, 100%, 40%);">+                                                                                    honorRefspec: true,</span><br><span style="color: hsl(120, 100%, 40%);">+                                                                                   shallow: true</span><br><span style="color: hsl(120, 100%, 40%);">+                                                                         ],</span><br><span style="color: hsl(120, 100%, 40%);">+                                                                    ],</span><br><span style="color: hsl(120, 100%, 40%);">+                                                                    userRemoteConfigs: [[url: docUrl]]</span><br><span style="color: hsl(120, 100%, 40%);">+                                                            ]</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+                                                   sh './tests/CI/publishAsteriskDocs.sh --branch-name=${BRANCH_NAME}'</span><br><span style="color: hsl(120, 100%, 40%);">+                                           }</span><br><span style="color: hsl(120, 100%, 40%);">+                                             </span><br><span>                                     }</span><br><span> </span><br><span>                                        def testGroups = readJSON file: "tests/CI/periodic-dailyTestGroups.json"</span><br><span>diff --git a/tests/CI/publishAsteriskDocs.sh b/tests/CI/publishAsteriskDocs.sh</span><br><span>new file mode 100755</span><br><span>index 0000000..54c962a</span><br><span>--- /dev/null</span><br><span>+++ b/tests/CI/publishAsteriskDocs.sh</span><br><span>@@ -0,0 +1,142 @@</span><br><span style="color: hsl(120, 100%, 40%);">+#</span><br><span style="color: hsl(120, 100%, 40%);">+# Publish Asterisk documentation to the wiki</span><br><span style="color: hsl(120, 100%, 40%);">+#</span><br><span style="color: hsl(120, 100%, 40%);">+#!/usr/bin/env bash</span><br><span style="color: hsl(120, 100%, 40%);">+CIDIR=$(dirname $(readlink -fn $0))</span><br><span style="color: hsl(120, 100%, 40%);">+source $CIDIR/ci.functions</span><br><span style="color: hsl(120, 100%, 40%);">+ASTETCDIR=$DESTDIR/etc/asterisk</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ASTERISK="$DESTDIR/usr/sbin/asterisk"</span><br><span style="color: hsl(120, 100%, 40%);">+CONFFILE=$ASTETCDIR/asterisk.conf</span><br><span style="color: hsl(120, 100%, 40%);">+OUTPUTDIR=${OUTPUT_DIR:-tests/CI/output/publish-docs}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+[ ! -d ${OUTPUTDIR} ] && mkdir -p $OUTPUTDIR</span><br><span style="color: hsl(120, 100%, 40%);">+[ x"$USER_GROUP" != x ] && sudo chown -R $USER_GROUP $OUTPUTDIR</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+rm -rf $ASTETCDIR/extensions.{ael,lua} || :</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+if test -f ~/.asterisk-wiki.conf; then</span><br><span style="color: hsl(120, 100%, 40%);">+   . ~/.asterisk-wiki.conf</span><br><span style="color: hsl(120, 100%, 40%);">+fi</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+: ${AWK:=awk}</span><br><span style="color: hsl(120, 100%, 40%);">+: ${GREP:=grep}</span><br><span style="color: hsl(120, 100%, 40%);">+: ${MAKE:=make}</span><br><span style="color: hsl(120, 100%, 40%);">+: ${GIT:=git}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+function fail()</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+    echo "${PROGNAME}: " "$@" >&2</span><br><span style="color: hsl(120, 100%, 40%);">+    exit 1</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+function usage()</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+    echo "usage: ${PROGNAME} --branch-name=<branch> [ --user-group=<user>:<group> ] [ --output-dir=<output_dir> ]"</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#</span><br><span style="color: hsl(120, 100%, 40%);">+# Check settings from config file</span><br><span style="color: hsl(120, 100%, 40%);">+#</span><br><span style="color: hsl(120, 100%, 40%);">+if ! test ${CONFLUENCE_URL}; then</span><br><span style="color: hsl(120, 100%, 40%);">+    fail "CONFLUENCE_URL not set in ~/.asterisk-wiki.conf"</span><br><span style="color: hsl(120, 100%, 40%);">+fi</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+if ! test ${CONFLUENCE_USER}; then</span><br><span style="color: hsl(120, 100%, 40%);">+    fail "CONFLUENCE_USER not set in ~/.asterisk-wiki.conf"</span><br><span style="color: hsl(120, 100%, 40%);">+fi</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+if ! test ${CONFLUENCE_PASSWORD}; then</span><br><span style="color: hsl(120, 100%, 40%);">+    fail "CONFLUENCE_PASSWORD not set in ~/.asterisk-wiki.conf"</span><br><span style="color: hsl(120, 100%, 40%);">+fi</span><br><span style="color: hsl(120, 100%, 40%);">+# needed by publishing scripts. pass via the environment so it doesn't show</span><br><span style="color: hsl(120, 100%, 40%);">+# up in the logs.</span><br><span style="color: hsl(120, 100%, 40%);">+export CONFLUENCE_PASSWORD</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+# default space to AST</span><br><span style="color: hsl(120, 100%, 40%);">+: ${CONFLUENCE_SPACE:=AST}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#</span><br><span style="color: hsl(120, 100%, 40%);">+# Check repository</span><br><span style="color: hsl(120, 100%, 40%);">+#</span><br><span style="color: hsl(120, 100%, 40%);">+if ! test -f main/asterisk.c; then</span><br><span style="color: hsl(120, 100%, 40%);">+    fail "Must run from an Asterisk checkout"</span><br><span style="color: hsl(120, 100%, 40%);">+fi</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#</span><br><span style="color: hsl(120, 100%, 40%);">+# Check current working copy</span><br><span style="color: hsl(120, 100%, 40%);">+#</span><br><span style="color: hsl(120, 100%, 40%);">+CHANGES=$(${GIT} status | grep 'modified:' | wc -l)</span><br><span style="color: hsl(120, 100%, 40%);">+if test ${CHANGES} -ne 0; then</span><br><span style="color: hsl(120, 100%, 40%);">+    fail "Asterisk checkout must be clean"</span><br><span style="color: hsl(120, 100%, 40%);">+fi</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+# Verbose, and exit on any command failure</span><br><span style="color: hsl(120, 100%, 40%);">+set -ex</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+AST_VER=$(export GREP; export AWK; ./build_tools/make_version .)</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+# Generate latest ARI documentation</span><br><span style="color: hsl(120, 100%, 40%);">+make ari-stubs</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+# Ensure docs are consistent with the implementation</span><br><span style="color: hsl(120, 100%, 40%);">+CHANGES=$(${GIT} status | grep 'modified:' | wc -l)</span><br><span style="color: hsl(120, 100%, 40%);">+if test ${CHANGES} -ne 0; then</span><br><span style="color: hsl(120, 100%, 40%);">+    fail "Asterisk code out of date compared to the model"</span><br><span style="color: hsl(120, 100%, 40%);">+fi</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+# make ari-stubs may modify the $Revision$ tags in a file; revert the</span><br><span style="color: hsl(120, 100%, 40%);">+# changes</span><br><span style="color: hsl(120, 100%, 40%);">+${GIT} reset --hard</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#</span><br><span style="color: hsl(120, 100%, 40%);">+# Don't publish docs for master. We still want the above validation to ensure</span><br><span style="color: hsl(120, 100%, 40%);">+# that REST API docs are kept up to date.</span><br><span style="color: hsl(120, 100%, 40%);">+#</span><br><span style="color: hsl(120, 100%, 40%);">+if test ${BRANCH_NAME} = 'master'; then</span><br><span style="color: hsl(120, 100%, 40%);">+    exit 0;</span><br><span style="color: hsl(120, 100%, 40%);">+fi</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#</span><br><span style="color: hsl(120, 100%, 40%);">+# Publish the REST API.</span><br><span style="color: hsl(120, 100%, 40%);">+#</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+${OUTPUTDIR}/publish-rest-api.py --username="${CONFLUENCE_USER}" \</span><br><span style="color: hsl(120, 100%, 40%);">+        --verbose \</span><br><span style="color: hsl(120, 100%, 40%);">+        --ast-version="${AST_VER}" \</span><br><span style="color: hsl(120, 100%, 40%);">+        ${CONFLUENCE_URL} \</span><br><span style="color: hsl(120, 100%, 40%);">+        ${CONFLUENCE_SPACE} \</span><br><span style="color: hsl(120, 100%, 40%);">+        "Asterisk ${BRANCH_NAME}"</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+rm -f ${OUTPUTDIR}/full-en_US.xml</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+sudo $ASTERISK ${USER_GROUP:+-U ${USER_GROUP%%:*} -G ${USER_GROUP##*:}} -gn -C $CONFFILE</span><br><span style="color: hsl(120, 100%, 40%);">+for n in `seq 1 5` ; do</span><br><span style="color: hsl(120, 100%, 40%);">+ sleep 3</span><br><span style="color: hsl(120, 100%, 40%);">+       $ASTERISK -rx "core waitfullybooted" -C $CONFFILE && break</span><br><span style="color: hsl(120, 100%, 40%);">+done</span><br><span style="color: hsl(120, 100%, 40%);">+sleep 1</span><br><span style="color: hsl(120, 100%, 40%);">+$ASTERISK -rx "xmldoc dump ${OUTPUTDIR}/asterisk-docs.xml" -C $CONFFILE</span><br><span style="color: hsl(120, 100%, 40%);">+$ASTERISK -rx "core stop now" -C $CONFFILE</span><br><span style="color: hsl(120, 100%, 40%);">+        </span><br><span style="color: hsl(120, 100%, 40%);">+#</span><br><span style="color: hsl(120, 100%, 40%);">+# Set the prefix argument for publishing docs</span><br><span style="color: hsl(120, 100%, 40%);">+#</span><br><span style="color: hsl(120, 100%, 40%);">+PREFIX="Asterisk ${BRANCH_NAME}"</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#</span><br><span style="color: hsl(120, 100%, 40%);">+# Publish XML documentation.</span><br><span style="color: hsl(120, 100%, 40%);">+#</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+# Script assumes that it's running from TOPDIR</span><br><span style="color: hsl(120, 100%, 40%);">+pushd ${OUTPUTDIR}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+./astxml2wiki.py --username="${CONFLUENCE_USER}" \</span><br><span style="color: hsl(120, 100%, 40%);">+    --server=${CONFLUENCE_URL} \</span><br><span style="color: hsl(120, 100%, 40%);">+    --prefix="${PREFIX}" \</span><br><span style="color: hsl(120, 100%, 40%);">+    --space="${CONFLUENCE_SPACE}" \</span><br><span style="color: hsl(120, 100%, 40%);">+    --file=asterisk-docs.xml \</span><br><span style="color: hsl(120, 100%, 40%);">+    --ast-version="${AST_VER}" \</span><br><span style="color: hsl(120, 100%, 40%);">+    -v</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+popd</span><br><span>\ No newline at end of file</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/9529">change 9529</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/9529"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 16 </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I29ba26134e5083bc6788ede235f1a5d4383c148a </div>
<div style="display:none"> Gerrit-Change-Number: 9529 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: George Joseph <gjoseph@digium.com> </div>