Add prepare-docs-for-afs role
We'll use this role for unified openstack docs publishing. Change-Id: I879d42cd04ab051b91c0b636856470cd4126b6f2 Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
parent
294d778ce8
commit
118b928e26
|
@ -0,0 +1 @@
|
|||
Prepare built openstack docs to be published to the OpenStack AFS cell.
|
|
@ -0,0 +1 @@
|
|||
zuul_work_dir: "src/{{ zuul.project.canonical_name }}"
|
|
@ -0,0 +1,12 @@
|
|||
- name: Process other branch changes
|
||||
args:
|
||||
chdir: "{{ zuul_work_dir }}"
|
||||
# Put other branch changes in dir named after branch under the
|
||||
# build dir. When Zuul copies these files they will be
|
||||
# accessible under the developer docs root using the branch name.
|
||||
# EG: feature/foo or milestone-proposed
|
||||
shell: |
|
||||
mv doc/build/html doc/build/tmp
|
||||
mkdir -p doc/build/html/{{ zuul.branch | dirname }}
|
||||
mv doc/build/tmp doc/build/html/{{ zuul.branch | basename }}
|
||||
tags: skip_ansible_lint
|
|
@ -0,0 +1,68 @@
|
|||
- name: Write marker text
|
||||
copy:
|
||||
dest: "{{ zuul_work_dir }}/doc/build/html/.root-marker"
|
||||
content: "Project: {{ zuul.project.name }} Branch: {{ zuul.branch }} Build: {{ zuul.build }} Revision: {{ zuul.ref }}"
|
||||
|
||||
- name: Process tagged build
|
||||
include: tagged.yaml
|
||||
when: "zuul.branch != 'master' and zuul.tag is defined"
|
||||
|
||||
- name: Process stable branch build
|
||||
include: stable.yaml
|
||||
when: "'stable' in zuul.branch and zuul.tag is not defined"
|
||||
|
||||
- name: Process branch build
|
||||
include: branch.yaml
|
||||
when: "zuul.branch != 'master' and 'stable' not in zuul.branch and zuul.tag is not defined"
|
||||
|
||||
- name: Rearrange publish directories
|
||||
args:
|
||||
executablke: /bin/bash
|
||||
shell: |
|
||||
set -xe
|
||||
if [[ {{ zuul.ref }} =~ ^refs/tags/ ]]; then
|
||||
# This job should not be configured to run for
|
||||
# pre-releases, so if we have a tag we want to use it as
|
||||
# the publishing location.
|
||||
tag=$(echo {{ zuul.ref }} | cut -d/ -f3-)
|
||||
branch_name=""
|
||||
else
|
||||
# If the ref wasn't a tag, assume it is a branch.
|
||||
branch_name={{ zuul.branch }}
|
||||
tag=""
|
||||
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
|
||||
if [[ ! -z "$tag" ]]; then
|
||||
# run-docs.sh will have already moved the content inside
|
||||
# a directory named for the tag, so we move that
|
||||
# directory to the publish location.
|
||||
mv doc/build/html/$tag doc/publish/
|
||||
mv doc/build/.root-marker doc/publish/$tag/
|
||||
elif [[ $branch_name = master ]]; then
|
||||
# run-docs.sh does not rename the output directory, but
|
||||
# we want it to be called "latest".
|
||||
mv doc/build/html doc/publish/latest
|
||||
mv doc/build/.root-marker doc/publish/latest/
|
||||
elif [[ $branch_name =~ stable/ ]]; then
|
||||
# run-docs.sh will have already moved the content inside
|
||||
# a directory named for the branch, so move that to the
|
||||
# publish location.
|
||||
mv doc/build/html/$(basename $branch_name) doc/publish/
|
||||
mv doc/build/.root-marker doc/publish/$(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
|
||||
# Move back into doc/build/html for artifact publisher.
|
||||
rm -rf doc/build/html
|
||||
mv doc/publish doc/build/html
|
|
@ -0,0 +1,12 @@
|
|||
- name: Process stable branch changes
|
||||
args:
|
||||
chdir: "{{ zuul_work_dir }}"
|
||||
# Put stable release changes in dir named after stable release under the
|
||||
# build dir. When Zuul copies these files they will be accessible under
|
||||
# the developer docs root using the stable release name.
|
||||
shell: |
|
||||
# Move the docs into a subdir if this is a stable branch build
|
||||
mv doc/build/html doc/build/tmp
|
||||
mkdir doc/build/html
|
||||
mv doc/build/tmp doc/build/html/{{ zuul.branch | replace('stable/', '') }}
|
||||
tags: skip_ansible_lint
|
|
@ -0,0 +1,31 @@
|
|||
- name: Get latest tag for project
|
||||
args:
|
||||
chdir: "{{ zuul_work_dir }}"
|
||||
executable: /bin/bash
|
||||
# This is a hack to ignore the year.release tags in projects since
|
||||
# now all projects use semver based versions instead of date based
|
||||
# versions. The date versions will sort higher even though they
|
||||
# should not so we just special case it here.
|
||||
shell: |
|
||||
git tag | sed -n -e '/^20[0-9]\{2\}\..*$/d' -e '/^[0-9]\+\(\.[0-9]\+\)*$/p' | sort -V | tail -1
|
||||
register: latest
|
||||
tags: skip_ansible_lint
|
||||
|
||||
# Put tagged releases in proper location. All tagged builds get copied to
|
||||
# BUILD_DIR/tagname. If this is the latest tagged release the copy of files
|
||||
# at BUILD_DIR remains. When Zuul copies this file the root developer
|
||||
# docs are always the latest release with older tags available under the
|
||||
# root in the tagname dir.
|
||||
|
||||
- name: Process tags only builds when the tag is the latest tag
|
||||
args:
|
||||
chdir: "{{ zuul_work_dir }}"
|
||||
# Now publish to / and /$TAG if this is the latest version for projects
|
||||
# and we are only publishing from the release pipeline,
|
||||
# or just /$TAG otherwise.
|
||||
shell: |
|
||||
# Copy the docs into a subdir if this is a tagged build
|
||||
mkdir doc/build/{{ zuul.tag }}
|
||||
cp -R doc/build/html/. doc/build/{{ zuul.tag }}
|
||||
mv doc/build/{{ zuul.tag }} doc/build/html/{{ zuul.tag }}
|
||||
tags: skip_ansible_lint
|
Loading…
Reference in New Issue