diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 3d1e6130..2d78a49c 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -54,13 +54,13 @@ jobs: # Helm maintains the latest minor version only and therefore each Helmfile version supports 2 Helm minor versions. # That's why we cover only 2 Helm minor versions in this matrix. # See https://github.com/helmfile/helmfile/pull/286#issuecomment-1250161182 for more context. - - helm-version: v3.12.3 + - helm-version: v3.13.3 kustomize-version: v4.5.7 plugin-secrets-version: 3.15.0 plugin-diff-version: 3.8.1 extra-helmfile-flags: '' v1mode: '' - - helm-version: v3.12.3 + - helm-version: v3.13.3 kustomize-version: v5.2.1 # We assume that the helm-secrets plugin is supposed to # work with the two most recent helm minor versions. @@ -71,20 +71,20 @@ jobs: plugin-diff-version: 3.9.2 extra-helmfile-flags: '' v1mode: '' - - helm-version: v3.13.3 + - helm-version: v3.14.0 kustomize-version: v4.5.7 plugin-secrets-version: 3.15.0 plugin-diff-version: 3.8.1 extra-helmfile-flags: '' v1mode: '' - - helm-version: v3.13.3 + - helm-version: v3.14.0 kustomize-version: v5.2.1 plugin-secrets-version: 4.5.1 plugin-diff-version: 3.9.2 extra-helmfile-flags: '' v1mode: '' # Helmfile v1 - - helm-version: v3.13.3 + - helm-version: v3.14.0 kustomize-version: v5.2.1 plugin-secrets-version: 4.5.1 plugin-diff-version: 3.9.2 @@ -92,7 +92,7 @@ jobs: v1mode: 'true' # In case you need to test some optional helmfile features, # enable it via extra-helmfile-flags below. - - helm-version: v3.13.3 + - helm-version: v3.14.0 kustomize-version: v5.2.1 plugin-secrets-version: 4.5.1 plugin-diff-version: 3.9.2 diff --git a/Dockerfile b/Dockerfile index 32940773..d0d4855e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -30,7 +30,7 @@ ENV HELM_CONFIG_HOME="${HELM_CONFIG_HOME}" ARG HELM_DATA_HOME="${HOME}/.local/share/helm" ENV HELM_DATA_HOME="${HELM_DATA_HOME}" -ARG HELM_VERSION="v3.13.3" +ARG HELM_VERSION="v3.14.0" ENV HELM_VERSION="${HELM_VERSION}" ARG HELM_LOCATION="https://get.helm.sh" ARG HELM_FILENAME="helm-${HELM_VERSION}-${TARGETOS}-${TARGETARCH}.tar.gz" @@ -38,8 +38,8 @@ RUN set -x && \ curl --retry 5 --retry-connrefused -LO "${HELM_LOCATION}/${HELM_FILENAME}" && \ echo Verifying ${HELM_FILENAME}... && \ case ${TARGETPLATFORM} in \ - "linux/amd64") HELM_SHA256="bbb6e7c6201458b235f335280f35493950dcd856825ddcfd1d3b40ae757d5c7d" ;; \ - "linux/arm64") HELM_SHA256="44aaa094ae24d01e8c36e327e1837fd3377a0f9152626da088384c5bc6d94562" ;; \ + "linux/amd64") HELM_SHA256="f43e1c3387de24547506ab05d24e5309c0ce0b228c23bd8aa64e9ec4b8206651" ;; \ + "linux/arm64") HELM_SHA256="b29e61674731b15f6ad3d1a3118a99d3cc2ab25a911aad1b8ac8c72d5a9d2952" ;; \ esac && \ echo "${HELM_SHA256} ${HELM_FILENAME}" | sha256sum -c && \ echo Extracting ${HELM_FILENAME}... && \ diff --git a/Dockerfile.debian-stable-slim b/Dockerfile.debian-stable-slim index 51ba027f..2f1b0406 100644 --- a/Dockerfile.debian-stable-slim +++ b/Dockerfile.debian-stable-slim @@ -35,7 +35,7 @@ ENV HELM_CONFIG_HOME="${HELM_CONFIG_HOME}" ARG HELM_DATA_HOME="${HOME}/.local/share/helm" ENV HELM_DATA_HOME="${HELM_DATA_HOME}" -ARG HELM_VERSION="v3.13.3" +ARG HELM_VERSION="v3.14.0" ENV HELM_VERSION="${HELM_VERSION}" ARG HELM_LOCATION="https://get.helm.sh" ARG HELM_FILENAME="helm-${HELM_VERSION}-${TARGETOS}-${TARGETARCH}.tar.gz" @@ -43,8 +43,8 @@ RUN set -x && \ curl --retry 5 --retry-connrefused -LO "${HELM_LOCATION}/${HELM_FILENAME}" && \ echo Verifying ${HELM_FILENAME}... && \ case ${TARGETPLATFORM} in \ - "linux/amd64") HELM_SHA256="bbb6e7c6201458b235f335280f35493950dcd856825ddcfd1d3b40ae757d5c7d" ;; \ - "linux/arm64") HELM_SHA256="44aaa094ae24d01e8c36e327e1837fd3377a0f9152626da088384c5bc6d94562" ;; \ + "linux/amd64") HELM_SHA256="f43e1c3387de24547506ab05d24e5309c0ce0b228c23bd8aa64e9ec4b8206651" ;; \ + "linux/arm64") HELM_SHA256="b29e61674731b15f6ad3d1a3118a99d3cc2ab25a911aad1b8ac8c72d5a9d2952" ;; \ esac && \ echo "${HELM_SHA256} ${HELM_FILENAME}" | sha256sum -c && \ echo Extracting ${HELM_FILENAME}... && \ diff --git a/Dockerfile.ubuntu b/Dockerfile.ubuntu index 35175772..a8198f54 100644 --- a/Dockerfile.ubuntu +++ b/Dockerfile.ubuntu @@ -35,7 +35,7 @@ ENV HELM_CONFIG_HOME="${HELM_CONFIG_HOME}" ARG HELM_DATA_HOME="${HOME}/.local/share/helm" ENV HELM_DATA_HOME="${HELM_DATA_HOME}" -ARG HELM_VERSION="v3.13.3" +ARG HELM_VERSION="v3.14.0" ENV HELM_VERSION="${HELM_VERSION}" ARG HELM_LOCATION="https://get.helm.sh" ARG HELM_FILENAME="helm-${HELM_VERSION}-${TARGETOS}-${TARGETARCH}.tar.gz" @@ -43,8 +43,8 @@ RUN set -x && \ curl --retry 5 --retry-connrefused -LO "${HELM_LOCATION}/${HELM_FILENAME}" && \ echo Verifying ${HELM_FILENAME}... && \ case ${TARGETPLATFORM} in \ - "linux/amd64") HELM_SHA256="bbb6e7c6201458b235f335280f35493950dcd856825ddcfd1d3b40ae757d5c7d" ;; \ - "linux/arm64") HELM_SHA256="44aaa094ae24d01e8c36e327e1837fd3377a0f9152626da088384c5bc6d94562" ;; \ + "linux/amd64") HELM_SHA256="f43e1c3387de24547506ab05d24e5309c0ce0b228c23bd8aa64e9ec4b8206651" ;; \ + "linux/arm64") HELM_SHA256="b29e61674731b15f6ad3d1a3118a99d3cc2ab25a911aad1b8ac8c72d5a9d2952" ;; \ esac && \ echo "${HELM_SHA256} ${HELM_FILENAME}" | sha256sum -c && \ echo Extracting ${HELM_FILENAME}... && \ diff --git a/go.mod b/go.mod index 4d74fdb3..e7c95a69 100644 --- a/go.mod +++ b/go.mod @@ -27,7 +27,7 @@ require ( golang.org/x/sync v0.6.0 golang.org/x/term v0.16.0 gopkg.in/yaml.v2 v2.4.0 - helm.sh/helm/v3 v3.13.3 + helm.sh/helm/v3 v3.14.0 k8s.io/apimachinery v0.29.1 ) @@ -170,8 +170,8 @@ require ( github.com/docker/go-metrics v0.0.1 // indirect github.com/docker/go-units v0.5.0 // indirect github.com/dustin/go-humanize v1.0.1 // indirect - github.com/emicklei/go-restful/v3 v3.10.1 // indirect - github.com/evanphx/json-patch v5.6.0+incompatible // indirect + github.com/emicklei/go-restful/v3 v3.11.0 // indirect + github.com/evanphx/json-patch v5.7.0+incompatible // indirect github.com/felixge/httpsnoop v1.0.3 // indirect github.com/getsops/gopgagent v0.0.0-20170926210634-4d7ea76ff71a // indirect github.com/getsops/sops/v3 v3.8.0 // indirect @@ -247,9 +247,9 @@ require ( gopkg.in/gookit/color.v1 v1.1.6 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - k8s.io/api v0.28.4 // indirect - k8s.io/cli-runtime v0.28.4 // indirect - k8s.io/client-go v0.28.4 // indirect + k8s.io/api v0.29.0 // indirect + k8s.io/cli-runtime v0.29.0 // indirect + k8s.io/client-go v0.29.0 // indirect k8s.io/klog/v2 v2.110.1 // indirect k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 // indirect k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect diff --git a/go.sum b/go.sum index e2777234..3ff2ac95 100644 --- a/go.sum +++ b/go.sum @@ -409,8 +409,8 @@ github.com/docker/libtrust v0.0.0-20150114040149-fa567046d9b1 h1:ZClxb8laGDf5arX github.com/docker/libtrust v0.0.0-20150114040149-fa567046d9b1/go.mod h1:cyGadeNEkKy96OOhEzfZl+yxihPEzKnqJwvfuSUqbZE= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= -github.com/emicklei/go-restful/v3 v3.10.1 h1:rc42Y5YTp7Am7CS630D7JmhRjq4UlEUuEKfrDac4bSQ= -github.com/emicklei/go-restful/v3 v3.10.1/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= +github.com/emicklei/go-restful/v3 v3.11.0 h1:rAQeMHw1c7zTmncogyy8VvRZwtkmkZ4FxERmMY4rD+g= +github.com/emicklei/go-restful/v3 v3.11.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= @@ -421,8 +421,8 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.m github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/evanphx/json-patch v5.6.0+incompatible h1:jBYDEEiFBPxA0v50tFdvOzQQTCvpL6mnFh5mB2/l16U= -github.com/evanphx/json-patch v5.6.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= +github.com/evanphx/json-patch v5.7.0+incompatible h1:vgGkfT/9f8zE6tvSCe74nfpAVDQ2tG6yudJd8LBksgI= +github.com/evanphx/json-patch v5.7.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs= github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw= @@ -1513,8 +1513,8 @@ gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gotest.tools/v3 v3.4.0 h1:ZazjZUfuVeZGLAmlKKuyv3IKP5orXcwtOwDQH6YVr6o= gotest.tools/v3 v3.4.0/go.mod h1:CtbdzLSsqVhDgMtKsx03ird5YTGB3ar27v0u/yKBW5g= -helm.sh/helm/v3 v3.13.3 h1:0zPEdGqHcubehJHP9emCtzRmu8oYsJFRrlVF3TFj8xY= -helm.sh/helm/v3 v3.13.3/go.mod h1:3OKO33yI3p4YEXtTITN2+4oScsHeQe71KuzhlZ+aPfg= +helm.sh/helm/v3 v3.14.0 h1:TaZIH6uOchn7L27ptwnnuHJiFrT/BsD4dFdp/HLT2nM= +helm.sh/helm/v3 v3.14.0/go.mod h1:2itvvDv2WSZXTllknfQo6j7u3VVgMAvm8POCDgYH424= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= @@ -1522,14 +1522,14 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -k8s.io/api v0.28.4 h1:8ZBrLjwosLl/NYgv1P7EQLqoO8MGQApnbgH8tu3BMzY= -k8s.io/api v0.28.4/go.mod h1:axWTGrY88s/5YE+JSt4uUi6NMM+gur1en2REMR7IRj0= +k8s.io/api v0.29.0 h1:NiCdQMY1QOp1H8lfRyeEf8eOwV6+0xA6XEE44ohDX2A= +k8s.io/api v0.29.0/go.mod h1:sdVmXoz2Bo/cb77Pxi71IPTSErEW32xa4aXwKH7gfBA= k8s.io/apimachinery v0.29.1 h1:KY4/E6km/wLBguvCZv8cKTeOwwOBqFNjwJIdMkMbbRc= k8s.io/apimachinery v0.29.1/go.mod h1:6HVkd1FwxIagpYrHSwJlQqZI3G9LfYWRPAkUvLnXTKU= -k8s.io/cli-runtime v0.28.4 h1:IW3aqSNFXiGDllJF4KVYM90YX4cXPGxuCxCVqCD8X+Q= -k8s.io/cli-runtime v0.28.4/go.mod h1:MLGRB7LWTIYyYR3d/DOgtUC8ihsAPA3P8K8FDNIqJ0k= -k8s.io/client-go v0.28.4 h1:Np5ocjlZcTrkyRJ3+T3PkXDpe4UpatQxj85+xjaD2wY= -k8s.io/client-go v0.28.4/go.mod h1:0VDZFpgoZfelyP5Wqu0/r/TRYcLYuJ2U1KEeoaPa1N4= +k8s.io/cli-runtime v0.29.0 h1:q2kC3cex4rOBLfPOnMSzV2BIrrQlx97gxHJs21KxKS4= +k8s.io/cli-runtime v0.29.0/go.mod h1:VKudXp3X7wR45L+nER85YUzOQIru28HQpXr0mTdeCrk= +k8s.io/client-go v0.29.0 h1:KmlDtFcrdUzOYrBhXHgKw5ycWzc3ryPX5mQe0SkG3y8= +k8s.io/client-go v0.29.0/go.mod h1:yLkXH4HKMAywcrD82KMSmfYg2DlE8mepPR4JGSo5n38= k8s.io/klog/v2 v2.110.1 h1:U/Af64HJf7FcwMcXyKm2RPM22WZzyR7OSpYj5tg3cL0= k8s.io/klog/v2 v2.110.1/go.mod h1:YGtd1984u+GgbuZ7e08/yBuAfKLSO0+uR1Fhi6ExXjo= k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 h1:aVUu9fTY98ivBPKR9Y5w/AuzbMm96cd3YHRTU83I780= diff --git a/pkg/app/init.go b/pkg/app/init.go index a93e88bd..8af8b890 100644 --- a/pkg/app/init.go +++ b/pkg/app/init.go @@ -17,8 +17,8 @@ import ( ) const ( - HelmRequiredVersion = "v3.12.3" - HelmRecommendedVersion = "v3.13.3" + HelmRequiredVersion = "v3.13.3" + HelmRecommendedVersion = "v3.14.0" HelmDiffRecommendedVersion = "v3.9.2" HelmSecretsRecommendedVersion = "v4.1.1" HelmGitRecommendedVersion = "v0.12.0" diff --git a/pkg/state/chart_dependency.go b/pkg/state/chart_dependency.go index a514a27e..bccc464c 100644 --- a/pkg/state/chart_dependency.go +++ b/pkg/state/chart_dependency.go @@ -63,7 +63,10 @@ func (d *UnresolvedDependencies) Add(chart, url, versionConstraint string) error Repository: url, VersionConstraint: versionConstraint, } - return d.add(dep) + if !d.contains(dep) { + return d.add(dep) + } + return nil } func (d *UnresolvedDependencies) add(dep unresolvedChartDependency) error { @@ -77,6 +80,22 @@ func (d *UnresolvedDependencies) add(dep unresolvedChartDependency) error { return nil } +// contains checks if the UnresolvedDependencies contains the specified unresolvedChartDependency. +// It returns true if the dependency is found, otherwise it returns false. +// fix 'more than one dependency with name or alias "raw"' error since helm v3.14.0 +func (d *UnresolvedDependencies) contains(dep unresolvedChartDependency) bool { + deps := d.deps[dep.ChartName] + if deps == nil { + return false + } + for _, existDep := range deps { + if existDep.ChartName == dep.ChartName { + return true + } + } + return false +} + func (d *UnresolvedDependencies) ToChartRequirements() *ChartRequirements { deps := []unresolvedChartDependency{} diff --git a/pkg/state/chart_dependency_test.go b/pkg/state/chart_dependency_test.go index 8f569c08..9ad33715 100644 --- a/pkg/state/chart_dependency_test.go +++ b/pkg/state/chart_dependency_test.go @@ -64,3 +64,71 @@ func TestGetUnresolvedDependenciess(t *testing.T) { }) } } + +func TestContains(t *testing.T) { + tests := []struct { + name string + dep unresolvedChartDependency + deps map[string][]unresolvedChartDependency + expected bool + }{ + { + name: "existing dependency with right item", + dep: unresolvedChartDependency{ + ChartName: "abc", + Repository: "oci://localhost:5000/aaa", + VersionConstraint: "0.1.0", + }, + deps: map[string][]unresolvedChartDependency{ + "abc": { + { + ChartName: "abc", + Repository: "oci://localhost:5000/aaa", + VersionConstraint: "0.1.0", + }, + }, + }, + expected: true, + }, + { + name: "existing dependency with empty item", + dep: unresolvedChartDependency{ + ChartName: "ghi", + Repository: "oci://localhost:5000/aaa", + VersionConstraint: "0.1.0", + }, + deps: map[string][]unresolvedChartDependency{ + "ghi": {}, + }, + expected: false, + }, + { + name: "non-existing dependency", + dep: unresolvedChartDependency{ + ChartName: "def", + Repository: "oci://localhost:5000/bbb", + VersionConstraint: "0.2.0", + }, + deps: map[string][]unresolvedChartDependency{ + "abc": { + { + ChartName: "abc", + Repository: "oci://localhost:5000/aaa", + VersionConstraint: "0.1.0", + }, + }, + }, + expected: false, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + d := &UnresolvedDependencies{ + deps: tt.deps, + } + actual := d.contains(tt.dep) + require.Equal(t, tt.expected, actual) + }) + } +}