project-config/jenkins/jobs/openstack-publish-jobs.yaml
Doug Hellmann f163f0ce9f define a unified project documentation build job
This new job will be used after we migrate the content from the
openstack-manuals repo into project trees.

Change-Id: Icfe74c1f9eabe50bbf6fe686c2e948fceca135cb
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2017-06-07 17:45:36 -04:00

198 lines
6.2 KiB
YAML

- job-template:
name: '{name}-docs-{node}'
node: '{node}'
builders:
- print-template-name:
template-name: "{template-name}"
- zuul-release-git-prep-upper-constraints
- install-distro-packages
- revoke-sudo
- docs
publishers:
- afs:
site: afs-docs
source: 'doc/build/html/**'
target: 'developer/{name}'
remove-prefix: 'doc/build/html'
- console-log
- job-template:
name: '{name}-docs-unified-{node}'
node: '{node}'
builders:
- print-template-name:
template-name: "{template-name}"
- zuul-release-git-prep-upper-constraints
- install-distro-packages
- revoke-sudo
- docs
- add-docs-root-marker:
docsrootdir: 'doc/build/html'
- shell: |
#!/bin/bash -x
if [[ $ZUUL_REFNAME =~ ^refs/tags/ ]]; then
# We need to determine the branch by looking to see
# where the tag exists. A tag can be on more than one
# branch, especially if the tag is applied and then the
# stable branch is created as we do in our normal stable
# branch creation process. If we get any stable
# branches, use the most recent one (assuming
# alphabetical ordering). If we do not see master, use
# whatever name we do see and let the logic below
# trigger an abort if we shouldn't be publishing.
refname=$(echo $ZUUL_REFNAME | cut -d/ -f2-)
git branch --contains $refname > branches.txt
if grep -q stable/ branches.txt; then
branch_name=$(grep stable/ branches.txt | sort | tail -n 1)
elif ! grep -q master branches.txt; then
branch_name=$(cat branches.txt | sort | tail -n 1)
else
branch_name=master
fi
else
# If the ref wasn't a tag, assume it is a branch.
branch_name=$ZUUL_REFNAME
fi
# When building from master we want to publish to the
# "latest" directory. When building from a stable branch, we
# want to publish to a directory using that branch base
# name. Building from other branches is an error.
if [[ $branch_name = master ]]; then
publish_name=latest
elif [[ $branch_name =~ stable/ ]]; then
publish_name=$(basename $branch_name)
elif [[ $branch_name =~ feature/ ]]; then
echo "Docs should not be published for feature branches"
exit 1
elif [[ $branch_name =~ driverfixes/ ]]; then
echo "Docs should not be published for feature branches"
exit 1
else
# What is this even?
echo "Could not determine publishing location for branch_name $branch_name"
exit 1
fi
# Rearrange the build output to reflect the end publishing
# location, so we can use doc/publish as the source for the
# publisher step.
mkdir -p doc/publish
mv doc/build/html doc/publish/$publish_name
publishers:
- afs:
site: afs-docs
source: 'doc/publish/**'
target: '{name}'
remove-prefix: 'doc/publish'
- console-log
- job-template:
name: '{name}-docs-tags-only'
description: Publish infra documents, use when only publish on tag
node: ubuntu-xenial
builders:
- print-template-name:
template-name: "{template-name}"
- zuul-release-git-prep-upper-constraints
- install-distro-packages
- revoke-sudo
- docs-tags-only-env:
env: venv
publishers:
- afs:
site: afs-docs
source: 'doc/build/html/**'
target: 'developer/{name}'
remove-prefix: 'doc/build/html'
- console-log
# Publish releasenotes to docs.openstack.org/releasenotes/. This is
# always published from master branch.
- job-template:
name: '{name}-releasenotes'
node: ubuntu-xenial
builders:
- print-template-name:
template-name: "{template-name}"
- zuul-git-branch-prep-upper-constraints:
branch: master
- install-distro-packages
- revoke-sudo
- shell: |
#!/bin/bash -xe
#
# When building the release notes after a patch merges we
# always want to build from master. Reno will find release
# notes on other branches and insert them into the right
# places in the documentation build, but only master has all
# of the appropriate branch-specific input files for
# Sphinx. The zuul-git-branch-prep builder checks out the
# repository where the current patch just merged, but it
# honors zuul configuration variables that may cause it to
# check out a patch merged into a stable branch. So, reset
# what we've checked out to master.
#
git checkout origin/master
- shell:
!include-raw-escape: include/build-releasenotes.sh
- add-docs-root-marker:
docsrootdir: releasenotes/build/html
publishers:
- afs:
site: afs-docs
source: 'releasenotes/build/html/**'
target: 'releasenotes/{name}'
remove-prefix: 'releasenotes/build/html'
- console-log
- job-template:
name: 'gate-{name}-releasenotes'
node: ubuntu-xenial
builders:
- print-template-name:
template-name: "{template-name}"
- zuul-git-prep-upper-constraints:
- install-distro-packages
- revoke-sudo
- shell:
!include-raw-escape: include/build-releasenotes.sh
publishers:
- upload-releasenotes-draft
- console-log
- job-group:
name: openstack-publish-jobs
jobs:
- '{name}-docs-{node}'
- '{name}-docs-unified-{node}'
node:
- ubuntu-trusty
- ubuntu-xenial
- job-group:
name: openstack-client-publish-jobs
jobs:
- '{name}-docs-tags-only'
- job-group:
name: openstack-releasenotes-jobs
jobs:
- 'gate-{name}-releasenotes'
- '{name}-releasenotes'