-
Notifications
You must be signed in to change notification settings - Fork 628
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
check-remote-image-existence.yml: check remote image existence in tem…
…plates Signed-off-by: Norio Nomura <[email protected]>
- Loading branch information
1 parent
374db8b
commit 8ca5e5a
Showing
2 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: Check Remote Image Existence | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
- 'examples/**.yaml' | ||
- 'hack/test-templates/**.yaml' | ||
- 'hack/check-remote-image-existence.sh' | ||
|
||
jobs: | ||
check-remote-image-existence: | ||
name: Check Remote Image Existence | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Run check-remote-image-existence.sh | ||
run: ./hack/check-remote-image-existence.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash | ||
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 | ||
done |