Skip to content

Commit c438ef7

Browse files
committed
helm
add diff plugin for helm
1 parent f8427a5 commit c438ef7

2 files changed

Lines changed: 30 additions & 3 deletions

File tree

.github/workflows/build_docker_images-static-helm.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ jobs:
5252
HELM_VERSION=$(wget -qO- https://api.github.com/repos/helm/helm/releases/latest | grep 'tag_name' | cut -d\" -f4 | sed 's/^v//')
5353
echo "HELM_VERSION=${HELM_VERSION}"
5454
echo "helm_version=${HELM_VERSION}" >> "$GITHUB_OUTPUT"
55+
HELM_DIFF_VERSION=$(wget -qO- https://api.github.com/repos/databus23/helm-diff/releases/latest | grep 'tag_name' | cut -d\" -f4 | sed 's/^v//')
56+
echo "HELM_DIFF_VERSION=${HELM_DIFF_VERSION}"
57+
echo "helm_diff_version=${HELM_DIFF_VERSION}" >> "$GITHUB_OUTPUT"
5558
5659
- name: Set up QEMU
5760
id: qemu
@@ -98,6 +101,7 @@ jobs:
98101
BUILD_DATE=${{steps.script.outputs.build_date}}
99102
VCS_REF=${{steps.script.outputs.commit_hash}}
100103
HELM_VERSION=${{steps.script.outputs.helm_version}}
104+
HELM_DIFF_VERSION=${{steps.script.outputs.helm_diff_version}}
101105
tags: |
102106
docker.io/${{steps.script.outputs.docker_repo}}:static-helm
103107
docker.io/${{steps.script.outputs.docker_repo}}:static-helm-${{steps.script.outputs.helm_version}}

static-helm.scratch.Dockerfile

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,52 @@
1-
# build: docker build --no-cache --progress=plain --target binary --build-arg HELM_VERSION=3.17.3 -t tobi312/tools:static-helm -f static-helm.scratch.Dockerfile .
1+
# build: docker build --no-cache --progress=plain --target binary --build-arg HELM_VERSION=3.19.0 -t tobi312/tools:static-helm -f static-helm.scratch.Dockerfile .
22
ARG HELM_VERSION
33
FROM golang:alpine AS static-helm
44

55
ARG HELM_VERSION
6+
ARG HELM_DIFF_VERSION
67

78
# helm https://github.com/helm/helm
89

910
SHELL ["/bin/ash", "-euxo", "pipefail", "-c"]
1011

1112
RUN \
13+
#apk add --no-cache git ; \
1214
OS="$(go env GOOS)" ; \
1315
ARCH="$(go env GOARCH)" ; \
1416
TARGETARCH="${ARCH}" ; \
1517
\
18+
# https://github.com/helm/helm
1619
HELM_VERSION=${HELM_VERSION:-$(wget -qO- https://api.github.com/repos/helm/helm/releases/latest | grep 'tag_name' | cut -d\" -f4)} ; \
1720
HELM_VERSION=$(echo ${HELM_VERSION} | sed 's/^v//') ; \
1821
echo ">> HELM_VERSION=${HELM_VERSION}" ; \
1922
wget -qO- "https://get.helm.sh/helm-v${HELM_VERSION}-${OS}-${TARGETARCH}.tar.gz" | tar -xz --strip-components=1 -C /usr/local/bin/ ${OS}-${TARGETARCH}/helm ; \
2023
chmod +x /usr/local/bin/helm ; \
2124
echo ">> HELM_VERSION (check): $(helm version)" ; \
2225
echo ">> helm Help:" ; \
23-
helm --help
24-
26+
helm --help ; \
27+
\
28+
# helm plugins directory
29+
mkdir -p ~/.local/share/helm/plugins ; \
30+
\
31+
# https://github.com/databus23/helm-diff
32+
if [ "$ARCH" != "riscv64" ]; then \
33+
if [ "$ARCH" = "arm" ]; then TARGETARCH="${TARGETARCH}v7" ; fi ; \
34+
HELM_DIFF_VERSION=${HELM_DIFF_VERSION:-$(wget -qO- https://api.github.com/repos/databus23/helm-diff/releases/latest | grep 'tag_name' | cut -d\" -f4)} ; \
35+
HELM_DIFF_VERSION=$(echo ${HELM_DIFF_VERSION} | sed 's/^v//') ; \
36+
echo ">> HELM_DIFF_VERSION=${HELM_DIFF_VERSION}" ; \
37+
mkdir -p ~/.local/share/helm/plugins/helm-diff ; \
38+
wget -qO- "https://github.com/databus23/helm-diff/releases/download/v${HELM_DIFF_VERSION}/helm-diff-${OS}-${TARGETARCH}.tgz" | tar -xz --strip-components=1 -C ~/.local/share/helm/plugins/helm-diff ; \
39+
echo ">> HELM_DIFF_VERSION (check): $(helm diff version)" ; \
40+
echo ">> helm diff Help:" ; \
41+
helm diff --help ; \
42+
else \
43+
echo "unknown arch: $ARCH" ; \
44+
fi
2545

2646
FROM scratch AS binary
2747

2848
ARG HELM_VERSION
49+
ARG HELM_DIFF_VERSION
2950
ARG VCS_REF
3051
ARG BUILD_DATE
3152

@@ -42,8 +63,10 @@ LABEL org.opencontainers.image.title="helm" \
4263
org.opencontainers.image.source="https://github.com/helm/helm"
4364

4465
COPY --from=static-helm /usr/local/bin/helm /usr/local/bin/helm
66+
COPY --from=static-helm /root/.local/share/helm/plugins /root/.local/share/helm/plugins
4567

4668
RUN ["helm", "version"]
69+
#RUN ["helm", "diff", "version"]
4770

4871
ENTRYPOINT ["helm"]
4972
#CMD ["version"]

0 commit comments

Comments
 (0)