From 020099fdb3b1a0fa482f8813c7a7147c1720fbc8 Mon Sep 17 00:00:00 2001 From: Mauro Sardara Date: Fri, 19 Aug 2022 11:02:27 +0200 Subject: ci(functions.sh): fallback to full image build if artifacts cannot be retrieved Ref: HICN-743 Change-Id: I9690f541e985fa6cde65bb892f0b8a7787fd2e93 Signed-off-by: Mauro Sardara --- scripts/functions.sh | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'scripts') diff --git a/scripts/functions.sh b/scripts/functions.sh index 06673f888..e5484b02e 100644 --- a/scripts/functions.sh +++ b/scripts/functions.sh @@ -94,10 +94,13 @@ function download_artifacts() { # Unzip them unzip "${SCRIPT_PATH}/../packages.zip" -d "${SCRIPT_PATH}/.." - else - echo "GERRIT_* environment is not set. Impossible to download artifacts." >&2 - exit 1 + + return 0 fi + + # Fall back to image re-build if artifacts cannot be downloaded + echo "GERRIT_* environment is not set. Image will be rebuilt from scratch" >&2 + return 1 } # Run functional tests @@ -106,11 +109,17 @@ function functional_test() { echo "********************* STARTING FUNCTIONAL TESTS *******************" echo "*******************************************************************" - download_artifacts + if download_artifacts; then + local build_sw=0 + local dockerfile_path="tests/Dockerfile.ci" + else + local build_sw=1 + local dockerfile_path="Dockerfile.dev" + fi # Run functional tests pushd ${SCRIPT_PATH}/../tests - BUILD_SOFTWARE=0 DOCKERFILE="tests/Dockerfile.ci" bash ./run-functional.sh + BUILD_SOFTWARE=${build_sw} DOCKERFILE=${dockerfile_path} bash ./run-functional.sh popd echo "*******************************************************************" -- cgit 1.2.3-korg