Skip to content

Commit eb35f89

Browse files
Copilotchefgs
andauthored
Improve kubectl download diagnostics
Agent-Logs-Url: https://github.com/cloudengine-labs/devops_os/sessions/8929bee2-ec5e-454a-8614-f771484942ab Co-authored-by: chefgs <7605658+chefgs@users.noreply.github.com>
1 parent 99b0320 commit eb35f89

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

.devcontainer/Dockerfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,12 @@ RUN if [ "$INSTALL_TERRAFORM" = "true" ]; then \
125125

126126
# Install kubectl if requested
127127
RUN if [ "$INSTALL_KUBECTL" = "true" ]; then \
128-
KUBECTL_VERSION="$(curl -fsSL https://dl.k8s.io/release/stable.txt)" \
128+
KUBECTL_VERSION="$(curl -fsSL https://dl.k8s.io/release/stable.txt)" || (echo "failed to resolve the latest kubectl version" >&2 && exit 1) \
129129
&& curl -fsSLo /tmp/kubectl "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/${TARGETOS}/${TARGETARCH}/kubectl" \
130130
&& curl -fsSLo /tmp/kubectl.sha256 "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/${TARGETOS}/${TARGETARCH}/kubectl.sha256" \
131-
&& (test "$(cat /tmp/kubectl.sha256)" = "$(sha256sum /tmp/kubectl | cut -d' ' -f1)" || (echo "kubectl checksum verification failed" >&2 && exit 1)) \
131+
&& KUBECTL_SHA256="$(cat /tmp/kubectl.sha256)" \
132+
&& DOWNLOADED_KUBECTL_SHA256="$(sha256sum /tmp/kubectl | cut -d' ' -f1)" \
133+
&& (test "${KUBECTL_SHA256}" = "${DOWNLOADED_KUBECTL_SHA256}" || (echo "kubectl checksum verification failed" >&2 && exit 1)) \
132134
&& install -o root -g root -m 0755 /tmp/kubectl /usr/local/bin/kubectl \
133135
&& rm -f /tmp/kubectl /tmp/kubectl.sha256; \
134136
fi

0 commit comments

Comments
 (0)