Hello community, here is the log from the commit of package helm for openSUSE:Factory checked in at 2020-11-15 15:22:27 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/helm (Old) and /work/SRC/openSUSE:Factory/.helm.new.24930 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "helm" Sun Nov 15 15:22:27 2020 rev:20 rq:848358 version:3.4.1 Changes: -------- --- /work/SRC/openSUSE:Factory/helm/helm.changes 2020-11-06 23:43:51.527406703 +0100 +++ /work/SRC/openSUSE:Factory/.helm.new.24930/helm.changes 2020-11-15 15:24:22.547322004 +0100 @@ -1,0 +2,26 @@ +Thu Nov 12 01:31:56 UTC 2020 - [email protected] + +- Update to version 3.4.1: + * add unittes for 'helm dep build' with --skip-refresh flag. + * Add --skip-refresh option in helm dep build + * Added tests for PR 8948 + * [#7696] Avoid crash in chart loader on unexpected file sequence + * [#7696] Avoid crash in chart loader on unexpected file sequence + * Updating to k8s 1.19.3 based packages + * lint: lint all documents in a multi-doc yaml file + * List either incubator or stable. + * Clarifies action needed to list new stable repo + * added test for https://github.com/helm/helm/pull/8913 related to https://github.com/helm/helm/issues/8621 + * do not check YAML if nothing was parsed + * helm search supports semver pre version numbers starting with 0 + * Fix that the invalid version number of the helm package command will escape + * Update err message to use the regex pattern directly + * Fix the lint error message for valid names + * Updating descriptions + * Adjusted import + * Reuse kube-client + * Fixes Error: could not find protocol handler for + * Add test case for LoadFiles + * Bugfix: panic when chart contains requirements.lock + +------------------------------------------------------------------- Old: ---- helm-3.4.0.tar.gz New: ---- helm-3.4.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ helm.spec ++++++ --- /var/tmp/diff_new_pack.mQCr3B/_old 2020-11-15 15:24:23.323322834 +0100 +++ /var/tmp/diff_new_pack.mQCr3B/_new 2020-11-15 15:24:23.327322839 +0100 @@ -16,20 +16,21 @@ # -%define git_commit ac925eb7279f4a6955df663a0128044a8a6b7593 +%define goipath helm.sh/helm/v3 +%define git_commit c4e74854886b2efe3321e185578e6db9be0a6e29 +%define git_dirty clean + Name: helm -Version: 3.4.0 +Version: 3.4.1 Release: 0 Summary: The Kubernetes Package Manager License: Apache-2.0 Group: Development/Languages/Other -URL: https://github.com/kubernetes/helm -Source: %{name}-%{version}.tar.gz +URL: https://github.com/helm/helm +Source0: https://github.com/helm/helm/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz Source1: vendor.tar.gz BuildRequires: golang-packaging -BuildRequires: xz BuildRequires: golang(API) >= 1.14 -%{go_nostrip} %{go_provides} %description @@ -59,15 +60,15 @@ %setup -qa1 %build -go build -mod=vendor -buildmode=pie ./cmd/helm +%goprep %{goipath} +%gobuild -mod vendor -buildmode pie -ldflags "-X %{goipath}/internal/version.version=%{version} -X %{goipath}/internal/version.gitCommit=%{git_commit} -X %{goipath}/internal/version.gitTreeState=%{git_dirty}" cmd/helm %install -mkdir -p %{buildroot}%{_bindir} -install -m755 helm %{buildroot}/%{_bindir}/helm +%goinstall mkdir -p %{buildroot}%{_datarootdir}/bash-completion/completions -./helm completion bash > %{buildroot}%{_datarootdir}/bash-completion/completions/%{name} +%{buildroot}/%{_bindir}/helm completion bash > %{buildroot}%{_datarootdir}/bash-completion/completions/%{name} mkdir -p %{buildroot}%{_datarootdir}/zsh_completion.d -./helm completion zsh > %{buildroot}%{_datarootdir}/zsh_completion.d/_%{name} +%{buildroot}/%{_bindir}/helm completion zsh > %{buildroot}%{_datarootdir}/zsh_completion.d/_%{name} %files %doc README.md ++++++ _service ++++++ --- /var/tmp/diff_new_pack.mQCr3B/_old 2020-11-15 15:24:23.363322877 +0100 +++ /var/tmp/diff_new_pack.mQCr3B/_new 2020-11-15 15:24:23.363322877 +0100 @@ -1,11 +1,11 @@ <services> <service name="tar_scm" mode="disabled"> - <param name="url">https://github.com/kubernetes/helm.git</param> + <param name="url">https://github.com/helm/helm.git</param> <param name="scm">git</param> <param name="exclude">.git</param> <param name="versionformat">@PARENT_TAG@</param> <param name="versionrewrite-pattern">v(.*)</param> - <param name="revision">v3.4.0</param> + <param name="revision">v3.4.1</param> <param name="changesgenerate">enable</param> </service> <service name="recompress" mode="disabled"> ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.mQCr3B/_old 2020-11-15 15:24:23.383322899 +0100 +++ /var/tmp/diff_new_pack.mQCr3B/_new 2020-11-15 15:24:23.383322899 +0100 @@ -1,4 +1,4 @@ <servicedata> <service name="tar_scm"> - <param name="url">https://github.com/kubernetes/helm.git</param> - <param name="changesrevision">7090a89efc8a18f3d8178bf47d2462450349a004</param></service></servicedata> \ No newline at end of file + <param name="url">https://github.com/helm/helm.git</param> + <param name="changesrevision">c4e74854886b2efe3321e185578e6db9be0a6e29</param></service></servicedata> \ No newline at end of file ++++++ helm-3.4.0.tar.gz -> helm-3.4.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/helm-3.4.0/.gitignore new/helm-3.4.1/.gitignore --- old/helm-3.4.0/.gitignore 1970-01-01 01:00:00.000000000 +0100 +++ new/helm-3.4.1/.gitignore 2020-11-11 20:44:01.000000000 +0100 @@ -0,0 +1,11 @@ +*.exe +.DS_Store +.coverage/ +.idea/ +.vimrc +.vscode/ +_dist/ +bin/ +vendor/ +# Ignores charts pulled for dependency build tests +cmd/helm/testdata/testcharts/issue-7233/charts/* diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/helm-3.4.0/cmd/helm/dependency_build.go new/helm-3.4.1/cmd/helm/dependency_build.go --- old/helm-3.4.0/cmd/helm/dependency_build.go 2020-10-19 23:34:48.000000000 +0200 +++ new/helm-3.4.1/cmd/helm/dependency_build.go 2020-11-11 20:44:01.000000000 +0100 @@ -58,6 +58,7 @@ Out: out, ChartPath: chartpath, Keyring: client.Keyring, + SkipUpdate: client.SkipRefresh, Getters: getter.All(settings), RepositoryConfig: settings.RepositoryConfig, RepositoryCache: settings.RepositoryCache, @@ -77,6 +78,7 @@ f := cmd.Flags() f.BoolVar(&client.Verify, "verify", false, "verify the packages against signatures") f.StringVar(&client.Keyring, "keyring", defaultKeyring(), "keyring containing public keys") + f.BoolVar(&client.SkipRefresh, "skip-refresh", false, "do not refresh the local repository cache") return cmd } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/helm-3.4.0/cmd/helm/dependency_build_test.go new/helm-3.4.1/cmd/helm/dependency_build_test.go --- old/helm-3.4.0/cmd/helm/dependency_build_test.go 2020-10-19 23:34:48.000000000 +0200 +++ new/helm-3.4.1/cmd/helm/dependency_build_test.go 2020-11-11 20:44:01.000000000 +0100 @@ -99,6 +99,19 @@ if v := reqver.Version; v != "0.1.0" { t.Errorf("mismatched versions. Expected %q, got %q", "0.1.0", v) } + + skipRefreshCmd := fmt.Sprintf("dependency build '%s' --skip-refresh --repository-config %s --repository-cache %s", filepath.Join(rootDir, chartname), repoFile, rootDir) + _, out, err = executeActionCommand(skipRefreshCmd) + + // In this pass, we check --skip-refresh option becomes effective. + if err != nil { + t.Logf("Output: %s", out) + t.Fatal(err) + } + + if strings.Contains(out, `update from the "test" chart repository`) { + t.Errorf("Repo did get updated\n%s", out) + } } func TestDependencyBuildCmdWithHelmV2Hash(t *testing.T) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/helm-3.4.0/cmd/helm/root.go new/helm-3.4.1/cmd/helm/root.go --- old/helm-3.4.0/cmd/helm/root.go 2020-10-19 23:34:48.000000000 +0200 +++ new/helm-3.4.1/cmd/helm/root.go 2020-11-11 20:44:01.000000000 +0100 @@ -62,8 +62,8 @@ | $HELM_REPOSITORY_CONFIG | set the path to the repositories file. | | $KUBECONFIG | set an alternative Kubernetes configuration file (default "~/.kube/config") | | $HELM_KUBEAPISERVER | set the Kubernetes API Server Endpoint for authentication | -| $HELM_KUBEASGROUPS | set the Username to impersonate for the operation. | -| $HELM_KUBEASUSER | set the Groups to use for impoersonation using a comma-separated list. | +| $HELM_KUBEASGROUPS | set the Groups to use for impersonation using a comma-separated list. | +| $HELM_KUBEASUSER | set the Username to impersonate for the operation. | | $HELM_KUBECONTEXT | set the name of the kubeconfig context. | | $HELM_KUBETOKEN | set the Bearer KubeToken used for authentication. | @@ -252,10 +252,12 @@ if url := r.URL; strings.Contains(url, exp.old) { fmt.Fprintf( os.Stderr, - "WARNING: %q is deprecated for %q and will be deleted Nov. 13, 2020.\nWARNING: You should switch to %q\n", + "WARNING: %q is deprecated for %q and will be deleted Nov. 13, 2020.\nWARNING: You should switch to %q via:\nWARNING: helm repo add %q %q --force-update\n", exp.old, exp.name, exp.new, + exp.name, + exp.new, ) } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/helm-3.4.0/cmd/helm/search_repo.go new/helm-3.4.1/cmd/helm/search_repo.go --- old/helm-3.4.0/cmd/helm/search_repo.go 2020-10-19 23:34:48.000000000 +0200 +++ new/helm-3.4.1/cmd/helm/search_repo.go 2020-11-11 20:44:01.000000000 +0100 @@ -154,16 +154,26 @@ data := res[:0] foundNames := map[string]bool{} + appendSearchResults := func(res *search.Result) { + data = append(data, res) + if !o.versions { + foundNames[res.Name] = true // If user hasn't requested all versions, only show the latest that matches + } + } for _, r := range res { if _, found := foundNames[r.Name]; found { continue } v, err := semver.NewVersion(r.Chart.Version) - if err != nil || constraint.Check(v) { - data = append(data, r) - if !o.versions { - foundNames[r.Name] = true // If user hasn't requested all versions, only show the latest that matches + + if err != nil { + // If the current version number check appears ErrSegmentStartsZero or ErrInvalidPrerelease error and not devel mode, ingore + if (err == semver.ErrSegmentStartsZero || err == semver.ErrInvalidPrerelease) && !o.devel { + continue } + appendSearchResults(r) + } else if constraint.Check(v) { + appendSearchResults(r) } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/helm-3.4.0/cmd/helm/search_repo_test.go new/helm-3.4.1/cmd/helm/search_repo_test.go --- old/helm-3.4.0/cmd/helm/search_repo_test.go 2020-10-19 23:34:48.000000000 +0200 +++ new/helm-3.4.1/cmd/helm/search_repo_test.go 2020-11-11 20:44:01.000000000 +0100 @@ -69,6 +69,14 @@ cmd: "search repo maria --output json", golden: "output/search-output-json.txt", }, { + name: "search for 'maria', expect one match with semver begin with zero development version", + cmd: "search repo maria --devel", + golden: "output/search-semver-pre-zero-devel-release.txt", + }, { + name: "search for 'nginx-ingress', expect one match with invalid development pre version", + cmd: "search repo nginx-ingress --devel", + golden: "output/search-semver-pre-invalid-release.txt", + }, { name: "search for 'alpine', expect valid yaml output", cmd: "search repo alpine --output yaml", golden: "output/search-output-yaml.txt", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/helm-3.4.0/cmd/helm/testdata/helmhome/helm/repository/testing-index.yaml new/helm-3.4.1/cmd/helm/testdata/helmhome/helm/repository/testing-index.yaml --- old/helm-3.4.0/cmd/helm/testdata/helmhome/helm/repository/testing-index.yaml 2020-10-19 23:34:48.000000000 +0200 +++ new/helm-3.4.1/cmd/helm/testdata/helmhome/helm/repository/testing-index.yaml 2020-11-11 20:44:01.000000000 +0100 @@ -55,3 +55,33 @@ - name: Bitnami email: [email protected] icon: "" + - name: mariadb + url: https://charts.helm.sh/stable/mariadb-0.3.0-0565674.tgz + checksum: 65229f6de44a2be9f215d11dbff311673fc8ba56 + home: https://mariadb.org + sources: + - https://github.com/bitnami/bitnami-docker-mariadb + version: 0.3.0-0565674 + description: Chart for MariaDB + keywords: + - mariadb + - mysql + - database + - sql + maintainers: + - name: Bitnami + email: [email protected] + icon: "" + nginx-ingress: + - name: nginx-ingress + url: https://github.com/kubernetes/ingress-nginx/ingress-a.b.c.sdfsdf.tgz + checksum: 25229f6de44a2be9f215d11dbff31167ddc8ba56 + home: https://github.com/kubernetes/ingress-nginx + sources: + - https://github.com/kubernetes/ingress-nginx + version: a.b.c.sdfsdf + description: Chart for nginx-ingress + keywords: + - ingress + - nginx + icon: "" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/helm-3.4.0/cmd/helm/testdata/output/search-semver-pre-invalid-release.txt new/helm-3.4.1/cmd/helm/testdata/output/search-semver-pre-invalid-release.txt --- old/helm-3.4.0/cmd/helm/testdata/output/search-semver-pre-invalid-release.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/helm-3.4.1/cmd/helm/testdata/output/search-semver-pre-invalid-release.txt 2020-11-11 20:44:01.000000000 +0100 @@ -0,0 +1,2 @@ +NAME CHART VERSION APP VERSION DESCRIPTION +testing/nginx-ingress a.b.c.sdfsdf Chart for nginx-ingress diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/helm-3.4.0/cmd/helm/testdata/output/search-semver-pre-zero-devel-release.txt new/helm-3.4.1/cmd/helm/testdata/output/search-semver-pre-zero-devel-release.txt --- old/helm-3.4.0/cmd/helm/testdata/output/search-semver-pre-zero-devel-release.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/helm-3.4.1/cmd/helm/testdata/output/search-semver-pre-zero-devel-release.txt 2020-11-11 20:44:01.000000000 +0100 @@ -0,0 +1,2 @@ +NAME CHART VERSION APP VERSION DESCRIPTION +testing/mariadb 0.3.0-0565674 Chart for MariaDB diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/helm-3.4.0/go.mod new/helm-3.4.1/go.mod --- old/helm-3.4.0/go.mod 2020-10-19 23:34:48.000000000 +0200 +++ new/helm-3.4.1/go.mod 2020-11-11 20:44:01.000000000 +0100 @@ -36,13 +36,13 @@ github.com/stretchr/testify v1.6.1 github.com/xeipuuv/gojsonschema v1.2.0 golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 - k8s.io/api v0.19.2 - k8s.io/apiextensions-apiserver v0.19.2 - k8s.io/apimachinery v0.19.2 - k8s.io/cli-runtime v0.19.2 - k8s.io/client-go v0.19.2 + k8s.io/api v0.19.3 + k8s.io/apiextensions-apiserver v0.19.3 + k8s.io/apimachinery v0.19.3 + k8s.io/cli-runtime v0.19.3 + k8s.io/client-go v0.19.3 k8s.io/klog v1.0.0 - k8s.io/kubectl v0.19.2 + k8s.io/kubectl v0.19.3 sigs.k8s.io/yaml v1.2.0 ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/helm-3.4.0/go.sum new/helm-3.4.1/go.sum --- old/helm-3.4.0/go.sum 2020-10-19 23:34:48.000000000 +0200 +++ new/helm-3.4.1/go.sum 2020-11-11 20:44:01.000000000 +0100 @@ -1072,82 +1072,41 @@ k8s.io/api v0.18.8/go.mod h1:d/CXqwWv+Z2XEG1LgceeDmHQwpUJhROPx16SlxJgERY= k8s.io/api v0.19.2 h1:q+/krnHWKsL7OBZg/rxnycsl9569Pud76UJ77MvKXms= k8s.io/api v0.19.2/go.mod h1:IQpK0zFQ1xc5iNIQPqzgoOwuFugaYHK4iCknlAQP9nI= -k8s.io/apiextensions-apiserver v0.18.4 h1:Y3HGERmS8t9u12YNUFoOISqefaoGRuTc43AYCLzWmWE= -k8s.io/apiextensions-apiserver v0.18.4/go.mod h1:NYeyeYq4SIpFlPxSAB6jHPIdvu3hL0pc36wuRChybio= -k8s.io/apiextensions-apiserver v0.18.8 h1:pkqYPKTHa0/3lYwH7201RpF9eFm0lmZDFBNzhN+k/sA= -k8s.io/apiextensions-apiserver v0.18.8/go.mod h1:7f4ySEkkvifIr4+BRrRWriKKIJjPyg9mb/p63dJKnlM= -k8s.io/apiextensions-apiserver v0.19.2 h1:oG84UwiDsVDu7dlsGQs5GySmQHCzMhknfhFExJMz9tA= -k8s.io/apiextensions-apiserver v0.19.2/go.mod h1:EYNjpqIAvNZe+svXVx9j4uBaVhTB4C94HkY3w058qcg= -k8s.io/apimachinery v0.18.4 h1:ST2beySjhqwJoIFk6p7Hp5v5O0hYY6Gngq/gUYXTPIA= -k8s.io/apimachinery v0.18.4/go.mod h1:OaXp26zu/5J7p0f92ASynJa1pZo06YlV9fG7BoWbCko= -k8s.io/apimachinery v0.18.8 h1:jimPrycCqgx2QPearX3to1JePz7wSbVLq+7PdBTTwQ0= -k8s.io/apimachinery v0.18.8/go.mod h1:6sQd+iHEqmOtALqOFjSWp2KZ9F0wlU/nWm0ZgsYWMig= -k8s.io/apimachinery v0.19.2 h1:5Gy9vQpAGTKHPVOh5c4plE274X8D/6cuEiTO2zve7tc= -k8s.io/apimachinery v0.19.2/go.mod h1:DnPGDnARWFvYa3pMHgSxtbZb7gpzzAZ1pTfaUNDVlmA= -k8s.io/apiserver v0.18.4/go.mod h1:q+zoFct5ABNnYkGIaGQ3bcbUNdmPyOCoEBcg51LChY8= -k8s.io/apiserver v0.18.8/go.mod h1:12u5FuGql8Cc497ORNj79rhPdiXQC4bf53X/skR/1YM= -k8s.io/apiserver v0.19.2/go.mod h1:FreAq0bJ2vtZFj9Ago/X0oNGC51GfubKK/ViOKfVAOA= -k8s.io/cli-runtime v0.18.4 h1:IUx7quIOb4gbQ4M+B1ksF/PTBovQuL5tXWzplX3t+FM= -k8s.io/cli-runtime v0.18.4/go.mod h1:9/hS/Cuf7NVzWR5F/5tyS6xsnclxoPLVtwhnkJG1Y4g= -k8s.io/cli-runtime v0.18.8 h1:ycmbN3hs7CfkJIYxJAOB10iW7BVPmXGXkfEyiV9NJ+k= -k8s.io/cli-runtime v0.18.8/go.mod h1:7EzWiDbS9PFd0hamHHVoCY4GrokSTPSL32MA4rzIu0M= -k8s.io/cli-runtime v0.19.2 h1:d4uOtKhy3ImdaKqZJ8yQgLrdtUwsJLfP4Dw7L/kVPOo= -k8s.io/cli-runtime v0.19.2/go.mod h1:CMynmJM4Yf02TlkbhKxoSzi4Zf518PukJ5xep/NaNeY= -k8s.io/client-go v0.18.4 h1:un55V1Q/B3JO3A76eS0kUSywgGK/WR3BQ8fHQjNa6Zc= -k8s.io/client-go v0.18.4/go.mod h1:f5sXwL4yAZRkAtzOxRWUhA/N8XzGCb+nPZI8PfobZ9g= -k8s.io/client-go v0.18.8 h1:SdbLpIxk5j5YbFr1b7fq8S7mDgDjYmUxSbszyoesoDM= -k8s.io/client-go v0.18.8/go.mod h1:HqFqMllQ5NnQJNwjro9k5zMyfhZlOwpuTLVrxjkYSxU= -k8s.io/client-go v0.19.2 h1:gMJuU3xJZs86L1oQ99R4EViAADUPMHHtS9jFshasHSc= -k8s.io/client-go v0.19.2/go.mod h1:S5wPhCqyDNAlzM9CnEdgTGV4OqhsW3jGO1UM1epwfJA= -k8s.io/code-generator v0.18.4/go.mod h1:TgNEVx9hCyPGpdtCWA34olQYLkh3ok9ar7XfSsr8b6c= -k8s.io/code-generator v0.18.8/go.mod h1:TgNEVx9hCyPGpdtCWA34olQYLkh3ok9ar7XfSsr8b6c= -k8s.io/code-generator v0.19.2/go.mod h1:moqLn7w0t9cMs4+5CQyxnfA/HV8MF6aAVENF+WZZhgk= -k8s.io/component-base v0.18.4 h1:Kr53Fp1iCGNsl9Uv4VcRvLy7YyIqi9oaJOQ7SXtKI98= -k8s.io/component-base v0.18.4/go.mod h1:7jr/Ef5PGmKwQhyAz/pjByxJbC58mhKAhiaDu0vXfPk= -k8s.io/component-base v0.18.8 h1:BW5CORobxb6q5mb+YvdwQlyXXS6NVH5fDXWbU7tf2L8= -k8s.io/component-base v0.18.8/go.mod h1:00frPRDas29rx58pPCxNkhUfPbwajlyyvu8ruNgSErU= -k8s.io/component-base v0.19.2 h1:jW5Y9RcZTb79liEhW3XDVTW7MuvEGP0tQZnfSX6/+gs= -k8s.io/component-base v0.19.2/go.mod h1:g5LrsiTiabMLZ40AR6Hl45f088DevyGY+cCE2agEIVo= -k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= -k8s.io/gengo v0.0.0-20200114144118-36b2048a9120/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= +k8s.io/api v0.19.3 h1:GN6ntFnv44Vptj/b+OnMW7FmzkpDoIDLZRvKX3XH9aU= +k8s.io/api v0.19.3/go.mod h1:VF+5FT1B74Pw3KxMdKyinLo+zynBaMBiAfGMuldcNDs= +k8s.io/apiextensions-apiserver v0.19.3 h1:WZxBypSHW4SdXHbdPTS/Jy7L2la6Niggs8BuU5o+avo= +k8s.io/apiextensions-apiserver v0.19.3/go.mod h1:igVEkrE9TzInc1tYE7qSqxaLg/rEAp6B5+k9Q7+IC8Q= +k8s.io/apimachinery v0.19.3 h1:bpIQXlKjB4cB/oNpnNnV+BybGPR7iP5oYpsOTEJ4hgc= +k8s.io/apimachinery v0.19.3/go.mod h1:DnPGDnARWFvYa3pMHgSxtbZb7gpzzAZ1pTfaUNDVlmA= +k8s.io/apiserver v0.19.3/go.mod h1:bx6dMm+H6ifgKFpCQT/SAhPwhzoeIMlHIaibomUDec0= +k8s.io/cli-runtime v0.19.3 h1:vZUTphJIvlh7+867cXiLmyzoCAuQdukbPLIad6eEajQ= +k8s.io/cli-runtime v0.19.3/go.mod h1:q+l845i5/uWzcUpCrl+L4f3XLaJi8ZeLVQ/decwty0A= +k8s.io/client-go v0.19.3 h1:ctqR1nQ52NUs6LpI0w+a5U+xjYwflFwA13OJKcicMxg= +k8s.io/client-go v0.19.3/go.mod h1:+eEMktZM+MG0KO+PTkci8xnbCZHvj9TqR6Q1XDUIJOM= +k8s.io/code-generator v0.19.3/go.mod h1:moqLn7w0t9cMs4+5CQyxnfA/HV8MF6aAVENF+WZZhgk= +k8s.io/component-base v0.19.3 h1:c+DzDNAQFlaoyX+yv8YuWi8xmlQvvY5DnJGbaz5U74o= +k8s.io/component-base v0.19.3/go.mod h1:WhLWSIefQn8W8jxSLl5WNiR6z8oyMe/8Zywg7alOkRc= k8s.io/gengo v0.0.0-20200413195148-3a45101e95ac/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= k8s.io/gengo v0.0.0-20200428234225-8167cfdcfc14/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= -k8s.io/klog v0.0.0-20181102134211-b9b56d5dfc92/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= -k8s.io/klog v0.3.0/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= k8s.io/klog v1.0.0 h1:Pt+yjF5aB1xDSVbau4VsWe+dQNzA0qv1LlXdC2dF6Q8= k8s.io/klog v1.0.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I= k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE= k8s.io/klog/v2 v2.2.0 h1:XRvcwJozkgZ1UQJmfMGpvRthQHOvihEhYtDfAaxMz/A= k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y= -k8s.io/kube-openapi v0.0.0-20200410145947-61e04a5be9a6 h1:Oh3Mzx5pJ+yIumsAD0MOECPVeXsVot0UkiaCGVyfGQY= -k8s.io/kube-openapi v0.0.0-20200410145947-61e04a5be9a6/go.mod h1:GRQhZsXIAJ1xR0C9bd8UpWHZ5plfAS9fzPjJuQ6JL3E= k8s.io/kube-openapi v0.0.0-20200805222855-6aeccd4b50c6 h1:+WnxoVtG8TMiudHBSEtrVL1egv36TkkJm+bA8AxicmQ= k8s.io/kube-openapi v0.0.0-20200805222855-6aeccd4b50c6/go.mod h1:UuqjUnNftUyPE5H64/qeyjQoUZhGpeFDVdxjTeEVN2o= -k8s.io/kubectl v0.18.4 h1:l9DUYPTEMs1+qNtoqPpTyaJOosvj7l7tQqphCO1K52s= -k8s.io/kubectl v0.18.4/go.mod h1:EzB+nfeUWk6fm6giXQ8P4Fayw3dsN+M7Wjy23mTRtB0= -k8s.io/kubectl v0.18.8 h1:qTkHCz21YmK0+S0oE6TtjtxmjeDP42gJcZJyRKsIenA= -k8s.io/kubectl v0.18.8/go.mod h1:PlEgIAjOMua4hDFTEkVf+W5M0asHUKfE4y7VDZkpLHM= -k8s.io/kubectl v0.19.2 h1:/Dxz9u7S0GnchLA6Avqi5k1qhZH4Fusgecj8dHsSnbk= -k8s.io/kubectl v0.19.2/go.mod h1:4ib3oj5ma6gF95QukTvC7ZBMxp60+UEAhDPjLuBIrV4= +k8s.io/kubectl v0.19.3 h1:T8IHHpg+uRIfn34wqJ8wHG5bbH+VV5FNPtJ+jKcho1U= +k8s.io/kubectl v0.19.3/go.mod h1:t5cscfrAuHUvEGNyNJjPKt+rGlaJzk8jrKYHXxEsANE= k8s.io/kubernetes v1.13.0/go.mod h1:ocZa8+6APFNC2tX1DZASIbocyYT5jHzqFVsY5aoB7Jk= -k8s.io/metrics v0.18.4/go.mod h1:luze4fyI9JG4eLDZy0kFdYEebqNfi0QrG4xNEbPkHOs= -k8s.io/metrics v0.18.8/go.mod h1:j7JzZdiyhLP2BsJm/Fzjs+j5Lb1Y7TySjhPWqBPwRXA= -k8s.io/metrics v0.19.2/go.mod h1:IlLaAGXN0q7yrtB+SV0q3JIraf6VtlDr+iuTcX21fCU= -k8s.io/utils v0.0.0-20200324210504-a9aa75ae1b89 h1:d4vVOjXm687F1iLSP2q3lyPPuyvTUt3aVoBpi2DqRsU= -k8s.io/utils v0.0.0-20200324210504-a9aa75ae1b89/go.mod h1:sZAwmy6armz5eXlNoLmJcl4F1QuKu7sr+mFQ0byX7Ew= +k8s.io/metrics v0.19.3/go.mod h1:Eap/Lk1FiAIjkaArFuv41v+ph6dbDpVGwAg7jMI+4vg= k8s.io/utils v0.0.0-20200729134348-d5654de09c73 h1:uJmqzgNWG7XyClnU/mLPBWwfKKF1K8Hf8whTseBgJcg= k8s.io/utils v0.0.0-20200729134348-d5654de09c73/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= -sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.7/go.mod h1:PHgbrJT7lCHcxMU+mDHEm+nx46H4zuuHZkDP6icnhu0= sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.9/go.mod h1:dzAXnQbTRyDlZPJX2SUPEqvnB+j7AJjtlox7PEwigU0= sigs.k8s.io/kustomize v2.0.3+incompatible h1:JUufWFNlI44MdtnjUqVnvh29rR37PQFzPbLXqhyOyX0= sigs.k8s.io/kustomize v2.0.3+incompatible/go.mod h1:MkjgH3RdOWrievjo6c9T245dYlB5QeXV4WCbnt/PEpU= -sigs.k8s.io/structured-merge-diff/v3 v3.0.0-20200116222232-67a7b8c61874/go.mod h1:PlARxl6Hbt/+BC80dRLi1qAmnMqwqDg62YvvVkZjemw= -sigs.k8s.io/structured-merge-diff/v3 v3.0.0 h1:dOmIZBMfhcHS09XZkMyUgkq5trg3/jRyJYFZUiaOp8E= -sigs.k8s.io/structured-merge-diff/v3 v3.0.0/go.mod h1:PlARxl6Hbt/+BC80dRLi1qAmnMqwqDg62YvvVkZjemw= sigs.k8s.io/structured-merge-diff/v4 v4.0.1 h1:YXTMot5Qz/X1iBRJhAt+vI+HVttY0WkSqqhKxQ0xVbA= sigs.k8s.io/structured-merge-diff/v4 v4.0.1/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK1F7G282QMXDPYydCw= -sigs.k8s.io/yaml v1.1.0 h1:4A07+ZFc2wgJwo8YNlQpr1rVlgUDlxXHhPJciaPY5gs= sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= sigs.k8s.io/yaml v1.2.0 h1:kr/MCeFWJWTwyaHoR9c8EjH9OumOmoF9YGiZd7lFm/Q= sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc= diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/helm-3.4.0/pkg/action/package.go new/helm-3.4.1/pkg/action/package.go --- old/helm-3.4.0/pkg/action/package.go 2020-10-19 23:34:48.000000000 +0200 +++ new/helm-3.4.1/pkg/action/package.go 2020-11-11 20:44:01.000000000 +0100 @@ -27,7 +27,6 @@ "github.com/pkg/errors" "golang.org/x/crypto/ssh/terminal" - "helm.sh/helm/v3/pkg/chart" "helm.sh/helm/v3/pkg/chart/loader" "helm.sh/helm/v3/pkg/chartutil" "helm.sh/helm/v3/pkg/provenance" @@ -64,9 +63,11 @@ // If version is set, modify the version. if p.Version != "" { - if err := setVersion(ch, p.Version); err != nil { - return "", err - } + ch.Metadata.Version = p.Version + } + + if err := validateVersion(ch.Metadata.Version); err != nil { + return "", err } if p.AppVersion != "" { @@ -103,14 +104,11 @@ return name, err } -func setVersion(ch *chart.Chart, ver string) error { - // Verify that version is a Version, and error out if it is not. +// validateVersion Verify that version is a Version, and error out if it is not. +func validateVersion(ver string) error { if _, err := semver.NewVersion(ver); err != nil { return err } - - // Set the version field on the chart. - ch.Metadata.Version = ver return nil } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/helm-3.4.0/pkg/action/package_test.go new/helm-3.4.1/pkg/action/package_test.go --- old/helm-3.4.0/pkg/action/package_test.go 2020-10-19 23:34:48.000000000 +0200 +++ new/helm-3.4.1/pkg/action/package_test.go 2020-11-11 20:44:01.000000000 +0100 @@ -22,31 +22,11 @@ "path" "testing" + "github.com/Masterminds/semver/v3" + "helm.sh/helm/v3/internal/test/ensure" - "helm.sh/helm/v3/pkg/chart" ) -func TestSetVersion(t *testing.T) { - c := &chart.Chart{ - Metadata: &chart.Metadata{ - Name: "prow", - Version: "0.0.1", - }, - } - expect := "1.2.3-beta.5" - if err := setVersion(c, expect); err != nil { - t.Fatal(err) - } - - if c.Metadata.Version != expect { - t.Errorf("Expected %q, got %q", expect, c.Metadata.Version) - } - - if err := setVersion(c, "monkeyface"); err == nil { - t.Error("Expected bogus version to return an error.") - } -} - func TestPassphraseFileFetcher(t *testing.T) { secret := "secret" directory := ensure.TempFile(t, "passphrase-file", []byte(secret)) @@ -100,3 +80,46 @@ t.Error("Expected passphraseFileFetcher returning an error") } } + +func TestValidateVersion(t *testing.T) { + type args struct { + ver string + } + tests := []struct { + name string + args args + wantErr error + }{ + { + "normal semver version", + args{ + ver: "1.1.3-23658", + }, + nil, + }, + { + "Pre version number starting with 0", + args{ + ver: "1.1.3-023658", + }, + semver.ErrSegmentStartsZero, + }, + { + "Invalid version number", + args{ + ver: "1.1.3.sd.023658", + }, + semver.ErrInvalidSemVer, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if err := validateVersion(tt.args.ver); err != nil { + if err != tt.wantErr { + t.Errorf("Expected {%v}, got {%v}", tt.wantErr, err) + } + + } + }) + } +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/helm-3.4.0/pkg/chart/loader/load.go new/helm-3.4.1/pkg/chart/loader/load.go --- old/helm-3.4.0/pkg/chart/loader/load.go 2020-10-19 23:34:48.000000000 +0200 +++ new/helm-3.4.1/pkg/chart/loader/load.go 2020-11-11 20:44:01.000000000 +0100 @@ -73,10 +73,11 @@ c := new(chart.Chart) subcharts := make(map[string][]*BufferedFile) + // do not rely on assumed ordering of files in the chart and crash + // if Chart.yaml was not coming early enough to initialize metadata for _, f := range files { c.Raw = append(c.Raw, &chart.File{Name: f.Name, Data: f.Data}) - switch { - case f.Name == "Chart.yaml": + if f.Name == "Chart.yaml" { if c.Metadata == nil { c.Metadata = new(chart.Metadata) } @@ -89,6 +90,13 @@ if c.Metadata.APIVersion == "" { c.Metadata.APIVersion = chart.APIVersionV1 } + } + } + for _, f := range files { + switch { + case f.Name == "Chart.yaml": + // already processed + continue case f.Name == "Chart.lock": c.Lock = new(chart.Lock) if err := yaml.Unmarshal(f.Data, &c.Lock); err != nil { @@ -123,6 +131,9 @@ if err := yaml.Unmarshal(f.Data, &c.Lock); err != nil { return c, errors.Wrap(err, "cannot load requirements.lock") } + if c.Metadata == nil { + c.Metadata = new(chart.Metadata) + } if c.Metadata.APIVersion == chart.APIVersionV1 { c.Files = append(c.Files, &chart.File{Name: f.Name, Data: f.Data}) } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/helm-3.4.0/pkg/chart/loader/load_test.go new/helm-3.4.1/pkg/chart/loader/load_test.go --- old/helm-3.4.0/pkg/chart/loader/load_test.go 2020-10-19 23:34:48.000000000 +0200 +++ new/helm-3.4.1/pkg/chart/loader/load_test.go 2020-11-11 20:44:01.000000000 +0100 @@ -22,6 +22,7 @@ "compress/gzip" "io" "io/ioutil" + "log" "os" "path/filepath" "runtime" @@ -206,6 +207,32 @@ verifyDependencies(t, c) } +func TestLoadFiles_BadCases(t *testing.T) { + for _, tt := range []struct { + name string + bufferedFiles []*BufferedFile + expectError string + }{ + { + name: "These files contain only requirements.lock", + bufferedFiles: []*BufferedFile{ + { + Name: "requirements.lock", + Data: []byte(""), + }, + }, + expectError: "validation: chart.metadata.apiVersion is required"}, + } { + _, err := LoadFiles(tt.bufferedFiles) + if err == nil { + t.Fatal("expected error when load illegal files") + } + if !strings.Contains(err.Error(), tt.expectError) { + t.Errorf("Expected error to contain %q, got %q for %s", tt.expectError, err.Error(), tt.name) + } + } +} + func TestLoadFiles(t *testing.T) { goodFiles := []*BufferedFile{ { @@ -280,6 +307,76 @@ } } +// Test the order of file loading. The Chart.yaml file needs to come first for +// later comparison checks. See https://github.com/helm/helm/pull/8948 +func TestLoadFilesOrder(t *testing.T) { + goodFiles := []*BufferedFile{ + { + Name: "requirements.yaml", + Data: []byte("dependencies:"), + }, + { + Name: "values.yaml", + Data: []byte("var: some values"), + }, + + { + Name: "templates/deployment.yaml", + Data: []byte("some deployment"), + }, + { + Name: "templates/service.yaml", + Data: []byte("some service"), + }, + { + Name: "Chart.yaml", + Data: []byte(`apiVersion: v1 +name: frobnitz +description: This is a frobnitz. +version: "1.2.3" +keywords: + - frobnitz + - sprocket + - dodad +maintainers: + - name: The Helm Team + email: [email protected] + - name: Someone Else + email: [email protected] +sources: + - https://example.com/foo/bar +home: http://example.com +icon: https://example.com/64x64.png +`), + }, + } + + // Capture stderr to make sure message about Chart.yaml handle dependencies + // is not present + r, w, err := os.Pipe() + if err != nil { + t.Fatalf("Unable to create pipe: %s", err) + } + stderr := log.Writer() + log.SetOutput(w) + defer func() { + log.SetOutput(stderr) + }() + + _, err = LoadFiles(goodFiles) + if err != nil { + t.Errorf("Expected good files to be loaded, got %v", err) + } + w.Close() + + var text bytes.Buffer + io.Copy(&text, r) + if text.String() != "" { + t.Errorf("Expected no message to Stderr, got %s", text.String()) + } + +} + // Packaging the chart on a Windows machine will produce an // archive that has \\ as delimiters. Test that we support these archives func TestLoadFileBackslash(t *testing.T) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/helm-3.4.0/pkg/chartutil/validate_name.go new/helm-3.4.1/pkg/chartutil/validate_name.go --- old/helm-3.4.0/pkg/chartutil/validate_name.go 2020-10-19 23:34:48.000000000 +0200 +++ new/helm-3.4.1/pkg/chartutil/validate_name.go 2020-11-11 20:44:01.000000000 +0100 @@ -17,6 +17,7 @@ package chartutil import ( + "fmt" "regexp" "github.com/pkg/errors" @@ -39,11 +40,15 @@ errMissingName = errors.New("no name provided") // errInvalidName indicates that an invalid release name was provided - errInvalidName = errors.New("invalid release name, must match regex ^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])+$ and the length must not longer than 53") + errInvalidName = errors.New(fmt.Sprintf( + "invalid release name, must match regex %s and the length must not be longer than 53", + validName.String())) // errInvalidKubernetesName indicates that the name does not meet the Kubernetes // restrictions on metadata names. - errInvalidKubernetesName = errors.New("invalid metadata name, must match regex ^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])+$ and the length must not longer than 253") + errInvalidKubernetesName = errors.New(fmt.Sprintf( + "invalid metadata name, must match regex %s and the length must not be longer than 253", + validName.String())) ) const ( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/helm-3.4.0/pkg/downloader/manager.go new/helm-3.4.1/pkg/downloader/manager.go --- old/helm-3.4.0/pkg/downloader/manager.go 2020-10-19 23:34:48.000000000 +0200 +++ new/helm-3.4.1/pkg/downloader/manager.go 2020-11-11 20:44:01.000000000 +0100 @@ -453,6 +453,12 @@ for _, dd := range deps { + // If the chart is in the local charts directory no repository needs + // to be specified. + if dd.Repository == "" { + continue + } + // When the repoName for a dependency is known we can skip ensuring if _, ok := repoNames[dd.Name]; ok { continue diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/helm-3.4.0/pkg/downloader/manager_test.go new/helm-3.4.1/pkg/downloader/manager_test.go --- old/helm-3.4.0/pkg/downloader/manager_test.go 2020-10-19 23:34:48.000000000 +0200 +++ new/helm-3.4.1/pkg/downloader/manager_test.go 2020-11-11 20:44:01.000000000 +0100 @@ -249,6 +249,76 @@ } } +// TestUpdateWithNoRepo is for the case of a dependency that has no repo listed. +// This happens when the dependency is in the charts directory and does not need +// to be fetched. +func TestUpdateWithNoRepo(t *testing.T) { + // Set up a fake repo + srv, err := repotest.NewTempServerWithCleanup(t, "testdata/*.tgz*") + if err != nil { + t.Fatal(err) + } + defer srv.Stop() + if err := srv.LinkIndices(); err != nil { + t.Fatal(err) + } + dir := func(p ...string) string { + return filepath.Join(append([]string{srv.Root()}, p...)...) + } + + // Setup the dependent chart + d := &chart.Chart{ + Metadata: &chart.Metadata{ + Name: "dep-chart", + Version: "0.1.0", + APIVersion: "v1", + }, + } + + // Save a chart with the dependency + c := &chart.Chart{ + Metadata: &chart.Metadata{ + Name: "with-dependency", + Version: "0.1.0", + APIVersion: "v2", + Dependencies: []*chart.Dependency{{ + Name: d.Metadata.Name, + Version: "0.1.0", + }}, + }, + } + if err := chartutil.SaveDir(c, dir()); err != nil { + t.Fatal(err) + } + + // Save dependent chart into the parents charts directory. If the chart is + // not in the charts directory Helm will return an error that it is not + // found. + if err := chartutil.SaveDir(d, dir(c.Metadata.Name, "charts")); err != nil { + t.Fatal(err) + } + + // Set-up a manager + b := bytes.NewBuffer(nil) + g := getter.Providers{getter.Provider{ + Schemes: []string{"http", "https"}, + New: getter.NewHTTPGetter, + }} + m := &Manager{ + ChartPath: dir(c.Metadata.Name), + Out: b, + Getters: g, + RepositoryConfig: dir("repositories.yaml"), + RepositoryCache: dir(), + } + + // Test the update + err = m.Update() + if err != nil { + t.Fatal(err) + } +} + // This function is the skeleton test code of failing tests for #6416 and #6871 and bugs due to #5874. // // This function is used by below tests that ensures success of build operation diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/helm-3.4.0/pkg/kube/client.go new/helm-3.4.1/pkg/kube/client.go --- old/helm-3.4.0/pkg/kube/client.go 2020-10-19 23:34:48.000000000 +0200 +++ new/helm-3.4.1/pkg/kube/client.go 2020-11-11 20:44:01.000000000 +0100 @@ -43,6 +43,7 @@ "k8s.io/apimachinery/pkg/watch" "k8s.io/cli-runtime/pkg/genericclioptions" "k8s.io/cli-runtime/pkg/resource" + "k8s.io/client-go/kubernetes" "k8s.io/client-go/kubernetes/scheme" cachetools "k8s.io/client-go/tools/cache" watchtools "k8s.io/client-go/tools/watch" @@ -60,6 +61,8 @@ Log func(string, ...interface{}) // Namespace allows to bypass the kubeconfig file for the choice of the namespace Namespace string + + kubeClient *kubernetes.Clientset } var addToScheme sync.Once @@ -87,9 +90,19 @@ var nopLogger = func(_ string, _ ...interface{}) {} +// getKubeClient get or create a new KubernetesClientSet +func (c *Client) getKubeClient() (*kubernetes.Clientset, error) { + var err error + if c.kubeClient == nil { + c.kubeClient, err = c.Factory.KubernetesClientSet() + } + + return c.kubeClient, err +} + // IsReachable tests connectivity to the cluster func (c *Client) IsReachable() error { - client, err := c.Factory.KubernetesClientSet() + client, err := c.getKubeClient() if err == genericclioptions.ErrEmptyConfig { // re-replace kubernetes ErrEmptyConfig error with a friendy error // moar workarounds for Kubernetes API breaking. @@ -115,7 +128,7 @@ // Wait up to the given timeout for the specified resources to be ready func (c *Client) Wait(resources ResourceList, timeout time.Duration) error { - cs, err := c.Factory.KubernetesClientSet() + cs, err := c.getKubeClient() if err != nil { return err } @@ -572,7 +585,7 @@ // WaitAndGetCompletedPodPhase waits up to a timeout until a pod enters a completed phase // and returns said phase (PodSucceeded or PodFailed qualify). func (c *Client) WaitAndGetCompletedPodPhase(name string, timeout time.Duration) (v1.PodPhase, error) { - client, err := c.Factory.KubernetesClientSet() + client, err := c.getKubeClient() if err != nil { return v1.PodUnknown, err } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/helm-3.4.0/pkg/lint/rules/template.go new/helm-3.4.1/pkg/lint/rules/template.go --- old/helm-3.4.0/pkg/lint/rules/template.go 2020-10-19 23:34:48.000000000 +0200 +++ new/helm-3.4.1/pkg/lint/rules/template.go 2020-11-11 20:44:01.000000000 +0100 @@ -20,6 +20,7 @@ "bufio" "bytes" "fmt" + "io" "os" "path" "path/filepath" @@ -27,7 +28,7 @@ "strings" "github.com/pkg/errors" - "sigs.k8s.io/yaml" + "k8s.io/apimachinery/pkg/util/yaml" "helm.sh/helm/v3/pkg/chart/loader" "helm.sh/helm/v3/pkg/chartutil" @@ -117,17 +118,30 @@ renderedContent := renderedContentMap[path.Join(chart.Name(), fileName)] if strings.TrimSpace(renderedContent) != "" { linter.RunLinterRule(support.WarningSev, fpath, validateTopIndentLevel(renderedContent)) - var yamlStruct K8sYamlStruct - // Even though K8sYamlStruct only defines a few fields, an error in any other - // key will be raised as well - err := yaml.Unmarshal([]byte(renderedContent), &yamlStruct) - - // If YAML linting fails, we sill progress. So we don't capture the returned state - // on this linter run. - linter.RunLinterRule(support.ErrorSev, fpath, validateYamlContent(err)) - linter.RunLinterRule(support.ErrorSev, fpath, validateMetadataName(&yamlStruct)) - linter.RunLinterRule(support.ErrorSev, fpath, validateNoDeprecations(&yamlStruct)) - linter.RunLinterRule(support.ErrorSev, fpath, validateMatchSelector(&yamlStruct, renderedContent)) + + decoder := yaml.NewYAMLOrJSONDecoder(strings.NewReader(renderedContent), 4096) + + // Lint all resources if the file contains multiple documents separated by --- + for { + // Even though K8sYamlStruct only defines a few fields, an error in any other + // key will be raised as well + var yamlStruct *K8sYamlStruct + + err := decoder.Decode(&yamlStruct) + if err == io.EOF { + break + } + + // If YAML linting fails, we sill progress. So we don't capture the returned state + // on this linter run. + linter.RunLinterRule(support.ErrorSev, fpath, validateYamlContent(err)) + + if yamlStruct != nil { + linter.RunLinterRule(support.ErrorSev, fpath, validateMetadataName(yamlStruct)) + linter.RunLinterRule(support.ErrorSev, fpath, validateNoDeprecations(yamlStruct)) + linter.RunLinterRule(support.ErrorSev, fpath, validateMatchSelector(yamlStruct, renderedContent)) + } + } } } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/helm-3.4.0/pkg/lint/rules/template_test.go new/helm-3.4.1/pkg/lint/rules/template_test.go --- old/helm-3.4.0/pkg/lint/rules/template_test.go 2020-10-19 23:34:48.000000000 +0200 +++ new/helm-3.4.1/pkg/lint/rules/template_test.go 2020-11-11 20:44:01.000000000 +0100 @@ -107,6 +107,20 @@ } } +func TestMultiTemplateFail(t *testing.T) { + linter := support.Linter{ChartDir: "./testdata/multi-template-fail"} + Templates(&linter, values, namespace, strict) + res := linter.Messages + + if len(res) != 1 { + t.Fatalf("Expected 1 error, got %d, %v", len(res), res) + } + + if !strings.Contains(res[0].Err.Error(), "object name does not conform to Kubernetes naming requirements") { + t.Errorf("Unexpected error: %s", res[0].Err) + } +} + func TestValidateMetadataName(t *testing.T) { names := map[string]bool{ "": false, @@ -332,3 +346,37 @@ } } + +// TestEmptyWithCommentsManifests checks the lint is not failing against empty manifests that contains only comments +// See https://github.com/helm/helm/issues/8621 +func TestEmptyWithCommentsManifests(t *testing.T) { + mychart := chart.Chart{ + Metadata: &chart.Metadata{ + APIVersion: "v2", + Name: "emptymanifests", + Version: "0.1.0", + Icon: "satisfy-the-linting-gods.gif", + }, + Templates: []*chart.File{ + { + Name: "templates/empty-with-comments.yaml", + Data: []byte("#@formatter:off\n"), + }, + }, + } + tmpdir := ensure.TempDir(t) + defer os.RemoveAll(tmpdir) + + if err := chartutil.SaveDir(&mychart, tmpdir); err != nil { + t.Fatal(err) + } + + linter := support.Linter{ChartDir: filepath.Join(tmpdir, mychart.Name())} + Templates(&linter, values, namespace, strict) + if l := len(linter.Messages); l > 0 { + for i, msg := range linter.Messages { + t.Logf("Message %d: %s", i, msg) + } + t.Fatalf("Expected 0 lint errors, got %d", l) + } +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/helm-3.4.0/pkg/lint/rules/testdata/multi-template-fail/Chart.yaml new/helm-3.4.1/pkg/lint/rules/testdata/multi-template-fail/Chart.yaml --- old/helm-3.4.0/pkg/lint/rules/testdata/multi-template-fail/Chart.yaml 1970-01-01 01:00:00.000000000 +0100 +++ new/helm-3.4.1/pkg/lint/rules/testdata/multi-template-fail/Chart.yaml 2020-11-11 20:44:01.000000000 +0100 @@ -0,0 +1,21 @@ +apiVersion: v2 +name: multi-template-fail +description: A Helm chart for Kubernetes + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +version: 0.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. +appVersion: 1.16.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/helm-3.4.0/pkg/lint/rules/testdata/multi-template-fail/templates/multi-fail.yaml new/helm-3.4.1/pkg/lint/rules/testdata/multi-template-fail/templates/multi-fail.yaml --- old/helm-3.4.0/pkg/lint/rules/testdata/multi-template-fail/templates/multi-fail.yaml 1970-01-01 01:00:00.000000000 +0100 +++ new/helm-3.4.1/pkg/lint/rules/testdata/multi-template-fail/templates/multi-fail.yaml 2020-11-11 20:44:01.000000000 +0100 @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: game-config +data: + game.properties: cheat +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: -this:name-is-not_valid$ +data: + game.properties: empty ++++++ vendor.tar.gz ++++++ /work/SRC/openSUSE:Factory/helm/vendor.tar.gz /work/SRC/openSUSE:Factory/.helm.new.24930/vendor.tar.gz differ: char 5, line 1 _______________________________________________ openSUSE Commits mailing list -- [email protected] To unsubscribe, email [email protected] List Netiquette: https://en.opensuse.org/openSUSE:Mailing_list_netiquette List Archives: https://lists.opensuse.org/archives/list/[email protected]
