From 53e9722b0b1e1d6ff804aa2331f91510404b90d0 Mon Sep 17 00:00:00 2001 From: annegentle Date: Thu, 30 Aug 2012 14:35:23 -0500 Subject: [PATCH] Adds a markdown to docbook script. Patch set 3 makes the jobname the filename and adds a second job for building the programming api mdown book. Patch set 4 corrects the job name to match the file name. Patch set 5 renames the .sh.save file and adds it to the job builders. Patch set 6 addresses final comments - appending to the gerrit-doc.properties file and removes tabs. Patch set 7 addresses comments. Would like to continue work on markdown to docbook and delay work on the properties script if possible. Patch set 8 removes docbook-properties as a prebuilder and removes DOC_OPERATING_SYSTEM as a variable. Rebase against master also. Updates macros.yaml and manuals.yaml to pass in filename for markdown files. Adds properties injection to the markdown to docbook jobs. Removes extraenous tab from modules/openstack_project/files/zuul/layout.yaml Additional fixes to pass in filename correctly and remove DOC_OPERATING_SYSTEM, fix filname typo. Removes file extension from markdown files, removes echo to gerrit-doc-properties from markdown-docbook script. Removes docbook-properties builder references as needed. Change-Id: I46c07cd11e96e8fc463a377519926a43981e4b3d Reviewed-on: https://review.openstack.org/12214 Reviewed-by: James E. Blair Reviewed-by: Monty Taylor Reviewed-by: Clark Boylan Approved: Clark Boylan Tested-by: Jenkins --- .../files/slave_scripts/markdown-docbook.sh | 19 +++++ .../files/slave_scripts/docbook-properties.sh | 29 +++++++ .../jenkins_job_builder/config/macros.yaml | 5 ++ .../jenkins_job_builder/config/manuals.yaml | 80 +++++++++++++++++++ .../openstack_project/files/zuul/layout.yaml | 5 ++ 5 files changed, 138 insertions(+) create mode 100755 modules/jenkins/files/slave_scripts/markdown-docbook.sh create mode 100644 modules/jenkins_slave/files/slave_scripts/docbook-properties.sh diff --git a/modules/jenkins/files/slave_scripts/markdown-docbook.sh b/modules/jenkins/files/slave_scripts/markdown-docbook.sh new file mode 100755 index 0000000000..f061be0428 --- /dev/null +++ b/modules/jenkins/files/slave_scripts/markdown-docbook.sh @@ -0,0 +1,19 @@ +#!/bin/bash -e + +# Documentation can be submitted in markdown and then converted to docbook +# so it can be built with the maven plugin. This is used by Jenkins when +# invoking certain docs jobs and the resulting output is made available to maven. + +# In case we start doing something more sophisticated with other refs +# later (such as tags). +BRANCH=$ZUUL_REFNAME +shopt -s extglob + +# Need to get the file name to insert here so it can be reused for multiple projects +# Filenames for the known repos that could do this are openstackapi-programming.mdown +# and images-api-v2.0.md and openstackapi-programming and images-api-v2.0 are the names +# for the ID and xml filename. +FILENAME=$1 +pandoc -f markdown -t docbook -s ${FILENAME}.@(md|mdown) | xsltproc -o - /usr/share/xml/docbook/stylesheet/docbook5/db4-upgrade.xsl - | xmllint --format - | sed -e 's,, > $FILENAME.xml' + +pwd diff --git a/modules/jenkins_slave/files/slave_scripts/docbook-properties.sh b/modules/jenkins_slave/files/slave_scripts/docbook-properties.sh new file mode 100644 index 0000000000..d94f665598 --- /dev/null +++ b/modules/jenkins_slave/files/slave_scripts/docbook-properties.sh @@ -0,0 +1,29 @@ +#!/bin/bash -e + +# Documentation is published to a URL depending on the branch of the +# openstack-manuals project. This script determines what that location +# should be, and writes a properties file. This is used by Jenkins when +# invoking certain docs jobs and made available to maven. + +# In case we start doing something more sophisticated with other refs +# later (such as tags). +BRANCH=$GERRIT_REFNAME + +# The master branch should get published to /trunk +if [ $BRANCH == "master" ] +then + DOC_RELEASE_PATH="trunk" + DOC_COMMENTS_ENABLED=0 +fi + +# The stable/ branch should get published to /releasename, such as diablo or essex +if [[ $BRANCH =~ ^stable/(.*)$ ]] +then + DOC_RELEASE_PATH=${BASH_REMATCH[1]} + DOC_COMMENTS_ENABLED=1 +fi + +echo "DOC_RELEASE_PATH=$DOC_RELEASE_PATH" >gerrit-doc.properties +echo "DOC_COMMENTS_ENABLED=$DOC_COMMENTS_ENABLED" >>gerrit-doc.properties + +pwd diff --git a/modules/openstack_project/files/jenkins_job_builder/config/macros.yaml b/modules/openstack_project/files/jenkins_job_builder/config/macros.yaml index c6e888bd23..92c6a57ad3 100644 --- a/modules/openstack_project/files/jenkins_job_builder/config/macros.yaml +++ b/modules/openstack_project/files/jenkins_job_builder/config/macros.yaml @@ -23,6 +23,11 @@ builders: - shell: "mvn package" +- builder: + name: markdown-docbook + builders: + - shell: "/usr/local/jenkins/slave_scripts/markdown-docbook.sh {filename}" + - builder: name: gerrit-package builders: diff --git a/modules/openstack_project/files/jenkins_job_builder/config/manuals.yaml b/modules/openstack_project/files/jenkins_job_builder/config/manuals.yaml index 44b21cfba8..91ae9196e9 100644 --- a/modules/openstack_project/files/jenkins_job_builder/config/manuals.yaml +++ b/modules/openstack_project/files/jenkins_job_builder/config/manuals.yaml @@ -84,3 +84,83 @@ target: 'api/openstack-volume/1.0/' remove-prefix: 'doc/target/docbkx/webhelp/volume-api-1.0/volume-api-guide/' excludes: '**/*.xml,**/null*' + +- job: + name: images-api-v20 + project-type: maven + concurrent: true + node: precise + + wrappers: + - timeout: + timeout: 40 + fail: true + + triggers: + - zuul-post + + prebuilders: + - gerrit-git-prep + - markdown-docbook + filename: "images-api-v2.0" + + properties: + - inject: + script-file: /usr/local/jenkins/slave_scripts/docbook-properties.sh + properties-file: gerrit-doc.properties + + maven: + root-module: + group-id: org.openstack.docs + artifact-id: openstack-guide + root-pom: openstack-image-service-api/pom.xml + goals: 'clean generate-sources' + + publishers: + - console-log-post + - ftp: + site: docs.openstack.org + source: 'doc/target/docbkx/webhelp/images-api-2.0/**' + target: 'api/openstack-image-service/2.0/' + remove-prefix: 'doc/target/docbkx/webhelp/images-api-2.0/' + excludes: '**/*.xml,**/null*' + +- job: + name: openstackapi-programming + project-type: maven + concurrent: true + node: precise + + wrappers: + - timeout: + timeout: 40 + fail: true + + triggers: + - zuul-post + + prebuilders: + - gerrit-git-prep + - markdown-docbook + filename: "openstackapi-programming" + + properties: + - inject: + script-file: /usr/local/jenkins/slave_scripts/docbook-properties.sh + properties-file: gerrit-doc.properties + + maven: + root-module: + group-id: org.openstack.docs + artifact-id: openstack-guide + root-pom: doc/src/docbkx/openstack-api-programming/pom.xml + goals: 'clean generate-sources' + + publishers: + - console-log-post + - ftp: + site: docs.openstack.org + source: 'doc/target/docbkx/webhelp/openstack-api-programming/**' + target: 'api/openstack-compute/programmer/' + remove-prefix: 'doc/target/docbkx/webhelp/openstack-api-programming/' + excludes: '**/*.xml,**/null*' diff --git a/modules/openstack_project/files/zuul/layout.yaml b/modules/openstack_project/files/zuul/layout.yaml index 78e940dbf6..389668d7e1 100644 --- a/modules/openstack_project/files/zuul/layout.yaml +++ b/modules/openstack_project/files/zuul/layout.yaml @@ -663,3 +663,8 @@ projects: - gate-volume-api-merge post: - volume-api + + - name: openstack/image-api + post: + - images-api-v20 +