From: Stephane Desneux Date: Fri, 7 Dec 2018 00:23:26 +0000 (+0100) Subject: docs: new job for multiversion documentation site X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=commitdiff_plain;h=037ec99552fe522f8196f36a1a6d0f5d056c0ce1;p=ci-management.git docs: new job for multiversion documentation site The generated website has two subfolders and a front page to let use chose between AGL versions: * master * flounder Bug-AGL: SPEC-1993 Change-Id: Ia8edd76f5f8119c2a4f29a2e36113aa2207e6031 Signed-off-by: Stephane Desneux --- diff --git a/jjb/daily-jjb-doc-multiversion-update/daily-jjb-doc-multiversion-update.local.sh b/jjb/daily-jjb-doc-multiversion-update/daily-jjb-doc-multiversion-update.local.sh new file mode 100755 index 00000000..e0fc9ea7 --- /dev/null +++ b/jjb/daily-jjb-doc-multiversion-update/daily-jjb-doc-multiversion-update.local.sh @@ -0,0 +1,50 @@ +#!/bin/bash + +set -e + +# make sure 'node' is in path (debian calls it nodejs) +mkdir -p bin +ln -sf /usr/bin/nodejs bin/node +export PATH=$PATH:`pwd`/bin + +[[ -z "$WORKSPACE" ]] && WORKSPACE=$(pwd -P) +HTDOCS=${HTDOCS:-$WORKSPACE/htdocs} + +. include-doc-multiversion-update.sh + +( sleep 7 ; firefox http://127.0.0.1:8000 ) & + +cd $HTDOCS + +node < {global[m] = require(m);} ); +var port=process.argv[2] || 8000; + +http.createServer(function(request, response) { + var uri=url.parse(request.url).pathname; + var filename=path.join(process.cwd(), uri); + fs.exists(filename,function(exists) { + if(!exists) { + response.writeHead(404, {"Content-Type": "text/plain"}); + response.write("404 Not Found\n"); + response.end(); + return; + } + if (fs.statSync(filename).isDirectory()) filename+='/index.html'; + fs.readFile(filename,"binary",function(err, file) { + if(err) { + response.writeHead(500,{"Content-Type": "text/plain"}); + response.write(err+"\n"); + response.end(); + return; + } + response.writeHead(200); + response.write(file,"binary"); + response.end(); + }); + }); +}).listen(parseInt(port,10)); +console.log("Static file server running at\n => http://localhost:" + port + "/\nCTRL + C to shutdown"); +EOF + diff --git a/jjb/daily-jjb-doc-multiversion-update/daily-jjb-doc-multiversion-update.yaml b/jjb/daily-jjb-doc-multiversion-update/daily-jjb-doc-multiversion-update.yaml new file mode 100644 index 00000000..4c0c0736 --- /dev/null +++ b/jjb/daily-jjb-doc-multiversion-update/daily-jjb-doc-multiversion-update.yaml @@ -0,0 +1,32 @@ +--- +- project: + name: daily-jjb-doc-multiversion + jobs: + - daily-jjb-doc-multiversion-update + +- job-template: + name: 'daily-jjb-doc-multiversion-update' + project-type: freestyle + concurrent: false + node: agl-test-slave + description: "Managed by JJB. Do not Edit. \ +
Build time graph:
" + + build-discarder: + days-to-keep: 30 + num-to-keep: 40 + artifact-days-to-keep: -1 + artifact-num-to-keep: 5 + + triggers: + - timed: '@daily' + + wrappers: + - agl-infra-wrappers: + build-timeout: '{build-timeout}' + + builders: + - shell: + !include-raw-escape: include-doc-multiversion-update.sh + - shell: + !include-raw-escape: include-doc-multiversion-upload.sh diff --git a/jjb/daily-jjb-doc-multiversion-update/include-doc-multiversion-update.sh b/jjb/daily-jjb-doc-multiversion-update/include-doc-multiversion-update.sh new file mode 100644 index 00000000..cb2cef74 --- /dev/null +++ b/jjb/daily-jjb-doc-multiversion-update/include-doc-multiversion-update.sh @@ -0,0 +1,267 @@ +#!/bin/bash +set -e + +# make sure 'node' is in path (debian calls it nodejs) +mkdir -p bin +ln -sf /usr/bin/nodejs bin/node +export PATH=$PATH:`pwd`/bin + +[[ -z "$WORKSPACE" ]] && WORKSPACE=$(pwd -P) +echo "Using workspace $WORKSPACE" +TMPDIR=${TMPDIR:-$WORKSPACE/docs-webtemplate} +HTDOCS=${HTDOCS:-$WORKSPACE/htdocs} +mkdir -p $HTDOCS + +trap "rm -rf $WORKSPACE/setupdocs.sh $TMPDIR" STOP INT QUIT EXIT + +# setupdocs is already imported from automotive-grade-linux/docs-webtemplate +#wget -O $WORKSPACE/setupdocs.sh https://raw.githubusercontent.com/automotive-grade-linux/docs-webtemplate/master/setupdocs.sh +chmod +x $WORKSPACE/setupdocs.sh + +function gensite() { + local branch=${1:-master} + local tmp=$TMPDIR/$branch + + mkdir -p $tmp + + $WORKSPACE/setupdocs.sh -w master -d $tmp + + pushd $tmp + + tocsdir="tocs_$branch" + # exception for master branch to keep aligned with legacy tocs_agl + [[ "$branch" == "master" ]] && tocsdir="tocs" + + sed -i "s|^baseurl:.*$|baseurl: \"/$branch\"|g" conf/_dev.yml + sed -i "s|^docsurl:.*$|docsurl: \"/$branch/docs\"|g" conf/_config.yml + cat <<-EOF >>conf/AppDefaults.js + config.TOCS_DIR="$PWD/content/$tocsdir"; + config.AGL_GERRIT_BRANCH="$branch"; + config.AGL_GITHUB_BRANCH="$branch"; + EOF + + navbarColor="#222" + typeDocStr="master branch" + if [ "$branch" == "flounder" ]; then + navbarColor="darkslategray" + typeDocStr="Flounder release" + fi + + git apply < + +-