summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Sardara <msardara@cisco.com>2022-08-19 11:02:27 +0200
committerMauro Sardara <msardara@cisco.com>2022-08-19 11:02:35 +0200
commit020099fdb3b1a0fa482f8813c7a7147c1720fbc8 (patch)
treec111361d118319308640fdf0dc3d14e57340b2d0
parente9128a4b15e32f94ef10d4b841093d9b89949050 (diff)
ci(functions.sh): fallback to full image build if artifacts cannot be retrieved
Ref: HICN-743 Change-Id: I9690f541e985fa6cde65bb892f0b8a7787fd2e93 Signed-off-by: Mauro Sardara <msardara@cisco.com>
-rw-r--r--scripts/functions.sh19
1 files changed, 14 insertions, 5 deletions
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 "*******************************************************************"