From ba498abc7d5230e5b83db64e48535e55e101d0e3 Mon Sep 17 00:00:00 2001 From: Luigi Toscano Date: Fri, 30 Mar 2018 15:33:35 +0200 Subject: [PATCH] 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 --- .../defaults/main.yaml | 2 ++ roles/build-sahara-images-dib/tasks/main.yaml | 2 +- tools/gate/build-images | 28 +++++++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/roles/build-sahara-images-dib/defaults/main.yaml b/roles/build-sahara-images-dib/defaults/main.yaml index d54f7d5d..b2defb97 100644 --- a/roles/build-sahara-images-dib/defaults/main.yaml +++ b/roles/build-sahara-images-dib/defaults/main.yaml @@ -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: '' diff --git a/roles/build-sahara-images-dib/tasks/main.yaml b/roles/build-sahara-images-dib/tasks/main.yaml index 8733bbe8..e2a354fe 100644 --- a/roles/build-sahara-images-dib/tasks/main.yaml +++ b/roles/build-sahara-images-dib/tasks/main.yaml @@ -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 }}" diff --git a/tools/gate/build-images b/tools/gate/build-images index 3cac6a62..7b0af128 100755 --- a/tools/gate/build-images +++ b/tools/gate/build-images @@ -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