check for image versions automatically in build (#948)
* add script * remove useless cat warning * remove unnecessary endline * support checking core images * add to github actions
This commit is contained in:
3
.github/workflows/gradle.yml
vendored
3
.github/workflows/gradle.yml
vendored
@@ -64,6 +64,9 @@ jobs:
|
||||
- name: Ensure no file change
|
||||
run: git status --porcelain && test -z "$(git status --porcelain)"
|
||||
|
||||
- name: Check images exist
|
||||
run: ./tools/bin/check_images_exist.sh
|
||||
|
||||
- name: Check documentation
|
||||
if: success() && github.ref == 'refs/heads/master'
|
||||
run: ./tools/site/link_checker.sh check_docs
|
||||
|
||||
31
tools/bin/check_images_exist.sh
Executable file
31
tools/bin/check_images_exist.sh
Executable file
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
function docker_tag_exists() {
|
||||
URL=https://hub.docker.com/v2/repositories/"$1"/tags/"$2"
|
||||
printf "\tURL: %s\n" "$URL"
|
||||
curl --silent -f -lSL "$URL" > /dev/null
|
||||
}
|
||||
|
||||
echo "Checking core images exist..."
|
||||
docker-compose pull || exit 1
|
||||
|
||||
echo "Checking integration images exist..."
|
||||
CONFIG_FILES=$(find airbyte-config/init | grep json | grep -v STANDARD_WORKSPACE | grep -v build)
|
||||
[ -z "$CONFIG_FILES" ] && echo "ERROR: Could not find any config files." && exit 1
|
||||
|
||||
while IFS= read -r file; do
|
||||
REPO=$(jq -r .dockerRepository < "$file")
|
||||
TAG=$(jq -r .dockerImageTag < "$file")
|
||||
echo "Checking $file..."
|
||||
printf "\tREPO: %s\n" "$REPO"
|
||||
printf "\tTAG: %s\n" "$TAG"
|
||||
if docker_tag_exists "$REPO" "$TAG"; then
|
||||
printf "\tSTATUS: found\n"
|
||||
else
|
||||
printf "\tERROR: not found!\n" && exit 1
|
||||
fi
|
||||
done <<< "$CONFIG_FILES"
|
||||
|
||||
echo "Success! All images exist!"
|
||||
Reference in New Issue
Block a user