Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package werf for openSUSE:Factory checked in at 2026-11-19 16:55:03 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/werf (Old) and /work/SRC/openSUSE:Factory/.werf.new.1251 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "werf" Thu Nov 19 16:55:03 2026 rev:90 rq:1398551 version:2.84.1 Changes: -------- --- /work/SRC/openSUSE:Factory/werf/werf.changes 2026-11-13 18:38:55.515426790 +0100 +++ /work/SRC/openSUSE:Factory/.werf.new.1251/werf.changes 2026-11-19 16:55:24.082511281 +0100 @@ -1,0 +2,16 @@ +Wed Nov 18 15:08:51 UTC 2026 - Johannes Kastl <[email protected]> + +- Update to version 2.84.1: + * Bug Fixes + - build: prevent empty-body errors when retrying registry + uploads (#8100) (59bfe8b) + - build: restore Docker Hub login for build and export (#8119) + (65befdd) + - deploy, tracking: stop uninstall and dismiss hanging on + elimination (#8120) (4dcffaf) + - deploy: stop helm dependency update panicking without + Chart.lock (#8121) (8f4f6fc) + - deploy: use saved plans that contain a blind apply (#8103) + (8a834d7) + +------------------------------------------------------------------- Old: ---- werf-2.84.0.obscpio New: ---- werf-2.84.1.obscpio ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ werf.spec ++++++ --- /var/tmp/diff_new_pack.fqn9oo/_old 2026-11-19 16:55:25.755582199 +0100 +++ /var/tmp/diff_new_pack.fqn9oo/_new 2026-11-19 16:55:25.757582284 +0100 @@ -17,7 +17,7 @@ Name: werf -Version: 2.84.0 +Version: 2.84.1 Release: 0 Summary: CLI for the Werf CI/CD system License: Apache-2.0 ++++++ _service ++++++ --- /var/tmp/diff_new_pack.fqn9oo/_old 2026-11-19 16:55:25.803584234 +0100 +++ /var/tmp/diff_new_pack.fqn9oo/_new 2026-11-19 16:55:25.808584446 +0100 @@ -3,7 +3,7 @@ <param name="url">https://github.com/werf/werf.git</param> <param name="scm">git</param> <param name="exclude">.git</param> - <param name="revision">refs/tags/v2.84.0</param> + <param name="revision">refs/tags/v2.84.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.fqn9oo/_old 2026-11-19 16:55:25.843585930 +0100 +++ /var/tmp/diff_new_pack.fqn9oo/_new 2026-11-19 16:55:25.850586226 +0100 @@ -3,6 +3,6 @@ <param name="url">https://github.com/werf/werf</param> <param name="changesrevision">508fb9aee29baca228674ba7a3d2d4fa1f5844d5</param></service><service name="tar_scm"> <param name="url">https://github.com/werf/werf.git</param> - <param name="changesrevision">4ca847c4b39ff5174f9174b41613133f4dfdcd62</param></service></servicedata> + <param name="changesrevision">d6c03cd89f799cc11accfcd13c729401c96502a8</param></service></servicedata> (No newline at EOF) ++++++ vendor.tar.gz ++++++ /work/SRC/openSUSE:Factory/werf/vendor.tar.gz /work/SRC/openSUSE:Factory/.werf.new.1251/vendor.tar.gz differ: char 141, line 2 ++++++ werf-2.84.0.obscpio -> werf-2.84.1.obscpio ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/werf-2.84.0/.release-please/2/manifest.json new/werf-2.84.1/.release-please/2/manifest.json --- old/werf-2.84.0/.release-please/2/manifest.json 2026-10-20 17:16:12.000000000 +0200 +++ new/werf-2.84.1/.release-please/2/manifest.json 2026-10-29 16:27:18.000000000 +0100 @@ -1,3 +1,3 @@ { - ".": "2.84.0" + ".": "2.84.1" } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/werf-2.84.0/CHANGELOG.md new/werf-2.84.1/CHANGELOG.md --- old/werf-2.84.0/CHANGELOG.md 2026-10-20 17:16:12.000000000 +0200 +++ new/werf-2.84.1/CHANGELOG.md 2026-10-29 16:27:18.000000000 +0100 @@ -1,5 +1,16 @@ # Changelog +## [2.84.1](https://github.com/werf/werf/compare/v2.84.0...v2.84.1) (2026-10-29) + + +### Bug Fixes + +* **build:** prevent empty-body errors when retrying registry uploads ([#8100](https://github.com/werf/werf/issues/8100)) ([59bfe8b](https://github.com/werf/werf/commit/59bfe8bb7249b22ec4a3ea44d8c803a50fbfc71b)) +* **build:** restore Docker Hub login for build and export ([#8119](https://github.com/werf/werf/issues/8119)) ([65befdd](https://github.com/werf/werf/commit/65befdde98501d11b51548ec3b340788b6150d32)) +* **deploy, tracking:** stop uninstall and dismiss hanging on elimination ([#8120](https://github.com/werf/werf/issues/8120)) ([4dcffaf](https://github.com/werf/werf/commit/4dcffafb5aceb3dd1ee808c3975145a98ca9d36a)) +* **deploy:** stop `helm dependency update` panicking without Chart.lock ([#8121](https://github.com/werf/werf/issues/8121)) ([8f4f6fc](https://github.com/werf/werf/commit/8f4f6fcf58f98b809462e4238df95e2a63ca8aa7)) +* **deploy:** use saved plans that contain a blind apply ([#8103](https://github.com/werf/werf/issues/8103)) ([8a834d7](https://github.com/werf/werf/commit/8a834d784c7ad9b1de8f4c091767413343a5522d)) + ## [2.84.0](https://github.com/werf/werf/compare/v2.83.1...v2.84.0) (2026-10-20) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/werf-2.84.0/go.mod new/werf-2.84.1/go.mod --- old/werf-2.84.0/go.mod 2026-10-20 17:16:12.000000000 +0200 +++ new/werf-2.84.1/go.mod 2026-10-29 16:27:18.000000000 +0100 @@ -62,11 +62,11 @@ github.com/werf/3p-helm-for-werf-helm v0.0.0-20241217155820-089f92cd5c9d github.com/werf/common-go v0.0.0-20260414103517-0558f83edc6d github.com/werf/copy-recurse v0.3.1 - github.com/werf/kubedog v0.13.1-0.20260912145640-ad1e8a134607 - github.com/werf/kubedog-for-werf-helm v0.0.0-20241217155728-9d45c48b82b6 + github.com/werf/kubedog v0.13.1-0.20261028084433-60827212f828 + github.com/werf/kubedog-for-werf-helm v0.0.0-20261028084224-acddc89799e7 github.com/werf/lockgate v0.1.1 github.com/werf/logboek v0.7.1 - github.com/werf/nelm v1.31.1-0.20261001091957-7d2829eb1373 + github.com/werf/nelm v1.31.2-0.20261021180502-7d1c80c67c12 github.com/werf/nelm-for-werf-helm v0.0.0-20241217155925-b0e6734d1dbf go.opentelemetry.io/otel v1.24.0 go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.24.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/werf-2.84.0/go.sum new/werf-2.84.1/go.sum --- old/werf-2.84.0/go.sum 2026-10-20 17:16:12.000000000 +0200 +++ new/werf-2.84.1/go.sum 2026-10-29 16:27:18.000000000 +0100 @@ -331,8 +331,6 @@ github.com/containers/luksy v0.0.0-20240312134643-3d2cf0e19c84/go.mod h1:+idJYfuH2iLhmk8wZEavPACGMRTnZ/NK/5D74U67Um4= github.com/containers/ocicrypt v1.1.10 h1:r7UR6o8+lyhkEywetubUUgcKFjOWOaWz8cEBrCPX0ic= github.com/containers/ocicrypt v1.1.10/go.mod h1:YfzSSr06PTHQwSTUKqDSjish9BeW1E4HUmreluQcMd8= -github.com/containers/storage v1.53.0 h1:VSES3C/u1pxjTJIXvLrSmyP7OBtDky04oGu07UvdTEA= -github.com/containers/storage v1.53.0/go.mod h1:pujcoOSc+upx15Jirdkebhtd8uJiLwbSd/mYT6zDJK8= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= @@ -1404,16 +1402,16 @@ github.com/werf/common-go v0.0.0-20260414103517-0558f83edc6d/go.mod h1:MXS0JR9zut+oR9oEM8PEkdXXoEbKDILTmWopt0z1eZs= github.com/werf/copy-recurse v0.3.1 h1:1DXl5+CnxOP9pcvXu7qkY2hnqxUHnE5KWdydALL/Ycs= github.com/werf/copy-recurse v0.3.1/go.mod h1:6Ypb+qN+hRBJgoCgEkX1vpbqcQ+8q69BQ3hi8s8Y6Qc= -github.com/werf/kubedog v0.13.1-0.20260912145640-ad1e8a134607 h1:CXhIpGRHalekTLSNDLUMPOXxJz28cyy4gdUSnanlLJk= -github.com/werf/kubedog v0.13.1-0.20260912145640-ad1e8a134607/go.mod h1:+pTZuZqy+xtj6yh49kfQuBGDMHdm7zVJbVl2s4xawe8= -github.com/werf/kubedog-for-werf-helm v0.0.0-20241217155728-9d45c48b82b6 h1:lpgQPTCp+wNJfTqJWtR6A5gRA4e4m/eRJFV7V18XCoA= -github.com/werf/kubedog-for-werf-helm v0.0.0-20241217155728-9d45c48b82b6/go.mod h1:PA9xGVKX9Il6sCgvPrcB3/FahRme3bXRz4BuylvAssc= +github.com/werf/kubedog v0.13.1-0.20261028084433-60827212f828 h1:MLQbWY7disBz14F4qfy5AkPQDj3XOQMvVXNDdiJrTus= +github.com/werf/kubedog v0.13.1-0.20261028084433-60827212f828/go.mod h1:+pTZuZqy+xtj6yh49kfQuBGDMHdm7zVJbVl2s4xawe8= +github.com/werf/kubedog-for-werf-helm v0.0.0-20261028084224-acddc89799e7 h1:/0wKPwm9TGh6WfyvCYCdrsOMtibfU4oH7doL7yrTGo4= +github.com/werf/kubedog-for-werf-helm v0.0.0-20261028084224-acddc89799e7/go.mod h1:PA9xGVKX9Il6sCgvPrcB3/FahRme3bXRz4BuylvAssc= github.com/werf/lockgate v0.1.1 h1:S400JFYjtWfE4i4LY9FA8zx0fMdfui9DPrBiTciCrx4= github.com/werf/lockgate v0.1.1/go.mod h1:0yIFSLq9ausy6ejNxF5uUBf/Ib6daMAfXuCaTMZJzIE= github.com/werf/logboek v0.7.1 h1:Ck8L7LVmj/wyrW/jk+EkkpGwdmpkOrsWAwoIgLHupc8= github.com/werf/logboek v0.7.1/go.mod h1:Gez5J4bxekyr6MxTmIJyId1F61rpO+0/V4vjCIEIZmk= -github.com/werf/nelm v1.31.1-0.20261001091957-7d2829eb1373 h1:UVdLE9Oy97LBtYjLhuSHt8C22+so8e7Bj0iNGlFrWeE= -github.com/werf/nelm v1.31.1-0.20261001091957-7d2829eb1373/go.mod h1:qRK9yCc26hCJ1ghJJ+2fmM12fATL+XIabLb/0gUsP/w= +github.com/werf/nelm v1.31.2-0.20261021180502-7d1c80c67c12 h1:UdfA0YHoXcdDq6Rj+jAEnZZ44QHF425CmjqjXKA8C5E= +github.com/werf/nelm v1.31.2-0.20261021180502-7d1c80c67c12/go.mod h1:qRK9yCc26hCJ1ghJJ+2fmM12fATL+XIabLb/0gUsP/w= github.com/werf/nelm-for-werf-helm v0.0.0-20241217155925-b0e6734d1dbf h1:K51qz209c1yJgKzPw8AeS72T21F/ACp0VI3RJvT4THA= github.com/werf/nelm-for-werf-helm v0.0.0-20241217155925-b0e6734d1dbf/go.mod h1:7RJXSGPKKPEvfPqrTwNA8jT7y52O0ebwhSbSn29ESMA= github.com/xanzy/go-gitlab v0.31.0/go.mod h1:sPLojNBn68fMUWSxIJtdVVIP8uSBYqesTfDUseX11Ug= diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/werf-2.84.0/pkg/deploy/helm_for_werf_helm/chart_extender_for_werf_helm/chart_dependencies_loader.go new/werf-2.84.1/pkg/deploy/helm_for_werf_helm/chart_extender_for_werf_helm/chart_dependencies_loader.go --- old/werf-2.84.0/pkg/deploy/helm_for_werf_helm/chart_extender_for_werf_helm/chart_dependencies_loader.go 2026-10-20 17:16:12.000000000 +0200 +++ new/werf-2.84.1/pkg/deploy/helm_for_werf_helm/chart_extender_for_werf_helm/chart_dependencies_loader.go 2026-10-29 16:27:18.000000000 +0100 @@ -64,6 +64,10 @@ } func CopyChartDependenciesIntoCache(ctx context.Context, chartDir string, ch *chart.Chart) error { + if ch.Lock == nil { + return nil + } + metadataBytes, err := yaml.Marshal(ch.Metadata) if err != nil { return fmt.Errorf("unable to marshal chart metadata into yaml: %w", err) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/werf-2.84.0/pkg/deploy/helm_for_werf_helm/chart_extender_for_werf_helm/chart_dependencies_loader_test.go new/werf-2.84.1/pkg/deploy/helm_for_werf_helm/chart_extender_for_werf_helm/chart_dependencies_loader_test.go --- old/werf-2.84.0/pkg/deploy/helm_for_werf_helm/chart_extender_for_werf_helm/chart_dependencies_loader_test.go 1970-01-01 01:00:00.000000000 +0100 +++ new/werf-2.84.1/pkg/deploy/helm_for_werf_helm/chart_extender_for_werf_helm/chart_dependencies_loader_test.go 2026-10-29 16:27:18.000000000 +0100 @@ -0,0 +1,31 @@ +package chart_extender_for_werf_helm + +import ( + "context" + "os" + "path/filepath" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + + "github.com/werf/3p-helm-for-werf-helm/pkg/chart/loader" + "github.com/werf/werf/v2/pkg/werf" +) + +var _ = Describe("CopyChartDependenciesIntoCache", func() { + It("should succeed for a chart with subcharts in charts/ but without Chart.lock", func(ctx context.Context) { + tmpDir := GinkgoT().TempDir() + Expect(werf.Init(tmpDir, filepath.Join(tmpDir, "home"))).To(Succeed()) + + chartDir := filepath.Join(tmpDir, "chart") + Expect(os.MkdirAll(filepath.Join(chartDir, "charts", "child"), os.ModePerm)).To(Succeed()) + Expect(os.WriteFile(filepath.Join(chartDir, "Chart.yaml"), []byte("apiVersion: v2\nname: parent\nversion: 0.1.0\n"), 0o644)).To(Succeed()) + Expect(os.WriteFile(filepath.Join(chartDir, "charts", "child", "Chart.yaml"), []byte("apiVersion: v2\nname: child\nversion: 0.1.0\n"), 0o644)).To(Succeed()) + + ch, err := loader.LoadDir(chartDir) + Expect(err).To(Succeed()) + Expect(ch.Lock).To(BeNil()) + + Expect(CopyChartDependenciesIntoCache(ctx, chartDir, ch)).To(Succeed()) + }) +}) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/werf-2.84.0/pkg/docker/config.go new/werf-2.84.1/pkg/docker/config.go --- old/werf-2.84.0/pkg/docker/config.go 2026-10-20 17:16:12.000000000 +0200 +++ new/werf-2.84.1/pkg/docker/config.go 2026-10-29 16:27:18.000000000 +0100 @@ -5,8 +5,10 @@ "path/filepath" "github.com/docker/cli/cli/config" + "github.com/docker/cli/cli/config/credentials" "github.com/docker/cli/cli/config/types" "github.com/docker/docker/pkg/homedir" + "github.com/google/go-containerregistry/pkg/authn" ) func GetDockerConfigCredentialsFile(configDir string) string { @@ -21,10 +23,23 @@ // // Inspired with https://github.com/google/go-containerregistry/blob/v0.20.3/cmd/crane/cmd/auth.go#L242 func StoreCredentials(configDir string, authConf types.AuthConfig) error { + originalAddress := authConf.ServerAddress + authConf.ServerAddress = credentialsServerAddress(authConf.ServerAddress) conf, err := config.Load(configDir) if err != nil { return fmt.Errorf("unable to load %s: %w", GetDockerConfigCredentialsFile(configDir), err) } + if authConf.ServerAddress == authn.DefaultAuthKey && conf.CredentialHelpers[authn.DefaultAuthKey] == "" { + for _, address := range []string{originalAddress, "index.docker.io", "docker.io"} { + if helper := conf.CredentialHelpers[address]; helper != "" { + conf.CredentialHelpers[authn.DefaultAuthKey] = helper + if err := conf.Save(); err != nil { + return fmt.Errorf("unable to save Docker Hub credential helper: %w", err) + } + break + } + } + } creds := conf.GetCredentialsStore(authConf.ServerAddress) err = creds.Store(authConf) if err != nil { @@ -41,10 +56,44 @@ if err != nil { return fmt.Errorf("unable to load %s: %w", GetDockerConfigCredentialsFile(configDir), err) } - creds := conf.GetCredentialsStore(authConf.ServerAddress) - err = creds.Erase(authConf.ServerAddress) - if err != nil { - return fmt.Errorf("unable to erase credentials: %w", err) + serverAddress := credentialsServerAddress(authConf.ServerAddress) + addresses := []string{serverAddress} + if serverAddress == authn.DefaultAuthKey { + addresses = append(addresses, "index.docker.io", "docker.io") + } + for _, address := range addresses { + creds := conf.GetCredentialsStore(address) + if serverAddress == authn.DefaultAuthKey { + // Docker CLI normalizes Hub aliases; select the legacy stores by their original keys. + helper := conf.CredentialHelpers[address] + if helper == "" { + helper = conf.CredentialsStore + } + creds = credentials.NewFileStore(conf) + if helper != "" { + creds = credentials.NewNativeStore(conf, helper) + } + stored, err := creds.Get(address) + if err != nil { + return fmt.Errorf("unable to get credentials for %q: %w", address, err) + } + stored.ServerAddress = "" + if stored == (types.AuthConfig{}) { + creds = credentials.NewFileStore(conf) + } + } + if err := creds.Erase(address); err != nil { + return fmt.Errorf("unable to erase credentials: %w", err) + } } return nil } + +func credentialsServerAddress(address string) string { + switch address { + case "docker.io", "index.docker.io": + return authn.DefaultAuthKey + default: + return address + } +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/werf-2.84.0/pkg/docker/config_test.go new/werf-2.84.1/pkg/docker/config_test.go --- old/werf-2.84.0/pkg/docker/config_test.go 1970-01-01 01:00:00.000000000 +0100 +++ new/werf-2.84.1/pkg/docker/config_test.go 2026-10-29 16:27:18.000000000 +0100 @@ -0,0 +1,155 @@ +package docker + +import ( + "encoding/json" + "fmt" + "os" + "path/filepath" + "strings" + + "github.com/docker/cli/cli/config" + "github.com/docker/cli/cli/config/credentials" + "github.com/docker/cli/cli/config/types" + "github.com/google/go-containerregistry/pkg/authn" + "github.com/google/go-containerregistry/pkg/name" + "github.com/onsi/ginkgo/v2" + "github.com/onsi/gomega" +) + +var _ = ginkgo.Describe("registry credentials", func() { + var configDir string + ginkgo.BeforeEach(func() { + configDir = ginkgo.GinkgoT().TempDir() + ginkgo.GinkgoT().Setenv("DOCKER_CONFIG", configDir) + gomega.Expect(os.WriteFile(filepath.Join(configDir, "config.json"), []byte(`{"auths":{}}`), 0o600)).To(gomega.Succeed()) + }) + + ginkgo.DescribeTable("stores credentials usable by the registry client and removes them on logout", + func(address, repository, expectedKey string) { + gomega.Expect(StoreCredentials(configDir, types.AuthConfig{ + ServerAddress: address, Username: "test-user", Password: "test-password", + })).To(gomega.Succeed()) + conf, err := config.Load(configDir) + gomega.Expect(err).NotTo(gomega.HaveOccurred()) + gomega.Expect(conf.AuthConfigs).To(gomega.HaveKey(expectedKey)) + gomega.Expect(conf.AuthConfigs).To(gomega.HaveLen(1)) + ref, err := name.NewRepository(repository) + gomega.Expect(err).NotTo(gomega.HaveOccurred()) + authenticator, err := authn.DefaultKeychain.Resolve(ref) + gomega.Expect(err).NotTo(gomega.HaveOccurred()) + resolved, err := authenticator.Authorization() + gomega.Expect(err).NotTo(gomega.HaveOccurred()) + gomega.Expect(resolved.Username).To(gomega.Equal("test-user")) + gomega.Expect(resolved.Password).To(gomega.Equal("test-password")) + + gomega.Expect(EraseCredentials(configDir, types.AuthConfig{ServerAddress: address})).To(gomega.Succeed()) + authenticator, err = authn.DefaultKeychain.Resolve(ref) + gomega.Expect(err).NotTo(gomega.HaveOccurred()) + gomega.Expect(authenticator).To(gomega.Equal(authn.Anonymous)) + gomega.Expect(EraseCredentials(configDir, types.AuthConfig{ServerAddress: address})).To(gomega.Succeed()) + }, + ginkgo.Entry("Docker Hub index", "index.docker.io", "index.docker.io/test/image", "https://index.docker.io/v1/"), + ginkgo.Entry("Docker Hub alias", "docker.io", "docker.io/test/image", "https://index.docker.io/v1/"), + ginkgo.Entry("Docker Hub canonical key", "https://index.docker.io/v1/", "index.docker.io/test/image", "https://index.docker.io/v1/"), + ginkgo.Entry("another registry", "registry.example.com:5000", "registry.example.com:5000/test/image", "registry.example.com:5000"), + ) + + ginkgo.DescribeTable("removes legacy Docker Hub credentials without touching other registries", func(address string) { + conf, err := config.Load(configDir) + gomega.Expect(err).NotTo(gomega.HaveOccurred()) + for _, key := range []string{"https://index.docker.io/v1/", "index.docker.io", "docker.io", "registry.example.com"} { + gomega.Expect(credentials.NewFileStore(conf).Store(types.AuthConfig{ServerAddress: key, Username: "test-user", Password: "test-password"})).To(gomega.Succeed()) + } + gomega.Expect(EraseCredentials(configDir, types.AuthConfig{ServerAddress: address})).To(gomega.Succeed()) + conf, err = config.Load(configDir) + gomega.Expect(err).NotTo(gomega.HaveOccurred()) + gomega.Expect(conf.AuthConfigs).To(gomega.HaveLen(1)) + gomega.Expect(conf.AuthConfigs).To(gomega.HaveKey("registry.example.com")) + }, + ginkgo.Entry("index", "index.docker.io"), + ginkgo.Entry("alias", "docker.io"), + ginkgo.Entry("canonical key", "https://index.docker.io/v1/"), + ) + + ginkgo.DescribeTable("preserves the Docker Hub credential helper", func(helperKey string) { + helperDir := ginkgo.GinkgoT().TempDir() + ginkgo.GinkgoT().Setenv("PATH", helperDir+string(os.PathListSeparator)+os.Getenv("PATH")) + ginkgo.GinkgoT().Setenv("WERF_TEST_CREDENTIAL_FILE", filepath.Join(helperDir, "credentials.json")) + helper := `#!/bin/sh +case "$1" in + store) cat > "$WERF_TEST_CREDENTIAL_FILE" ;; + get) + read -r server + file="$WERF_TEST_CREDENTIAL_FILE" + if [ "$server" != "https://index.docker.io/v1/" ]; then file="$file.$server"; fi + if [ -f "$file" ]; then + cat "$file" + else + echo 'credentials not found in native keychain' + exit 1 + fi ;; + erase) + read -r server + file="$WERF_TEST_CREDENTIAL_FILE" + if [ "$server" != "https://index.docker.io/v1/" ]; then file="$file.$server"; fi + rm "$file" ;; + *) exit 1 ;; +esac +` + gomega.Expect(os.WriteFile(filepath.Join(helperDir, "docker-credential-werf-test"), []byte(helper), 0o700)).To(gomega.Succeed()) + gomega.Expect(os.WriteFile(filepath.Join(configDir, "config.json"), []byte(fmt.Sprintf(`{"auths":{},"credHelpers":{%q:"werf-test"}}`, helperKey)), 0o600)).To(gomega.Succeed()) + legacyFile := os.Getenv("WERF_TEST_CREDENTIAL_FILE") + "." + helperKey + if helperKey == "mixed" { + legacyHelper := strings.Replace(helper, "#!/bin/sh", "#!/bin/sh\nWERF_TEST_CREDENTIAL_FILE=\"$WERF_TEST_CREDENTIAL_FILE.legacy\"", 1) + gomega.Expect(os.WriteFile(filepath.Join(helperDir, "docker-credential-werf-legacy-test"), []byte(legacyHelper), 0o700)).To(gomega.Succeed()) + gomega.Expect(os.WriteFile(filepath.Join(configDir, "config.json"), []byte(`{"auths":{},"credHelpers":{"https://index.docker.io/v1/":"werf-test","index.docker.io":"werf-legacy-test"}}`), 0o600)).To(gomega.Succeed()) + legacyFile = os.Getenv("WERF_TEST_CREDENTIAL_FILE") + ".legacy.index.docker.io" + } + if helperKey != "https://index.docker.io/v1/" { + gomega.Expect(os.WriteFile(legacyFile, []byte(`{"Username":"old-user","Secret":"old-password"}`), 0o600)).To(gomega.Succeed()) + } + gomega.Expect(StoreCredentials(configDir, types.AuthConfig{ServerAddress: "index.docker.io", Username: "test-user", Password: "test-password"})).To(gomega.Succeed()) + data, err := os.ReadFile(os.Getenv("WERF_TEST_CREDENTIAL_FILE")) + gomega.Expect(err).NotTo(gomega.HaveOccurred()) + var stored struct{ ServerURL, Username, Secret string } + gomega.Expect(json.Unmarshal(data, &stored)).To(gomega.Succeed()) + gomega.Expect(stored.ServerURL).To(gomega.Equal("https://index.docker.io/v1/")) + gomega.Expect(stored.Username).To(gomega.Equal("test-user")) + gomega.Expect(stored.Secret).To(gomega.Equal("test-password")) + conf, err := config.Load(configDir) + gomega.Expect(err).NotTo(gomega.HaveOccurred()) + gomega.Expect(conf.CredentialHelpers["https://index.docker.io/v1/"]).To(gomega.Equal("werf-test")) + for _, credentials := range conf.AuthConfigs { + gomega.Expect(credentials.Username).To(gomega.BeEmpty()) + gomega.Expect(credentials.Password).To(gomega.BeEmpty()) + gomega.Expect(credentials.Auth).To(gomega.BeEmpty()) + } + ref, err := name.NewRepository("index.docker.io/test/image") + gomega.Expect(err).NotTo(gomega.HaveOccurred()) + authenticator, err := authn.DefaultKeychain.Resolve(ref) + gomega.Expect(err).NotTo(gomega.HaveOccurred()) + resolved, err := authenticator.Authorization() + gomega.Expect(err).NotTo(gomega.HaveOccurred()) + gomega.Expect(resolved.Username).To(gomega.Equal("test-user")) + gomega.Expect(resolved.Password).To(gomega.Equal("test-password")) + for _, address := range []string{"index.docker.io", "docker.io"} { + gomega.Expect(credentials.NewFileStore(conf).Store(types.AuthConfig{ServerAddress: address, Username: "old-user", Password: "old-password"})).To(gomega.Succeed()) + } + + gomega.Expect(EraseCredentials(configDir, types.AuthConfig{ServerAddress: "docker.io"})).To(gomega.Succeed()) + conf, err = config.Load(configDir) + gomega.Expect(err).NotTo(gomega.HaveOccurred()) + gomega.Expect(conf.AuthConfigs).To(gomega.BeEmpty()) + _, err = os.Stat(os.Getenv("WERF_TEST_CREDENTIAL_FILE")) + gomega.Expect(os.IsNotExist(err)).To(gomega.BeTrue()) + if helperKey != "https://index.docker.io/v1/" { + _, err = os.Stat(legacyFile) + gomega.Expect(os.IsNotExist(err)).To(gomega.BeTrue()) + } + }, + ginkgo.Entry("canonical helper", "https://index.docker.io/v1/"), + ginkgo.Entry("legacy index helper", "index.docker.io"), + ginkgo.Entry("legacy alias helper", "docker.io"), + ginkgo.Entry("distinct canonical and legacy helpers", "mixed"), + ) +}) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/werf-2.84.0/pkg/docker_registry/common_api.go new/werf-2.84.1/pkg/docker_registry/common_api.go --- old/werf-2.84.0/pkg/docker_registry/common_api.go 2026-10-20 17:16:12.000000000 +0200 +++ new/werf-2.84.1/pkg/docker_registry/common_api.go 2026-10-29 16:27:18.000000000 +0100 @@ -86,7 +86,7 @@ dt.TLSNextProto = make(map[string]func(authority string, c *tls.Conn) http.RoundTripper) } - t = dt + t = &requestBodyTransport{underlying: dt} } // Add werf User-Agent header. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/werf-2.84.0/pkg/docker_registry/helpers_test.go new/werf-2.84.1/pkg/docker_registry/helpers_test.go --- old/werf-2.84.0/pkg/docker_registry/helpers_test.go 2026-10-20 17:16:12.000000000 +0200 +++ new/werf-2.84.1/pkg/docker_registry/helpers_test.go 2026-10-29 16:27:18.000000000 +0100 @@ -312,6 +312,18 @@ return roundTrip(req) } +type trackedRequestBody struct { + io.Reader + closed bool +} + +var _ io.ReadCloser = (*trackedRequestBody)(nil) + +func (body *trackedRequestBody) Close() error { + body.closed = true + return nil +} + var _ Interface = (*listingRegistryStub)(nil) type listingRegistryStub struct { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/werf-2.84.0/pkg/docker_registry/request_body_retry_test.go new/werf-2.84.1/pkg/docker_registry/request_body_retry_test.go --- old/werf-2.84.0/pkg/docker_registry/request_body_retry_test.go 1970-01-01 01:00:00.000000000 +0100 +++ new/werf-2.84.1/pkg/docker_registry/request_body_retry_test.go 2026-10-29 16:27:18.000000000 +0100 @@ -0,0 +1,123 @@ +package docker_registry + +import ( + "bytes" + "context" + "errors" + "fmt" + "io" + "net/http" + "os" + "path/filepath" + "strings" + "sync" + "sync/atomic" + + "github.com/google/go-containerregistry/pkg/v1/remote/transport" + "github.com/onsi/ginkgo/v2" + "github.com/onsi/gomega" +) + +var _ = ginkgo.Describe("registry request body retries", func() { + ginkgo.BeforeEach(func() { + configDir := ginkgo.GinkgoT().TempDir() + gomega.Expect(os.WriteFile(filepath.Join(configDir, "config.json"), []byte(`{"auths":{}}`), 0o600)).To(gomega.Succeed()) + ginkgo.GinkgoT().Setenv("DOCKER_CONFIG", configDir) + }) + + ginkgo.DescribeTable("preserves the manifest and registry result after a rejected upload", func(status int, useTLS bool, finalStatus int) { + fixture := newWritableBearerRegistryFixtureWithTLS(useTLS) + ginkgo.DeferCleanup(fixture.server.Close) + fixture.server.Config.SetKeepAlivesEnabled(false) + var accepted atomic.Int64 + accepted.Store(1) + fixture.authorize = func(req *http.Request) bool { + return req.Header.Get("Authorization") == fmt.Sprintf("Bearer token-%d", accepted.Load()) + } + fixture.tokenReply = func(w http.ResponseWriter, req *http.Request, count int64) { + defer ginkgo.GinkgoRecover() + accepted.Store(count) + w.Header().Set("Content-Type", "application/json") + w.Header().Set("Connection", "close") + _, err := fmt.Fprintf(w, `{"token":"token-%d","expires_in":300}`, count) + gomega.Expect(err).NotTo(gomega.HaveOccurred()) + } + + var mu sync.Mutex + var manifests [][]byte + backend := fixture.backend + fixture.backend = http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { + defer ginkgo.GinkgoRecover() + if req.Method != http.MethodPut || !strings.Contains(req.URL.Path, "/manifests/") { + backend.ServeHTTP(w, req) + return + } + + body, err := io.ReadAll(req.Body) + gomega.Expect(err).NotTo(gomega.HaveOccurred()) + mu.Lock() + manifests = append(manifests, body) + first := len(manifests) == 1 + mu.Unlock() + if first { + w.Header().Set("Connection", "close") + if status == http.StatusUnauthorized { + accepted.Store(2) + w.Header().Set("WWW-Authenticate", fmt.Sprintf(`Bearer realm="%s/token",service="fixture"`, fixture.server.URL)) + } else { + w.Header().Set("Retry-After", "0") + } + w.WriteHeader(status) + return + } + + if finalStatus != http.StatusCreated { + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(finalStatus) + _, err := fmt.Fprint(w, `{"errors":[{"code":"DENIED","message":"fixture registry rejection"}]}`) + gomega.Expect(err).NotTo(gomega.HaveOccurred()) + return + } + + req.Body = io.NopCloser(bytes.NewReader(body)) + backend.ServeHTTP(w, req) + }) + + registry := newAPI(apiOptions{InsecureRegistry: !useTLS, SkipTlsVerifyRegistry: useTLS}) + ref := strings.TrimPrefix(strings.TrimPrefix(fixture.server.URL, "http://"), "https://") + "/repo:retry" + ctx, cancel := context.WithCancel(context.Background()) + ginkgo.DeferCleanup(cancel) + err := registry.PushImage(ctx, ref, &PushImageOptions{Labels: map[string]string{"retry": "complete"}}) + if finalStatus == http.StatusCreated { + gomega.Expect(err).NotTo(gomega.HaveOccurred()) + } else { + var registryErr *transport.Error + gomega.Expect(errors.As(err, ®istryErr)).To(gomega.BeTrue(), "expected registry error, got %v", err) + gomega.Expect(registryErr.StatusCode).To(gomega.Equal(finalStatus)) + gomega.Expect(err).To(gomega.MatchError(gomega.ContainSubstring("fixture registry rejection"))) + } + + mu.Lock() + bodies := append([][]byte(nil), manifests...) + mu.Unlock() + gomega.Expect(bodies).To(gomega.HaveLen(2)) + gomega.Expect(bodies[0]).NotTo(gomega.BeEmpty()) + gomega.Expect(bodies[1]).To(gomega.Equal(bodies[0])) + if status == http.StatusUnauthorized { + gomega.Expect(fixture.exchanges.Load()).To(gomega.Equal(int64(2))) + } + if finalStatus != http.StatusCreated { + return + } + info, err := registry.GetRepoImage(ctx, ref) + gomega.Expect(err).NotTo(gomega.HaveOccurred()) + gomega.Expect(info.Labels).To(gomega.HaveKeyWithValue("retry", "complete")) + }, + ginkgo.Entry("renews the token", http.StatusUnauthorized, false, http.StatusCreated), + ginkgo.Entry("renews the token over TLS", http.StatusUnauthorized, true, http.StatusCreated), + ginkgo.Entry("recovers from rate limiting", http.StatusTooManyRequests, false, http.StatusCreated), + ginkgo.Entry("recovers from service unavailability", http.StatusServiceUnavailable, false, http.StatusCreated), + ginkgo.Entry("reports a repeated authorization failure", http.StatusUnauthorized, false, http.StatusUnauthorized), + ginkgo.Entry("reports a registry rejection after token renewal", http.StatusUnauthorized, true, http.StatusForbidden), + ) +}) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/werf-2.84.0/pkg/docker_registry/request_body_transport.go new/werf-2.84.1/pkg/docker_registry/request_body_transport.go --- old/werf-2.84.0/pkg/docker_registry/request_body_transport.go 1970-01-01 01:00:00.000000000 +0100 +++ new/werf-2.84.1/pkg/docker_registry/request_body_transport.go 2026-10-29 16:27:18.000000000 +0100 @@ -0,0 +1,29 @@ +package docker_registry + +import ( + "fmt" + "net/http" +) + +var _ http.RoundTripper = (*requestBodyTransport)(nil) + +type requestBodyTransport struct { + underlying http.RoundTripper +} + +func (t *requestBodyTransport) RoundTrip(req *http.Request) (*http.Response, error) { + if req.Body == nil || req.Body == http.NoBody || req.GetBody == nil { + return t.underlying.RoundTrip(req) + } + + // Authentication and rate-limit retries can reuse a request whose body was consumed. + req.Body.Close() + body, err := req.GetBody() + if err != nil { + return nil, fmt.Errorf("reopen registry request body: %w", err) + } + + cloned := req.Clone(req.Context()) + cloned.Body = body + return t.underlying.RoundTrip(cloned) +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/werf-2.84.0/pkg/docker_registry/request_body_transport_test.go new/werf-2.84.1/pkg/docker_registry/request_body_transport_test.go --- old/werf-2.84.0/pkg/docker_registry/request_body_transport_test.go 1970-01-01 01:00:00.000000000 +0100 +++ new/werf-2.84.1/pkg/docker_registry/request_body_transport_test.go 2026-10-29 16:27:18.000000000 +0100 @@ -0,0 +1,77 @@ +package docker_registry + +import ( + "context" + "errors" + "io" + "net/http" + "strings" + + "github.com/onsi/ginkgo/v2" + "github.com/onsi/gomega" +) + +var _ = ginkgo.Describe("registry request body transport", func() { + ginkgo.It("closes the unused original before opening each replacement and preserves the request", func() { + original := &trackedRequestBody{Reader: strings.NewReader("manifest")} + req, err := http.NewRequestWithContext(context.Background(), http.MethodPut, "https://registry.test/manifest", original) + gomega.Expect(err).NotTo(gomega.HaveOccurred()) + req.GetBody = func() (io.ReadCloser, error) { + gomega.Expect(original.closed).To(gomega.BeTrue()) + return io.NopCloser(strings.NewReader("manifest")), nil + } + var bodies []string + transport := &requestBodyTransport{underlying: bearerRoundTripperFunc(func(sent *http.Request) (*http.Response, error) { + defer sent.Body.Close() + gomega.Expect(sent).NotTo(gomega.BeIdenticalTo(req)) + body, err := io.ReadAll(sent.Body) + gomega.Expect(err).NotTo(gomega.HaveOccurred()) + bodies = append(bodies, string(body)) + return &http.Response{StatusCode: http.StatusCreated, Body: http.NoBody}, nil + })} + for range 2 { + resp, err := transport.RoundTrip(req) + gomega.Expect(err).NotTo(gomega.HaveOccurred()) + gomega.Expect(resp.Body.Close()).To(gomega.Succeed()) + gomega.Expect(req.Body).To(gomega.BeIdenticalTo(original)) + } + gomega.Expect(bodies).To(gomega.Equal([]string{"manifest", "manifest"})) + }) + + ginkgo.It("returns a body factory error without sending and closes the original", func() { + original := &trackedRequestBody{Reader: strings.NewReader("manifest")} + req, err := http.NewRequestWithContext(context.Background(), http.MethodPut, "https://registry.test/manifest", original) + gomega.Expect(err).NotTo(gomega.HaveOccurred()) + factoryErr := errors.New("body unavailable") + req.GetBody = func() (io.ReadCloser, error) { return nil, factoryErr } + transport := &requestBodyTransport{underlying: bearerRoundTripperFunc(func(*http.Request) (*http.Response, error) { + ginkgo.Fail("sent a request without its body") + return nil, factoryErr + })} + resp, err := transport.RoundTrip(req) + gomega.Expect(err).To(gomega.MatchError(gomega.ContainSubstring(factoryErr.Error()))) + gomega.Expect(errors.Is(err, factoryErr)).To(gomega.BeTrue()) + gomega.Expect(resp).To(gomega.BeNil()) + gomega.Expect(original.closed).To(gomega.BeTrue()) + }) + + ginkgo.It("passes a non-replayable stream through without closing it early", func() { + original := &trackedRequestBody{Reader: strings.NewReader("stream")} + req, err := http.NewRequestWithContext(context.Background(), http.MethodPatch, "https://registry.test/blob", original) + gomega.Expect(err).NotTo(gomega.HaveOccurred()) + transport := &requestBodyTransport{underlying: bearerRoundTripperFunc(func(sent *http.Request) (*http.Response, error) { + defer sent.Body.Close() + gomega.Expect(sent).To(gomega.BeIdenticalTo(req)) + gomega.Expect(original.closed).To(gomega.BeFalse()) + body, err := io.ReadAll(sent.Body) + gomega.Expect(err).NotTo(gomega.HaveOccurred()) + gomega.Expect(string(body)).To(gomega.Equal("stream")) + return &http.Response{StatusCode: http.StatusAccepted, Body: http.NoBody}, nil + })} + resp, err := transport.RoundTrip(req) + gomega.Expect(err).NotTo(gomega.HaveOccurred()) + gomega.Expect(resp.StatusCode).To(gomega.Equal(http.StatusAccepted)) + gomega.Expect(resp.Body.Close()).To(gomega.Succeed()) + gomega.Expect(original.closed).To(gomega.BeTrue()) + }) +}) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/werf-2.84.0/pkg/docker_registry/transport/helpers_test.go new/werf-2.84.1/pkg/docker_registry/transport/helpers_test.go --- old/werf-2.84.0/pkg/docker_registry/transport/helpers_test.go 1970-01-01 01:00:00.000000000 +0100 +++ new/werf-2.84.1/pkg/docker_registry/transport/helpers_test.go 2026-10-29 16:27:18.000000000 +0100 @@ -0,0 +1,26 @@ +package transport + +import ( + "io" + "net/http" +) + +type roundTripperFunc func(*http.Request) (*http.Response, error) + +var _ http.RoundTripper = roundTripperFunc(nil) + +func (roundTrip roundTripperFunc) RoundTrip(req *http.Request) (*http.Response, error) { + return roundTrip(req) +} + +type trackedResponseBody struct { + io.Reader + closed bool +} + +var _ io.ReadCloser = (*trackedResponseBody)(nil) + +func (body *trackedResponseBody) Close() error { + body.closed = true + return nil +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/werf-2.84.0/pkg/docker_registry/transport/transport.go new/werf-2.84.1/pkg/docker_registry/transport/transport.go --- old/werf-2.84.0/pkg/docker_registry/transport/transport.go 2026-10-20 17:16:12.000000000 +0200 +++ new/werf-2.84.1/pkg/docker_registry/transport/transport.go 2026-10-29 16:27:18.000000000 +0100 @@ -19,13 +19,21 @@ } func (t *transport) RoundTrip(req *http.Request) (*http.Response, error) { + if req.Body != nil && req.Body != http.NoBody && req.GetBody == nil { + return t.underlying.RoundTrip(req) + } + operation := func() (*http.Response, error) { resp, err := t.underlying.RoundTrip(req) if err != nil { return nil, backoff.Permanent(err) } - return backoffHttpRetryAfterHandler(resp) + result, err := backoffHttpRetryAfterHandler(resp) + if err != nil { + resp.Body.Close() + } + return result, err } notify := func(err error, duration time.Duration) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/werf-2.84.0/pkg/docker_registry/transport/transport_test.go new/werf-2.84.1/pkg/docker_registry/transport/transport_test.go --- old/werf-2.84.0/pkg/docker_registry/transport/transport_test.go 1970-01-01 01:00:00.000000000 +0100 +++ new/werf-2.84.1/pkg/docker_registry/transport/transport_test.go 2026-10-29 16:27:18.000000000 +0100 @@ -0,0 +1,85 @@ +package transport + +import ( + "context" + "io" + "net/http" + "strings" + + "github.com/onsi/ginkgo/v2" + "github.com/onsi/gomega" +) + +var _ = ginkgo.Describe("registry rate-limit transport", func() { + ginkgo.DescribeTable("returns a rejected non-replayable upload without retrying", func(status int) { + req, err := http.NewRequestWithContext(context.Background(), http.MethodPatch, "https://registry.test/blob", io.NopCloser(strings.NewReader("stream"))) + gomega.Expect(err).NotTo(gomega.HaveOccurred()) + body := &trackedResponseBody{Reader: strings.NewReader("rejected")} + want := &http.Response{StatusCode: status, Body: body, Header: http.Header{"Retry-After": []string{"0"}}} + calls := 0 + transport := NewTransport(roundTripperFunc(func(sent *http.Request) (*http.Response, error) { + defer sent.Body.Close() + calls++ + gomega.Expect(calls).To(gomega.Equal(1)) + content, err := io.ReadAll(sent.Body) + gomega.Expect(err).NotTo(gomega.HaveOccurred()) + gomega.Expect(string(content)).To(gomega.Equal("stream")) + return want, nil + })) + resp, err := transport.RoundTrip(req) + gomega.Expect(err).NotTo(gomega.HaveOccurred()) + gomega.Expect(resp).To(gomega.BeIdenticalTo(want)) + gomega.Expect(body.closed).To(gomega.BeFalse()) + gomega.Expect(resp.Body.Close()).To(gomega.Succeed()) + }, + ginkgo.Entry("429", http.StatusTooManyRequests), + ginkgo.Entry("503", http.StatusServiceUnavailable), + ) + + ginkgo.DescribeTable("closes rejected responses before retrying", func(status int) { + req, err := http.NewRequestWithContext(context.Background(), http.MethodGet, "https://registry.test/tags", nil) + gomega.Expect(err).NotTo(gomega.HaveOccurred()) + body := &trackedResponseBody{Reader: strings.NewReader("retry later")} + calls := 0 + transport := NewTransport(roundTripperFunc(func(*http.Request) (*http.Response, error) { + calls++ + if calls == 1 { + return &http.Response{StatusCode: status, Body: body, Header: http.Header{"Retry-After": []string{"0"}}}, nil + } + gomega.Expect(body.closed).To(gomega.BeTrue()) + return &http.Response{StatusCode: http.StatusOK, Body: http.NoBody}, nil + })) + resp, err := transport.RoundTrip(req) + gomega.Expect(err).NotTo(gomega.HaveOccurred()) + gomega.Expect(resp.StatusCode).To(gomega.Equal(http.StatusOK)) + gomega.Expect(resp.Body.Close()).To(gomega.Succeed()) + gomega.Expect(calls).To(gomega.Equal(2)) + }, + ginkgo.Entry("429", http.StatusTooManyRequests), + ginkgo.Entry("503", http.StatusServiceUnavailable), + ) + + ginkgo.DescribeTable("closes rejected responses when no retry follows", func(retryAfter string, cancelRequest bool) { + ctx, cancel := context.WithCancel(context.Background()) + ginkgo.DeferCleanup(cancel) + req, err := http.NewRequestWithContext(ctx, http.MethodGet, "https://registry.test/tags", nil) + gomega.Expect(err).NotTo(gomega.HaveOccurred()) + body := &trackedResponseBody{Reader: strings.NewReader("retry later")} + transport := NewTransport(roundTripperFunc(func(*http.Request) (*http.Response, error) { + if cancelRequest { + cancel() + } + return &http.Response{StatusCode: http.StatusServiceUnavailable, Body: body, Header: http.Header{"Retry-After": []string{retryAfter}}}, nil + })) + resp, err := transport.RoundTrip(req) + gomega.Expect(err).To(gomega.HaveOccurred()) + gomega.Expect(resp).To(gomega.BeNil()) + gomega.Expect(body.closed).To(gomega.BeTrue()) + if cancelRequest { + gomega.Expect(err).To(gomega.MatchError(context.Canceled)) + } + }, + ginkgo.Entry("invalid Retry-After", "invalid", false), + ginkgo.Entry("canceled request", "30", true), + ) +}) ++++++ werf.obsinfo ++++++ --- /var/tmp/diff_new_pack.fqn9oo/_old 2026-11-19 16:55:26.924631753 +0100 +++ /var/tmp/diff_new_pack.fqn9oo/_new 2026-11-19 16:55:26.927631880 +0100 @@ -1,5 +1,5 @@ name: werf -version: 2.84.0 -mtime: 1792509372 -commit: 4ca847c4b39ff5174f9174b41613133f4dfdcd62 +version: 2.84.1 +mtime: 1793287638 +commit: d6c03cd89f799cc11accfcd13c729401c96502a8
