Skip to content

Commit 3efc697

Browse files
authored
Helm v4 support (#872)
* Update packages for Helm v4
1 parent 7b4b176 commit 3efc697

File tree

14 files changed

+564
-584
lines changed

14 files changed

+564
-584
lines changed

.github/copilot-instructions.md

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,24 @@ Always reference these instructions first and fallback to search or bash command
99
**Prerequisites:**
1010
- Go >= 1.21 (currently uses Go 1.24.5)
1111
- Helm v3 (tested with v3.17.4 and v3.18.6)
12-
- Make sure `/home/runner/go/bin` is in your PATH for staticcheck: `export PATH=$PATH:/home/runner/go/bin`
1312

14-
**Bootstrap and Build Process:**
15-
- ALWAYS run: `make bootstrap` first - downloads dependencies and installs staticcheck. Takes <1 second (if already done) or ~50 seconds (first time).
16-
- Build the plugin: `make build` - includes linting and compiles the binary. Takes ~9 seconds after bootstrap.
17-
- NEVER CANCEL builds. Set timeout to 3+ minutes for bootstrap, 2+ minutes for build operations.
13+
**Build Process:**
14+
- Build the plugin: `make build` - includes linting and compiles the binary.
15+
- NEVER CANCEL builds. Set timeout to 2+ minutes for build operations.
1816

1917
**Testing:**
2018
- Run unit tests: `make test` - includes coverage analysis. Takes ~12 seconds. NEVER CANCEL - set timeout to 3+ minutes.
2119
- Tests include comprehensive coverage (38.7% overall) and use a fake helm binary for isolation.
2220
- Test coverage is generated in `cover.out` with detailed function-level coverage reports.
2321

2422
**Linting and Code Quality:**
25-
- Local linting: `make lint` - runs gofmt, go vet, and staticcheck verification. Takes ~2 seconds.
23+
- Local linting: `make lint` - runs gofmt, go vet. Takes ~2 seconds.
2624
- Code formatting: `make format` - applies gofmt formatting automatically. Takes <1 second.
2725
- Full golangci-lint runs only in CI via GitHub Actions, not available locally.
2826
- ALWAYS run `make format` and `make lint` before committing changes.
2927

3028
**Plugin Installation:**
31-
- Install as Helm plugin: `make install` or `make install/helm3` - builds and installs to Helm plugins directory. Takes ~3 seconds.
29+
- Install as Helm plugin: `make install` or `make install/helm` - builds and installs to Helm plugins directory. Takes ~3 seconds.
3230
- The plugin installs via `install-binary.sh` script which handles cross-platform binary installation.
3331

3432
## Validation Scenarios
@@ -63,8 +61,7 @@ Always reference these instructions first and fallback to search or bash command
6361

6462
**CRITICAL: NEVER CANCEL long-running commands. Use these timeout values:**
6563

66-
- `make bootstrap`: <1 second (if already done) or ~50 seconds (first time) (set timeout: 5+ minutes)
67-
- `make build`: ~9 seconds after bootstrap (set timeout: 3+ minutes)
64+
- `make build`: ~9 seconds (set timeout: 3+ minutes)
6865
- `make test`: ~12 seconds (set timeout: 3+ minutes)
6966
- `make lint`: ~2 seconds (set timeout: 1 minute)
7067
- `make format`: <1 second (set timeout: 1 minute)
@@ -77,7 +74,7 @@ Always reference these instructions first and fallback to search or bash command
7774
- `cmd/` - Command-line interface implementation (upgrade, release, revision, rollback, version)
7875
- `diff/` - Core diffing logic and output formatting
7976
- `manifest/` - Kubernetes manifest parsing and handling
80-
- `scripts/` - Build and verification scripts (gofmt, govet, staticcheck)
77+
- `scripts/` - Build and verification scripts (gofmt, govet)
8178
- `testdata/`, `*/testdata/` - Test fixtures and mock data
8279
- `plugin.yaml` - Helm plugin configuration
8380
- `install-binary.sh` - Cross-platform installation script
@@ -114,7 +111,6 @@ HELM_NAMESPACE=default HELM_BIN=helm ./bin/diff upgrade --install --dry-run my-r
114111
**Common Commands Reference:**
115112
```bash
116113
# Full development cycle
117-
make bootstrap # Install dependencies (once)
118114
make build # Build with linting
119115
make test # Run all tests
120116
make format # Format code

.github/workflows/ci.yaml

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,7 @@ jobs:
1616
- uses: actions/checkout@v5
1717
- uses: actions/setup-go@v6
1818
with:
19-
go-version-file: 'go.mod'
20-
21-
- name: Install dependencies
22-
run: make bootstrap
19+
go-version-file: "go.mod"
2320

2421
- name: Run unit tests
2522
run: make test
@@ -41,9 +38,9 @@ jobs:
4138
fail-fast: false
4239
matrix:
4340
os: [ubuntu-latest, macos-latest, windows-latest]
44-
shell: [ default ]
45-
experimental: [ false ]
46-
helm-version: [ v3.18.6, v3.19.0 ]
41+
shell: [default]
42+
experimental: [false]
43+
helm-version: [v3.18.6, v3.19.2, v4.0.0]
4744
include:
4845
- os: windows-latest
4946
shell: wsl
@@ -61,16 +58,29 @@ jobs:
6158
- os: windows-latest
6259
shell: wsl
6360
experimental: false
64-
helm-version: v3.19.0
61+
helm-version: v3.19.2
62+
- os: windows-latest
63+
shell: cygwin
64+
experimental: false
65+
helm-version: v3.19.2
66+
- os: ubuntu-latest
67+
container: alpine
68+
shell: sh
69+
experimental: false
70+
helm-version: v3.19.2
71+
- os: windows-latest
72+
shell: wsl
73+
experimental: false
74+
helm-version: v4.0.0
6575
- os: windows-latest
6676
shell: cygwin
6777
experimental: false
68-
helm-version: v3.19.0
78+
helm-version: v4.0.0
6979
- os: ubuntu-latest
7080
container: alpine
7181
shell: sh
7282
experimental: false
73-
helm-version: v3.19.0
83+
helm-version: v4.0.0
7484

7585
steps:
7686
- name: Disable autocrlf
@@ -84,7 +94,7 @@ jobs:
8494
- name: Setup Helm
8595
uses: azure/setup-helm@v4
8696
with:
87-
version: ${{ matrix.helm-version }}
97+
version: "${{ matrix.helm-version }}"
8898

8999
- name: Setup WSL
90100
if: "contains(matrix.shell, 'wsl')"
@@ -95,7 +105,7 @@ jobs:
95105
uses: egor-tensin/setup-cygwin@v4
96106

97107
- name: helm plugin install
98-
run: helm plugin install .
108+
run: helm plugin install --debug .
99109

100110
integration-tests:
101111
name: Integration Tests
@@ -109,12 +119,12 @@ jobs:
109119
# That's why we cover only 2 Helm minor versions in this matrix.
110120
# See https://github.com/helmfile/helmfile/pull/286#issuecomment-1250161182 for more context.
111121
- helm-version: v3.18.6
112-
- helm-version: v3.19.0
122+
- helm-version: v3.19.2
123+
- helm-version: v4.0.0
113124
steps:
114125
- uses: engineerd/[email protected]
115126
with:
116-
skipClusterLogsExport: true
117-
127+
skipClusterLogsExport: true
118128

119129
- uses: actions/checkout@v5
120130

@@ -123,8 +133,11 @@ jobs:
123133
with:
124134
version: ${{ matrix.helm-version }}
125135

136+
- name: Helm Version
137+
run: helm version
138+
126139
- name: helm plugin install
127-
run: helm plugin install .
140+
run: make install/helm
128141

129142
- name: helm create helm-diff
130143
run: helm create helm-diff

.golangci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ linters:
5858
- golang.org/x/term
5959
- gopkg.in/yaml.v2
6060
- github.com/stretchr/testify/require
61-
- helm.sh/helm/v3
61+
- helm.sh/helm/v4
6262
- k8s.io/api/core/v1
6363
- k8s.io/apiextensions-apiserver
6464
- k8s.io/apimachinery

Makefile

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

4-
HELM_3_PLUGINS := $(shell helm env HELM_PLUGINS)
4+
HELM_PLUGINS := $(shell helm env HELM_PLUGINS)
55

66
PKG:= github.com/databus23/helm-diff/v3
77
LDFLAGS := -X $(PKG)/cmd.Version=$(VERSION)
@@ -19,18 +19,17 @@ install: build
1919
cp bin/diff $(HELM_HOME)/plugins/helm-diff/bin
2020
cp plugin.yaml $(HELM_HOME)/plugins/helm-diff/
2121

22-
.PHONY: install/helm3
23-
install/helm3: build
24-
mkdir -p $(HELM_3_PLUGINS)/helm-diff/bin
25-
cp bin/diff $(HELM_3_PLUGINS)/helm-diff/bin
26-
cp plugin.yaml $(HELM_3_PLUGINS)/helm-diff/
22+
.PHONY: install/helm
23+
install/helm: build
24+
mkdir -p $(HELM_PLUGINS)/helm-diff/bin
25+
cp bin/diff $(HELM_PLUGINS)/helm-diff/bin
26+
cp plugin.yaml $(HELM_PLUGINS)/helm-diff/
2727

2828
.PHONY: lint
2929
lint:
3030
scripts/update-gofmt.sh
3131
scripts/verify-gofmt.sh
3232
scripts/verify-govet.sh
33-
scripts/verify-staticcheck.sh
3433

3534
.PHONY: build
3635
build: lint
@@ -42,11 +41,6 @@ test:
4241
go test -v ./... -coverprofile cover.out -race
4342
go tool cover -func cover.out
4443

45-
.PHONY: bootstrap
46-
bootstrap:
47-
go mod download
48-
command -v staticcheck || go install honnef.co/go/tools/cmd/staticcheck@latest
49-
5044
.PHONY: docker-run-release
5145
docker-run-release: export pkg=/go/src/github.com/databus23/helm-diff
5246
docker-run-release:
@@ -63,7 +57,7 @@ docker-run-release:
6357
-v ${SSH_AUTH_SOCK}:/tmp/ssh-agent.sock -e SSH_AUTH_SOCK=/tmp/ssh-agent.sock \
6458
-v $(shell pwd):$(pkg) \
6559
-v $(shell pwd)/docker-run-release-cache:/.cache \
66-
-w $(pkg) helm-diff-release make bootstrap release
60+
-w $(pkg) helm-diff-release make release
6761

6862
.PHONY: dist
6963
dist: export COPYFILE_DISABLE=1 #teach OSX tar to not put ._* files in tar archive

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ The first step is to download the repository and enter the directory. You can do
4343
Next, install the plugin into helm.
4444

4545
```bash
46-
make install/helm3
46+
make install/helm
4747
```
4848

4949

0 commit comments

Comments
 (0)