Skip to content

Commit ba92dec

Browse files
committed
check-remote-image-existence.sh: exit 1 if any image does not exist
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]>
1 parent 97f2b4c commit ba92dec

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

hack/check-remote-image-existence.sh

+16-12
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,20 @@ set -eu -o pipefail
44
# Get the directory of the script
55
script_dir=$(dirname "$0")
66

7-
for template in $(realpath "${script_dir}"/../examples/*.yaml "${script_dir}"/./test-templates/*.yaml|sort -u); do
8-
for location in $(yq eval '.images[].location' "${template}"); do
9-
if [[ "${location}" == http* ]]; then
10-
response=$(curl -L -s -I -o /dev/null -w "%{http_code}" "${location}")
11-
if [[ ${response} != "200" ]]; then
12-
line=$(grep -n "${location}" "${template}" | cut -d ':' -f 1)
13-
echo "::error file=${template},line=${line}::response: ${response} for ${location}"
14-
else
15-
echo "response: ${response} for ${location}"
16-
fi
17-
fi
18-
done
7+
result=0
8+
for template in $(realpath "${script_dir}"/../examples/*.yaml "${script_dir}"/./test-templates/*.yaml | sort -u); do
9+
for location in $(yq eval '.images[].location' "${template}"); do
10+
if [[ ${location} == http* ]]; then
11+
response=$(curl -L -s -I -o /dev/null -w "%{http_code}" "${location}")
12+
if [[ ${response} != "200" ]]; then
13+
line=$(grep -n "${location}" "${template}" | cut -d ':' -f 1)
14+
echo "::error file=${template},line=${line}::response: ${response} for ${location}"
15+
result=1
16+
else
17+
echo "response: ${response} for ${location}"
18+
fi
19+
fi
20+
done
1921
done
22+
23+
exit "${result}"

0 commit comments

Comments
 (0)