Add native Zuul v3 manila image elements jobs

Replace the auto-converted legacy jobs with native jobs
and define all the jobs in-tree.  After we merge this we
can remove the legacy-manila-publish-generic job from the
openstack-zuul-jobs repository.

Note that the old job apparently relied on some JJB magic
to construct tagged-image names.  This no longer works so
instead we use 'git describe --tags' to obtain a current
tag, publish the image with its tagged name, and symlink
manila-service-image-master.qcow2 -- which is the expected
image-name for our CI jobs -- to it.

Unfortunately the new publish job can't be tested
beforehand so we may have to follow this with another
patch if there are issues.

Closes-Bug: #1812478
Change-Id: Ie0c367591c0e1ae4fefb62688ecd76aff5b94464
This commit is contained in:
Tom Barron 2019-01-18 12:36:48 -05:00
parent 53b7969bb5
commit ee41dc68a8
4 changed files with 87 additions and 105 deletions

View File

@ -1,15 +1,3 @@
- job:
name: manila-image-elements-buildimage-docker
parent: legacy-base
run: playbooks/manila-buildimage-docker/run.yaml
timeout: 1800
- job:
name: manila-image-elements-buildimage-generic
parent: legacy-base
run: playbooks/manila-buildimage-generic/run.yaml
timeout: 1800
- project:
templates:
- check-requirements
@ -37,4 +25,38 @@
- manila-image-elements-buildimage-generic
post:
jobs:
- legacy-manila-publishimage-generic
- manila-image-elements-publish-artifacts
- job:
name: manila-image-elements-buildimage-docker
description: |
Build docker image for the "container" manila back end.
parent: unittests
timeout: 1800
required-projects:
- openstack/manila-image-elements
run: playbooks/manila-buildimage-docker/run.yaml
- job:
name: manila-image-elements-buildimage-generic
description: |
Build service image for the "generic" manila back end.
parent: unittests
timeout: 1800
required-projects:
- openstack/manila-image-elements
run: playbooks/manila-buildimage-generic/run.yaml
- job:
name: manila-image-elements-publish-artifacts
description: |
Build image artifacts and publish to tarballs.openstack.org
parent: publish-openstack-artifacts
timeout: 3600
final: true
required-projects:
- openstack/manila-image-elements
run: playbooks/manila-buildimage-generic/run.yaml
post-run: playbooks/manila-publish-artifacts/post.yaml

View File

@ -1,49 +1,6 @@
- hosts: all
name: Autoconverted job legacy-manila-buildimage-docker from old job gate-manila-buildimage-docker-ubuntu-xenial
roles:
- bindep
tasks:
- name: Ensure legacy workspace directory
file:
path: '{{ ansible_user_dir }}/workspace'
state: directory
- shell:
cmd: |
set -e
set -x
CLONEMAP=`mktemp`
function cleanup {
# In cases where zuul-cloner is aborted during a git
# clone operation, git will remove the git work tree in
# its cleanup. The work tree in these jobs is the
# workspace directory, which means that subsequent
# jenkins post-build actions can not run because the
# workspace has been removed.
# To reduce the likelihood of this having an impact,
# recreate the workspace directory if needed
mkdir -p $WORKSPACE
rm -f $CLONEMAP
}
trap cleanup EXIT
cat > $CLONEMAP << EOF
clonemap:
- name: $ZUUL_PROJECT
dest: .
EOF
/usr/zuul-env/bin/zuul-cloner -m $CLONEMAP --cache-dir /opt/git \
git://git.openstack.org $ZUUL_PROJECT
executable: /bin/bash
chdir: '{{ ansible_user_dir }}/workspace'
environment: '{{ zuul | zuul_legacy_vars }}'
- shell:
cmd: |
set -e
set -x
./tools/gate/build-images docker
executable: /bin/bash
chdir: '{{ ansible_user_dir }}/workspace'
environment: '{{ zuul | zuul_legacy_vars }}'
- name: Run tools/gate/build-images docker
command: bash -xe tools/gate/build-images docker
args:
chdir: '{{ zuul.project.src_dir }}'

View File

@ -1,49 +1,39 @@
- hosts: all
name: Autoconverted job legacy-manila-buildimage-generic from old job gate-manila-buildimage-generic-ubuntu-xenial
roles:
- bindep
tasks:
- name: Ensure legacy workspace directory
- name: Run tools/gate/build-images generic
command: bash -xe tools/gate/build-images generic
args:
chdir: '{{ zuul.project.src_dir }}'
- name: create images directory
file:
path: '{{ ansible_user_dir }}/workspace'
path: '{{ zuul.project.src_dir }}/images'
state: directory
- shell:
cmd: |
set -e
set -x
CLONEMAP=`mktemp`
function cleanup {
# In cases where zuul-cloner is aborted during a git
# clone operation, git will remove the git work tree in
# its cleanup. The work tree in these jobs is the
# workspace directory, which means that subsequent
# jenkins post-build actions can not run because the
# workspace has been removed.
# To reduce the likelihood of this having an impact,
# recreate the workspace directory if needed
mkdir -p $WORKSPACE
rm -f $CLONEMAP
}
trap cleanup EXIT
cat > $CLONEMAP << EOF
clonemap:
- name: $ZUUL_PROJECT
dest: .
EOF
/usr/zuul-env/bin/zuul-cloner -m $CLONEMAP --cache-dir /opt/git \
git://git.openstack.org $ZUUL_PROJECT
executable: /bin/bash
chdir: '{{ ansible_user_dir }}/workspace'
environment: '{{ zuul | zuul_legacy_vars }}'
- shell:
cmd: |
set -e
set -x
./tools/gate/build-images generic
executable: /bin/bash
chdir: '{{ ansible_user_dir }}/workspace'
environment: '{{ zuul | zuul_legacy_vars }}'
mode: 0755
- name: Collect git tag
command: git describe --tags
args:
chdir: '{{ zuul.project.src_dir }}'
register: tagoutput
- name: show directory contents after the build
command: ls -lrt
args:
chdir: '{{ zuul.project.src_dir }}'
- name: get the source directory
command: pwd
args:
chdir: '{{ zuul.project.src_dir }}'
register: src_dir
- name: hard link to image from images directory using tag
file:
src: '{{ src_dir.stdout }}/manila-service-image.qcow2'
dest: '{{ src_dir.stdout }}/images/manila-service-image-{{ tagoutput.stdout }}.qcow2'
state: hard
- name: now symlink using "master" in place of tag
file:
src: '{{ src_dir.stdout }}/images/manila-service-image-{{ tagoutput.stdout }}.qcow2'
dest: '{{ src_dir.stdout }}/images/manila-service-image-master.qcow2'
state: link
- name: show contents of the image directory
command: ls -lrt
args:
chdir: '{{ src_dir.stdout }}/images'

View File

@ -0,0 +1,13 @@
- hosts: all
name: Copy artifacts
tasks:
- synchronize:
dest: "{{ zuul.executor.work_root }}/artifacts/images/"
mode: pull
src: "{{ zuul.project.src_dir }}/images/"
copy_links: true
verify_host: true
rsync_opts:
- --filter=P, *.qcow2
- --include=**
- --delete