From 8ffe6529c9084428d12f561d2d0d973f5388687e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Ma=CC=88der?= Date: Tue, 10 Apr 2018 10:13:53 +0200 Subject: [PATCH 1/5] =?UTF-8?q?=E2=9A=99=EF=B8=8F=20Reduce=20number=20of?= =?UTF-8?q?=20branches=20to=20build?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build-branches.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build-branches.sh b/build-branches.sh index 0e28363..1dd1131 100755 --- a/build-branches.sh +++ b/build-branches.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Builds all published branches +# Builds develop, develop-* and master branches ORIGINAL_GITHUB_REPO="digitalocean/netbox" GITHUB_REPO="${GITHUB_REPO-$ORIGINAL_GITHUB_REPO}" @@ -7,7 +7,7 @@ URL_RELEASES="https://api.github.com/repos/${GITHUB_REPO}/branches" CURL="curl -sS" -BRANCHES=$($CURL "${URL_RELEASES}" | jq -r 'map(.name) | .[] | scan("^[^v].+")') +BRANCHES=$($CURL "${URL_RELEASES}" | jq -r 'map(.name) | .[] | scan("^[^v].+") | match("^(master|develop).*") | .string') ERROR=0 From 626195d00f1953f62909cd3080b31de7f4e384ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Ma=CC=88der?= Date: Tue, 10 Apr 2018 10:37:27 +0200 Subject: [PATCH 2/5] =?UTF-8?q?=E2=9A=99=EF=B8=8F=20Parallel=20builds?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .travis.yml | 6 ++++++ build-all.sh | 58 +++++++++++++++++++++++++++++++++++++--------------- 2 files changed, 48 insertions(+), 16 deletions(-) diff --git a/.travis.yml b/.travis.yml index 484a947..2dac8f3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,12 @@ sudo: required language: python +env: + - BUILD=release + - BUILD=prerelease + - BUILD=branches + - BUILD=special + git: depth: 5 diff --git a/build-all.sh b/build-all.sh index dcff779..aa06b71 100755 --- a/build-all.sh +++ b/build-all.sh @@ -1,5 +1,14 @@ #!/bin/bash # Builds all Docker images this project provides +# Arguments: +# BUILD: The release to build. +# Allowed: release, prerelease, branches, special +# Default: undefined + +ALL_BUILDS=("release" "prerelease" "branches" "special") +BUILDS=("${BUILD:-"${ALL_BUILDS[@]}"}") + +echo "⚙️ Configured builds: ${BUILDS[*]}" VARIANTS=("" "ldap") @@ -35,23 +44,40 @@ if [ ! -z "${DEBUG}" ] || \ fi fi - echo "🛠 Building '$DOCKERFILE'" + for BUILD in "${BUILDS[@]}"; do + echo "🛠 Building '$BUILD' from '$DOCKERFILE'" + case $BUILD in + release) + # build the latest release + # shellcheck disable=SC2068 + ./build-latest.sh $@ || ERROR=1 + ;; + prerelease) + # build the latest pre-release + # shellcheck disable=SC2068 + PRERELEASE=true ./build-latest.sh $@ || ERROR=1 + ;; + branches) + # build all branches + # shellcheck disable=SC2068 + ./build-branches.sh $@ || ERROR=1 + ;; + special) + # special build + # shellcheck disable=SC2068 + SRC_ORG=lampwins TAG=webhooks-backend ./build.sh "feature/webhooks-backend" $@ || ERROR=1 + ;; + *) + echo "🚨 Unrecognized build '$BUILD'." - # build the latest release - # shellcheck disable=SC2068 - ./build-latest.sh $@ || ERROR=1 - - # build the latest pre-release - # shellcheck disable=SC2068 - PRERELEASE=true ./build-latest.sh $@ || ERROR=1 - - # build all branches - # shellcheck disable=SC2068 - ./build-branches.sh $@ || ERROR=1 - - # special build - # shellcheck disable=SC2068 - SRC_ORG=lampwins TAG=webhooks-backend ./build.sh "feature/webhooks-backend" $@ || ERROR=1 + if [ -z "$DEBUG" ]; then + exit 1 + else + echo "⚠️ Would exit here with code '1', but DEBUG is enabled." + fi + ;; + esac + done done else echo "❎ Not building anything." From 6c3966415b76752247ff9fff63426669d8ea8aa1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Ma=CC=88der?= Date: Tue, 10 Apr 2018 10:58:31 +0200 Subject: [PATCH 3/5] =?UTF-8?q?=E2=9A=99=EF=B8=8F=20Additional=20build=20d?= =?UTF-8?q?ebug=20info?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build-all.sh | 2 ++ build-branches.sh | 2 ++ build-latest.sh | 2 ++ build.sh | 2 ++ 4 files changed, 8 insertions(+) diff --git a/build-all.sh b/build-all.sh index aa06b71..9961f92 100755 --- a/build-all.sh +++ b/build-all.sh @@ -5,6 +5,8 @@ # Allowed: release, prerelease, branches, special # Default: undefined +echo "▶️ $0 $*" + ALL_BUILDS=("release" "prerelease" "branches" "special") BUILDS=("${BUILD:-"${ALL_BUILDS[@]}"}") diff --git a/build-branches.sh b/build-branches.sh index 1dd1131..36c55d7 100755 --- a/build-branches.sh +++ b/build-branches.sh @@ -1,6 +1,8 @@ #!/bin/bash # Builds develop, develop-* and master branches +echo "▶️ $0 $*" + ORIGINAL_GITHUB_REPO="digitalocean/netbox" GITHUB_REPO="${GITHUB_REPO-$ORIGINAL_GITHUB_REPO}" URL_RELEASES="https://api.github.com/repos/${GITHUB_REPO}/branches" diff --git a/build-latest.sh b/build-latest.sh index bebe554..e996251 100755 --- a/build-latest.sh +++ b/build-latest.sh @@ -1,6 +1,8 @@ #!/bin/bash # Builds the latest released version +echo "▶️ $0 $*" + ORIGINAL_GITHUB_REPO="digitalocean/netbox" GITHUB_REPO="${GITHUB_REPO-$ORIGINAL_GITHUB_REPO}" URL_RELEASES="https://api.github.com/repos/${GITHUB_REPO}/releases" diff --git a/build.sh b/build.sh index f28532a..ecd680d 100755 --- a/build.sh +++ b/build.sh @@ -1,6 +1,8 @@ #!/bin/bash # Builds the Dockerfile[.variant] and injects tgz'ed Netbox code from Github +echo "▶️ $0 $*" + set -e if [ "${1}x" == "x" ] || [ "${1}" == "--help" ] || [ "${1}" == "-h" ]; then From 1fb6b80f939811a2231b7fafcfb394af98e9af02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Ma=CC=88der?= Date: Tue, 10 Apr 2018 11:13:52 +0200 Subject: [PATCH 4/5] =?UTF-8?q?=E2=9A=99=EF=B8=8F=20Print=20every=20comman?= =?UTF-8?q?d?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build-all.sh | 1 + build-branches.sh | 1 + build-latest.sh | 1 + build.sh | 2 +- 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/build-all.sh b/build-all.sh index 9961f92..5c3490f 100755 --- a/build-all.sh +++ b/build-all.sh @@ -6,6 +6,7 @@ # Default: undefined echo "▶️ $0 $*" +set -x ALL_BUILDS=("release" "prerelease" "branches" "special") BUILDS=("${BUILD:-"${ALL_BUILDS[@]}"}") diff --git a/build-branches.sh b/build-branches.sh index 36c55d7..8054d5a 100755 --- a/build-branches.sh +++ b/build-branches.sh @@ -2,6 +2,7 @@ # Builds develop, develop-* and master branches echo "▶️ $0 $*" +set -x ORIGINAL_GITHUB_REPO="digitalocean/netbox" GITHUB_REPO="${GITHUB_REPO-$ORIGINAL_GITHUB_REPO}" diff --git a/build-latest.sh b/build-latest.sh index e996251..fce32d4 100755 --- a/build-latest.sh +++ b/build-latest.sh @@ -2,6 +2,7 @@ # Builds the latest released version echo "▶️ $0 $*" +set -x ORIGINAL_GITHUB_REPO="digitalocean/netbox" GITHUB_REPO="${GITHUB_REPO-$ORIGINAL_GITHUB_REPO}" diff --git a/build.sh b/build.sh index ecd680d..9e6da03 100755 --- a/build.sh +++ b/build.sh @@ -2,7 +2,7 @@ # Builds the Dockerfile[.variant] and injects tgz'ed Netbox code from Github echo "▶️ $0 $*" - +set -x set -e if [ "${1}x" == "x" ] || [ "${1}" == "--help" ] || [ "${1}" == "-h" ]; then From a5dccb25586af4482a6d5ef7dbfebf80257e97f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Ma=CC=88der?= Date: Tue, 10 Apr 2018 11:42:06 +0200 Subject: [PATCH 5/5] =?UTF-8?q?Revert=20"=E2=9A=99=EF=B8=8F=20Print=20ever?= =?UTF-8?q?y=20command"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 1fb6b80f939811a2231b7fafcfb394af98e9af02. --- build-all.sh | 1 - build-branches.sh | 1 - build-latest.sh | 1 - build.sh | 2 +- 4 files changed, 1 insertion(+), 4 deletions(-) diff --git a/build-all.sh b/build-all.sh index 5c3490f..9961f92 100755 --- a/build-all.sh +++ b/build-all.sh @@ -6,7 +6,6 @@ # Default: undefined echo "▶️ $0 $*" -set -x ALL_BUILDS=("release" "prerelease" "branches" "special") BUILDS=("${BUILD:-"${ALL_BUILDS[@]}"}") diff --git a/build-branches.sh b/build-branches.sh index 8054d5a..36c55d7 100755 --- a/build-branches.sh +++ b/build-branches.sh @@ -2,7 +2,6 @@ # Builds develop, develop-* and master branches echo "▶️ $0 $*" -set -x ORIGINAL_GITHUB_REPO="digitalocean/netbox" GITHUB_REPO="${GITHUB_REPO-$ORIGINAL_GITHUB_REPO}" diff --git a/build-latest.sh b/build-latest.sh index fce32d4..e996251 100755 --- a/build-latest.sh +++ b/build-latest.sh @@ -2,7 +2,6 @@ # Builds the latest released version echo "▶️ $0 $*" -set -x ORIGINAL_GITHUB_REPO="digitalocean/netbox" GITHUB_REPO="${GITHUB_REPO-$ORIGINAL_GITHUB_REPO}" diff --git a/build.sh b/build.sh index 9e6da03..ecd680d 100755 --- a/build.sh +++ b/build.sh @@ -2,7 +2,7 @@ # Builds the Dockerfile[.variant] and injects tgz'ed Netbox code from Github echo "▶️ $0 $*" -set -x + set -e if [ "${1}x" == "x" ] || [ "${1}" == "--help" ] || [ "${1}" == "-h" ]; then