bind-charmers team mailing list archive
-
bind-charmers team
-
Mailing list archive
-
Message #00018
[Merge] ~barryprice/charm-k8s-bind/+git/bind-k8s-image-builder:master into ~bind-charmers/charm-k8s-bind/+git/bind-k8s-image-builder:master
Barry Price has proposed merging ~barryprice/charm-k8s-bind/+git/bind-k8s-image-builder:master into ~bind-charmers/charm-k8s-bind/+git/bind-k8s-image-builder:master.
Commit message:
Explicitly ensure git is installed, add shellcheck as a linter, and apply its recommendations to our entrypoint script
Requested reviews:
Bind Charmers (bind-charmers)
For more details, see:
https://code.launchpad.net/~barryprice/charm-k8s-bind/+git/bind-k8s-image-builder/+merge/387933
--
Your team Bind Charmers is requested to review the proposed merge of ~barryprice/charm-k8s-bind/+git/bind-k8s-image-builder:master into ~bind-charmers/charm-k8s-bind/+git/bind-k8s-image-builder:master.
diff --git a/Makefile b/Makefile
index 964c0e2..d23bdb0 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,16 @@
DIST_RELEASE ?= focal
-DOCKER_DEPS = bind9
+DOCKER_DEPS = bind9 git
+SNAP_DEPS = shellcheck
-build-image:
+deps:
+ @echo "Checking shellcheck is present."
+ @which shellcheckk >/dev/null || echo "Please install shellcheck to continue ('sudo snap install shellcheck')" && false
+
+lint: deps
+ @echo "Running shellcheck."
+ @shellcheck files/docker-entrypoint.sh
+
+build-image: lint
@echo "Building the image."
@docker build \
--no-cache=true \
diff --git a/files/docker-entrypoint.sh b/files/docker-entrypoint.sh
index fad6930..254d722 100644
--- a/files/docker-entrypoint.sh
+++ b/files/docker-entrypoint.sh
@@ -1,16 +1,16 @@
#!/bin/bash
set -eu
-if [ -z ${CUSTOM_CONFIG_REPO-} ]; then
+if [ -z "${CUSTOM_CONFIG_REPO-}" ]; then
echo "No custom repo set, will fall back to package default config"
-elif [ -z ${BIND_CONFDIR-} ]; then
+elif [ -z "${BIND_CONFDIR-}" ]; then
BIND_CONFDIR="/etc/bind";
else
echo "Pulling config from $CUSTOM_CONFIG_REPO"
if [ -d /etc/bind ]; then
- mv /etc/bind /etc/bind_$(date +"%Y-%m-%d_%H-%M-%S");
+ mv /etc/bind /etc/bind_"$(date +"%Y-%m-%d_%H-%M-%S")";
fi
- git clone $CUSTOM_CONFIG_REPO $BIND_CONFDIR
+ git clone "$CUSTOM_CONFIG_REPO" "$BIND_CONFDIR"
fi
exec "$@"
Follow ups