diff --git a/.github/ansible/get_binaries.sh b/.github/ansible/get_binaries.sh index c9cbe91f34..777262e26f 100755 --- a/.github/ansible/get_binaries.sh +++ b/.github/ansible/get_binaries.sh @@ -2,30 +2,37 @@ set -e -RELEASE=${RELEASE:-false} +if [ -z "${DOCKER_TAG}" ]; then + # DOCKER_TAG absent, trying to find latest one in docker hub + + RELEASE=${RELEASE:-false} + # look at docker hub for latest tag for neon docker image + if [ "${RELEASE}" = "true" ]; then + echo "search latest release tag" + VERSION=$(curl -s https://registry.hub.docker.com/v1/repositories/neondatabase/neon/tags |jq -r -S '.[].name' | grep release | sed 's/release-//g' | grep -E '^[0-9]+$' | sort -n | tail -1) + if [ -z "${VERSION}" ]; then + echo "no any docker tags found, exiting..." + exit 1 + else + TAG="release-${VERSION}" + fi + else + echo "search latest dev tag" + VERSION=$(curl -s https://registry.hub.docker.com/v1/repositories/neondatabase/neon/tags |jq -r -S '.[].name' | grep -E '^[0-9]+$' | sort -n | tail -1) + if [ -z "${VERSION}" ]; then + echo "no any docker tags found, exiting..." + exit 1 + else + TAG="${VERSION}" + fi + fi + echo "found ${VERSION}" -# look at docker hub for latest tag for neon docker image -if [ "${RELEASE}" = "true" ]; then - echo "search latest release tag" - VERSION=$(curl -s https://registry.hub.docker.com/v1/repositories/neondatabase/neon/tags |jq -r -S '.[].name' | grep release | sed 's/release-//g' | grep -E '^[0-9]+$' | sort -n | tail -1) - if [ -z "${VERSION}" ]; then - echo "no any docker tags found, exiting..." - exit 1 - else - TAG="release-${VERSION}" - fi else - echo "search latest dev tag" - VERSION=$(curl -s https://registry.hub.docker.com/v1/repositories/neondatabase/neon/tags |jq -r -S '.[].name' | grep -E '^[0-9]+$' | sort -n | tail -1) - if [ -z "${VERSION}" ]; then - echo "no any docker tags found, exiting..." - exit 1 - else - TAG="${VERSION}" - fi + # DOCKER_TAG present, using it + TAG=${DOCKER_TAG} fi -echo "found ${VERSION}" # do initial cleanup rm -rf neon_install postgres_install.tar.gz neon_install.tar.gz .neon_current_version diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index d28da92d11..635c6126cc 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -562,6 +562,7 @@ jobs: - name: Redeploy run: | + export DOCKER_TAG=${{needs.docker-image.outputs.build-tag}} cd "$(pwd)/.github/ansible" if [[ "$GITHUB_REF_NAME" == "main" ]]; then