Commit graph

154 commits

Author SHA1 Message Date
Branch Vincent
c6d9a5bdc2 build: set kube version via debug.BuildInfo
Signed-off-by: Branch Vincent <branchevincent@gmail.com>
Signed-off-by: George Jenkins <gvjenkins@gmail.com>
2025-12-19 21:13:47 -08:00
Benoit Tigeot
faa8912e36
Inform we use a different golangci-lint version than the CI
Signed-off-by: Benoit Tigeot <benoit.tigeot@lifen.fr>
2025-11-27 08:58:32 +01:00
Benoit Tigeot
b6a8c65216
fix: correct LDFLAGS path for default Kubernetes version
The Makefile LDFLAGS were pointing to an incorrect package path
(helm.sh/helm/v4/pkg/chart/common/util) that doesn't exist, causing
the k8sVersionMajor and k8sVersionMinor variables to silently fail
to be set. This left the hardcoded defaults (1.20) in place.

After this fix, `helm template` now correctly defaults to Kubernetes
v1.34.0 (matching the bundled client-go version) instead of v1.20.0,
ensuring charts render with current stable API versions.

Testing scenario:

```sh
cat > /tmp/test-chart/Chart.yaml << 'EOF'
apiVersion: v2
name: test-chart
version: 1.0.0
kubeVersion: ">= 1.28.0-0"
EOF

./bin/helm template test-release /tmp/test-chart

cat > /tmp/test-chart-fail/Chart.yaml << 'EOF'
apiVersion: v2
name: test-chart-fail
version: 1.0.0
kubeVersion: ">= 1.35.0-0"
EOF

./bin/helm template test-release /tmp/test-chart-fail

Exit code 1
Error: chart requires kubeVersion: >= 1.35.0-0 which is incompatible with Kubernetes v1.34.0
```

Fixes #31508
Closes #31501
Closes #31502

Signed-off-by: Benoit Tigeot <benoit.tigeot@lifen.fr>
2025-11-14 21:18:37 +01:00
Robert Sirchia
f0386b1daa
Merge pull request #31338 from yzewei/add-loong64-support
Add loongarch64 support
2025-10-21 15:51:31 -04:00
yzewei
fd3ef2e000 Add loongarch64 support
Signed-off-by: yzewei <yangzewei@loongson.cn>
2025-10-09 09:07:39 +08:00
George Jenkins
b97452d0e7 feat: helm version print Kubernetes (client-go) version
Signed-off-by: George Jenkins <gvjenkins@gmail.com>
2025-10-01 14:15:47 -07:00
Stephanie Hohenberg
1904ef6ad8 Adapt test-coverage command to be able to run for a certain package
Signed-off-by: Stephanie Hohenberg <stephanie.hohenberg@gmail.com>
2025-09-07 11:01:16 -04:00
Matt Farina
9dcc49cbd5 Move lint pkg to be part of each chart version
Linting is specific to the chart versions. A v2 and v3 chart will
lint differently.

To accomplish this, packages like engine need to be able to handle
different chart versions. This was accomplished by some changes:

1. The introduction of a Charter interface for charts
2. The ChartAccessor which is able to accept a chart and then
   provide access to its data via an interface. There is an
   interface, factory, and implementation for each version of
   chart.
3. Common packages were moved to a common and util packages.
   Due to some package loops, there are 2 packages which may
   get some consolidation in the future.

The new interfaces provide the foundation to move the actions
and cmd packages to be able to handle multiple apiVersions of
charts.

Signed-off-by: Matt Farina <matt.farina@suse.com>
2025-09-02 12:14:37 -04:00
Evans Mungai
5dabfdfb3f
Merge remote-tracking branch 'origin/main' into em/check-go-modules
Signed-off-by: Evans Mungai <mbuevans@gmail.com>
2025-09-01 12:01:11 +01:00
Terry Howe
9eafbc53df fix: make file whitespace
Signed-off-by: Terry Howe <terrylhowe@gmail.com>
2025-08-30 02:00:33 -04:00
Terry Howe
4bc93393bc
feature: enable shuffle for unit tests
Signed-off-by: Terry Howe <terrylhowe@gmail.com>
2025-08-18 10:40:23 -06:00
Evans Mungai
064a18ff79
Update Makefile
Co-authored-by: Terry Howe <terrylhowe@gmail.com>
Signed-off-by: Evans Mungai <mbuevans@gmail.com>
2025-08-07 17:50:26 +01:00
Evans Mungai
46c8caa410
Add info target as part of build
Signed-off-by: Evans Mungai <mbuevans@gmail.com>
2025-08-07 19:11:17 +03:00
Evans Mungai
0dae3d6e88
chore: check if go modules are tidy before build
Signed-off-by: Evans Mungai <mbuevans@gmail.com>
2025-08-07 12:34:26 +01:00
Matt Farina
0dffc580b0
Simpligy the JSON Schema checking
A new library was introduced that provides JSON Schema checking for
newer versions of the schema. In Helm v4, there is no need to have
two packages doing the JSON schema validation. The message output
can have breaking changes.

This change moves everything to the newer library. It also uses a
wrapper error to enable a clean Helm only interface for the
public Go API validation functions. This would enable the replacement
of the Schema validation library, if needed, without breaking the
Go API contract.

Signed-off-by: Matt Farina <matt.farina@suse.com>
2025-04-14 19:32:01 -04:00
Matt Farina
61d3eca55c
Move pkg/chart to pkg/chart/v2 to prepare for v3 charts
This change moves the code, updates the import locations, and
adds a doc.go file to document what the v2 package is for.

This is part of HIP 20 for v3 charts

Signed-off-by: Matt Farina <matt.farina@suse.com>
2025-02-25 15:20:44 -05:00
Matt Farina
5c0deec327
Moving chartutil to chart/util
chartutil was originally created to operate on protobufs which are
no longer part of Helm. The util package makes more sense to be
part of the chart package.

This change is part of the HIP 20 to create v3 charts and
explicitly call out v2 charts. The changes for this are in smaller
bite size changes.

Signed-off-by: Matt Farina <matt.farina@suse.com>
2025-02-21 15:25:55 -05:00
Matt Farina
2236294119 Updating to helm.sh/helm/v4
Since Helm is going through breaking changes with Helm v4, the version path to
Helm needs to be updated.

Signed-off-by: Matt Farina <matt.farina@suse.com>
2024-12-26 16:33:51 -05:00
George Jenkins
4a15cc3385 Cleanup redundant GO11MODULE
Signed-off-by: George Jenkins <gvjenkins@gmail.com>
2024-10-20 19:56:14 -07:00
Matt Farina
d45439f2e9
Merge pull request #11923 from Bhargav-InfraCloud/helm-create-deprication-tests
test(create): Add test to check deprecated `apiVersion`s in resource templates created by `helm create`
2024-09-27 21:37:28 +02:00
Asmit De
5cef14370d
[mk] Add windows arm64 build targets
Signed-off-by: Asmit De <asmit.de@outlook.com>
2024-05-12 01:54:46 -07:00
Bhargav Ravuri
9c0b4c8121
test(create): Test to check deprecated resource templates
Test to check deprecation warnings on resource templates that are
created by `helm create` against the latest Kubernetes version. This
test is run in a separate Makefile command to avoid failing other unit
tests configured to run with a specific Kubernetes version(s).

For resources that are disabled by default (like hpa and ingress),
to avoid skipping them from the helm linter test, they are enabled in
the test.

Fixes #11495

Signed-off-by: Bhargav Ravuri <bhargav.ravuri@infracloud.io>
2024-04-03 12:25:12 +05:30
weidongkl
57a1bb80e5
Update architecture detection method
```
In some OS, obtaining the processor type from `uname - p` may fail.
For Golang programs, we should use `go env GOARCH` to obtain the architecture

=====================
$ go env GOARCH
amd64
$ uname -m
x86_64
$ uname -p
unknown
```

Signed-off-by: weidongkl <weidong@uniontech.com>
2024-01-11 10:53:29 +08:00
Matt Farina
847369c184
Update to Go 1.21 for builds
Noteis:
1. This moves golangci scanning to a GitHub action. This will
   enable inline pointers to issues in the PR where linting fails.
2. Go 1.21 is specified in the go.mod because Kubernetes libs
   require it.
3. The lint issues were removed. Some were fixed while others
   were handled by skipping linting or using _ as an argument.
   Many of these can be refactored later for better cleanup.

Signed-off-by: Matt Farina <matt.farina@suse.com>
2024-01-08 15:48:36 -05:00
Antony Chazapis
040330592f Pin gox to specific commit
Signed-off-by: Antony Chazapis <chazapis@ics.forth.gr>
2023-09-01 09:47:01 +03:00
Antony Chazapis
786707c065 Add support for RISC-V
Signed-off-by: Antony Chazapis <chazapis@ics.forth.gr>
2023-07-13 11:56:56 +03:00
Joe Julian
6f6c0d831d
Allow CGO_ENABLED to be overridden for build
On Mac OS they have some custom dns c library that uses some
configuration files other than resolv.conf to configure dns lookups. The
standard go library does not handle these custom configuration files
which causes dns lookups to fail for some mac users.

This allows the downstream pacakgers to override CGO_ENABLED to build
binaries that use the custom dns library.

Signed-off-by: Joe Julian <me@joejulian.name>
2022-10-05 16:12:17 -07:00
Matthew Fisher
aa6e82bac8
fix: use go install instead of go get
Signed-off-by: Matthew Fisher <matt.fisher@fermyon.com>
2022-07-06 13:34:15 -07:00
Matt Farina
3490f1e7b6 Updating vcs to latest version
vcs had a release due to a CVE. This updates to the latest version
that mitigates the CVE.

Note, the Makefile was updated so that `make build` would build
without cgo just like gox does in the CI pipeline. They should
both build without cgo so we can catch issues before merging to
master where a canary build would pick up the problem.

Signed-off-by: Matt Farina <matt@mattfarina.com>
2022-04-04 15:52:07 -04:00
Adam Reese
d1da9e757e
fix(ci-lint): increase timeout for golangci-lint
Signed-off-by: Adam Reese <adam@reese.io>
2021-07-06 10:37:37 -07:00
Josh Soref
2bf8fdf45d
chore: Spelling (#9410)
* spelling: annotate

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: asserts

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: behavior

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: binary

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: contain

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: copied

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: dependency

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: depending

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: deprecated

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: doesn't

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: donot

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: github

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: inputting

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: iteration

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: jabberwocky

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: kubernetes

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: length

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: mismatch

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: multiple

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: nonexistent

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: outputs

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: panicking

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: plugins

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: parsing

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: porthos

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: regular

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: resource

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: repositories

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: something

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: strict

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: string

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: unknown

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2021-03-15 21:11:57 -04:00
Matt Farina
bfb6bb7af9
Merge pull request #9381 from joelanford/darwin-arm64
Add darwin/arm64 (Apple Silicon) support
2021-03-12 11:56:53 -05:00
pallavJha
03eec30907 add flag trimpath in the go build command
Signed-off-by: Pallav Jha <pallav_kumar71@yahoo.com>
Signed-off-by: pallavJha <pallav_kumar71@yahoo.com>
2021-03-06 15:31:36 +05:30
Joe Lanford
ecdc34c5ab
Add darwin/arm64 (Apple Silicon) support
Signed-off-by: Joe Lanford <joe.lanford@gmail.com>
2021-02-18 10:17:53 -05:00
Marc Khouzam
8d33624520 fix(test): Increase golangci-lint timeout
CircleCI has been failing on 'make test-style' because of a timeout.
This commit increases the timeout.

Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>
2021-02-15 21:32:55 -05:00
Adam Reese
b4010b7782
chore(Makefile): add target to generate golden files
Add target to generate golden files used in unit tests

Signed-off-by: Adam Reese <adam@reese.io>
2021-01-11 12:14:45 -08:00
Adam Reese
6760dda91f
Merge pull request #9192 from adamreese/fix/rebuild-on-gomod-change
fix(Makefile): rebuild the binary if go.mod has changed
2021-01-06 11:36:44 -08:00
Joe Julian
fdcd22ef58
Reduce linting severity for users of out-of-date kubernetes (#8608)
* Reduce linting severity for users of out-of-date kubernetes

Fixes #8596

Signed-off-by: Joe Julian <me@joejulian.name>

* add more verbose deprecation info

Signed-off-by: Joe Julian <me@joejulian.name>

* use new upstream deprecations

Signed-off-by: Joe Julian <me@joejulian.name>

* do not error for custom resources

Signed-off-by: Joe Julian <me@joejulian.name>

* Define deprecation version in lint rules by LDFLAG

Signed-off-by: Joe Julian <me@joejulian.name>

* make comment clearer

Signed-off-by: Joe Julian <me@joejulian.name>

* Extend the k8s version discovery and constants to chartutil

Signed-off-by: Joe Julian <me@joejulian.name>

* remove awk dependency

Signed-off-by: Joe Julian <me@joejulian.name>

* align k8s version constant names between capabilities.go and deprecations.go

Signed-off-by: Joe Julian <me@joejulian.name>

* show the error if the unexpected happens

Signed-off-by: Joe Julian <me@joejulian.name>

* bump k8sVersionMinor and golden chart templates for k8s 1.20

Signed-off-by: Joe Julian <me@joejulian.name>

* bump for tests to match 1.20.1

Signed-off-by: Joe Julian <me@joejulian.name>
2021-01-05 16:05:33 -07:00
Adam Reese
a58209dfa4
fix(Makefile): rebuild the binary if go.mod has changed
Rebuild the binary when go.mod or go.sum has changed

Signed-off-by: Adam Reese <adam@reese.io>
2021-01-05 13:40:06 -08:00
Li Zhijian
e97975d7ad Makefile: check and use GOBIN environment variable first
'go get' will install binaries into GOBIN when it's set which is not
always same with GOPATH/bin

this commit can fix below errors:
~/workspace/k8s/helm$ go env | grep -e GOPATH -e GOBIN -e GOROO
GOBIN="/home/lizj/go/bin"
GOPATH="/home/lizj/gosrc"
GOROOT="/home/lizj/go"
~/workspace/k8s/helm$ make build-cross
(cd /; GO111MODULE=on go get -u github.com/mitchellh/gox)
go: github.com/mitchellh/gox upgrade => v1.0.1
go: github.com/hashicorp/go-version upgrade => v1.2.1
GO111MODULE=on CGO_ENABLED=0 /home/lizj/gosrc/bin/gox -parallel=3 -output="_dist/{{.OS}}-{{.Arch}}/helm" -osarch='darwin/amd64 linux/amd64 linux/386 linux/arm linux/arm64 linux/ppc64le linux/s390x windows/amd64'  -tags '' -ldflags '-w -s -X helm.sh/helm/v3/internal/version.metadata=unreleased -X helm.sh/helm/v3/internal/version.gitCommit=59c77716ad61331da28c37e9430d5f6a3ab23fed -X helm.sh/helm/v3/internal/version.gitTreeState=dirty  -extldflags "-static"' ./cmd/helm
bash: /home/lizj/gosrc/bin/gox: No such file or directory
Makefile:146: recipe for target 'build-cross' failed
make: *** [build-cross] Error 127

Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>
2020-09-30 16:18:59 +08:00
Li Zhijian
d1c8561be6 fix incorrect wildcard expand
Previously, when there is no *.{gz,zip} files under _dist, the wildcard
will be expanded to 2 strings '_dist/*.gz' and '_dist/*.zip'(see below).
helm$ ls _dist
helm$ make checksum
for f in _dist/*.{gz,zip} ; do \
	shasum -a 256 "${f}" | sed 's/_dist\///' > "${f}.sha256sum" ; \
	shasum -a 256 "${f}" | awk '{print $1}' > "${f}.sha256" ; \
done
shasum: _dist/*.gz:
shasum: _dist/*.gz:
shasum: _dist/*.zip:
shasum: _dist/*.zip:
helm$ ls _dist
'*.gz.sha256'  '*.gz.sha256sum'  '*.zip.sha256'  '*.zip.sha256sum'

Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>
2020-09-16 10:44:26 +08:00
Matthew Fisher
f9077ecd65
Merge pull request #8678 from Foxboron/morten/fix-ldflags-override
Makefile: Fix LDFLAGS overriding
2020-09-15 13:40:30 -07:00
Morten Linderud
f917c169d0
Makefile: Fix LDFLAGS overriding
When distributions build software it's desirable to have the ability to
define own linker flags, or Go flags. As `-ldflags` defined in `go
build` overrides `-ldflags` defined in the env variable `GOFLAGS`, there
is a distinct need to be able to replace the default values with new
ones or append to them.

Fixes #8645

Signed-off-by: Morten Linderud <morten@linderud.pw>
2020-09-15 22:24:10 +02:00
Ma Xinjian
8b2cf17648 Add support to install helm
install the binary that was compiled by make build

Signed-off-by: Ma Xinjian <maxj.fnst@cn.fujitsu.com>
2020-09-15 16:06:58 +08:00
Chris Wells
9a13385022 fix: Allow building in a path containing spaces
Signed-off-by: Chris Wells <chriswells0@users.noreply.github.com>
2020-07-19 14:42:04 -04:00
Bridget Kromhout
08517a9ec0
Correct make target in Makefile
Signed-off-by: Bridget Kromhout <bridget@kromhout.org>
2020-07-13 16:04:15 -05:00
Manuel Rüger
fd99c9055d chore(Makefile): Remove unused variable
dep was replaced by go mod

Signed-off-by: Manuel Rüger <manuel@rueg.eu>
2020-06-16 14:34:03 +02:00
Matthew Fisher
5bb951d5a2
Merge pull request #7636 from paulczar/make-release-notes
Adds script to help craft release notes
2020-03-05 10:19:07 -08:00
Matthew Fisher
2d191fc111
Merge pull request #7427 from poelzi/master
Use /usr/bin/env for bash
2020-02-20 13:16:12 -08:00
Paul Czarkowski
f1416a6979 Adds script to help craft release notes
Signed-off-by: Paul Czarkowski <username.taken@gmail.com>
2020-02-19 14:20:50 -06:00