chore(): Improves script logic with better debugging
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Elia el Lazkani 2023-07-04 21:43:16 +02:00
parent cf7afe8d47
commit 9ebf78caca

View file

@ -14,26 +14,31 @@ printf "Found digests for scan report...\n"
extra_vars="" extra_vars=""
if env | grep REGISTRY_USERNAME > /dev/null; if [ ! -z $REGISTRY_USERNAME ]; then
then printf "Found registry username...\n"
extra_vars="$extra_vars --username $REGISTRY_USERNAME" extra_vars="$extra_vars --username $REGISTRY_USERNAME"
fi fi
if env | grep REGISTRY_PASSWORD > /dev/null; if [ ! -z REGISTRY_PASSWORD ]; then
then printf "Found registry password\n"
extra_vars="$extra_vars --password $REGISTRY_PASSWORD " extra_vars="$extra_vars --password $REGISTRY_PASSWORD "
fi fi
printf "Cleaning result file, if it already exists...\n"
if [ -e result.json ]; then
rm result.json
fi
image_base=$(echo "$image" | awk -F ':' '{print $1}') image_base=$(echo "$image" | awk -F ':' '{print $1}')
printf "Pulling $image_base:@$report_digest...\n" printf "Pulling $image_base:@$report_digest...\n"
if [ -e result.json ]; then
rm result.json
fi
oras pull $extra_vars $image_base:@$report_digest oras pull $extra_vars $image_base:@$report_digest
printf "Checking for result file..."
if [ -e result.json ]; then if [ -e result.json ]; then
printf "Result file found !"
exit 0 exit 0
else else
printf "Result file not found !"
exit 1 exit 1
fi fi