From a4186c1031e031d89e1d78dcce417b629f084b4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20M=C3=A4der?= Date: Tue, 10 Dec 2019 21:44:11 +0100 Subject: [PATCH] Prepares scripts and documentation for #184 --- DOCKER_HUB.md | 6 +++--- README.md | 4 ++-- build-branches.sh | 2 +- build.sh | 20 ++++++++++---------- hooks/common | 2 +- hooks/push | 4 ++-- 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/DOCKER_HUB.md b/DOCKER_HUB.md index 10c4154..d3b3e68 100644 --- a/DOCKER_HUB.md +++ b/DOCKER_HUB.md @@ -11,21 +11,21 @@ Autotest: Internal and External Pull Requests Repository Links: Enable for Base Image Build Rules: - Source Type: Branch - Source: master + Source: release Docker Tag: branches Dockerfile location: Dockerfile Build Context: / Autobuild: on Build Caching: on - Source Type: Branch - Source: master + Source: release Docker Tag: prerelease Dockerfile location: Dockerfile Build Context: / Autobuild: on Build Caching: on - Source Type: Branch - Source: master + Source: release Docker Tag: release Dockerfile location: Dockerfile Build Context: / diff --git a/README.md b/README.md index 13f7241..00f3aaf 100644 --- a/README.md +++ b/README.md @@ -43,10 +43,10 @@ Then there is currently one extra tags for each of the above labels: ## Quickstart -To get Netbox up and running: +To get Netbox up and running in Docker: ```bash -git clone -b master https://github.com/netbox-community/netbox-docker.git +git clone -b release https://github.com/netbox-community/netbox-docker.git cd netbox-docker docker-compose pull docker-compose up -d diff --git a/build-branches.sh b/build-branches.sh index a6bc736..483e771 100755 --- a/build-branches.sh +++ b/build-branches.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Builds develop, develop-* and master branches +# Builds develop, develop-* and master branches of Netbox echo "▶️ $0 $*" diff --git a/build.sh b/build.sh index 14ab409..8ea1476 100755 --- a/build.sh +++ b/build.sh @@ -27,9 +27,9 @@ if [ "${1}x" == "x" ] || [ "${1}" == "--help" ] || [ "${1}" == "-h" ]; then echo " Default: undefined" echo " TAG The version part of the docker tag." echo " Default:" - echo " When \${BRANCH}=master: latest" - echo " When \${BRANCH}=develop: snapshot" - echo " Else: same as \${BRANCH}" + echo " When =master: latest" + echo " When =develop: snapshot" + echo " Else: same as " echo " DOCKER_REGISTRY The Docker repository's registry (i.e. '\${DOCKER_REGISTRY}/\${DOCKER_ORG}/\${DOCKER_REPO}'')" echo " Used for tagging the image." echo " Default: docker.io" @@ -106,7 +106,7 @@ fi ### SRC_ORG="${SRC_ORG-netbox-community}" SRC_REPO="${SRC_REPO-netbox}" -BRANCH="${1}" +NETBOX_BRANCH="${1}" URL="${URL-https://github.com/${SRC_ORG}/${SRC_REPO}.git}" NETBOX_PATH="${NETBOX_PATH-.netbox}" @@ -114,9 +114,9 @@ NETBOX_PATH="${NETBOX_PATH-.netbox}" # fetching the source ### if [ "${2}" != "--push-only" ] && [ -z "${SKIP_GIT}" ] ; then - echo "🌐 Checking out '${BRANCH}' of netbox from the url '${URL}' into '${NETBOX_PATH}'" + echo "🌐 Checking out '${NETBOX_BRANCH}' of netbox from the url '${URL}' into '${NETBOX_PATH}'" if [ ! -d "${NETBOX_PATH}" ]; then - $DRY git clone -q --depth 10 -b "${BRANCH}" "${URL}" "${NETBOX_PATH}" + $DRY git clone -q --depth 10 -b "${NETBOX_BRANCH}" "${URL}" "${NETBOX_PATH}" fi ( @@ -127,7 +127,7 @@ if [ "${2}" != "--push-only" ] && [ -z "${SKIP_GIT}" ] ; then fi $DRY git remote set-url origin "${URL}" - $DRY git fetch -qp --depth 10 origin "${BRANCH}" + $DRY git fetch -qp --depth 10 origin "${NETBOX_BRANCH}" $DRY git checkout -qf FETCH_HEAD $DRY git prune ) @@ -174,13 +174,13 @@ fi DOCKER_REGISTRY="${DOCKER_REGISTRY-docker.io}" DOCKER_ORG="${DOCKER_ORG-netboxcommunity}" DOCKER_REPO="${DOCKER_REPO-netbox}" -case "${BRANCH}" in +case "${NETBOX_BRANCH}" in master) TAG="${TAG-latest}";; develop) TAG="${TAG-snapshot}";; *) - TAG="${TAG-$BRANCH}";; + TAG="${TAG-$NETBOX_BRANCH}";; esac ### @@ -241,7 +241,7 @@ for DOCKER_TARGET in "${DOCKER_TARGETS[@]}"; do if [ "${DOCKER_TARGET}" == "main" ]; then DOCKER_BUILD_ARGS+=( --label "ORIGINAL_TAG=${TARGET_DOCKER_TAG}" - + --label "org.label-schema.build-date=${BUILD_DATE}" --label "org.opencontainers.image.created=${BUILD_DATE}" diff --git a/hooks/common b/hooks/common index 49cd507..c0ad1a8 100755 --- a/hooks/common +++ b/hooks/common @@ -31,7 +31,7 @@ run_build() { ./build-branches.sh $@ ;; this) # Pull Requests - # only build the 'master' branch + # only build the 'master' branch of netbox # (resulting in the 'latest' docker tag) # and the 'main' target. DOCKER_TARGET=main ./build.sh master diff --git a/hooks/push b/hooks/push index 81dc7db..6513b24 100755 --- a/hooks/push +++ b/hooks/push @@ -2,8 +2,8 @@ . hooks/common -if [ "${SOURCE_BRANCH}" == "master" ] || [ "${DEBUG}" == "true" ]; then - if [ "${SOURCE_BRANCH}" != "master" ]; then +if [ "${SOURCE_BRANCH}" == "release" ] || [ "${DEBUG}" == "true" ]; then + if [ "${SOURCE_BRANCH}" != "release" ]; then echo "⚠️⚠️⚠️ Would exit, but DEBUG is '${DEBUG}'". fi