Merge "Modify job to build images"
This commit is contained in:
7 changed files with 89 additions and 49 deletions
15
.zuul.yaml
15
.zuul.yaml
@@ -6,7 +6,7 @@
check:
jobs:
- openstack-tox-pep8
- manila-image-elements-buildimage-generic
- manila-image-elements-buildimages
- manila-image-elements-buildimage-docker:
voting:false
- manila-tempest-dsvm-container-scenario-custom-image:
@@ -22,7 +22,7 @@
gate:
jobs:
- openstack-tox-pep8
- manila-image-elements-buildimage-generic
- manila-image-elements-buildimages
post:
jobs:
- manila-image-elements-publish-artifacts
@@ -38,14 +38,15 @@
run:playbooks/manila-buildimage-docker/run.yaml
- job:
name:manila-image-elements-buildimage-generic
name:manila-image-elements-buildimages
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
timeout:1800
required-projects:
- openstack/manila-image-elements
run:playbooks/manila-buildimage-generic/run.yaml
run:playbooks/manila-buildimages/run.yaml
- job:
name:manila-image-elements-publish-artifacts
@@ -56,7 +57,5 @@
final:true
required-projects:
- 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
@@ -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
# Argument is expected to be type of image - either 'generic' or
# 'docker'.
# Argument is expected to be type of image. Use 'generic' to build an image
# 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ドル
@@ -11,6 +13,10 @@ if [[ "$IMAGE" == "generic"* ]]; then
elif [[ "$IMAGE" == @(docker|container)* ]]; then
tox -v -e buildimage-docker
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
echo $image_name > ./IMAGE_NAME
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.