Init changes for helm4 support

Signed-off-by: Dan Garfield <dan.garfield@octopus.com>
This commit is contained in:
Dan Garfield 2026-04-17 13:50:36 -06:00
parent 21615be541
commit 256af80244
No known key found for this signature in database
7 changed files with 23 additions and 7 deletions

2
assets/swagger.json generated
View file

@ -7719,7 +7719,7 @@
},
"version": {
"type": "string",
"title": "Version is the Helm version to use for templating (\"3\")"
"title": "Version is the Helm version to use for templating (\"3\" or \"4\")"
}
}
},

View file

@ -3,10 +3,23 @@ set -eux -o pipefail
. "$(dirname "$0")"/../tool-versions.sh
export TARGET_FILE=helm-v${helm3_version}-${INSTALL_OS}-${ARCHITECTURE}.tar.gz
# Determine which Helm version to install (default to v3)
HELM_VERSION=${HELM_VERSION:-3}
[ -e "$DOWNLOADS/${TARGET_FILE}" ] || curl -sLf --retry 3 -o "$DOWNLOADS/${TARGET_FILE}" "https://get.helm.sh/helm-v${helm3_version}-$INSTALL_OS-$ARCHITECTURE.tar.gz"
if [ "$HELM_VERSION" = "3" ]; then
TARGET_FILE=helm-v${helm3_version}-${INSTALL_OS}-${ARCHITECTURE}.tar.gz
DOWNLOAD_URL="https://get.helm.sh/helm-v${helm3_version}-$INSTALL_OS-$ARCHITECTURE.tar.gz"
elif [ "$HELM_VERSION" = "4" ]; then
TARGET_FILE=helm-v${helm4_version}-${INSTALL_OS}-${ARCHITECTURE}.tar.gz
DOWNLOAD_URL="https://get.helm.sh/helm-v${helm4_version}-$INSTALL_OS-$ARCHITECTURE.tar.gz"
else
echo "Error: HELM_VERSION must be 3 or 4, got $HELM_VERSION"
exit 1
fi
[ -e "$DOWNLOADS/${TARGET_FILE}" ] || curl -sLf --retry 3 -o "$DOWNLOADS/${TARGET_FILE}" "$DOWNLOAD_URL"
"$(dirname "$0")"/compare-chksum.sh
mkdir -p /tmp/helm && tar -C /tmp/helm -xf "$DOWNLOADS/${TARGET_FILE}"
sudo install -m 0755 "/tmp/helm/$INSTALL_OS-$ARCHITECTURE/helm" "$BIN/helm"
helm version

View file

@ -12,6 +12,7 @@
# add-kustomize-checksums.sh to help download checksums.
###############################################################################
helm3_version=3.20.1
helm4_version=4.1.1
kustomize5_version=5.8.1
protoc_version=29.3
oras_version=1.2.0

View file

@ -542,7 +542,7 @@ message ApplicationSourceHelm {
// FileParameters are file parameters to the helm template
repeated HelmFileParameter fileParameters = 5;
// Version is the Helm version to use for templating ("3")
// Version is the Helm version to use for templating ("3" or "4")
optional string version = 6;
// PassCredentials pass credentials to all domains (Helm's --pass-credentials)

View file

@ -1858,7 +1858,7 @@ func schema_pkg_apis_application_v1alpha1_ApplicationSourceHelm(ref common.Refer
},
"version": {
SchemaProps: spec.SchemaProps{
Description: "Version is the Helm version to use for templating (\"3\")",
Description: "Version is the Helm version to use for templating (\"3\" or \"4\")",
Type: []string{"string"},
Format: "",
},

View file

@ -547,7 +547,7 @@ type ApplicationSourceHelm struct {
Values string `json:"values,omitempty" patchStrategy:"replace" protobuf:"bytes,4,opt,name=values"`
// FileParameters are file parameters to the helm template
FileParameters []HelmFileParameter `json:"fileParameters,omitempty" protobuf:"bytes,5,opt,name=fileParameters"`
// Version is the Helm version to use for templating ("3")
// Version is the Helm version to use for templating ("3" or "4")
Version string `json:"version,omitempty" protobuf:"bytes,6,opt,name=version"`
// PassCredentials pass credentials to all domains (Helm's --pass-credentials)
PassCredentials bool `json:"passCredentials,omitempty" protobuf:"bytes,7,opt,name=passCredentials"`

View file

@ -34,9 +34,11 @@ type Cmd struct {
func NewCmd(workDir string, version string, proxy string, noProxy string) (*Cmd, error) {
switch version {
// If v3 is specified (or by default, if no value is specified) then use v3
// If v3 or v4 is specified (or by default, if no value is specified) then use v3
case "", "v3":
return NewCmdWithVersion(workDir, false, proxy, noProxy)
case "v4":
return NewCmdWithVersion(workDir, false, proxy, noProxy)
}
return nil, fmt.Errorf("helm chart version '%s' is not supported", version)
}