Skip to content

Commit 8c7554d

Browse files
committed
Add helm-v4 support
This commit adds support for Helm v4 while maintaining backward compatibility with Helm v3. Helm v2 support has been dropped. Key changes: - Added dual Helm v3/v4 API support using wrapper pattern - Runtime version detection by reading plugin manifest format - Separate plugin manifests for Helm v3 and v4 - Install hook automatically copies correct manifest - Updated acceptance tests to test both Helm 3 and 4 - Bumped dependencies to latest versions (Go 1.25, Helm v3.19.4, Helm v4.0.4) - Added arm64/aarch64 architecture support - Updated GoReleaser configuration (fixed deprecation warning) - Removed all Helm v2 code and references
1 parent 01df751 commit 8c7554d

40 files changed

Lines changed: 1086 additions & 1081 deletions

.github/workflows/build-pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- name: setup go environment
1515
uses: actions/setup-go@v2
1616
with:
17-
go-version: '1.21'
17+
go-version: '1.25'
1818
- name: run unit tests
1919
run: sudo pip install virtualenv && make test
2020
- name: build binary

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
- name: setup go environment
1414
uses: actions/setup-go@v2
1515
with:
16-
go-version: '1.21'
16+
go-version: '1.25'
1717
- name: run unit tests
1818
run: sudo pip install virtualenv && make test
1919
- name: build binary

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ jobs:
1818
name: Set up Go
1919
uses: actions/setup-go@v2
2020
with:
21-
go-version: "1.21"
21+
go-version: "1.25"
2222
-
2323
name: Run GoReleaser
24-
uses: goreleaser/goreleaser-action@v2
24+
uses: goreleaser/goreleaser-action@v6
2525
with:
2626
version: latest
27-
args: release --rm-dist
27+
args: release --clean
2828
env:
2929
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
**/*.tgz.prov
44
.chartmuseum.log
55
.cover/
6-
.helm2/
76
.helm3/
7+
.helm-version
88
.idea/
99
.robot/
1010
.venv/

.goreleaser.yml

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1+
version: 2
2+
13
env:
24
- GO111MODULE=on
5+
36
before:
47
hooks:
58
- go mod download
9+
610
builds:
711
- main: ./cmd/helm-cm-push
8-
binary: ./bin/helm-cm-push
12+
binary: bin/helm-cm-push
913
env:
1014
- CGO_ENABLED=0
1115
goos:
@@ -14,15 +18,21 @@ builds:
1418
- windows
1519
goarch:
1620
- amd64
17-
- arm
1821
- arm64
19-
goarm:
20-
- "6"
21-
- "7"
22+
goamd64:
23+
- v1
24+
goarm64:
25+
- v8.0
26+
# Exclude windows arm builds (marked as broken by GoReleaser)
27+
ignore:
28+
- goos: windows
29+
goarch: arm
2230

2331
archives:
24-
- id: tarball
25-
format: tar.gz
32+
- id: default
33+
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
2634
files:
2735
- LICENSE
2836
- plugin.yaml
37+
- testdata/plugin-helm3.yaml
38+
- testdata/plugin-helm4.yaml

Makefile

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,38 +4,68 @@ HAS_PIP := $(shell command -v pip3;)
44
HAS_VENV := $(shell command -v virtualenv;)
55

66
.PHONY: build
7-
build: build_linux build_mac build_windows
7+
build: build_linux build_linux_arm64 build_mac build_mac_arm64 build_windows build_windows_arm64
88

99
build_windows: export GOARCH=amd64
1010
build_windows: export GO111MODULE=on
1111
build_windows:
1212
@GOOS=windows go build -v --ldflags="-w -X main.Version=$(VERSION) -X main.Revision=$(REVISION)" \
1313
-o bin/windows/amd64/helm-cm-push cmd/helm-cm-push/main.go # windows
1414

15+
build_windows_arm64: export GOARCH=arm64
16+
build_windows_arm64: export GO111MODULE=on
17+
build_windows_arm64:
18+
@GOOS=windows go build -v --ldflags="-w -X main.Version=$(VERSION) -X main.Revision=$(REVISION)" \
19+
-o bin/windows/arm64/helm-cm-push cmd/helm-cm-push/main.go # windows arm64
20+
1521
link_windows:
1622
@cp bin/windows/amd64/helm-cm-push ./bin/helm-cm-push
1723

24+
link_windows_arm64:
25+
@cp bin/windows/arm64/helm-cm-push ./bin/helm-cm-push
26+
1827
build_linux: export GOARCH=amd64
1928
build_linux: export CGO_ENABLED=0
2029
build_linux: export GO111MODULE=on
2130
build_linux:
2231
@GOOS=linux go build -v --ldflags="-w -X main.Version=$(VERSION) -X main.Revision=$(REVISION)" \
2332
-o bin/linux/amd64/helm-cm-push cmd/helm-cm-push/main.go # linux
2433

34+
build_linux_arm64: export GOARCH=arm64
35+
build_linux_arm64: export CGO_ENABLED=0
36+
build_linux_arm64: export GO111MODULE=on
37+
build_linux_arm64:
38+
@GOOS=linux go build -v --ldflags="-w -X main.Version=$(VERSION) -X main.Revision=$(REVISION)" \
39+
-o bin/linux/arm64/helm-cm-push cmd/helm-cm-push/main.go # linux arm64
40+
2541
link_linux:
2642
@cp bin/linux/amd64/helm-cm-push ./bin/helm-cm-push
2743

44+
link_linux_arm64:
45+
@cp bin/linux/arm64/helm-cm-push ./bin/helm-cm-push
46+
2847
build_mac: export GOARCH=amd64
2948
build_mac: export CGO_ENABLED=0
3049
build_mac: export GO111MODULE=on
3150
build_mac:
3251
@GOOS=darwin go build -v --ldflags="-w -X main.Version=$(VERSION) -X main.Revision=$(REVISION)" \
33-
-o bin/darwin/amd64/helm-cm-push cmd/helm-cm-push/main.go # mac osx
52+
-o bin/darwin/amd64/helm-cm-push cmd/helm-cm-push/main.go # mac osx intel
3453
@cp bin/darwin/amd64/helm-cm-push ./bin/helm-cm-push # For use w make install
3554

55+
build_mac_arm64: export GOARCH=arm64
56+
build_mac_arm64: export CGO_ENABLED=0
57+
build_mac_arm64: export GO111MODULE=on
58+
build_mac_arm64:
59+
@GOOS=darwin go build -v --ldflags="-w -X main.Version=$(VERSION) -X main.Revision=$(REVISION)" \
60+
-o bin/darwin/arm64/helm-cm-push cmd/helm-cm-push/main.go # mac osx apple silicon
61+
@cp bin/darwin/arm64/helm-cm-push ./bin/helm-cm-push # For use w make install
62+
3663
link_mac:
3764
@cp bin/darwin/amd64/helm-cm-push ./bin/helm-cm-push
3865

66+
link_mac_arm64:
67+
@cp bin/darwin/arm64/helm-cm-push ./bin/helm-cm-push
68+
3969
.PHONY: clean
4070
clean:
4171
@git status --ignored --short | grep '^!! ' | sed 's/!! //' | xargs rm -rf

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ Based on the version in `plugin.yaml`, release binary will be downloaded from Gi
1010

1111
```
1212
$ helm plugin install https://github.com/chartmuseum/helm-push
13-
Downloading and installing helm-push v0.10.1 ...
14-
https://github.com/chartmuseum/helm-push/releases/download/v0.10.1/helm-push_0.10.1_darwin_amd64.tar.gz
13+
Downloading and installing helm-push v0.11.0 ...
14+
https://github.com/chartmuseum/helm-push/releases/download/v0.11.0/helm-push_0.11.0_darwin_amd64.tar.gz
1515
Installed plugin: cm-push
1616
```
1717

@@ -101,9 +101,9 @@ In ChartMuseum server (>0.7.1) this will automatically be added to index.yaml if
101101

102102
## Authentication
103103
### Basic Auth
104-
If you have added your repo with the `--username`/`--password` flags (Helm 2.9+), or have added your repo with the basic auth username/password in the URL (e.g. `https://myuser:mypass@my.chart.repo.com`), no further setup is required.
104+
If you have added your repo with the `--username`/`--password` flags, or have added your repo with the basic auth username/password in the URL (e.g. `https://myuser:mypass@my.chart.repo.com`), no further setup is required.
105105

106-
The plugin will use the auth info located in `~/.helm/repository/repositories.yaml` (for Helm 2) or `~/.config/helm/repositories.yaml` (for Helm 3) in order to authenticate.
106+
The plugin will use the auth info located in `~/.config/helm/repositories.yaml` in order to authenticate.
107107

108108
If you are running ChartMuseum with `AUTH_ANONYMOUS_GET=true`, and have added your repo without authentication, the plugin recognizes the following environment variables for basic auth on push operations:
109109
```

acceptance_tests/01-helm.robot

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ Suite Setup Suite Setup
66
Suite Teardown Suite Teardown
77

88
*** Test Cases ***
9-
Plugin installs on Helm 2
10-
Test plugin installation 2
11-
129
Plugin installs on Helm 3
1310
Test plugin installation 3
1411

12+
Plugin installs on Helm 4
13+
Test plugin installation 4
14+
1515
*** Keywords ***
1616
Test plugin installation
1717
[Arguments] ${version}
@@ -45,11 +45,11 @@ helm-push is not listed as a Helm plugin after removal
4545
Suite Setup
4646
set helm version 3
4747
remove helm plugin
48-
set helm version 2
48+
set helm version 4
4949
remove helm plugin
5050

5151
Suite Teardown
5252
set helm version 3
5353
remove helm plugin
54-
set helm version 2
54+
set helm version 4
5555
remove helm plugin

acceptance_tests/02-chartmuseum.robot

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,19 @@ Suite Setup Suite Setup
88
Suite Teardown Suite Teardown
99

1010
*** Test Cases ***
11-
Plugin works with ChartMuseum on Helm 2
12-
Test ChartMuseum integration 2
13-
1411
Plugin works with ChartMuseum on Helm 3
1512
Test ChartMuseum integration 3
1613

14+
Plugin works with ChartMuseum on Helm 4
15+
Test ChartMuseum integration 4
16+
1717
*** Keywords ***
1818
Test ChartMuseum integration
1919
[Arguments] ${version}
2020
set helm version ${version}
2121
install helm plugin
2222
helm major version detected by plugin is ${version}
2323

24-
use test chart built by same helm version
25-
clear chartmuseum storage
26-
Chart directory can be pushed to ChartMuseum
27-
Chart directory can be pushed to ChartMuseum with custom version
28-
Chart package can be pushed to ChartMuseum
29-
Chart package can be pushed to ChartMuseum with custom version
30-
31-
use test chart built by opposite helm version
3224
clear chartmuseum storage
3325
Chart directory can be pushed to ChartMuseum
3426
Chart directory can be pushed to ChartMuseum with custom version
@@ -114,20 +106,20 @@ Chart package can be pushed to ChartMuseum with custom version
114106
Suite Setup
115107
set helm version 3
116108
remove helm plugin
117-
set helm version 2
109+
set helm version 4
118110
remove helm plugin
119111
remove chartmuseum logs
120112
start chartmuseum
121113
Sleep 2
122-
set helm version 2
123-
add chart repo
124114
set helm version 3
125115
add chart repo
116+
set helm version 4
117+
add chart repo
126118

127119
Suite Teardown
128120
set helm version 3
129121
remove helm plugin
130-
set helm version 2
122+
set helm version 4
131123
remove helm plugin
132124
remove chart repo
133125
stop chartmuseum

acceptance_tests/lib/ChartMuseum.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ def package_exists_in_chartmuseum_storage(self, find=''):
3030
self.run_command('find %s -maxdepth 1 -name "*%s.tgz" | grep tgz' % (common.STORAGE_DIR, find))
3131

3232
def package_contains_expected_files(self):
33-
# Check for requirements.yaml in Helm 2 (a Helm 2-specific file)
33+
# Check for requirements.yaml (legacy dependency format)
3434
checkRequirementsYamlCmd = '(cd %s && mkdir -p tmp && tar -xf *.tgz --directory tmp && find tmp -name requirements.yaml | grep requirements.yaml)' % common.STORAGE_DIR
3535

36-
# Check for values.schema.json in Helm 3 (a Helm 3-specific file)
36+
# Check for values.schema.json (Helm 3+ specific file)
3737
checkValuesSchemaJsonCmd = '(cd %s && mkdir -p tmp && tar -xf *.tgz --directory tmp && find tmp -name values.schema.json | grep values.schema.json)' % common.STORAGE_DIR
3838

3939
if common.USE_OPPOSITE_VERSION:

0 commit comments

Comments
 (0)