Merge "Update to using zuulv3 variables"

This commit is contained in:
Zuul 2017-09-06 02:13:33 +00:00 committed by Gerrit Code Review
commit 294d778ce8
8 changed files with 73 additions and 64 deletions

View File

@ -1,3 +1,3 @@
- hosts: all
roles:
- prepare-docs-for-afs
- prepare-infra-docs-for-afs

View File

@ -1,62 +0,0 @@
- name: Process built docs to prepare for AFS publication
args:
chdir: "{{ zuul_work_dir }}"
executable: /bin/bash
shell: |
set -ex
tags_handling=${2:both}
MARKER_TEXT="Project: $ZUUL_PROJECT Ref: $ZUUL_REFNAME Build: $ZUUL_UUID Revision: $ZUUL_NEWREV"
echo $MARKER_TEXT > doc/build/html/.root-marker
if [ -z "$ZUUL_REFNAME" ] || [ "$ZUUL_REFNAME" == "master" ] ; then
: # Leave the docs where they are.
elif echo $ZUUL_REFNAME | grep refs/tags/ >/dev/null ; then
# 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 Jenkins copies this file the root developer
# docs are always the latest release with older tags available under the
# root in the tagname dir.
TAG=$(echo $ZUUL_REFNAME | sed 's/refs.tags.//')
if [ ! -z $TAG ] ; then
# 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.
LATEST=$(git tag | sed -n -e '/^20[0-9]\{2\}\..*$/d' -e '/^[0-9]\+\(\.[0-9]\+\)*$/p' | sort -V | tail -1)
# 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.
if [ "$tags_handling" = "tags-only" -a "$TAG" = "$LATEST" ] ; then
# Copy the docs into a subdir if this is a tagged build
mkdir doc/build/$TAG
cp -R doc/build/html/. doc/build/$TAG
mv doc/build/$TAG doc/build/html/$TAG
else
# Move the docs into a subdir if this is a tagged build
mv doc/build/html doc/build/tmp
mkdir doc/build/html
mv doc/build/tmp doc/build/html/$TAG
fi
fi
elif echo $ZUUL_REFNAME | grep stable/ >/dev/null ; then
# Put stable release changes in dir named after stable release under the
# build dir. When Jenkins copies these files they will be accessible under
# the developer docs root using the stable release name.
BRANCH=$(echo $ZUUL_REFNAME | sed 's/stable.//')
if [ ! -z $BRANCH ] ; then
# 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/$BRANCH
fi
else
# Put other branch changes in dir named after branch under the
# build dir. When Jenkins copies these files they will be
# accessible under the developer docs root using the branch name.
# EG: feature/foo or milestone-proposed
BRANCH=$ZUUL_REFNAME
TOP=`dirname $BRANCH`
mv doc/build/html doc/build/tmp
mkdir -p doc/build/html/$TOP
mv doc/build/tmp doc/build/html/$BRANCH
fi

View File

@ -0,0 +1 @@
Prepare built openstack-infra docs to be published to the OpenStack AFS cell.

View File

@ -1,2 +1 @@
---
zuul_work_dir: "src/{{ zuul.project.canonical_name }}"

View File

@ -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

View File

@ -0,0 +1,16 @@
- 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"

View File

@ -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

View File

@ -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