Modify job to build images
We currently only build the generic driver image with the job "manila-image-elements-buildimage-generic". Since we'd like to use a cephfs based client image, we can reuse the job to produce two images instead of one. The new job "manila-image-elements-buildimages" produces two images: "manila-service-image-cephfs-{tag}.qcow2" and "manila-service-image-{tag}.qcow2"; where the tag corresponds to the version of this project. The job also creates a soft link of the tagged images with a "-master" suffix instead of the tag - this is useful for CI jobs that don't need to worry about changing/using the latest tag. Change-Id: I60c6b38b5d5de7649c0d760519a79288fafca1e3 Signed-off-by: Goutham Pacha Ravi <gouthampravi@gmail.com>
This commit is contained in:
parent
c127687d3d
commit
a833b762d7
15
.zuul.yaml
15
.zuul.yaml
@ -6,7 +6,7 @@
|
|||||||
check:
|
check:
|
||||||
jobs:
|
jobs:
|
||||||
- openstack-tox-pep8
|
- openstack-tox-pep8
|
||||||
- manila-image-elements-buildimage-generic
|
- manila-image-elements-buildimages
|
||||||
- manila-image-elements-buildimage-docker:
|
- manila-image-elements-buildimage-docker:
|
||||||
voting: false
|
voting: false
|
||||||
- manila-tempest-dsvm-container-scenario-custom-image:
|
- manila-tempest-dsvm-container-scenario-custom-image:
|
||||||
@ -22,7 +22,7 @@
|
|||||||
gate:
|
gate:
|
||||||
jobs:
|
jobs:
|
||||||
- openstack-tox-pep8
|
- openstack-tox-pep8
|
||||||
- manila-image-elements-buildimage-generic
|
- manila-image-elements-buildimages
|
||||||
post:
|
post:
|
||||||
jobs:
|
jobs:
|
||||||
- manila-image-elements-publish-artifacts
|
- manila-image-elements-publish-artifacts
|
||||||
@ -38,14 +38,15 @@
|
|||||||
run: playbooks/manila-buildimage-docker/run.yaml
|
run: playbooks/manila-buildimage-docker/run.yaml
|
||||||
|
|
||||||
- job:
|
- job:
|
||||||
name: manila-image-elements-buildimage-generic
|
name: manila-image-elements-buildimages
|
||||||
description: |
|
description: |
|
||||||
Build service image for the "generic" manila back end.
|
Build service image for the "generic" manila back end, and any other
|
||||||
|
images specified in the role "build-mie-images"
|
||||||
parent: unittests
|
parent: unittests
|
||||||
timeout: 1800
|
timeout: 1800
|
||||||
required-projects:
|
required-projects:
|
||||||
- openstack/manila-image-elements
|
- openstack/manila-image-elements
|
||||||
run: playbooks/manila-buildimage-generic/run.yaml
|
run: playbooks/manila-buildimages/run.yaml
|
||||||
|
|
||||||
- job:
|
- job:
|
||||||
name: manila-image-elements-publish-artifacts
|
name: manila-image-elements-publish-artifacts
|
||||||
@ -56,7 +57,5 @@
|
|||||||
final: true
|
final: true
|
||||||
required-projects:
|
required-projects:
|
||||||
- openstack/manila-image-elements
|
- openstack/manila-image-elements
|
||||||
run: playbooks/manila-buildimage-generic/run.yaml
|
run: playbooks/manila-buildimages/run.yaml
|
||||||
post-run: playbooks/manila-publish-artifacts/post.yaml
|
post-run: playbooks/manila-publish-artifacts/post.yaml
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,39 +0,0 @@
|
|||||||
- hosts: all
|
|
||||||
tasks:
|
|
||||||
- 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: '{{ zuul.project.src_dir }}/images'
|
|
||||||
state: directory
|
|
||||||
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'
|
|
3
playbooks/manila-buildimages/run.yaml
Normal file
3
playbooks/manila-buildimages/run.yaml
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
- hosts: all
|
||||||
|
roles:
|
||||||
|
- build-mie-images
|
14
roles/build-mie-images/README.rst
Normal file
14
roles/build-mie-images/README.rst
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
build-mie-images
|
||||||
|
================
|
||||||
|
|
||||||
|
An ansible role to build images with manila-image-elements
|
||||||
|
|
||||||
|
Role Variables
|
||||||
|
--------------
|
||||||
|
|
||||||
|
.. zuul:rolevar:: images_to_build
|
||||||
|
:type: list
|
||||||
|
:default: ['generic', 'cephfs']
|
||||||
|
|
||||||
|
|
||||||
|
One or more image types to build.
|
4
roles/build-mie-images/defaults/main.yml
Normal file
4
roles/build-mie-images/defaults/main.yml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
images_to_build:
|
||||||
|
- cephfs
|
||||||
|
- generic
|
53
roles/build-mie-images/tasks/main.yml
Normal file
53
roles/build-mie-images/tasks/main.yml
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
---
|
||||||
|
- name: build the requested images
|
||||||
|
command: bash -xe tools/gate/build-images {{ item }}
|
||||||
|
args:
|
||||||
|
chdir: "{{ zuul.project.src_dir }}"
|
||||||
|
with_items: "{{ images_to_build }}"
|
||||||
|
- name: create images directory
|
||||||
|
file:
|
||||||
|
path: "{{ zuul.project.src_dir }}/images"
|
||||||
|
state: directory
|
||||||
|
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: grab all images built
|
||||||
|
find:
|
||||||
|
paths: "{{ src_dir.stdout }}"
|
||||||
|
patterns: '*.qcow2'
|
||||||
|
file_type: file
|
||||||
|
register: images_built
|
||||||
|
- name: hard link images into the images directory using the git tag
|
||||||
|
file:
|
||||||
|
src: "{{ item.path }}"
|
||||||
|
dest: "{{ src_dir.stdout }}/images/{{ item.path | basename | splitext | first }}-{{ tagoutput.stdout }}.qcow2"
|
||||||
|
state: hard
|
||||||
|
with_items: "{{ images_built.files }}"
|
||||||
|
- name: grab the tagged images
|
||||||
|
find:
|
||||||
|
paths: "{{ src_dir.stdout }}/images"
|
||||||
|
patterns: "*.qcow2"
|
||||||
|
file_type: file
|
||||||
|
register: images_tagged
|
||||||
|
- name: create "master" symlinks for these images
|
||||||
|
file:
|
||||||
|
src: "{{ item.path }}"
|
||||||
|
dest: "{{ src_dir.stdout }}/images/{{ item.path | basename | regex_replace('\\d+.*qcow2', 'master.qcow2') }}"
|
||||||
|
state: link
|
||||||
|
with_items: "{{ images_tagged.files }}"
|
||||||
|
- name: get contents of the images directory
|
||||||
|
command: ls -lrt
|
||||||
|
args:
|
||||||
|
chdir: "{{ zuul.project.src_dir }}/images/"
|
10
tools/gate/build-images
Executable file → Normal file
10
tools/gate/build-images
Executable file → Normal file
@ -1,7 +1,9 @@
|
|||||||
#!/bin/bash -xe
|
#!/bin/bash -xe
|
||||||
|
|
||||||
# Argument is expected to be type of image - either 'generic' or
|
# Argument is expected to be type of image. Use 'generic' to build an image
|
||||||
# 'docker'.
|
# with NFS and CIFS for use with Manila's Generic driver. Or specify a
|
||||||
|
# protocol (ex: cephfs) to build an image with protocol specific packages,
|
||||||
|
# or use "docker" to build a container image for use with the Container driver.
|
||||||
|
|
||||||
IMAGE=$1
|
IMAGE=$1
|
||||||
|
|
||||||
@ -11,6 +13,10 @@ if [[ "$IMAGE" == "generic"* ]]; then
|
|||||||
elif [[ "$IMAGE" == @(docker|container)* ]]; then
|
elif [[ "$IMAGE" == @(docker|container)* ]]; then
|
||||||
tox -v -e buildimage-docker
|
tox -v -e buildimage-docker
|
||||||
image_name="manila-docker-container.tar.gz"
|
image_name="manila-docker-container.tar.gz"
|
||||||
|
else
|
||||||
|
export MANILA_IMG_NAME="manila-service-image-$IMAGE"
|
||||||
|
tox -v -e buildimage -- -s $IMAGE
|
||||||
|
image_name="$MANILA_IMG_NAME.qcow2"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo $image_name > ./IMAGE_NAME
|
echo $image_name > ./IMAGE_NAME
|
||||||
|
Loading…
Reference in New Issue
Block a user