Zuul roles: allow to build only a specific image

Useful to generate a single image on-the-fly
and use it for scenario tests
(or simply useful for a refactor of the rest of the
build-images script).

Change-Id: Ica615e9e7d93b38fd12189a9f97d26ca62d84a3e
This commit is contained in:
Luigi Toscano 2018-03-30 15:33:35 +02:00
parent af81b26545
commit ba498abc7d
3 changed files with 31 additions and 1 deletions

View File

@ -2,3 +2,5 @@
sahara_image_elements_src_dir: "{{ zuul.projects['git.openstack.org/openstack/sahara-image-elements'].src_dir }}"
sahara_build_directory: /var/tmp/sahara-image-build
sahara_plugin: vanilla
sahara_plugin_version: ''
sahara_plugin_distro: ''

View File

@ -1,4 +1,4 @@
- name: Build all the images for the selected plugin
command: ./tools/gate/build-images "{{ sahara_plugin }}"
command: ./tools/gate/build-images "{{ sahara_plugin }}" "{{ sahara_plugin_version }}" "{{ sahara_plugin_distro }}"
args:
chdir: "{{ sahara_image_elements_src_dir }}"

View File

@ -1,7 +1,35 @@
#!/bin/bash -xe
PLUGIN=$1
PLUGIN_VERSION=${2:-''}
PLUGIN_DISTRO=${3:-''}
export DIB_MIN_TMPFS=10
# build a specific version if requested
if [ -n "${PLUGIN}" ] && [ -n "${PLUGIN_VERSION}" ] && [ -n "${PLUGIN_DISTRO}" ]; then
case ${PLUGIN} in
vanilla|cloudera|ambari)
VERSION_FLAG="-v ${PLUGIN_VERSION}"
;;
mapr)
VERSION_FLAG="-r ${PLUGIN_VERSION}"
;;
spark)
VERSION_FLAG="-s ${PLUGIN_VERSION}"
;;
storm)
VERSION_FLAG="-t ${PLUGIN_VERSION}"
;;
*)
VERSION_FLAG=""
;;
esac
tox -e venv -- sahara-image-create -x -u -p ${PLUGIN} -i ${PLUGIN_DISTRO} ${VERSION_FLAG}
exit
fi
# build (almost) all versions for a specified plugin
case "$PLUGIN" in
"vanilla")
# temporary don't test building fedora image