Skip to content

Commit

Permalink
check-remote-image-existence.sh: exit 1 if any image does not exist
Browse files Browse the repository at this point in the history
Signed-off-by: Norio Nomura <[email protected]>

check-remote-image-existence.sh: change to tab

Signed-off-by: Norio Nomura <[email protected]>

check-remote-image-existence.sh: remove double quotation in [[ ]]

Signed-off-by: Norio Nomura <[email protected]>

check-remote-image-existence.sh: add space to `|`

Signed-off-by: Norio Nomura <[email protected]>
  • Loading branch information
norio-nomura committed Aug 18, 2024
1 parent e9e6068 commit 509fb2e
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions hack/check-remote-image-existence.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,20 @@ set -eu -o pipefail
# Get the directory of the script
script_dir=$(dirname "$0")

for template in $(realpath "${script_dir}"/../examples/*.yaml "${script_dir}"/./test-templates/*.yaml|sort -u); do
for location in $(yq eval '.images[].location' "${template}"); do
if [[ "${location}" == http* ]]; then
response=$(curl -L -s -I -o /dev/null -w "%{http_code}" "${location}")
if [[ ${response} != "200" ]]; then
line=$(grep -n "${location}" "${template}" | cut -d ':' -f 1)
echo "::error file=${template},line=${line}::response: ${response} for ${location}"
else
echo "response: ${response} for ${location}"
fi
fi
done
result=0
for template in $(realpath "${script_dir}"/../examples/*.yaml "${script_dir}"/./test-templates/*.yaml | sort -u); do
for location in $(yq eval '.images[].location' "${template}"); do
if [[ ${location} == http* ]]; then
response=$(curl -L -s -I -o /dev/null -w "%{http_code}" "${location}")
if [[ ${response} != "200" ]]; then
line=$(grep -n "${location}" "${template}" | cut -d ':' -f 1)
echo "::error file=${template},line=${line}::response: ${response} for ${location}"
result=1
else
echo "response: ${response} for ${location}"
fi
fi
done
done

exit "${result}"

0 comments on commit 509fb2e

Please sign in to comment.