Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package flux2-cli for openSUSE:Factory checked in at 2026-11-23 12:27:29 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/flux2-cli (Old) and /work/SRC/openSUSE:Factory/.flux2-cli.new.1340718 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "flux2-cli" Mon Nov 23 12:27:29 2026 rev:42 rq:1399886 version:2.10.1 Changes: -------- --- /work/SRC/openSUSE:Factory/flux2-cli/flux2-cli.changes 2026-10-28 17:48:24.306726816 +0100 +++ /work/SRC/openSUSE:Factory/.flux2-cli.new.1340718/flux2-cli.changes 2026-11-23 12:33:25.195004219 +0100 @@ -1,0 +2,47 @@ +Mon Nov 23 06:14:53 UTC 2026 - Johannes Kastl <[email protected]> + +- Update to version 2.10.1: + Flux v2.10.1 is a patch release that fixes credential caching + across the controllers, so changes to the + credential.auth.fluxcd.io/username and + gcp.auth.fluxcd.io/workload-identity-provider ServiceAccount + annotations take effect on the next reconcile instead of + continuing to use the previously cached authenticator until it + expires or the controller restarts. It also resolves the default + decryption ServiceAccount lazily for Kustomizations that only use + Age or PGP keys, restores authentication to registries whose + token service runs on a private address and after same-host HTTP + to HTTPS redirects by updating ORAS to v2.7.0, and fixes Git + checkouts that deleted the target of a relative symlink or got + permanently stuck when the push branch removed a file that + relative symlinks point to. Users are encouraged to upgrade for + the best experience. + * Components changelog + - source-controller v1.10.2 + - kustomize-controller v1.10.2 + - notification-controller v1.10.1 + - helm-controller v1.7.2 + - image-reflector-controller v1.3.1 + - image-automation-controller v1.3.1 + * CLI changelog + - [release/v2.10.x] Strip credentials from the push artifact + source URL in #6179 + - [release/v2.10.x] Reject partial basic auth in secret + commands in #6185 + - [release/v2.10.x] Paginate resource listing in flux migrate + in #6196 + - [release/v2.10.x] Prevent infinite loop on flux migrate in + #6205 + - [release/v2.10.x] Fix resolve-symlinks for read-only + directories in #6207 + - [release/v2.10.x] Fix panic on unreadable kustomization file + in #6208 + - [release/v2.10.x] Update toolkit components in #6210 + - [release/v2.10.x] Fix panic decoding short Helm release + storage in tree in #6211 + - [release/v2.10.x] Allow colons in --registry-creds password + in #6212 + - [release/v2.10.x] Fix --team parsing in bootstrap commands in + #6213 + +------------------------------------------------------------------- Old: ---- flux2-cli-2.10.0.obscpio New: ---- flux2-cli-2.10.1.obscpio ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ flux2-cli.spec ++++++ --- /var/tmp/diff_new_pack.RFiWNp/_old 2026-11-23 12:33:30.915245263 +0100 +++ /var/tmp/diff_new_pack.RFiWNp/_new 2026-11-23 12:33:30.920245474 +0100 @@ -20,16 +20,16 @@ # check these versions on updates # see flux2/manifests/bases/*/kustomization.yaml -%define helm_controller_version v1.7.1 -%define image_automation_controller_version v1.3.0 -%define image_reflector_controller_version v1.3.0 -%define kustomize_controller_version v1.10.1 -%define notification_controller_version v1.10.0 -%define source_controller_version v1.10.1 +%define helm_controller_version v1.7.2 +%define image_automation_controller_version v1.3.1 +%define image_reflector_controller_version v1.3.1 +%define kustomize_controller_version v1.10.2 +%define notification_controller_version v1.10.1 +%define source_controller_version v1.10.2 %define source_watcher_version v2.3.1 Name: flux2-cli -Version: 2.10.0 +Version: 2.10.1 Release: 0 Summary: CLI for Flux2CD License: Apache-2.0 @@ -55,11 +55,10 @@ BuildRequires: bash-completion BuildRequires: fish BuildRequires: git-core +BuildRequires: go1.27 >= 1.27.0 BuildRequires: helm BuildRequires: kustomize BuildRequires: zsh -# 16.0 currently contains 1.26rc3 which causes the build to fail... -BuildRequires: go1.27 >= 1.27.0 %description Flux is a tool for keeping Kubernetes clusters in sync with sources of ++++++ _service ++++++ --- /var/tmp/diff_new_pack.RFiWNp/_old 2026-11-23 12:33:31.081252259 +0100 +++ /var/tmp/diff_new_pack.RFiWNp/_new 2026-11-23 12:33:31.087252512 +0100 @@ -3,7 +3,7 @@ <param name="url">https://github.com/fluxcd/flux2.git</param> <param name="scm">git</param> <param name="exclude">.git</param> - <param name="revision">refs/tags/v2.10.0</param> + <param name="revision">refs/tags/v2.10.1</param> <param name="versionformat">@PARENT_TAG@</param> <param name="versionrewrite-pattern">v(.*)</param> <param name="changesgenerate">enable</param> ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.RFiWNp/_old 2026-11-23 12:33:31.144254914 +0100 +++ /var/tmp/diff_new_pack.RFiWNp/_new 2026-11-23 12:33:31.156255419 +0100 @@ -3,6 +3,6 @@ <param name="url">https://github.com/fluxcd/flux2</param> <param name="changesrevision">1fd61a06264d71cf445ed55c4f14d401d26a1c64</param></service><service name="tar_scm"> <param name="url">https://github.com/fluxcd/flux2.git</param> - <param name="changesrevision">3fa784edd773d56630bb9f62645e08f70c2cff0a</param></service></servicedata> + <param name="changesrevision">23dcfe98fe672acdf44ecd9c60cbac41b57f5de8</param></service></servicedata> (No newline at EOF) ++++++ flux2-cli-2.10.0.obscpio -> flux2-cli-2.10.1.obscpio ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flux2-cli-2.10.0/cmd/flux/bootstrap.go new/flux2-cli-2.10.1/cmd/flux/bootstrap.go --- old/flux2-cli-2.10.0/cmd/flux/bootstrap.go 2026-10-26 15:20:36.000000000 +0100 +++ new/flux2-cli-2.10.1/cmd/flux/bootstrap.go 2026-11-20 13:35:06.000000000 +0100 @@ -208,7 +208,7 @@ return fmt.Errorf("--registry-creds requires --image-pull-secret to be set") } - if bootstrapArgs.registryCredential != "" && len(strings.Split(bootstrapArgs.registryCredential, ":")) != 2 { + if bootstrapArgs.registryCredential != "" && len(strings.SplitN(bootstrapArgs.registryCredential, ":", 2)) != 2 { return fmt.Errorf("invalid --registry-creds format, expected 'user:password'") } @@ -247,10 +247,11 @@ func mapTeamSlice(s []string, defaultPermission string) map[string]string { m := make(map[string]string, len(s)) for _, v := range s { - m[v] = defaultPermission if s := strings.Split(v, ":"); len(s) == 2 { m[s[0]] = s[1] + continue } + m[v] = defaultPermission } return m diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flux2-cli-2.10.0/cmd/flux/bootstrap_bitbucket_server.go new/flux2-cli-2.10.1/cmd/flux/bootstrap_bitbucket_server.go --- old/flux2-cli-2.10.0/cmd/flux/bootstrap_bitbucket_server.go 2026-10-26 15:20:36.000000000 +0100 +++ new/flux2-cli-2.10.1/cmd/flux/bootstrap_bitbucket_server.go 2026-11-20 13:35:06.000000000 +0100 @@ -221,6 +221,7 @@ ManifestFile: sourcesecret.MakeDefaultOptions().ManifestFile, } if bootstrapArgs.tokenAuth { + secretOpts.GitScheme = "https" if bServerArgs.personal { secretOpts.Username = bServerArgs.owner } else { @@ -229,6 +230,7 @@ secretOpts.Password = bitbucketToken secretOpts.CACrt = caBundle } else { + secretOpts.GitScheme = "ssh" keypair, err := sourcesecret.LoadKeyPairFromPath(bootstrapArgs.privateKeyFile, gitArgs.password) if err != nil { return err diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flux2-cli-2.10.0/cmd/flux/bootstrap_git.go new/flux2-cli-2.10.1/cmd/flux/bootstrap_git.go --- old/flux2-cli-2.10.0/cmd/flux/bootstrap_git.go 2026-10-26 15:20:36.000000000 +0100 +++ new/flux2-cli-2.10.1/cmd/flux/bootstrap_git.go 2026-11-20 13:35:06.000000000 +0100 @@ -300,6 +300,7 @@ // Configure last as it depends on the config above. secretOpts.SSHHostname = repositoryURL.Host } + secretOpts.GitScheme = repositoryURL.Scheme // Sync manifest config syncOpts := sync.Options{ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flux2-cli-2.10.0/cmd/flux/bootstrap_gitea.go new/flux2-cli-2.10.1/cmd/flux/bootstrap_gitea.go --- old/flux2-cli-2.10.0/cmd/flux/bootstrap_gitea.go 2026-10-26 15:20:36.000000000 +0100 +++ new/flux2-cli-2.10.1/cmd/flux/bootstrap_gitea.go 2026-11-20 13:35:06.000000000 +0100 @@ -213,10 +213,12 @@ ManifestFile: sourcesecret.MakeDefaultOptions().ManifestFile, } if bootstrapArgs.tokenAuth { + secretOpts.GitScheme = "https" secretOpts.Username = "git" secretOpts.Password = gtToken secretOpts.CACrt = caBundle } else { + secretOpts.GitScheme = "ssh" secretOpts.PrivateKeyAlgorithm = sourcesecret.PrivateKeyAlgorithm(bootstrapArgs.keyAlgorithm) secretOpts.RSAKeyBits = int(bootstrapArgs.keyRSABits) secretOpts.ECDSACurve = bootstrapArgs.keyECDSACurve.Curve diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flux2-cli-2.10.0/cmd/flux/bootstrap_github.go new/flux2-cli-2.10.1/cmd/flux/bootstrap_github.go --- old/flux2-cli-2.10.0/cmd/flux/bootstrap_github.go 2026-10-26 15:20:36.000000000 +0100 +++ new/flux2-cli-2.10.1/cmd/flux/bootstrap_github.go 2026-11-20 13:35:06.000000000 +0100 @@ -220,10 +220,12 @@ ManifestFile: sourcesecret.MakeDefaultOptions().ManifestFile, } if bootstrapArgs.tokenAuth { + secretOpts.GitScheme = "https" secretOpts.Username = "git" secretOpts.Password = ghToken secretOpts.CACrt = caBundle } else { + secretOpts.GitScheme = "ssh" secretOpts.PrivateKeyAlgorithm = sourcesecret.PrivateKeyAlgorithm(bootstrapArgs.keyAlgorithm) secretOpts.RSAKeyBits = int(bootstrapArgs.keyRSABits) secretOpts.ECDSACurve = bootstrapArgs.keyECDSACurve.Curve diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flux2-cli-2.10.0/cmd/flux/bootstrap_gitlab.go new/flux2-cli-2.10.1/cmd/flux/bootstrap_gitlab.go --- old/flux2-cli-2.10.0/cmd/flux/bootstrap_gitlab.go 2026-10-26 15:20:36.000000000 +0100 +++ new/flux2-cli-2.10.1/cmd/flux/bootstrap_gitlab.go 2026-11-20 13:35:06.000000000 +0100 @@ -256,13 +256,16 @@ ManifestFile: sourcesecret.MakeDefaultOptions().ManifestFile, } if bootstrapArgs.tokenAuth { + secretOpts.GitScheme = "https" secretOpts.Username = "git" secretOpts.Password = glToken secretOpts.CACrt = caBundle } else if gitlabArgs.deployTokenAuth { + secretOpts.GitScheme = "https" // the actual deploy token will be reconciled later secretOpts.CACrt = caBundle } else { + secretOpts.GitScheme = "ssh" keypair, err := sourcesecret.LoadKeyPairFromPath(bootstrapArgs.privateKeyFile, gitArgs.password) if err != nil { return err diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flux2-cli-2.10.0/cmd/flux/bootstrap_test.go new/flux2-cli-2.10.1/cmd/flux/bootstrap_test.go --- old/flux2-cli-2.10.0/cmd/flux/bootstrap_test.go 2026-10-26 15:20:36.000000000 +0100 +++ new/flux2-cli-2.10.1/cmd/flux/bootstrap_test.go 2026-11-20 13:35:06.000000000 +0100 @@ -19,6 +19,8 @@ import ( "strings" "testing" + + "github.com/google/go-cmp/cmp" ) func TestBootstrapValidate_signingFlags(t *testing.T) { @@ -160,6 +162,53 @@ } } +func TestBootstrapValidate_registryCreds(t *testing.T) { + tests := []struct { + name string + creds string + wantErr string + }{ + {name: "user and password is valid", creds: "fluxcd:secret"}, + {name: "colon in the password is valid", creds: "fluxcd:pa:ss:word"}, + { + name: "missing separator errors", + creds: "fluxcd", + wantErr: "invalid --registry-creds format, expected 'user:password'", + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + savedDefaultComponents := bootstrapArgs.defaultComponents + savedCreds := bootstrapArgs.registryCredential + savedSecret := bootstrapArgs.imagePullSecret + defer func() { + bootstrapArgs.defaultComponents = savedDefaultComponents + bootstrapArgs.registryCredential = savedCreds + bootstrapArgs.imagePullSecret = savedSecret + }() + + // Seed the default components, see TestBootstrapValidate_signingFlags. + bootstrapArgs.defaultComponents = bootstrapArgs.requiredComponents + bootstrapArgs.registryCredential = tt.creds + bootstrapArgs.imagePullSecret = "regcred" + + err := bootstrapValidate() + if tt.wantErr == "" { + if err != nil { + t.Fatalf("expected no error, got: %v", err) + } + return + } + if err == nil { + t.Fatalf("expected error containing %q, got nil", tt.wantErr) + } + if !strings.Contains(err.Error(), tt.wantErr) { + t.Fatalf("expected error containing %q, got: %v", tt.wantErr, err) + } + }) + } +} + // Providers that generate the SSH transport key in-process (github, gitea) // must reject --ssh-signing-reuse-private-key with their own, provider- // specific error before bootstrapValidate runs — otherwise the generic @@ -205,4 +254,41 @@ } }) } +} + +func TestMapTeamSlice(t *testing.T) { + tests := []struct { + name string + teams []string + want map[string]string + }{ + { + name: "no teams", + teams: nil, + want: map[string]string{}, + }, + { + name: "team without permission gets the default", + teams: []string{"devs"}, + want: map[string]string{"devs": "maintain"}, + }, + { + name: "team with permission", + teams: []string{"devs:admin"}, + want: map[string]string{"devs": "admin"}, + }, + { + name: "teams with and without permission", + teams: []string{"devs:admin", "ops", "qa:read"}, + want: map[string]string{"devs": "admin", "ops": "maintain", "qa": "read"}, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got := mapTeamSlice(tt.teams, "maintain") + if diff := cmp.Diff(tt.want, got); diff != "" { + t.Errorf("unexpected team permissions (-want +got):\n%s", diff) + } + }) + } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flux2-cli-2.10.0/cmd/flux/build_artifact.go new/flux2-cli-2.10.1/cmd/flux/build_artifact.go --- old/flux2-cli-2.10.0/cmd/flux/build_artifact.go 2026-10-26 15:20:36.000000000 +0100 +++ new/flux2-cli-2.10.1/cmd/flux/build_artifact.go 2026-11-20 13:35:06.000000000 +0100 @@ -211,7 +211,10 @@ } if realInfo.IsDir() { - if err := os.MkdirAll(dstPath, realInfo.Mode()); err != nil { + // Keep the owner able to write to the copy, as the source can be + // read-only (e.g. the Nix store) and the files still have to be + // copied into the directory and removed from it afterwards. + if err := os.MkdirAll(dstPath, realInfo.Mode().Perm()|0o700); err != nil { return err } // Recursively copy the resolved directory contents. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flux2-cli-2.10.0/cmd/flux/build_artifact_test.go new/flux2-cli-2.10.1/cmd/flux/build_artifact_test.go --- old/flux2-cli-2.10.0/cmd/flux/build_artifact_test.go 2026-10-26 15:20:36.000000000 +0100 +++ new/flux2-cli-2.10.1/cmd/flux/build_artifact_test.go 2026-11-20 13:35:06.000000000 +0100 @@ -19,6 +19,7 @@ import ( "os" "path/filepath" + "runtime" "strings" "testing" @@ -269,3 +270,46 @@ g.Expect(err).To(BeNil()) g.Expect(string(content2)).To(Equal("data")) } + +func Test_resolveSymlinks_readOnlyDir(t *testing.T) { + if runtime.GOOS == "windows" || os.Geteuid() == 0 { + t.Skip("directory permissions are not enforced") + } + g := NewWithT(t) + + // Create a read-only source tree, like a store path of Nix. + srcDir := t.TempDir() + roDir := filepath.Join(srcDir, "apps") + subDir := filepath.Join(roDir, "sub") + g.Expect(os.MkdirAll(subDir, 0o755)).To(Succeed()) + g.Expect(os.WriteFile(filepath.Join(roDir, "ns.yaml"), []byte("kind: Namespace"), 0o444)).To(Succeed()) + g.Expect(os.WriteFile(filepath.Join(subDir, "cm.yaml"), []byte("kind: ConfigMap"), 0o444)).To(Succeed()) + g.Expect(os.Chmod(subDir, 0o555)).To(Succeed()) + g.Expect(os.Chmod(roDir, 0o555)).To(Succeed()) + // Registered after t.TempDir, so it runs before the removal of srcDir. + t.Cleanup(func() { + os.Chmod(roDir, 0o755) + os.Chmod(subDir, 0o755) + }) + + symlinkDir := t.TempDir() + g.Expect(os.Symlink(roDir, filepath.Join(symlinkDir, "linked"))).To(Succeed()) + + resolved, cleanupDir, err := resolveSymlinks(symlinkDir) + g.Expect(err).To(BeNil()) + t.Cleanup(func() { os.RemoveAll(cleanupDir) }) + + // Verify the files of the read-only directories were copied + content, err := os.ReadFile(filepath.Join(resolved, "linked", "ns.yaml")) + g.Expect(err).To(BeNil()) + g.Expect(string(content)).To(Equal("kind: Namespace")) + + content, err = os.ReadFile(filepath.Join(resolved, "linked", "sub", "cm.yaml")) + g.Expect(err).To(BeNil()) + g.Expect(string(content)).To(Equal("kind: ConfigMap")) + + // Verify the copy can be removed + g.Expect(os.RemoveAll(cleanupDir)).To(Succeed()) + _, err = os.Stat(cleanupDir) + g.Expect(os.IsNotExist(err)).To(BeTrue()) +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flux2-cli-2.10.0/cmd/flux/build_kustomization.go new/flux2-cli-2.10.1/cmd/flux/build_kustomization.go --- old/flux2-cli-2.10.0/cmd/flux/build_kustomization.go 2026-10-26 15:20:36.000000000 +0100 +++ new/flux2-cli-2.10.1/cmd/flux/build_kustomization.go 2026-11-20 13:35:06.000000000 +0100 @@ -117,7 +117,7 @@ } if buildKsArgs.kustomizationFile != "" { - if fs, err := os.Stat(buildKsArgs.kustomizationFile); os.IsNotExist(err) || fs.IsDir() { + if fs, err := os.Stat(buildKsArgs.kustomizationFile); err != nil || fs.IsDir() { return fmt.Errorf("invalid kustomization file %q", buildKsArgs.kustomizationFile) } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flux2-cli-2.10.0/cmd/flux/build_kustomization_test.go new/flux2-cli-2.10.1/cmd/flux/build_kustomization_test.go --- old/flux2-cli-2.10.0/cmd/flux/build_kustomization_test.go 2026-10-26 15:20:36.000000000 +0100 +++ new/flux2-cli-2.10.1/cmd/flux/build_kustomization_test.go 2026-11-20 13:35:06.000000000 +0100 @@ -166,6 +166,12 @@ assertFunc: "assertError", }, { + name: "kustomization file below a regular file", + args: "build kustomization podinfo --kustomization-file ./testdata/build-kustomization/podinfo-kustomization.yaml/ks.yaml --path ./testdata/build-kustomization/podinfo", + resultFile: "invalid kustomization file \"./testdata/build-kustomization/podinfo-kustomization.yaml/ks.yaml\"", + assertFunc: "assertError", + }, + { name: "build podinfo", args: "build kustomization podinfo --kustomization-file " + tmpFile + " --path ./testdata/build-kustomization/podinfo", resultFile: "./testdata/build-kustomization/podinfo-result.yaml", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flux2-cli-2.10.0/cmd/flux/create_secret_git.go new/flux2-cli-2.10.1/cmd/flux/create_secret_git.go --- old/flux2-cli-2.10.0/cmd/flux/create_secret_git.go 2026-10-26 15:20:36.000000000 +0100 +++ new/flux2-cli-2.10.1/cmd/flux/create_secret_git.go 2026-11-20 13:35:06.000000000 +0100 @@ -137,6 +137,7 @@ Namespace: *kubeconfigArgs.Namespace, Labels: labels, ManifestFile: sourcesecret.MakeDefaultOptions().ManifestFile, + GitScheme: u.Scheme, } switch u.Scheme { case "ssh": @@ -151,7 +152,7 @@ opts.ECDSACurve = secretGitArgs.ecdsaCurve.Curve opts.Password = secretGitArgs.password case "http", "https": - if (secretGitArgs.username == "" || secretGitArgs.password == "") && secretGitArgs.bearerToken == "" { + if secretGitArgs.username == "" && secretGitArgs.password == "" && secretGitArgs.bearerToken == "" { return fmt.Errorf("for Git over HTTP/S the username and password, or a bearer token is required") } opts.Username = secretGitArgs.username diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flux2-cli-2.10.0/cmd/flux/create_secret_git_test.go new/flux2-cli-2.10.1/cmd/flux/create_secret_git_test.go --- old/flux2-cli-2.10.0/cmd/flux/create_secret_git_test.go 2026-10-26 15:20:36.000000000 +0100 +++ new/flux2-cli-2.10.1/cmd/flux/create_secret_git_test.go 2026-11-20 13:35:06.000000000 +0100 @@ -32,6 +32,11 @@ assert: assertGoldenFile("./testdata/create_secret/git/secret-git-basic.yaml"), }, { + name: "basic secret with password only", + args: "create secret git podinfo-auth --url=https://github.com/stefanprodan/podinfo --password=my-password --namespace=my-namespace --export", + assert: assertError("for Git over HTTP/S, basic authentication requires both a username and a password; for token-based authentication, use the token as the password with any non-empty username"), + }, + { name: "ssh key", args: "create secret git podinfo-auth --url=ssh://[email protected]/stefanprodan/podinfo --private-key-file=./testdata/create_secret/git/ecdsa.private --namespace=my-namespace --export", assert: assertGoldenFile("testdata/create_secret/git/git-ssh-secret.yaml"), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flux2-cli-2.10.0/cmd/flux/create_source_git.go new/flux2-cli-2.10.1/cmd/flux/create_source_git.go --- old/flux2-cli-2.10.0/cmd/flux/create_source_git.go 2026-10-26 15:20:36.000000000 +0100 +++ new/flux2-cli-2.10.1/cmd/flux/create_source_git.go 2026-11-20 13:35:06.000000000 +0100 @@ -197,6 +197,17 @@ return fmt.Errorf("specifying a CA file is not supported for Git over SSH") } + if sourceGitArgs.secretRef == "" { + gitAuth := sourcesecret.Options{ + GitScheme: u.Scheme, + Username: sourceGitArgs.username, + Password: sourceGitArgs.password, + } + if err := gitAuth.ValidateGitAuth(); err != nil { + return err + } + } + sourceLabels, err := parseLabels() if err != nil { return err @@ -277,6 +288,7 @@ Name: name, Namespace: *kubeconfigArgs.Namespace, ManifestFile: sourcesecret.MakeDefaultOptions().ManifestFile, + GitScheme: u.Scheme, } switch u.Scheme { case "ssh": diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flux2-cli-2.10.0/cmd/flux/create_source_git_test.go new/flux2-cli-2.10.1/cmd/flux/create_source_git_test.go --- old/flux2-cli-2.10.0/cmd/flux/create_source_git_test.go 2026-10-26 15:20:36.000000000 +0100 +++ new/flux2-cli-2.10.1/cmd/flux/create_source_git_test.go 2026-11-20 13:35:06.000000000 +0100 @@ -176,6 +176,61 @@ } } +func TestCreateSourceGitPartialBasicAuth(t *testing.T) { + partialAuthErr := "for Git over HTTP/S, basic authentication requires both a username and a password; for token-based authentication, use the token as the password with any non-empty username" + + cases := []struct { + name string + args string + assert assertFunc + }{ + { + name: "password without username over HTTPS", + args: "create source git podinfo --url=https://github.com/stefanprodan/podinfo --branch=main --password=token --export", + assert: assertError(partialAuthErr), + }, + { + name: "username without password over HTTPS", + args: "create source git podinfo --url=https://github.com/stefanprodan/podinfo --branch=main --username=git --export", + assert: assertError(partialAuthErr), + }, + { + name: "password without username over HTTP", + args: "create source git podinfo --url=http://git.example.com/podinfo.git --branch=main --password=token --export", + assert: assertError(partialAuthErr), + }, + { + name: "password with an existing secret ref is not validated", + args: "create source git podinfo --url=https://github.com/stefanprodan/podinfo --branch=main --password=token --secret-ref=podinfo-auth --export", + assert: assertSuccess(), + }, + { + name: "username and password over HTTPS", + args: "create source git podinfo --url=https://github.com/stefanprodan/podinfo --branch=main --username=git --password=token --export", + assert: assertSuccess(), + }, + { + name: "no credentials over HTTPS", + args: "create source git podinfo --url=https://github.com/stefanprodan/podinfo --branch=main --export", + assert: assertSuccess(), + }, + { + name: "password as SSH key passphrase is not validated", + args: "create source git podinfo --url=ssh://[email protected]/stefanprodan/podinfo.git --branch=main --password=passphrase --export", + assert: assertSuccess(), + }, + } + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + cmd := cmdTestCase{ + args: tc.args, + assert: tc.assert, + } + cmd.runTestCmd(t) + }) + } +} + func TestCreateSourceGit(t *testing.T) { // Default command used for multiple tests var command = "create source git podinfo --url=https://github.com/stefanprodan/podinfo --branch=master --timeout=" + testTimeout.String() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flux2-cli-2.10.0/cmd/flux/diff_kustomization.go new/flux2-cli-2.10.1/cmd/flux/diff_kustomization.go --- old/flux2-cli-2.10.0/cmd/flux/diff_kustomization.go 2026-10-26 15:20:36.000000000 +0100 +++ new/flux2-cli-2.10.1/cmd/flux/diff_kustomization.go 2026-11-20 13:35:06.000000000 +0100 @@ -99,7 +99,7 @@ } if diffKsArgs.kustomizationFile != "" { - if fs, err := os.Stat(diffKsArgs.kustomizationFile); os.IsNotExist(err) || fs.IsDir() { + if fs, err := os.Stat(diffKsArgs.kustomizationFile); err != nil || fs.IsDir() { return fmt.Errorf("invalid kustomization file %q", diffKsArgs.kustomizationFile) } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flux2-cli-2.10.0/cmd/flux/diff_kustomization_test.go new/flux2-cli-2.10.1/cmd/flux/diff_kustomization_test.go --- old/flux2-cli-2.10.0/cmd/flux/diff_kustomization_test.go 2026-10-26 15:20:36.000000000 +0100 +++ new/flux2-cli-2.10.1/cmd/flux/diff_kustomization_test.go 2026-11-20 13:35:06.000000000 +0100 @@ -46,6 +46,12 @@ assert: assertError("invalid resource path \"\""), }, { + name: "kustomization file below a regular file", + args: "diff kustomization podinfo --path ./testdata/build-kustomization/podinfo --kustomization-file ./testdata/diff-kustomization/deployment.yaml/ks.yaml", + objectFile: "", + assert: assertError("invalid kustomization file \"./testdata/diff-kustomization/deployment.yaml/ks.yaml\""), + }, + { name: "diff nothing deployed", args: "diff kustomization podinfo --path ./testdata/build-kustomization/podinfo --progress-bar=false", objectFile: "", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flux2-cli-2.10.0/cmd/flux/install.go new/flux2-cli-2.10.1/cmd/flux/install.go --- old/flux2-cli-2.10.0/cmd/flux/install.go 2026-10-26 15:20:36.000000000 +0100 +++ new/flux2-cli-2.10.1/cmd/flux/install.go 2026-11-20 13:35:06.000000000 +0100 @@ -141,7 +141,7 @@ return fmt.Errorf("--registry-creds requires --image-pull-secret to be set") } - if installArgs.registryCredential != "" && len(strings.Split(installArgs.registryCredential, ":")) != 2 { + if installArgs.registryCredential != "" && len(strings.SplitN(installArgs.registryCredential, ":", 2)) != 2 { return fmt.Errorf("invalid --registry-creds format, expected 'user:password'") } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flux2-cli-2.10.0/cmd/flux/install_test.go new/flux2-cli-2.10.1/cmd/flux/install_test.go --- old/flux2-cli-2.10.0/cmd/flux/install_test.go 2026-10-26 15:20:36.000000000 +0100 +++ new/flux2-cli-2.10.1/cmd/flux/install_test.go 2026-11-20 13:35:06.000000000 +0100 @@ -58,6 +58,16 @@ args: "install --registry-creds=fluxcd:test", assert: assertError(`--registry-creds requires --image-pull-secret to be set`), }, + { + name: "registry credentials without a separator", + args: "install --export --image-pull-secret=regcred --registry-creds=fluxcd", + assert: assertError(`invalid --registry-creds format, expected 'user:password'`), + }, + { + name: "registry credentials with a colon in the password", + args: "install --export --image-pull-secret=regcred --registry-creds=fluxcd:pa:ss", + assert: assertSuccess(), + }, } for _, tt := range tests { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flux2-cli-2.10.0/cmd/flux/migrate.go new/flux2-cli-2.10.1/cmd/flux/migrate.go --- old/flux2-cli-2.10.0/cmd/flux/migrate.go 2026-10-26 15:20:36.000000000 +0100 +++ new/flux2-cli-2.10.1/cmd/flux/migrate.go 2026-11-20 13:35:06.000000000 +0100 @@ -30,10 +30,12 @@ "github.com/spf13/cobra" apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/types" "k8s.io/client-go/util/retry" + cmdutil "k8s.io/kubectl/pkg/cmd/util" "sigs.k8s.io/controller-runtime/pkg/client" helmv2 "github.com/fluxcd/helm-controller/api/v2" @@ -389,63 +391,135 @@ } // migrateCR migrates all CRs for the given CRD to the specified version by patching them. +// The CRs are listed in metadata-only chunks to keep memory usage bounded on large clusters. func (c *ClusterMigrator) migrateCR(ctx context.Context, crd *apiextensionsv1.CustomResourceDefinition, version string) error { - list := &unstructured.UnstructuredList{} - apiVersion := crd.Spec.Group + "/" + version - listKind := crd.Spec.Names.ListKind + gvk := schema.GroupVersionKind{ + Group: crd.Spec.Group, + Version: version, + Kind: crd.Spec.Names.Kind, + } + + // The continue token points at the snapshot taken when the first page was + // read. Patching between pages can outlive the etcd compaction window on + // large clusters, causing subsequent List calls to return 410 Expired. + // Restart from the first page and skip already patched objects, so every + // attempt makes progress. + patched := make(map[types.NamespacedName]struct{}) + for { + progressed, err := c.migrateCRPages(ctx, gvk, apiVersion, version, patched) + if err == nil { + return nil + } + if !apierrors.IsResourceExpired(err) { + return fmt.Errorf("failed to migrate resources for CRD %s: %w", crd.Name, err) + } + if !progressed { + return fmt.Errorf("failed to migrate resources for CRD %s: %w", crd.Name, err) + } + } +} - list.SetAPIVersion(apiVersion) - list.SetKind(listKind) +// migrateCRPages migrates the given resource pages, skipping objects patched in +// a previous attempt. It reports whether any object was patched before the list +// expired. +func (c *ClusterMigrator) migrateCRPages(ctx context.Context, gvk schema.GroupVersionKind, + apiVersion, version string, patched map[types.NamespacedName]struct{}) (bool, error) { + + progressed := false + continueToken := "" + for { + // Only metadata is needed to rewrite managedFields, so avoid decoding + // the full spec and status of every resource. + list := &metav1.PartialObjectMetadataList{} + list.SetGroupVersionKind(gvk) + + listOpts := []client.ListOption{ + client.InNamespace(""), + client.Limit(cmdutil.DefaultChunkSize), + } + if continueToken != "" { + listOpts = append(listOpts, client.Continue(continueToken)) + } - err := c.kubeClient.List(ctx, list, client.InNamespace("")) - if err != nil { - return fmt.Errorf("failed to list resources for CRD %s: %w", crd.Name, err) - } + if err := c.kubeClient.List(ctx, list, listOpts...); err != nil { + return progressed, err + } - if len(list.Items) == 0 { - return nil + pageProgressed, err := c.migrateItems(ctx, list.Items, gvk, apiVersion, version, patched) + progressed = progressed || pageProgressed + if err != nil { + return progressed, err + } + + continueToken = list.GetContinue() + if continueToken == "" { + return progressed, nil + } } +} + +// migrateItems patches the given CRs to migrate them to the specified version. +func (c *ClusterMigrator) migrateItems(ctx context.Context, items []metav1.PartialObjectMetadata, + gvk schema.GroupVersionKind, apiVersion, version string, patched map[types.NamespacedName]struct{}) (bool, error) { + + progressed := false + for i := range items { + item := &items[i] + key := types.NamespacedName{Namespace: item.Namespace, Name: item.Name} + if _, ok := patched[key]; ok { + continue + } + item.SetGroupVersionKind(gvk) - for _, item := range list.Items { - patches, err := ssa.PatchMigrateToVersion(&item, apiVersion) + // PatchMigrateToVersion only reads the managed fields, so build a + // metadata-only object to compute the patch. + obj := &unstructured.Unstructured{} + obj.SetGroupVersionKind(gvk) + obj.SetName(item.Name) + obj.SetNamespace(item.Namespace) + obj.SetManagedFields(item.GetManagedFields()) + + patches, err := ssa.PatchMigrateToVersion(obj, apiVersion) if err != nil { - return fmt.Errorf("failed to create migration patch for %s/%s/%s: %w", - item.GetKind(), item.GetNamespace(), item.GetName(), err) + return progressed, fmt.Errorf("failed to create migration patch for %s/%s/%s: %w", + gvk.Kind, item.Namespace, item.Name, err) } if len(patches) == 0 { // patch the resource with an empty patch to update the version if err := c.kubeClient.Patch( ctx, - &item, + item, client.RawPatch(client.Merge.Type(), []byte("{}")), ); err != nil && !apierrors.IsNotFound(err) { - return fmt.Errorf(" %s/%s/%s failed to migrate: %w", - item.GetKind(), item.GetNamespace(), item.GetName(), err) + return progressed, fmt.Errorf(" %s/%s/%s failed to migrate: %w", + gvk.Kind, item.Namespace, item.Name, err) } } else { // patch the resource to migrate the managed fields to the latest apiVersion rawPatch, err := json.Marshal(patches) if err != nil { - return fmt.Errorf("failed to marshal migration patch for %s/%s/%s: %w", - item.GetKind(), item.GetNamespace(), item.GetName(), err) + return progressed, fmt.Errorf("failed to marshal migration patch for %s/%s/%s: %w", + gvk.Kind, item.Namespace, item.Name, err) } if err := c.kubeClient.Patch( ctx, - &item, + item, client.RawPatch(types.JSONPatchType, rawPatch), ); err != nil && !apierrors.IsNotFound(err) { - return fmt.Errorf(" %s/%s/%s failed to migrate managed fields: %w", - item.GetKind(), item.GetNamespace(), item.GetName(), err) + return progressed, fmt.Errorf(" %s/%s/%s failed to migrate managed fields: %w", + gvk.Kind, item.Namespace, item.Name, err) } } logger.Successf("%s/%s/%s migrated to version %s", - item.GetKind(), item.GetNamespace(), item.GetName(), version) + gvk.Kind, item.Namespace, item.Name, version) + patched[key] = struct{}{} + progressed = true } - return nil + return progressed, nil } // getStorageVersion retrieves the storage version of a CustomResourceDefinition. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flux2-cli-2.10.0/cmd/flux/migrate_test.go new/flux2-cli-2.10.1/cmd/flux/migrate_test.go --- old/flux2-cli-2.10.0/cmd/flux/migrate_test.go 2026-10-26 15:20:36.000000000 +0100 +++ new/flux2-cli-2.10.1/cmd/flux/migrate_test.go 2026-11-20 13:35:06.000000000 +0100 @@ -18,13 +18,24 @@ import ( "bytes" + "context" + "fmt" "io/fs" "os" + "strconv" "testing" "testing/fstest" . "github.com/onsi/gomega" + apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" + apierrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/types" + cmdutil "k8s.io/kubectl/pkg/cmd/util" + "sigs.k8s.io/controller-runtime/pkg/client" + + kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1" ) type writeToMemoryFS struct { @@ -307,3 +318,119 @@ }) } } + +// metadataMigrationClient simulates a paginated metadata-only list, including +// a continue token expiring once while patching the first page. +type metadataMigrationClient struct { + client.Client + + pages [][]metav1.PartialObjectMetadata + expired bool + listCalls int + patched []string + patchTypes []types.PatchType +} + +func (c *metadataMigrationClient) List(_ context.Context, list client.ObjectList, opts ...client.ListOption) error { + var listOpts client.ListOptions + listOpts.ApplyOptions(opts) + + if listOpts.Limit != int64(cmdutil.DefaultChunkSize) { + return fmt.Errorf("expected list limit %d, got %d", cmdutil.DefaultChunkSize, listOpts.Limit) + } + + ml, ok := list.(*metav1.PartialObjectMetadataList) + if !ok { + return fmt.Errorf("expected PartialObjectMetadataList, got %T", list) + } + + page := 0 + if listOpts.Continue != "" { + n, err := strconv.Atoi(listOpts.Continue) + if err != nil { + return fmt.Errorf("invalid continue token %q: %w", listOpts.Continue, err) + } + page = n + } + if page >= len(c.pages) { + return fmt.Errorf("page %d out of range", page) + } + + // Simulate etcd compaction expiring the first attempt's snapshot. + if page == 1 && !c.expired { + c.expired = true + return apierrors.NewResourceExpired("continue token expired") + } + + ml.Items = c.pages[page] + for i := range ml.Items { + ml.Items[i].SetGroupVersionKind(schema.GroupVersionKind{ + Group: kustomizev1.GroupVersion.Group, + Version: kustomizev1.GroupVersion.Version, + Kind: kustomizev1.KustomizationKind, + }) + } + if page+1 < len(c.pages) { + ml.SetContinue(strconv.Itoa(page + 1)) + } + c.listCalls++ + return nil +} + +func (c *metadataMigrationClient) Patch(_ context.Context, obj client.Object, patch client.Patch, _ ...client.PatchOption) error { + if _, ok := obj.(*metav1.PartialObjectMetadata); !ok { + return fmt.Errorf("expected PartialObjectMetadata, got %T", obj) + } + c.patched = append(c.patched, obj.GetName()) + c.patchTypes = append(c.patchTypes, patch.Type()) + return nil +} + +func TestClusterMigrator_migrateCR_pagination(t *testing.T) { + g := NewWithT(t) + + managedFields := []metav1.ManagedFieldsEntry{ + { + Manager: "test", + Operation: metav1.ManagedFieldsOperationUpdate, + APIVersion: kustomizev1.GroupVersion.String() + "beta2", + FieldsType: "FieldsV1", + FieldsV1: metav1.NewFieldsV1(`{"f:metadata":{}}`), + }, + } + item := func(name string) metav1.PartialObjectMetadata { + return metav1.PartialObjectMetadata{ + Name: name, + Namespace: "default", + ManagedFields: managedFields, + } + } + + kc := &metadataMigrationClient{ + pages: [][]metav1.PartialObjectMetadata{ + {item("test-0"), item("test-1")}, + {item("test-2")}, + }, + } + + crd := &apiextensionsv1.CustomResourceDefinition{ + Name: "kustomizations.kustomize.toolkit.fluxcd.io", + Spec: apiextensionsv1.CustomResourceDefinitionSpec{ + Group: kustomizev1.GroupVersion.Group, + Names: apiextensionsv1.CustomResourceDefinitionNames{ + Kind: kustomizev1.KustomizationKind, + ListKind: kustomizev1.KustomizationKind + "List", + }, + }, + } + + migrator := NewClusterMigrator(kc, nil) + err := migrator.migrateCR(context.Background(), crd, kustomizev1.GroupVersion.Version) + g.Expect(err).ToNot(HaveOccurred()) + + // Page 1 is listed and patched, then page 2 expires. The retry lists page 1 + // again (skipping the patched objects) and patches page 2. + g.Expect(kc.listCalls).To(Equal(3)) + g.Expect(kc.patched).To(ConsistOf("test-0", "test-1", "test-2")) + g.Expect(kc.patchTypes).To(ConsistOf(types.JSONPatchType, types.JSONPatchType, types.JSONPatchType)) +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flux2-cli-2.10.0/cmd/flux/push_artifact.go new/flux2-cli-2.10.1/cmd/flux/push_artifact.go --- old/flux2-cli-2.10.0/cmd/flux/push_artifact.go 2026-10-26 15:20:36.000000000 +0100 +++ new/flux2-cli-2.10.1/cmd/flux/push_artifact.go 2026-11-20 13:35:06.000000000 +0100 @@ -20,6 +20,7 @@ "context" "encoding/json" "fmt" + "net/url" "os" "strings" "time" @@ -212,7 +213,7 @@ } meta := oci.Metadata{ - Source: pushArtifactArgs.source, + Source: sourceWithoutCredentials(pushArtifactArgs.source), Revision: pushArtifactArgs.revision, Annotations: annotations, } @@ -335,3 +336,15 @@ return nil } + +// sourceWithoutCredentials drops the userinfo from an HTTP(S) source URL. +// The value is usually the Git remote URL, which can embed a token (e.g. in +// GitLab CI checkouts), and it ends up in the artifact annotations. +func sourceWithoutCredentials(source string) string { + u, err := url.Parse(source) + if err != nil || u.User == nil || (u.Scheme != "http" && u.Scheme != "https") { + return source + } + u.User = nil + return u.String() +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flux2-cli-2.10.0/cmd/flux/push_artifact_test.go new/flux2-cli-2.10.1/cmd/flux/push_artifact_test.go --- old/flux2-cli-2.10.0/cmd/flux/push_artifact_test.go 2026-10-26 15:20:36.000000000 +0100 +++ new/flux2-cli-2.10.1/cmd/flux/push_artifact_test.go 2026-11-20 13:35:06.000000000 +0100 @@ -55,3 +55,22 @@ g.Expect(err).ToNot(HaveOccurred()) g.Expect(manifest.Annotations).To(HaveKeyWithValue(oci.CreatedAnnotation, "1970-01-01T00:00:00Z")) } + +func TestPushArtifactSourceWithoutCredentials(t *testing.T) { + g := NewWithT(t) + + g.Expect(setupRegistryServer(t.Context())).To(Succeed()) + + // A Git remote URL with a token, as set up by GitLab CI checkouts. + ref := dockerReg + "/source-credentials:v1" + _, err := executeCommand("push artifact oci://" + ref + + " --path=./testdata/diff-artifact/deployment.yaml" + + " --source=https://gitlab-ci-token:[email protected]/org/repo.git --revision=test") + g.Expect(err).ToNot(HaveOccurred()) + + raw, err := crane.Manifest(ref) + g.Expect(err).ToNot(HaveOccurred()) + manifest, err := gcrv1.ParseManifest(bytes.NewReader(raw)) + g.Expect(err).ToNot(HaveOccurred()) + g.Expect(manifest.Annotations).To(HaveKeyWithValue(oci.SourceAnnotation, "https://gitlab.example.com/org/repo.git")) +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flux2-cli-2.10.0/cmd/flux/tree_kustomization.go new/flux2-cli-2.10.1/cmd/flux/tree_kustomization.go --- old/flux2-cli-2.10.0/cmd/flux/tree_kustomization.go 2026-10-26 15:20:36.000000000 +0100 +++ new/flux2-cli-2.10.1/cmd/flux/tree_kustomization.go 2026-11-20 13:35:06.000000000 +0100 @@ -236,29 +236,9 @@ return nil, fmt.Errorf("failed to decode the Helm storage object for HelmRelease '%s'", objectKey.String()) } - // adapted from https://github.com/helm/helm/blob/02685e94bd3862afcb44f6cd7716dbeb69743567/pkg/storage/driver/util.go - var b64 = base64.StdEncoding - b, err := b64.DecodeString(string(releaseData)) - if err != nil { - return nil, err - } - var magicGzip = []byte{0x1f, 0x8b, 0x08} - if bytes.Equal(b[0:3], magicGzip) { - r, err := gzip.NewReader(bytes.NewReader(b)) - if err != nil { - return nil, err - } - defer r.Close() - b2, err := io.ReadAll(r) - if err != nil { - return nil, err - } - b = b2 - } - // extract objects from Helm storage - var rls hrStorage - if err := json.Unmarshal(b, &rls); err != nil { + rls, err := decodeHelmReleaseStorage(releaseData) + if err != nil { return nil, fmt.Errorf("failed to decode the Helm storage object for HelmRelease '%s': %w", objectKey.String(), err) } @@ -312,3 +292,38 @@ return result, nil } + +// decodeHelmReleaseStorage decodes the base64 encoded, optionally gzip +// compressed, Helm release storage payload into an hrStorage. +// +// adapted from https://github.com/helm/helm/blob/02685e94bd3862afcb44f6cd7716dbeb69743567/pkg/storage/driver/util.go +func decodeHelmReleaseStorage(releaseData []byte) (*hrStorage, error) { + b, err := base64.StdEncoding.DecodeString(string(releaseData)) + if err != nil { + return nil, err + } + + // For backwards compatibility with releases that were stored before + // compression was introduced we skip decompression if the gzip magic + // header is not found. The length check guards against payloads that + // are shorter than the header. + magicGzip := []byte{0x1f, 0x8b, 0x08} + if len(b) > 3 && bytes.Equal(b[0:3], magicGzip) { + r, err := gzip.NewReader(bytes.NewReader(b)) + if err != nil { + return nil, err + } + defer r.Close() + b2, err := io.ReadAll(r) + if err != nil { + return nil, err + } + b = b2 + } + + var rls hrStorage + if err := json.Unmarshal(b, &rls); err != nil { + return nil, err + } + return &rls, nil +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flux2-cli-2.10.0/cmd/flux/tree_kustomization_decode_test.go new/flux2-cli-2.10.1/cmd/flux/tree_kustomization_decode_test.go --- old/flux2-cli-2.10.0/cmd/flux/tree_kustomization_decode_test.go 1970-01-01 01:00:00.000000000 +0100 +++ new/flux2-cli-2.10.1/cmd/flux/tree_kustomization_decode_test.go 2026-11-20 13:35:06.000000000 +0100 @@ -0,0 +1,102 @@ +//go:build unit +// +build unit + +/* +Copyright 2026 The Flux authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "bytes" + "compress/gzip" + "encoding/base64" + "encoding/json" + "testing" +) + +func gzipBase64(t *testing.T, data []byte) string { + t.Helper() + var buf bytes.Buffer + w := gzip.NewWriter(&buf) + if _, err := w.Write(data); err != nil { + t.Fatalf("gzip write: %v", err) + } + if err := w.Close(); err != nil { + t.Fatalf("gzip close: %v", err) + } + return base64.StdEncoding.EncodeToString(buf.Bytes()) +} + +func TestDecodeHelmReleaseStorage(t *testing.T) { + const manifest = "apiVersion: v1\nkind: ConfigMap\n" + releaseJSON, err := json.Marshal(hrStorage{Name: "test", Manifest: manifest}) + if err != nil { + t.Fatalf("marshal release: %v", err) + } + + tests := []struct { + name string + releaseData string + wantErr bool + wantManifest string + }{ + { + name: "plain json release", + releaseData: base64.StdEncoding.EncodeToString(releaseJSON), + wantManifest: manifest, + }, + { + name: "gzipped json release", + releaseData: gzipBase64(t, releaseJSON), + wantManifest: manifest, + }, + { + // Decodes to the two bytes "{}", which is shorter than the + // gzip magic header. The unguarded b[0:3] slice used to panic. + name: "payload shorter than gzip header", + releaseData: base64.StdEncoding.EncodeToString([]byte("{}")), + }, + { + // Decodes to an empty payload, also shorter than the header. + name: "empty payload", + releaseData: "", + wantErr: true, + }, + { + name: "invalid base64", + releaseData: "not-base64!!", + wantErr: true, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + rls, err := decodeHelmReleaseStorage([]byte(tt.releaseData)) + if tt.wantErr { + if err == nil { + t.Fatalf("expected an error, got nil") + } + return + } + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + if rls.Manifest != tt.wantManifest { + t.Fatalf("manifest mismatch: got %q, want %q", rls.Manifest, tt.wantManifest) + } + }) + } +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flux2-cli-2.10.0/go.mod new/flux2-cli-2.10.1/go.mod --- old/flux2-cli-2.10.0/go.mod 2026-10-26 15:20:36.000000000 +0100 +++ new/flux2-cli-2.10.1/go.mod 2026-11-20 13:35:06.000000000 +0100 @@ -13,26 +13,26 @@ github.com/distribution/distribution/v3 v3.1.2 github.com/fluxcd/cli-utils v1.4.0 github.com/fluxcd/go-git-providers v0.30.0 - github.com/fluxcd/helm-controller/api v1.7.1 - github.com/fluxcd/image-automation-controller/api v1.3.0 - github.com/fluxcd/image-reflector-controller/api v1.3.0 - github.com/fluxcd/kustomize-controller/api v1.10.1 - github.com/fluxcd/notification-controller/api v1.10.0 + github.com/fluxcd/helm-controller/api v1.7.2 + github.com/fluxcd/image-automation-controller/api v1.3.1 + github.com/fluxcd/image-reflector-controller/api v1.3.1 + github.com/fluxcd/kustomize-controller/api v1.10.2 + github.com/fluxcd/notification-controller/api v1.10.1 github.com/fluxcd/pkg/apis/event v0.32.0 github.com/fluxcd/pkg/apis/meta v1.38.0 - github.com/fluxcd/pkg/auth v0.66.0 + github.com/fluxcd/pkg/auth v0.66.2 github.com/fluxcd/pkg/chartutil v1.35.0 github.com/fluxcd/pkg/envsubst v1.9.0 - github.com/fluxcd/pkg/git v0.56.0 + github.com/fluxcd/pkg/git v0.56.2 github.com/fluxcd/pkg/kustomize v1.44.0 github.com/fluxcd/pkg/oci v0.73.0 github.com/fluxcd/pkg/runtime v0.122.0 github.com/fluxcd/pkg/sourceignore v0.22.0 github.com/fluxcd/pkg/ssa v0.83.0 - github.com/fluxcd/pkg/ssh v0.29.0 + github.com/fluxcd/pkg/ssh v0.29.1 github.com/fluxcd/pkg/tar v1.4.0 github.com/fluxcd/pkg/version v0.20.0 - github.com/fluxcd/source-controller/api v1.10.1 + github.com/fluxcd/source-controller/api v1.10.2 github.com/fluxcd/source-watcher/api/v2 v2.3.1 github.com/go-git/go-git/v5 v5.19.3 github.com/go-logr/logr v1.4.4 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flux2-cli-2.10.0/go.sum new/flux2-cli-2.10.1/go.sum --- old/flux2-cli-2.10.0/go.sum 2026-10-26 15:20:36.000000000 +0100 +++ new/flux2-cli-2.10.1/go.sum 2026-11-20 13:35:06.000000000 +0100 @@ -171,16 +171,16 @@ github.com/fluxcd/gitkit v0.6.0/go.mod h1:svOHuKi0fO9HoawdK4HfHAJJseZDHHjk7I3ihnCIqNo= github.com/fluxcd/go-git-providers v0.30.0 h1:8s2u6syI0xRy9pH9yEhhsc4wAZm/Kyb04iBQySu3cQc= github.com/fluxcd/go-git-providers v0.30.0/go.mod h1:z0mJJosY4coMRRyy+C6IoSkEu9hgkqRAbqUUeUlqrzk= -github.com/fluxcd/helm-controller/api v1.7.1 h1:kARTcSBiS05mQsY7nVdL+XGaIGPZd/oC5owFTN6NIyk= -github.com/fluxcd/helm-controller/api v1.7.1/go.mod h1:cCTRZcz/hjvI+3AxRGgsGe/AeEjZHHKUYxV/+6uidNM= -github.com/fluxcd/image-automation-controller/api v1.3.0 h1:0Dk+aLD9YzX6ToRBz88thx2X68KzXeaeASjHQAyMano= -github.com/fluxcd/image-automation-controller/api v1.3.0/go.mod h1:ypBgXSDvspIw5XX1P5OP13rEknyqqMzoHXUW0PDnYjM= -github.com/fluxcd/image-reflector-controller/api v1.3.0 h1:RoU4EutcI2ke180tVK6IEEPw9nr1LGItephyyiB+DDA= -github.com/fluxcd/image-reflector-controller/api v1.3.0/go.mod h1:QNc5i2Wiw+qUHJ3cBMtTn0yqx8G9v8kLvjistjDqE+0= -github.com/fluxcd/kustomize-controller/api v1.10.1 h1:/7h464untM4nSwJCnoja1UkJC7G7NM3BWhAi1N3P8ME= -github.com/fluxcd/kustomize-controller/api v1.10.1/go.mod h1:hSq1/80SS0106LhfGr2fe/+P8MgCfBQ82EocC6Su/Ms= -github.com/fluxcd/notification-controller/api v1.10.0 h1:3T+NPI1Keu2UGW0TzTOK6AJakLTospPNIh216tL30dw= -github.com/fluxcd/notification-controller/api v1.10.0/go.mod h1:6pIwQXLusLDiWLZrzQeOme6f7RD5pMC/bCgUu6SUXAA= +github.com/fluxcd/helm-controller/api v1.7.2 h1:nQfiNCBWRjGI5q020On7kHQh77WCl54+sBA9FY6TBug= +github.com/fluxcd/helm-controller/api v1.7.2/go.mod h1:cCTRZcz/hjvI+3AxRGgsGe/AeEjZHHKUYxV/+6uidNM= +github.com/fluxcd/image-automation-controller/api v1.3.1 h1:eBZUPOCR78Ch4fAS0yl0uATJmzqO5mIYDVTulo3HtQ0= +github.com/fluxcd/image-automation-controller/api v1.3.1/go.mod h1:ypBgXSDvspIw5XX1P5OP13rEknyqqMzoHXUW0PDnYjM= +github.com/fluxcd/image-reflector-controller/api v1.3.1 h1:hi4UnJuAyWccCjxs8o4ZQx5feeX0a/eUJKlfJjDDW4c= +github.com/fluxcd/image-reflector-controller/api v1.3.1/go.mod h1:QNc5i2Wiw+qUHJ3cBMtTn0yqx8G9v8kLvjistjDqE+0= +github.com/fluxcd/kustomize-controller/api v1.10.2 h1:tj4mU/3uUBzVxxx4zi95fxs8x2BhEUQkFNOKNRrxn08= +github.com/fluxcd/kustomize-controller/api v1.10.2/go.mod h1:hSq1/80SS0106LhfGr2fe/+P8MgCfBQ82EocC6Su/Ms= +github.com/fluxcd/notification-controller/api v1.10.1 h1:N7dIRwe1UyK5q9scUknsCFLKywqUIDVR36FgF0Ymc/4= +github.com/fluxcd/notification-controller/api v1.10.1/go.mod h1:6pIwQXLusLDiWLZrzQeOme6f7RD5pMC/bCgUu6SUXAA= github.com/fluxcd/pkg/apis/acl v0.12.0 h1:UWpZDqKxpKDW38wdXIMHV8Uv3POPu2vUrra0JH1frH0= github.com/fluxcd/pkg/apis/acl v0.12.0/go.mod h1:PJrGIu5Bw/6/siO95uhS+pi5oKSU+gVJqHqsPHb8Kok= github.com/fluxcd/pkg/apis/crypto v0.5.0 h1:buy9YCvrD8IpKqOVCSV9k2wlF2iVPaETLOZBqsbyfVs= @@ -191,16 +191,16 @@ github.com/fluxcd/pkg/apis/kustomize v1.23.0/go.mod h1:Jm/LmEsqJIldhhTmhkORAq8JKVZK3ZV2Q88rntjGxEI= github.com/fluxcd/pkg/apis/meta v1.38.0 h1:7t6/DuGFAPx2LE4MsRh1jskjnVE6qELKfr/LrfG7KE8= github.com/fluxcd/pkg/apis/meta v1.38.0/go.mod h1:lmdugeiZyt6w+DRm8ypkB+nwrzm+saMbqSfZKGBbTOE= -github.com/fluxcd/pkg/auth v0.66.0 h1:fNS6cf1WOVxVCdEKfCfDgbEgk2t3kzepaI1IKuiXuYo= -github.com/fluxcd/pkg/auth v0.66.0/go.mod h1:eD0iXDzt4BCHVNoBoDkYCsD3+LD39WN/r1qaqsgPJWk= +github.com/fluxcd/pkg/auth v0.66.2 h1:3Bowt4CTFYHhmkihhf1wEh0OPnRAmUDNTNSg2du5U4I= +github.com/fluxcd/pkg/auth v0.66.2/go.mod h1:FRwXijck00jGScJmtKfHIbAnYdAU5BzMtpwOOOZv4Bc= github.com/fluxcd/pkg/cache v0.19.0 h1:gcpASwfXLkaHTq8dv9AkXD+IvD54IfskRwGv3SDwC+E= github.com/fluxcd/pkg/cache v0.19.0/go.mod h1:HYfYegfUsGBIttmTDZDFa0xmbeba4wPyND1YKitXm0w= github.com/fluxcd/pkg/chartutil v1.35.0 h1:FVzo4J8IyIIH1WTEjRsNWlILBz1wyHl6DIsdiJA35n8= github.com/fluxcd/pkg/chartutil v1.35.0/go.mod h1:WOOnJSy+bVOIYrjvQ1aEiURtYVJcqt7d+E2L/SQvBBI= github.com/fluxcd/pkg/envsubst v1.9.0 h1:QTagwV4WLmqF+JsD1rGkcKFmmj4HV64BnqNM1T311kc= github.com/fluxcd/pkg/envsubst v1.9.0/go.mod h1:9VgSWepmQj/H3icObqh65DNodrUz8P88QnM3EaSE5mA= -github.com/fluxcd/pkg/git v0.56.0 h1:DYsgOthnW0FtHAeosvJYQGCa/5PTbWwnDZdML7wt4YI= -github.com/fluxcd/pkg/git v0.56.0/go.mod h1:C3dgIpk8DXkgAE3tjxzkg/d4f+8DqY6GXmWbEpTBTT4= +github.com/fluxcd/pkg/git v0.56.2 h1:OwfN7iDyK+UfJtrGmZRSiVAsxU9kd26n+4T1x87K96E= +github.com/fluxcd/pkg/git v0.56.2/go.mod h1:lYrY2gRyCmxzurtrDiStPxXYIxBsccXUAatyciyr4vU= github.com/fluxcd/pkg/gittestserver v0.33.0 h1:/MKs5Yf3w4BR91fJ4hH6W3E+saQYPDB3toViyDpQXpA= github.com/fluxcd/pkg/gittestserver v0.33.0/go.mod h1:l6PPC/CuAbHn1YHniEulzbU/UWuHHQQegJmWzuz/sz0= github.com/fluxcd/pkg/kustomize v1.44.0 h1:S9ExtSX/wuuqQpvpzuRewM+PTeBVD6IHymnVQE1vFhg= @@ -215,14 +215,14 @@ github.com/fluxcd/pkg/spiffe v0.2.0/go.mod h1:zLRMyp/vOwQEGWLhe04qKOBorUuTQvwBKBgpmWwkKQE= github.com/fluxcd/pkg/ssa v0.83.0 h1:uFKrK255D8wdZxI6k6CznDmVgcah2y+0B+DYYpq/kZs= github.com/fluxcd/pkg/ssa v0.83.0/go.mod h1:J91YwWDZDDwNUIKWPbTk771JT0CzoWwJL5og9muo1jw= -github.com/fluxcd/pkg/ssh v0.29.0 h1:sw25lljJsA54Lcr1oiw7sBLU1c3vWroZf9uLy87rltg= -github.com/fluxcd/pkg/ssh v0.29.0/go.mod h1:193HoPaYQ/SJ9zsJZSMwVsQA/XL02ouOwAHj7jekHCw= +github.com/fluxcd/pkg/ssh v0.29.1 h1:UlluDeulYuGCD0afgdvSrvOnzib3pHISnpF0tz2pIks= +github.com/fluxcd/pkg/ssh v0.29.1/go.mod h1:193HoPaYQ/SJ9zsJZSMwVsQA/XL02ouOwAHj7jekHCw= github.com/fluxcd/pkg/tar v1.4.0 h1:E6LKORT7ZBd/1ekX4N/gS9LeKfyLui1lBgne8e5PC8I= github.com/fluxcd/pkg/tar v1.4.0/go.mod h1:20lDnHLNj/mgTUA494YWkxldX8zyyFexSKpuipX+6Tk= github.com/fluxcd/pkg/version v0.20.0 h1:uPT60sOPMPd0q3n1Go7dYC1fOjkq8wznwNwZ5vv7AJ0= github.com/fluxcd/pkg/version v0.20.0/go.mod h1:n+JDY4+3Wb2NpFF3jWTSEEKvJC97ed+hN+o7QnBCHDA= -github.com/fluxcd/source-controller/api v1.10.1 h1:DqqIctqpgyZvPCjpJUFwWjUM063Y5xblsLqxmxQxcac= -github.com/fluxcd/source-controller/api v1.10.1/go.mod h1:ar4cOwOZ9aMei+7eChKuJFJmnN1Mm5LOTZ9q46Yp4c0= +github.com/fluxcd/source-controller/api v1.10.2 h1:OPs3SN0rlhcxJ8HXHHFj5h0wkmrCIgfLIDmK6C66Ahc= +github.com/fluxcd/source-controller/api v1.10.2/go.mod h1:ar4cOwOZ9aMei+7eChKuJFJmnN1Mm5LOTZ9q46Yp4c0= github.com/fluxcd/source-watcher/api/v2 v2.3.1 h1:/PEIgMxiDbQYGNYLKwmJ2Fokw1cYqypQIad8LQNqy40= github.com/fluxcd/source-watcher/api/v2 v2.3.1/go.mod h1:Nu9SHM3Lyu6voF5euRNKGwjPExVOoU5ykanB3BreXvM= github.com/fsnotify/fsnotify v1.10.1 h1:b0/UzAf9yR5rhf3RPm9gf3ehBPpf0oZKIjtpKrx59Ho= diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flux2-cli-2.10.0/manifests/bases/helm-controller/kustomization.yaml new/flux2-cli-2.10.1/manifests/bases/helm-controller/kustomization.yaml --- old/flux2-cli-2.10.0/manifests/bases/helm-controller/kustomization.yaml 2026-10-26 15:20:36.000000000 +0100 +++ new/flux2-cli-2.10.1/manifests/bases/helm-controller/kustomization.yaml 2026-11-20 13:35:06.000000000 +0100 @@ -1,8 +1,8 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: -- https://github.com/fluxcd/helm-controller/releases/download/v1.7.1/helm-controller.crds.yaml -- https://github.com/fluxcd/helm-controller/releases/download/v1.7.1/helm-controller.deployment.yaml +- https://github.com/fluxcd/helm-controller/releases/download/v1.7.2/helm-controller.crds.yaml +- https://github.com/fluxcd/helm-controller/releases/download/v1.7.2/helm-controller.deployment.yaml - account.yaml transformers: - labels.yaml diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flux2-cli-2.10.0/manifests/bases/image-automation-controller/kustomization.yaml new/flux2-cli-2.10.1/manifests/bases/image-automation-controller/kustomization.yaml --- old/flux2-cli-2.10.0/manifests/bases/image-automation-controller/kustomization.yaml 2026-10-26 15:20:36.000000000 +0100 +++ new/flux2-cli-2.10.1/manifests/bases/image-automation-controller/kustomization.yaml 2026-11-20 13:35:06.000000000 +0100 @@ -1,8 +1,8 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: -- https://github.com/fluxcd/image-automation-controller/releases/download/v1.3.0/image-automation-controller.crds.yaml -- https://github.com/fluxcd/image-automation-controller/releases/download/v1.3.0/image-automation-controller.deployment.yaml +- https://github.com/fluxcd/image-automation-controller/releases/download/v1.3.1/image-automation-controller.crds.yaml +- https://github.com/fluxcd/image-automation-controller/releases/download/v1.3.1/image-automation-controller.deployment.yaml - account.yaml transformers: - labels.yaml diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flux2-cli-2.10.0/manifests/bases/image-reflector-controller/kustomization.yaml new/flux2-cli-2.10.1/manifests/bases/image-reflector-controller/kustomization.yaml --- old/flux2-cli-2.10.0/manifests/bases/image-reflector-controller/kustomization.yaml 2026-10-26 15:20:36.000000000 +0100 +++ new/flux2-cli-2.10.1/manifests/bases/image-reflector-controller/kustomization.yaml 2026-11-20 13:35:06.000000000 +0100 @@ -1,8 +1,8 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: -- https://github.com/fluxcd/image-reflector-controller/releases/download/v1.3.0/image-reflector-controller.crds.yaml -- https://github.com/fluxcd/image-reflector-controller/releases/download/v1.3.0/image-reflector-controller.deployment.yaml +- https://github.com/fluxcd/image-reflector-controller/releases/download/v1.3.1/image-reflector-controller.crds.yaml +- https://github.com/fluxcd/image-reflector-controller/releases/download/v1.3.1/image-reflector-controller.deployment.yaml - account.yaml transformers: - labels.yaml diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flux2-cli-2.10.0/manifests/bases/kustomize-controller/kustomization.yaml new/flux2-cli-2.10.1/manifests/bases/kustomize-controller/kustomization.yaml --- old/flux2-cli-2.10.0/manifests/bases/kustomize-controller/kustomization.yaml 2026-10-26 15:20:36.000000000 +0100 +++ new/flux2-cli-2.10.1/manifests/bases/kustomize-controller/kustomization.yaml 2026-11-20 13:35:06.000000000 +0100 @@ -1,8 +1,8 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: -- https://github.com/fluxcd/kustomize-controller/releases/download/v1.10.1/kustomize-controller.crds.yaml -- https://github.com/fluxcd/kustomize-controller/releases/download/v1.10.1/kustomize-controller.deployment.yaml +- https://github.com/fluxcd/kustomize-controller/releases/download/v1.10.2/kustomize-controller.crds.yaml +- https://github.com/fluxcd/kustomize-controller/releases/download/v1.10.2/kustomize-controller.deployment.yaml - account.yaml transformers: - labels.yaml diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flux2-cli-2.10.0/manifests/bases/notification-controller/kustomization.yaml new/flux2-cli-2.10.1/manifests/bases/notification-controller/kustomization.yaml --- old/flux2-cli-2.10.0/manifests/bases/notification-controller/kustomization.yaml 2026-10-26 15:20:36.000000000 +0100 +++ new/flux2-cli-2.10.1/manifests/bases/notification-controller/kustomization.yaml 2026-11-20 13:35:06.000000000 +0100 @@ -1,8 +1,8 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: -- https://github.com/fluxcd/notification-controller/releases/download/v1.10.0/notification-controller.crds.yaml -- https://github.com/fluxcd/notification-controller/releases/download/v1.10.0/notification-controller.deployment.yaml +- https://github.com/fluxcd/notification-controller/releases/download/v1.10.1/notification-controller.crds.yaml +- https://github.com/fluxcd/notification-controller/releases/download/v1.10.1/notification-controller.deployment.yaml - account.yaml transformers: - labels.yaml diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flux2-cli-2.10.0/manifests/bases/source-controller/kustomization.yaml new/flux2-cli-2.10.1/manifests/bases/source-controller/kustomization.yaml --- old/flux2-cli-2.10.0/manifests/bases/source-controller/kustomization.yaml 2026-10-26 15:20:36.000000000 +0100 +++ new/flux2-cli-2.10.1/manifests/bases/source-controller/kustomization.yaml 2026-11-20 13:35:06.000000000 +0100 @@ -1,8 +1,8 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: -- https://github.com/fluxcd/source-controller/releases/download/v1.10.1/source-controller.crds.yaml -- https://github.com/fluxcd/source-controller/releases/download/v1.10.1/source-controller.deployment.yaml +- https://github.com/fluxcd/source-controller/releases/download/v1.10.2/source-controller.crds.yaml +- https://github.com/fluxcd/source-controller/releases/download/v1.10.2/source-controller.deployment.yaml - account.yaml transformers: - labels.yaml diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flux2-cli-2.10.0/manifests/crds/kustomization.yaml new/flux2-cli-2.10.1/manifests/crds/kustomization.yaml --- old/flux2-cli-2.10.0/manifests/crds/kustomization.yaml 2026-10-26 15:20:36.000000000 +0100 +++ new/flux2-cli-2.10.1/manifests/crds/kustomization.yaml 2026-11-20 13:35:06.000000000 +0100 @@ -1,10 +1,10 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: -- https://github.com/fluxcd/source-controller/releases/download/v1.10.1/source-controller.crds.yaml -- https://github.com/fluxcd/kustomize-controller/releases/download/v1.10.1/kustomize-controller.crds.yaml -- https://github.com/fluxcd/helm-controller/releases/download/v1.7.1/helm-controller.crds.yaml -- https://github.com/fluxcd/notification-controller/releases/download/v1.10.0/notification-controller.crds.yaml -- https://github.com/fluxcd/image-reflector-controller/releases/download/v1.3.0/image-reflector-controller.crds.yaml -- https://github.com/fluxcd/image-automation-controller/releases/download/v1.3.0/image-automation-controller.crds.yaml +- https://github.com/fluxcd/source-controller/releases/download/v1.10.2/source-controller.crds.yaml +- https://github.com/fluxcd/kustomize-controller/releases/download/v1.10.2/kustomize-controller.crds.yaml +- https://github.com/fluxcd/helm-controller/releases/download/v1.7.2/helm-controller.crds.yaml +- https://github.com/fluxcd/notification-controller/releases/download/v1.10.1/notification-controller.crds.yaml +- https://github.com/fluxcd/image-reflector-controller/releases/download/v1.3.1/image-reflector-controller.crds.yaml +- https://github.com/fluxcd/image-automation-controller/releases/download/v1.3.1/image-automation-controller.crds.yaml - https://github.com/fluxcd/source-watcher/releases/download/v2.3.1/source-watcher.crds.yaml diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flux2-cli-2.10.0/pkg/manifestgen/sourcesecret/options.go new/flux2-cli-2.10.1/pkg/manifestgen/sourcesecret/options.go --- old/flux2-cli-2.10.0/pkg/manifestgen/sourcesecret/options.go 2026-10-26 15:20:36.000000000 +0100 +++ new/flux2-cli-2.10.1/pkg/manifestgen/sourcesecret/options.go 2026-11-20 13:35:06.000000000 +0100 @@ -82,6 +82,11 @@ TrustPolicy []byte Address string + // GitScheme is the URL scheme of the Git remote ("ssh", "http" or + // "https"). GenerateGit uses it to validate the authentication options; + // when empty, no validation is performed. + GitScheme string + // GitHub App options GitHubAppID string GitHubAppClientID string diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flux2-cli-2.10.0/pkg/manifestgen/sourcesecret/sourcesecret.go new/flux2-cli-2.10.1/pkg/manifestgen/sourcesecret/sourcesecret.go --- old/flux2-cli-2.10.0/pkg/manifestgen/sourcesecret/sourcesecret.go 2026-10-26 15:20:36.000000000 +0100 +++ new/flux2-cli-2.10.1/pkg/manifestgen/sourcesecret/sourcesecret.go 2026-11-20 13:35:06.000000000 +0100 @@ -64,7 +64,30 @@ Auth string `json:"auth,omitempty"` } +// ValidateGitAuth returns an error if the authentication options are +// incomplete for the configured Git URL scheme. Basic authentication over +// HTTP/S requires both a username and a password. For SSH, the password is +// the private key passphrase and is not validated. +func (o Options) ValidateGitAuth() error { + switch o.GitScheme { + case "ssh": + return nil + case "http", "https": + if o.BearerToken != "" { + return nil + } + if (o.Username == "") != (o.Password == "") { + return fmt.Errorf("for Git over HTTP/S, basic authentication requires both a username and a password; for token-based authentication, use the token as the password with any non-empty username") + } + } + return nil +} + func GenerateGit(options Options) (*manifestgen.Manifest, error) { + if err := options.ValidateGitAuth(); err != nil { + return nil, err + } + var err error var keypair *ssh.KeyPair diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flux2-cli-2.10.0/pkg/manifestgen/sourcesecret/sourcesecret_test.go new/flux2-cli-2.10.1/pkg/manifestgen/sourcesecret/sourcesecret_test.go --- old/flux2-cli-2.10.0/pkg/manifestgen/sourcesecret/sourcesecret_test.go 2026-10-26 15:20:36.000000000 +0100 +++ new/flux2-cli-2.10.1/pkg/manifestgen/sourcesecret/sourcesecret_test.go 2026-11-20 13:35:06.000000000 +0100 @@ -88,3 +88,67 @@ }) } } + +func TestValidateGitAuth(t *testing.T) { + tests := []struct { + name string + options Options + wantErr bool + }{ + {name: "https both set", options: Options{GitScheme: "https", Username: "git", Password: "token"}}, + {name: "https neither set", options: Options{GitScheme: "https"}}, + {name: "https username only", options: Options{GitScheme: "https", Username: "git"}, wantErr: true}, + {name: "https password only", options: Options{GitScheme: "https", Password: "token"}, wantErr: true}, + {name: "http password only", options: Options{GitScheme: "http", Password: "token"}, wantErr: true}, + {name: "https password only with bearer token", options: Options{GitScheme: "https", Password: "token", BearerToken: "token"}}, + {name: "ssh password only", options: Options{GitScheme: "ssh", Password: "passphrase"}}, + {name: "no scheme", options: Options{Password: "token"}}, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if err := tt.options.ValidateGitAuth(); (err != nil) != tt.wantErr { + t.Fatalf("ValidateGitAuth() error = %v, wantErr %v", err, tt.wantErr) + } + }) + } +} + +func TestGenerateGitPartialBasicAuth(t *testing.T) { + tests := []struct { + name string + options Options + wantErr bool + }{ + { + name: "username only", + options: Options{Name: "git-auth", Namespace: "flux-system", GitScheme: "https", Username: "git"}, + wantErr: true, + }, + { + name: "password only", + options: Options{Name: "git-auth", Namespace: "flux-system", GitScheme: "https", Password: "token"}, + wantErr: true, + }, + { + name: "both set", + options: Options{Name: "git-auth", Namespace: "flux-system", GitScheme: "https", Username: "git", Password: "token"}, + }, + { + name: "bearer token with password only", + options: Options{Name: "git-auth", Namespace: "flux-system", GitScheme: "https", Password: "token", BearerToken: "token"}, + }, + { + name: "ssh passphrase only", + options: Options{Name: "git-auth", Namespace: "flux-system", GitScheme: "ssh", Password: "passphrase"}, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if _, err := GenerateGit(tt.options); (err != nil) != tt.wantErr { + t.Fatalf("GenerateGit() error = %v, wantErr %v", err, tt.wantErr) + } + }) + } +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flux2-cli-2.10.0/tests/integration/go.mod new/flux2-cli-2.10.1/tests/integration/go.mod --- old/flux2-cli-2.10.0/tests/integration/go.mod 2026-10-26 15:20:36.000000000 +0100 +++ new/flux2-cli-2.10.1/tests/integration/go.mod 2026-11-20 13:35:06.000000000 +0100 @@ -13,7 +13,7 @@ github.com/fluxcd/notification-controller/api v1.10.0 github.com/fluxcd/pkg/apis/event v0.32.0 github.com/fluxcd/pkg/apis/meta v1.38.0 - github.com/fluxcd/pkg/git v0.56.0 + github.com/fluxcd/pkg/git v0.56.2 github.com/fluxcd/pkg/runtime v0.122.0 github.com/fluxcd/source-controller/api v1.10.0 github.com/fluxcd/test-infra/tftestenv v0.0.0-20260419142339-c6535d1fff77 @@ -59,7 +59,7 @@ github.com/felixge/httpsnoop v1.1.0 // indirect github.com/fluxcd/pkg/apis/acl v0.12.0 // indirect github.com/fluxcd/pkg/apis/kustomize v1.23.0 // indirect - github.com/fluxcd/pkg/ssh v0.29.0 // indirect + github.com/fluxcd/pkg/ssh v0.29.1 // indirect github.com/fluxcd/pkg/version v0.20.0 // indirect github.com/fxamacker/cbor/v2 v2.9.3 // indirect github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/flux2-cli-2.10.0/tests/integration/go.sum new/flux2-cli-2.10.1/tests/integration/go.sum --- old/flux2-cli-2.10.0/tests/integration/go.sum 2026-10-26 15:20:36.000000000 +0100 +++ new/flux2-cli-2.10.1/tests/integration/go.sum 2026-11-20 13:35:06.000000000 +0100 @@ -111,14 +111,14 @@ github.com/fluxcd/pkg/apis/kustomize v1.23.0/go.mod h1:Jm/LmEsqJIldhhTmhkORAq8JKVZK3ZV2Q88rntjGxEI= github.com/fluxcd/pkg/apis/meta v1.38.0 h1:7t6/DuGFAPx2LE4MsRh1jskjnVE6qELKfr/LrfG7KE8= github.com/fluxcd/pkg/apis/meta v1.38.0/go.mod h1:lmdugeiZyt6w+DRm8ypkB+nwrzm+saMbqSfZKGBbTOE= -github.com/fluxcd/pkg/git v0.56.0 h1:DYsgOthnW0FtHAeosvJYQGCa/5PTbWwnDZdML7wt4YI= -github.com/fluxcd/pkg/git v0.56.0/go.mod h1:C3dgIpk8DXkgAE3tjxzkg/d4f+8DqY6GXmWbEpTBTT4= +github.com/fluxcd/pkg/git v0.56.2 h1:OwfN7iDyK+UfJtrGmZRSiVAsxU9kd26n+4T1x87K96E= +github.com/fluxcd/pkg/git v0.56.2/go.mod h1:lYrY2gRyCmxzurtrDiStPxXYIxBsccXUAatyciyr4vU= github.com/fluxcd/pkg/gittestserver v0.33.0 h1:/MKs5Yf3w4BR91fJ4hH6W3E+saQYPDB3toViyDpQXpA= github.com/fluxcd/pkg/gittestserver v0.33.0/go.mod h1:l6PPC/CuAbHn1YHniEulzbU/UWuHHQQegJmWzuz/sz0= github.com/fluxcd/pkg/runtime v0.122.0 h1:5nT+3PqbRvnzIMBNW6g/lIqsg6B715zaF12J3KnvjJY= github.com/fluxcd/pkg/runtime v0.122.0/go.mod h1:46y8/GVMFotQkQxzzePecv7cn09DLbQhq6cl2VQ5l9A= -github.com/fluxcd/pkg/ssh v0.29.0 h1:sw25lljJsA54Lcr1oiw7sBLU1c3vWroZf9uLy87rltg= -github.com/fluxcd/pkg/ssh v0.29.0/go.mod h1:193HoPaYQ/SJ9zsJZSMwVsQA/XL02ouOwAHj7jekHCw= +github.com/fluxcd/pkg/ssh v0.29.1 h1:UlluDeulYuGCD0afgdvSrvOnzib3pHISnpF0tz2pIks= +github.com/fluxcd/pkg/ssh v0.29.1/go.mod h1:193HoPaYQ/SJ9zsJZSMwVsQA/XL02ouOwAHj7jekHCw= github.com/fluxcd/pkg/version v0.20.0 h1:uPT60sOPMPd0q3n1Go7dYC1fOjkq8wznwNwZ5vv7AJ0= github.com/fluxcd/pkg/version v0.20.0/go.mod h1:n+JDY4+3Wb2NpFF3jWTSEEKvJC97ed+hN+o7QnBCHDA= github.com/fluxcd/source-controller/api v1.10.0 h1:th1PYE0f27GWumb/7HoLB9g2zR6YpJue5+I66IuQCww= ++++++ flux2-cli.obsinfo ++++++ --- /var/tmp/diff_new_pack.RFiWNp/_old 2026-11-23 12:33:31.964289469 +0100 +++ /var/tmp/diff_new_pack.RFiWNp/_new 2026-11-23 12:33:31.970289722 +0100 @@ -1,5 +1,5 @@ name: flux2-cli -version: 2.10.0 -mtime: 1793024436 -commit: 3fa784edd773d56630bb9f62645e08f70c2cff0a +version: 2.10.1 +mtime: 1795178106 +commit: 23dcfe98fe672acdf44ecd9c60cbac41b57f5de8 ++++++ helm-controller.deployment.yaml ++++++ --- /var/tmp/diff_new_pack.RFiWNp/_old 2026-11-23 12:33:32.081294399 +0100 +++ /var/tmp/diff_new_pack.RFiWNp/_new 2026-11-23 12:33:32.087294652 +0100 @@ -28,7 +28,7 @@ valueFrom: fieldRef: fieldPath: metadata.namespace - image: fluxcd/helm-controller:v1.7.1 + image: fluxcd/helm-controller:v1.7.2 imagePullPolicy: IfNotPresent livenessProbe: httpGet: ++++++ image-automation-controller.deployment.yaml ++++++ --- /var/tmp/diff_new_pack.RFiWNp/_old 2026-11-23 12:33:32.200299414 +0100 +++ /var/tmp/diff_new_pack.RFiWNp/_new 2026-11-23 12:33:32.212299920 +0100 @@ -28,7 +28,7 @@ valueFrom: fieldRef: fieldPath: metadata.namespace - image: fluxcd/image-automation-controller:v1.3.0 + image: fluxcd/image-automation-controller:v1.3.1 imagePullPolicy: IfNotPresent livenessProbe: httpGet: ++++++ image-reflector-controller.deployment.yaml ++++++ --- /var/tmp/diff_new_pack.RFiWNp/_old 2026-11-23 12:33:32.319304429 +0100 +++ /var/tmp/diff_new_pack.RFiWNp/_new 2026-11-23 12:33:32.325304682 +0100 @@ -28,7 +28,7 @@ valueFrom: fieldRef: fieldPath: metadata.namespace - image: fluxcd/image-reflector-controller:v1.3.0 + image: fluxcd/image-reflector-controller:v1.3.1 imagePullPolicy: IfNotPresent livenessProbe: httpGet: ++++++ kustomize-controller.deployment.yaml ++++++ --- /var/tmp/diff_new_pack.RFiWNp/_old 2026-11-23 12:33:32.414308432 +0100 +++ /var/tmp/diff_new_pack.RFiWNp/_new 2026-11-23 12:33:32.421308727 +0100 @@ -28,7 +28,7 @@ valueFrom: fieldRef: fieldPath: metadata.namespace - image: fluxcd/kustomize-controller:v1.10.1 + image: fluxcd/kustomize-controller:v1.10.2 imagePullPolicy: IfNotPresent livenessProbe: httpGet: ++++++ notification-controller.deployment.yaml ++++++ --- /var/tmp/diff_new_pack.RFiWNp/_old 2026-11-23 12:33:32.543313868 +0100 +++ /var/tmp/diff_new_pack.RFiWNp/_new 2026-11-23 12:33:32.550314163 +0100 @@ -60,7 +60,7 @@ valueFrom: fieldRef: fieldPath: metadata.namespace - image: fluxcd/notification-controller:v1.10.0 + image: fluxcd/notification-controller:v1.10.1 imagePullPolicy: IfNotPresent livenessProbe: httpGet: ++++++ source-controller.deployment.yaml ++++++ --- /var/tmp/diff_new_pack.RFiWNp/_old 2026-11-23 12:33:32.652318462 +0100 +++ /var/tmp/diff_new_pack.RFiWNp/_new 2026-11-23 12:33:32.662318883 +0100 @@ -50,7 +50,7 @@ fieldPath: metadata.namespace - name: TUF_ROOT value: /tmp/.sigstore - image: fluxcd/source-controller:v1.10.1 + image: fluxcd/source-controller:v1.10.2 imagePullPolicy: IfNotPresent livenessProbe: httpGet: ++++++ vendor.tar.gz ++++++ /work/SRC/openSUSE:Factory/flux2-cli/vendor.tar.gz /work/SRC/openSUSE:Factory/.flux2-cli.new.1340718/vendor.tar.gz differ: char 13, line 1
