diff options
author | Luc Provoost <luc.provoost@intel.com> | 2021-02-18 21:16:46 +0100 |
---|---|---|
committer | Luc Provoost <luc.provoost@intel.com> | 2021-02-19 10:53:38 +0000 |
commit | 7e060e50f591b68a425450ace732c6c2f9f1b943 (patch) | |
tree | 7aaff70a1d51d797bfd80ac2a8c7578156ce2953 /rapidvm/dib | |
parent | 480fcf799c1c30421e10abb78b91303ade4bc059 (diff) |
qcow2 image file name to include GIT_BRANCH
The qcow2 file name is now constructed as a combination of
rapid-${GIT_BRANCH##*}.qcow2
The image is built and copied every time the job is triggered. In this
way we will overwrite rapid-latest.qcow2.
Change-Id: I9f9c255dc5207a7595aa9e49ae57bd50b42c4d3b
Signed-off-by: Luc Provoost <luc.provoost@intel.com>
Diffstat (limited to 'rapidvm/dib')
-rwxr-xr-x | rapidvm/dib/build-image.sh | 50 |
1 files changed, 20 insertions, 30 deletions
diff --git a/rapidvm/dib/build-image.sh b/rapidvm/dib/build-image.sh index e7b337e5..49086dec 100755 --- a/rapidvm/dib/build-image.sh +++ b/rapidvm/dib/build-image.sh @@ -38,50 +38,40 @@ set -e # Artifact URL gs_url=artifacts.opnfv.org/samplevnf/images -# image version number -__version__=0.01 -image_name=rapid-$__version__ +image_name=rapid-${GIT_BRANCH##*/} # if image exists skip building echo "Checking if image exists in google storage..." if command -v gsutil >/dev/null; then if gsutil -q stat gs://$gs_url/$image_name.qcow2; then echo "Image already exists at http://$gs_url/$image_name.qcow2" - echo "Build is skipped" - exit 0 fi - echo "Image does not exist in google storage, starting build..." + echo "Starting build..." echo else echo "Cannot check image availability in OPNFV artifact repository (gsutil not available)" fi -# check if image is already built locally -if [ -f $image_name.qcow2 ]; then - echo "Image $image_name.qcow2 already exists locally" +# install diskimage-builder +if [ -d dib-venv ]; then + . dib-venv/bin/activate else - - # install diskimage-builder - if [ -d dib-venv ]; then - . dib-venv/bin/activate - else - virtualenv dib-venv - . dib-venv/bin/activate - pip install diskimage-builder - fi - # Add rapid elements directory to the DIB elements path - export ELEMENTS_PATH=`pwd`/elements - # canned user/password for direct login - export DIB_DEV_USER_USERNAME=prox - export DIB_DEV_USER_PASSWORD=prox - export DIB_DEV_USER_PWDLESS_SUDO=Y - # Set the data sources to have ConfigDrive only - export DIB_CLOUD_INIT_DATASOURCES="Ec2, ConfigDrive, OpenStack" - # Use ELRepo to have latest kernel - export DIB_USE_ELREPO_KERNEL=True - echo "Building $image_name.qcow2..." - time disk-image-create -o $image_name centos7 cloud-init rapid vm + virtualenv dib-venv + . dib-venv/bin/activate + pip install diskimage-builder fi +# Add rapid elements directory to the DIB elements path +export ELEMENTS_PATH=`pwd`/elements +# canned user/password for direct login +export DIB_DEV_USER_USERNAME=prox +export DIB_DEV_USER_PASSWORD=prox +export DIB_DEV_USER_PWDLESS_SUDO=Y +# Set the data sources to have ConfigDrive only +export DIB_CLOUD_INIT_DATASOURCES="Ec2, ConfigDrive, OpenStack" +# Use ELRepo to have latest kernel +export DIB_USE_ELREPO_KERNEL=True +echo "Building $image_name.qcow2..." +time disk-image-create -o $image_name centos7 cloud-init rapid vm ls -l $image_name.qcow2 |