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=""
if env | grep REGISTRY_USERNAME > /dev/null;
then
if [ ! -z $REGISTRY_USERNAME ]; then
printf "Found registry username...\n"
extra_vars="$extra_vars --username $REGISTRY_USERNAME"
fi
if env | grep REGISTRY_PASSWORD > /dev/null;
then
if [ ! -z REGISTRY_PASSWORD ]; then
printf "Found registry password\n"
extra_vars="$extra_vars --password $REGISTRY_PASSWORD "
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}')
printf "Pulling $image_base:@$report_digest...\n"
if [ -e result.json ]; then
rm result.json
fi
oras pull $extra_vars $image_base:@$report_digest
printf "Checking for result file..."
if [ -e result.json ]; then
printf "Result file found !"
exit 0
else
printf "Result file not found !"
exit 1
fi