Check for all web related existing cache before generating

Signed-off-by: Kiran Parajuli <kiranparajuli589@gmail.com>
This commit is contained in:
Kiran Parajuli
2022-09-27 15:04:02 +05:45
parent d0b069dfb3
commit 9062e891c6
2 changed files with 132 additions and 78 deletions
+10 -3
View File
@@ -1,18 +1,25 @@
#!/bin/bash
source .drone.env
# if no $1 is supplied end the script
# Can be web, acceptance or e2e
if [ -z "$1" ]; then
echo "No cache item is supplied."
exit 1
fi
echo "Checking web version - $WEB_COMMITID in cache"
URL="$CACHE_ENDPOINT/$CACHE_BUCKET/ocis/web-test-runner/$WEB_COMMITID/web.tar.gz"
URL="$CACHE_ENDPOINT/$CACHE_BUCKET/ocis/web-test-runner/$WEB_COMMITID/$1.tar.gz"
echo "Checking for the web cache at '$URL'."
if curl --output /dev/null --silent --head --fail "$URL"
then
echo "Web with commit id $WEB_COMMITID already available in cache"
echo "$1 cache with commit id $WEB_COMMITID already available."
# https://discourse.drone.io/t/how-to-exit-a-pipeline-early-without-failing/3951
# exit a Pipeline early without failing
exit 78
else
echo "Web with $WEB_COMMITID not available in cache"
echo "$1 cache with commit id $WEB_COMMITID was not available."
fi