X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=nfvbenchvm%2Fdib%2Fbuild-image.sh;h=88cf2e58dd8c69b6494d8bd92e95084ed943d3da;hb=24997eda1e0530c0bde3f0955b807e534cd112fd;hp=034c4dde437e2442ad6bb6409caff72e8b631b54;hpb=0036098e46e16c9ae5b795b108a5b9566c02906b;p=nfvbench.git diff --git a/nfvbenchvm/dib/build-image.sh b/nfvbenchvm/dib/build-image.sh index 034c4dd..88cf2e5 100755 --- a/nfvbenchvm/dib/build-image.sh +++ b/nfvbenchvm/dib/build-image.sh @@ -5,10 +5,25 @@ # The following packages must be installed prior to using this script: # sudo apt-get -y install python-virtualenv qemu-utils kpartx +set -e + +# Artifact URL +gs_url=artifacts.opnfv.org/nfvbench/images + # image version number -__version__=0.3 +__version__=0.5 image_name=nfvbenchvm_centos-$__version__ +# if image exists skip building +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" + exit 0 + fi +else + echo "Cannot check image availability in OPNFV artifact repository (gsutil not available)" +fi + # install diskimage-builder if [ -d dib-venv ]; then . dib-venv/bin/activate @@ -37,5 +52,12 @@ export DIB_USE_ELREPO_KERNEL=True echo "Building $image_name.qcow2..." time disk-image-create -o $image_name centos7 nfvbenchvm - ls -l $image_name.qcow2 + +if command -v gsutil >/dev/null; then + echo "Uploading $image_name.qcow2..." + gsutil cp $image_name.qcow2 gs://$gs_url/$image_name.qcow2 + echo "You can access to image at http://$gs_url/$image_name.qcow2" +else + echo "Cannot upload new image to the OPNFV artifact repository (gsutil not available)" +fi