2019-02-01 02:58:07 -06:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
ensure_jq() {
|
2019-10-10 05:42:10 -05:00
|
|
|
if [ ! -x "$(command -v jq)" ]; then
|
2019-10-10 07:51:06 -05:00
|
|
|
if [ -x "$(command -v apt-get)" ]; then
|
2019-10-10 05:42:10 -05:00
|
|
|
echo "🛠🛠🛠 Installing 'jq' via 'apt-get'"
|
|
|
|
apt-get update && apt-get install -y jq
|
|
|
|
else
|
|
|
|
echo "⚠️⚠️⚠️ apt-get not found, unable to automatically install 'jq'."
|
2019-02-01 02:58:07 -06:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
# Passes args to the scripts
|
|
|
|
run_build() {
|
2019-10-10 05:42:10 -05:00
|
|
|
echo "🐳🐳🐳 Building '${BUILD}' images"
|
2019-02-01 02:58:07 -06:00
|
|
|
case $BUILD in
|
|
|
|
release)
|
|
|
|
# build the latest release
|
|
|
|
# shellcheck disable=SC2068
|
|
|
|
./build-latest.sh $@
|
|
|
|
;;
|
|
|
|
prerelease)
|
|
|
|
# build the latest pre-release
|
|
|
|
# shellcheck disable=SC2068
|
|
|
|
PRERELEASE=true ./build-latest.sh $@
|
|
|
|
;;
|
|
|
|
branches)
|
|
|
|
# build all branches
|
|
|
|
# shellcheck disable=SC2068
|
|
|
|
./build-branches.sh $@
|
|
|
|
;;
|
2019-10-10 07:08:31 -05:00
|
|
|
this) # Pull Requests
|
2019-10-10 07:48:45 -05:00
|
|
|
# only build the 'master' branch
|
|
|
|
# (resulting in the 'latest' docker tag)
|
|
|
|
# and the 'main' target.
|
|
|
|
DOCKER_TARGET=main ./build.sh master
|
2019-10-10 07:08:31 -05:00
|
|
|
;;
|
2019-02-01 02:58:07 -06:00
|
|
|
*)
|
|
|
|
echo "🚨 Unrecognized build '$BUILD'."
|
|
|
|
|
|
|
|
if [ -z "$DEBUG" ]; then
|
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
echo "⚠️ Would exit here with code '1', but DEBUG is enabled."
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
|
|
|
echo "🤖🤖🤖 Preparing build"
|
2019-02-06 07:54:41 -06:00
|
|
|
export DOCKER_ORG="index.docker.io/netboxcommunity"
|
|
|
|
export DOCKER_REPO=netbox
|
|
|
|
export DOCKERHUB_REPO=netboxcommunity/netbox
|
2019-10-10 05:42:10 -05:00
|
|
|
# shellcheck disable=SC2153
|
2019-10-14 17:47:19 -05:00
|
|
|
export BUILD="${DOCKER_TAG}"
|
2019-02-01 02:58:07 -06:00
|
|
|
|
|
|
|
unset DOCKER_TAG
|
|
|
|
|
|
|
|
ensure_jq
|