Format shell scripts with shfmt
This commit is contained in:
parent
c6df6a040a
commit
04ac3d5f4b
7 changed files with 73 additions and 59 deletions
|
@ -45,16 +45,16 @@ _get_image_configuration() {
|
||||||
--silent \
|
--silent \
|
||||||
--location \
|
--location \
|
||||||
--header "Authorization: Bearer $token" \
|
--header "Authorization: Bearer $token" \
|
||||||
"https://registry-1.docker.io/v2/$image/blobs/$digest" \
|
"https://registry-1.docker.io/v2/$image/blobs/$digest" |
|
||||||
| jq -r ".config.Labels.\"$label\""
|
jq -r ".config.Labels.\"$label\""
|
||||||
}
|
}
|
||||||
|
|
||||||
_get_token() {
|
_get_token() {
|
||||||
local image=$1
|
local image=$1
|
||||||
curl \
|
curl \
|
||||||
--silent \
|
--silent \
|
||||||
"https://auth.docker.io/token?scope=repository:$image:pull&service=registry.docker.io" \
|
"https://auth.docker.io/token?scope=repository:$image:pull&service=registry.docker.io" |
|
||||||
| jq -r '.token'
|
jq -r '.token'
|
||||||
}
|
}
|
||||||
|
|
||||||
_get_digest() {
|
_get_digest() {
|
||||||
|
@ -65,8 +65,8 @@ _get_digest() {
|
||||||
--silent \
|
--silent \
|
||||||
--header "Accept: application/vnd.docker.distribution.manifest.v2+json" \
|
--header "Accept: application/vnd.docker.distribution.manifest.v2+json" \
|
||||||
--header "Authorization: Bearer $token" \
|
--header "Authorization: Bearer $token" \
|
||||||
"https://registry-1.docker.io/v2/$image/manifests/$tag" \
|
"https://registry-1.docker.io/v2/$image/manifests/$tag" |
|
||||||
| jq -r '.config.digest'
|
jq -r '.config.digest'
|
||||||
}
|
}
|
||||||
|
|
||||||
_get_layers() {
|
_get_layers() {
|
||||||
|
@ -77,6 +77,6 @@ _get_layers() {
|
||||||
--silent \
|
--silent \
|
||||||
--header "Accept: application/vnd.docker.distribution.manifest.v2+json" \
|
--header "Accept: application/vnd.docker.distribution.manifest.v2+json" \
|
||||||
--header "Authorization: Bearer $token" \
|
--header "Authorization: Bearer $token" \
|
||||||
"https://registry-1.docker.io/v2/$image/manifests/$tag" \
|
"https://registry-1.docker.io/v2/$image/manifests/$tag" |
|
||||||
| jq -r '.layers[].digest'
|
jq -r '.layers[].digest'
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,8 +60,9 @@ if [ "${PRERELEASE}" == "true" ]; then
|
||||||
# shellcheck disable=SC2003
|
# shellcheck disable=SC2003
|
||||||
MINOR_UNSTABLE=$(expr match "${VERSION}" 'v[0-9]\+\.\([0-9]\+\)')
|
MINOR_UNSTABLE=$(expr match "${VERSION}" 'v[0-9]\+\.\([0-9]\+\)')
|
||||||
|
|
||||||
if { [ "${MAJOR_STABLE}" -eq "${MAJOR_UNSTABLE}" ] \
|
if {
|
||||||
&& [ "${MINOR_STABLE}" -ge "${MINOR_UNSTABLE}" ];
|
[ "${MAJOR_STABLE}" -eq "${MAJOR_UNSTABLE}" ] &&
|
||||||
|
[ "${MINOR_STABLE}" -ge "${MINOR_UNSTABLE}" ]
|
||||||
} || [ "${MAJOR_STABLE}" -gt "${MAJOR_UNSTABLE}" ]; then
|
} || [ "${MAJOR_STABLE}" -gt "${MAJOR_UNSTABLE}" ]; then
|
||||||
|
|
||||||
echo "❎ Latest unstable version '${VERSION}' is not higher than the latest stable version '$STABLE_VERSION'."
|
echo "❎ Latest unstable version '${VERSION}' is not higher than the latest stable version '$STABLE_VERSION'."
|
||||||
|
|
24
build.sh
24
build.sh
|
@ -174,9 +174,18 @@ PROJECT_VERSION="${PROJECT_VERSION-$(sed -e 's/^[[:space:]]*//' -e 's/[[:space:]
|
||||||
|
|
||||||
# Get the Git information from the netbox directory
|
# Get the Git information from the netbox directory
|
||||||
if [ -d "${NETBOX_PATH}/.git" ]; then
|
if [ -d "${NETBOX_PATH}/.git" ]; then
|
||||||
NETBOX_GIT_REF=$(cd "${NETBOX_PATH}"; git rev-parse HEAD)
|
NETBOX_GIT_REF=$(
|
||||||
NETBOX_GIT_BRANCH=$(cd "${NETBOX_PATH}"; git rev-parse --abbrev-ref HEAD)
|
cd "${NETBOX_PATH}"
|
||||||
NETBOX_GIT_URL=$(cd "${NETBOX_PATH}"; git remote get-url origin)
|
git rev-parse HEAD
|
||||||
|
)
|
||||||
|
NETBOX_GIT_BRANCH=$(
|
||||||
|
cd "${NETBOX_PATH}"
|
||||||
|
git rev-parse --abbrev-ref HEAD
|
||||||
|
)
|
||||||
|
NETBOX_GIT_URL=$(
|
||||||
|
cd "${NETBOX_PATH}"
|
||||||
|
git remote get-url origin
|
||||||
|
)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
###
|
###
|
||||||
|
@ -187,11 +196,14 @@ DOCKER_ORG="${DOCKER_ORG-netboxcommunity}"
|
||||||
DOCKER_REPO="${DOCKER_REPO-netbox}"
|
DOCKER_REPO="${DOCKER_REPO-netbox}"
|
||||||
case "${NETBOX_BRANCH}" in
|
case "${NETBOX_BRANCH}" in
|
||||||
master)
|
master)
|
||||||
TAG="${TAG-latest}";;
|
TAG="${TAG-latest}"
|
||||||
|
;;
|
||||||
develop)
|
develop)
|
||||||
TAG="${TAG-snapshot}";;
|
TAG="${TAG-snapshot}"
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
TAG="${TAG-$NETBOX_BRANCH}";;
|
TAG="${TAG-$NETBOX_BRANCH}"
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
###
|
###
|
||||||
|
|
|
@ -22,9 +22,10 @@ load_configuration() {
|
||||||
# this curl call will get a reply once unit is fully launched
|
# this curl call will get a reply once unit is fully launched
|
||||||
curl --silent --output /dev/null --request GET --unix-socket $UNIT_SOCKET http://localhost/
|
curl --silent --output /dev/null --request GET --unix-socket $UNIT_SOCKET http://localhost/
|
||||||
|
|
||||||
echo "⚙️ Applying configuration from $UNIT_CONFIG";
|
echo "⚙️ Applying configuration from $UNIT_CONFIG"
|
||||||
|
|
||||||
RESP_CODE=$(curl \
|
RESP_CODE=$(
|
||||||
|
curl \
|
||||||
--silent \
|
--silent \
|
||||||
--output /dev/null \
|
--output /dev/null \
|
||||||
--write-out '%{http_code}' \
|
--write-out '%{http_code}' \
|
||||||
|
|
2
test.sh
2
test.sh
|
@ -28,7 +28,7 @@ if [ -z "${IMAGE}" ]; then
|
||||||
echo "⚠️ No image defined"
|
echo "⚠️ No image defined"
|
||||||
|
|
||||||
if [ -z "${DEBUG}" ]; then
|
if [ -z "${DEBUG}" ]; then
|
||||||
exit 1;
|
exit 1
|
||||||
else
|
else
|
||||||
echo "⚠️ Would 'exit 1' here, but DEBUG is '${DEBUG}'."
|
echo "⚠️ Would 'exit 1' here, but DEBUG is '${DEBUG}'."
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue