From c7ab15f914714b1eb200d306cbd5a2568c354446 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Ma=CC=88der?= Date: Wed, 6 Feb 2019 12:30:08 +0100 Subject: [PATCH] Consistent variable use in build scripts --- build-branches.sh | 2 +- build-latest.sh | 8 ++++++-- docker/docker-entrypoint.sh | 23 +++++++++++++++++++++++ 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/build-branches.sh b/build-branches.sh index 91dbf22..ae2058b 100755 --- a/build-branches.sh +++ b/build-branches.sh @@ -11,7 +11,7 @@ else GITHUB_OAUTH_PARAMS="" fi -ORIGINAL_GITHUB_REPO="digitalocean/netbox" +ORIGINAL_GITHUB_REPO="${SRC_ORG-digitalocean}/${SRC_REPO-netbox}" GITHUB_REPO="${GITHUB_REPO-$ORIGINAL_GITHUB_REPO}" URL_RELEASES="https://api.github.com/repos/${GITHUB_REPO}/branches?${GITHUB_OAUTH_PARAMS}" diff --git a/build-latest.sh b/build-latest.sh index 89c183e..c607fc9 100755 --- a/build-latest.sh +++ b/build-latest.sh @@ -47,7 +47,7 @@ if [ "${PRERELEASE}" == "true" ]; then fi # Check if that version is not already available on docker hub: -ORIGINAL_DOCKERHUB_REPO="netboxcommunity/netbox" +ORIGINAL_DOCKERHUB_REPO="${DOCKER_ORG-netboxcommunity}/${DOCKER_REPO-netbox}" DOCKERHUB_REPO="${DOCKERHUB_REPO-$ORIGINAL_DOCKERHUB_REPO}" URL_DOCKERHUB_TOKEN="https://auth.docker.io/token?service=registry.docker.io&scope=repository:${DOCKERHUB_REPO}:pull" BEARER_TOKEN="$($CURL "${URL_DOCKERHUB_TOKEN}" | jq -r .token)" @@ -63,7 +63,11 @@ fi ALREADY_BUILT="$($CURL -H "${AUTHORIZATION_HEADER}" "${URL_DOCKERHUB_TAG}" | jq -e ".tags | any(.==\"${DOCKER_TAG}\")")" -if [ "$ALREADY_BUILT" == "false" ]; then +if [ -n "$DEBUG" ] && [ "$ALREADY_BUILT" == "false" ]; then + if [ -n "$DEBUG" ]; then + echo "⚠️ Would not build, because ${DOCKER_TAG} already exists on https://hub.docker.com/r/${DOCKERHUB_REPO}, but DEBUG is enabled." + fi + # shellcheck disable=SC2068 ./build.sh "${VERSION}" $@ exit $? diff --git a/docker/docker-entrypoint.sh b/docker/docker-entrypoint.sh index 4cef815..796c202 100755 --- a/docker/docker-entrypoint.sh +++ b/docker/docker-entrypoint.sh @@ -1,6 +1,27 @@ #!/bin/bash set -e +# inform about deprecation + +depraction_warning() { + echo "" + echo "" + echo "" + echo "⚠️ WARNING ⚠️ WARNING ⚠️ WARNING ⚠️" + echo "" + echo "📣️ The docker images for Netbox have moved to 'netboxcommunity/netbox'." + echo "" + echo "❌ Your setup will not get any updates anymore." + echo "❌ Your setup will break after 2019." + echo "" + echo "ℹ️ Just rename 'ninech/netbox' to 'netboxcommunity/netbox' and your good again." + echo "" + echo "" + echo "" +} + +depraction_warning + # wait shortly and then run db migrations (retry on error) while ! ./manage.py migrate 2>&1; do echo "⏳ Waiting on DB..." @@ -49,6 +70,8 @@ done echo "✅ Initialisation is done." +depraction_warning + # launch whatever is passed by docker # (i.e. the RUN instruction in the Dockerfile) exec ${@}