Exit if kolla image build failed 11/47111/1
authorZhijiang Hu <hu.zhijiang@zte.com.cn>
Mon, 13 Nov 2017 07:34:32 +0000 (02:34 -0500)
committerZhijiang Hu <hu.zhijiang@zte.com.cn>
Mon, 13 Nov 2017 07:34:32 +0000 (02:34 -0500)
Previously, image build failure was ignored since the failure is
caused by images that we do not need. Then, we only build what
we really need. So now, image build failure should not be ginored
any more.

This PS also do clean up task after failure occured, althrough
this is  not really necessary when running in a temporary VM. But
it is helpful when running manually.

Change-Id: Ica8771e80bc313795598e18dc0175177ccb6c11a
Signed-off-by: Zhijiang Hu <hu.zhijiang@zte.com.cn>
ci/kolla-build-vm.sh

index c7d9435..552af6f 100755 (executable)
@@ -311,19 +311,15 @@ function start_build {
     echo "Start to build Kolla image"
     pushd $KOLLA_GIT_DIR/kolla
 
-    # Some of the images may be failed to built out but is OK
-    # so we use "|| true" here.
-    # TODO: We can impl. some checks to see if the images that
-    # we really care are built successfully.
     echo "=============================OpenStack & ODL build from binary=============================="
 
     REGISTRY_PARAM="--registry 127.0.0.1:5000 --push --tag $KOLLA_IMAGE_VERSION"
-    tools/build.py $REGISTRY_PARAM || true;
+    tools/build.py $REGISTRY_PARAM;
 
     echo "=============================DPDK build from source=============================="
 
     REGISTRY_PARAM="--registry 127.0.0.1:5000 --push --tag $KOLLA_IMAGE_VERSION --template-override contrib/template-override/ovs-dpdk.j2 -t source dpdk"
-    tools/build.py $REGISTRY_PARAM || true;
+    tools/build.py $REGISTRY_PARAM;
     popd
 }
 
@@ -339,7 +335,9 @@ error_trap()
     fi
 
     echo "Image build failed with $exitcode"
-
+    cleanup_kolla_image
+    cleanup_registry_server
+    cleanup_registry_data
     exit $exitcode
 }
 
@@ -361,6 +359,3 @@ start_registry_server
 start_build
 cleanup_kolla_image
 pack_registry_data
-
-# TODO: Upload to OPNFV artifacts repo.
-