From 0b656453f0874007b8c5897afd86d1e76818ec26 Mon Sep 17 00:00:00 2001 From: vponomaryov Date: Fri, 10 Mar 2017 17:24:42 +0200 Subject: [PATCH] Allow built image be available via local webserver It will be used for testing of newly proposed changes to this project in tempest CI jobs. Change-Id: I74d118b6661fe7683f505706c67a793700844af3 Depends-On: I005d1b204ea25ced8913351d19eac282ca465fb6 --- tools/gate/build-images | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/tools/gate/build-images b/tools/gate/build-images index fb65dfa..3487de3 100755 --- a/tools/gate/build-images +++ b/tools/gate/build-images @@ -1,9 +1,27 @@ #!/bin/bash -xe -IMAGE=$1 +# 1 - First argument is expected to be type of image - either 'generic' or +# 'docker'. +# 2 - Second argument is expected to be boolean value that defines whether we +# should put newly built image to local webserver or not. -if [ "$IMAGE" = "generic" ]; then +IMAGE=$1 +PUT_IMAGE_TO_LOCAL_WEBSERVER=${2:-"False"} + +if [[ "$IMAGE" == "generic"* ]]; then tox -v -e buildimage -elif [ "$IMAGE" = "docker" ]; then + image_name="manila-service-image.qcow2" +elif [[ "$IMAGE" == @(docker|container)* ]]; then tox -v -e buildimage-docker + image_name="manila-docker-container.tar.gz" +fi + +if [[ $PUT_IMAGE_TO_LOCAL_WEBSERVER != [Ff][Aa][Ll][Ss][Ee] ]]; then + source_path="$(pwd)/$image_name" + destination_dir="/var/www/public_html" + destination_path="$destination_dir/$image_name" + sudo mkdir -p $destination_dir + sudo ln -s $source_path $destination_path + echo "Image with name '$image_name' is available now at \ + http://localhost:80/public_html/$image_name" fi