[VOL-5063] - Fix stale voltctl binary install by docker.
docker/Dockerfile.voltctl
-------------------------
o voltctl v1.6.1 installed by hardcoded path.
- v1.8.3 released, v1.9.1 latest available (release pending).
o Download into a temp file to avoid contention or access problems.
o Split download and install into two distinct steps:
- Helps create a tiny window for installation.
- Binary corrupt/unusable while downloading.
o Plenty of comments added.
o Long term revisit this logic, branch==master should retrieve/install
latest tagged release binary. Release cycle needs to retrieve a
frozen binary but only on the release branch/tag.
Change-Id: I6f301b934b67dcd3061c7b48386d016ab62e8a82
diff --git a/Makefile b/Makefile
index 75f58a1..24d6433 100644
--- a/Makefile
+++ b/Makefile
@@ -856,8 +856,21 @@
voltctl-docker-image-build:
cd docker && docker build -t opencord/voltctl:local -f Dockerfile.voltctl .
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
voltctl-docker-image-install-kind:
@if [ "`kind get clusters | grep kind`" = '' ]; then echo "no kind cluster found" && exit 1; fi
kind load docker-image --name `kind get clusters | grep kind` opencord/voltctl:local
+## -----------------------------------------------------------------------
+## Intent: [yuck] replace with a standalone reusable installer 4script
+## -----------------------------------------------------------------------
+.PHONY: voltctl-download-url
+voltctl-download-url:
+ curl --silent https://api.github.com/repos/opencord/voltctl/releases/latest \
+ | grep 'browser_download_url' \
+ | grep 'linux-amd64'
+
+# [latest] https://github.com/opencord/voltctl/releases/download/untagged-cd611c39178f25b95a87/voltctl-1.9.1-linux-amd64
+
# [EOF]
diff --git a/VERSION b/VERSION
index ae93586..aab16c0 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.12.7
+2.12.7.1-dev
diff --git a/docker/Dockerfile.voltctl b/docker/Dockerfile.voltctl
index a394938..9931b9f 100644
--- a/docker/Dockerfile.voltctl
+++ b/docker/Dockerfile.voltctl
@@ -15,7 +15,47 @@
FROM busybox:1.31.1-glibc
RUN mkdir -p /usr/bin
-RUN wget -O - https://github.com/opencord/voltctl/releases/download/v1.6.1/voltctl-1.6.1-linux-amd64 > /usr/bin/voltctl
+
+# -------------------------------------------------------------------
+# [VOL-5063] - branch==master install latest (tag ?!?)
+# else install release(d) version.
+# -------------------------------------------------------------------
+# https://api.github.com/repos/opencord/voltctl/releases/latest
+# - offers voltctl/releases/download/1.8.45 as released
+# https://github.com/opencord/voltctl/releases
+# - offers v1.9.1 (latest released via build + tagging).
+# -------------------------------------------------------------------
+# RUN wget -O - https://github.com/opencord/voltctl/releases/download/v1.9.1/voltctl-1.9.1-linux-amd64
+
+# https://github.com/opencord/voltctl/releases/download/untagged-cd611c39178f25b95a87/voltctl-1.9.1-linux-amd64
+
+RUN wget -q\
+ -O /usr/bin/voltctl.tmp\
+ https://github.com/opencord/voltctl/releases/download/v1.8.45/voltctl-1.8.45-linux-amd64
+
+## -----------------------------------------------------
+## Maintain a tiny window for rename to avoid contention
+## - Validate download by displaying version
+## - --version not supported by wget binary
+## - Detection and error recovery possible if release
+## binary corrupt or mia but potential for stale
+## command version to silently persist is a larger
+## testing issue so explicitly overwrite.
+## -----------------------------------------------------
+RUN chmod a+x /usr/bin/voltctl.tmp && sync
+# RUN /usr/bin/voltctl.tmp --version
COPY volt.config /root/.volt/config
-RUN chmod a+x /usr/bin/voltctl && sync && voltctl completion bash >> /root/.bashrc
+RUN mv -vf /usr/bin/voltctl.tmp /usr/bin/voltctl
+RUN /usr/bin/voltctl completion bash >> /root/.bashrc
+
+## -----------------------------------------------------------------------
+## Infinite loop -- huh(?!?)
+## Interrogate voltctl startup for status to avoid potential for
+## container accumulation when downstream container shutdown fails.
+## -----------------------------------------------------------------------
+## If sleep is intended to keep the container alive for downstream tasks
+## use handshakes and/or timeouts to avoid long term, idle, resource retention
+## -----------------------------------------------------------------------
CMD ["sh", "-c", "sleep infinity"]
+
+# [EOF]