Skip to content

Commit 49e5318

Browse files
authored
Add Dockerfile.install for testing plugin installation locally (#227)
1 parent 0c256a9 commit 49e5318

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed

Makefile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
HELM_HOME ?= $(shell helm home)
22
VERSION := $(shell sed -n -e 's/version:[ "]*\([^"]*\).*/\1/p' plugin.yaml)
33

4+
HELM_3_PLUGINS := $(shell bash -c 'eval $$(helm env); echo $$HELM_PLUGINS')
5+
46
PKG:= github.com/databus23/helm-diff
57
LDFLAGS := -X $(PKG)/cmd.Version=$(VERSION)
68

@@ -19,6 +21,12 @@ install: build
1921
cp bin/diff $(HELM_HOME)/plugins/helm-diff/bin
2022
cp plugin.yaml $(HELM_HOME)/plugins/helm-diff/
2123

24+
.PHONY: install/helm3
25+
install/helm3:
26+
mkdir -p $(HELM_3_PLUGINS)/helm-diff/bin
27+
cp bin/diff $(HELM_3_PLUGINS)/helm-diff/bin
28+
cp plugin.yaml $(HELM_3_PLUGINS)/helm-diff/
29+
2230
.PHONY: lint
2331
lint:
2432
scripts/update-gofmt.sh
@@ -70,3 +78,9 @@ ifndef GITHUB_TOKEN
7078
$(error GITHUB_TOKEN is undefined)
7179
endif
7280
scripts/release.sh v$(VERSION) master
81+
82+
# Test for the plugin installation with `helm plugin install -v THIS_BRANCH` works
83+
# Useful for verifying modified `install-binary.sh` still works against various environments
84+
.PHONY: test-plugin-installation
85+
test-plugin-installation:
86+
docker build -f testdata/Dockerfile.install .

testdata/Dockerfile.install

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
FROM alpine/helm:2.16.9
2+
3+
ADD . /workspace
4+
5+
WORKDIR /workspace
6+
7+
RUN helm init -c
8+
RUN helm plugin install .
9+
RUN helm version -c
10+
11+
FROM alpine/helm:3.2.4
12+
13+
ADD . /workspace
14+
15+
WORKDIR /workspace
16+
17+
RUN helm plugin install .
18+
RUN helm version -c
19+
20+
FROM ubuntu:focal
21+
22+
ADD . /workspace
23+
24+
WORKDIR /workspace
25+
26+
# See "From Apt (Debian/Ubuntu)" at https://helm.sh/docs/intro/install/
27+
RUN apt-get update && \
28+
apt-get install curl && \
29+
curl https://helm.baltorepo.com/organization/signing.asc | sudo apt-key add - && \
30+
apt-get install apt-transport-https --yes && \
31+
echo "deb https://baltocdn.com/helm/stable/debian/ all main" | tee /etc/apt/sources.list.d/helm-stable-debian.list && \
32+
apt-get update && \
33+
apt-get install helm
34+
35+
RUN helm plugin install .
36+
RUN helm version -c

0 commit comments

Comments
 (0)