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-12-02 17:05:34 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/werf (Old) and /work/SRC/openSUSE:Factory/.werf.new.1340718 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "werf" Wed Dec 2 17:05:34 2026 rev:91 rq:1402254 version:2.85.0 Changes: -------- --- /work/SRC/openSUSE:Factory/werf/werf.changes 2026-11-19 16:55:24.082511281 +0100 +++ /work/SRC/openSUSE:Factory/.werf.new.1340718/werf.changes 2026-12-02 17:08:10.047691013 +0100 @@ -1,0 +2,15 @@ +Wed Dec 02 05:58:32 UTC 2026 - Johannes Kastl <[email protected]> + +- Update to version 2.85.0: + * Features + - deploy: refuse to deploy charts that require werf v3 (#8141) + (5ace974) + * Bug Fixes + - build, buildah: stop failed builds leaking working containers + (#8148) (a7d140a) + - build: keep git files that differ only by case intact on + macOS (#8166) (15af887) + - build: stop git mappings failing on a stale .gitmodules entry + (#8164) (bd0be13) + +------------------------------------------------------------------- Old: ---- werf-2.84.1.obscpio New: ---- werf-2.85.0.obscpio ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ werf.spec ++++++ --- /var/tmp/diff_new_pack.nINlGe/_old 2026-12-02 17:08:11.483751782 +0100 +++ /var/tmp/diff_new_pack.nINlGe/_new 2026-12-02 17:08:11.484751824 +0100 @@ -17,7 +17,7 @@ Name: werf -Version: 2.84.1 +Version: 2.85.0 Release: 0 Summary: CLI for the Werf CI/CD system License: Apache-2.0 ++++++ _service ++++++ --- /var/tmp/diff_new_pack.nINlGe/_old 2026-12-02 17:08:11.514753094 +0100 +++ /var/tmp/diff_new_pack.nINlGe/_new 2026-12-02 17:08:11.518753263 +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.1</param> + <param name="revision">refs/tags/v2.85.0</param> <param name="versionformat">@PARENT_TAG@</param> <param name="versionrewrite-pattern">v(.*)</param> <param name="changesgenerate">enable</param> ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.nINlGe/_old 2026-12-02 17:08:11.538754109 +0100 +++ /var/tmp/diff_new_pack.nINlGe/_new 2026-12-02 17:08:11.541754236 +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">d6c03cd89f799cc11accfcd13c729401c96502a8</param></service></servicedata> + <param name="changesrevision">4caf990f4a382926ec34ac45366ba561e06b3c37</param></service></servicedata> (No newline at EOF) ++++++ vendor.tar.gz ++++++ /work/SRC/openSUSE:Factory/werf/vendor.tar.gz /work/SRC/openSUSE:Factory/.werf.new.1340718/vendor.tar.gz differ: char 141, line 2 ++++++ werf-2.84.1.obscpio -> werf-2.85.0.obscpio ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/werf-2.84.1/.release-please/2/manifest.json new/werf-2.85.0/.release-please/2/manifest.json --- old/werf-2.84.1/.release-please/2/manifest.json 2026-10-29 16:27:18.000000000 +0100 +++ new/werf-2.85.0/.release-please/2/manifest.json 2026-11-12 13:24:51.000000000 +0100 @@ -1,3 +1,3 @@ { - ".": "2.84.1" + ".": "2.85.0" } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/werf-2.84.1/CHANGELOG.md new/werf-2.85.0/CHANGELOG.md --- old/werf-2.84.1/CHANGELOG.md 2026-10-29 16:27:18.000000000 +0100 +++ new/werf-2.85.0/CHANGELOG.md 2026-11-12 13:24:51.000000000 +0100 @@ -1,5 +1,19 @@ # Changelog +## [2.85.0](https://github.com/werf/werf/compare/v2.84.1...v2.85.0) (2026-11-12) + + +### Features + +* **deploy:** refuse to deploy charts that require werf v3 ([#8141](https://github.com/werf/werf/issues/8141)) ([5ace974](https://github.com/werf/werf/commit/5ace97443a1f1e3619a60beea495f6fb397386df)) + + +### Bug Fixes + +* **build, buildah:** stop failed builds leaking working containers ([#8148](https://github.com/werf/werf/issues/8148)) ([a7d140a](https://github.com/werf/werf/commit/a7d140aa4b90e5ffd8ffa4349a608b9d84c80035)) +* **build:** keep git files that differ only by case intact on macOS ([#8166](https://github.com/werf/werf/issues/8166)) ([15af887](https://github.com/werf/werf/commit/15af8873d56c8d68e2f22bf0a782309d2550ddbe)) +* **build:** stop git mappings failing on a stale .gitmodules entry ([#8164](https://github.com/werf/werf/issues/8164)) ([bd0be13](https://github.com/werf/werf/commit/bd0be13d7e575fe53c267337f728fa088668b2ef)) + ## [2.84.1](https://github.com/werf/werf/compare/v2.84.0...v2.84.1) (2026-10-29) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/werf-2.84.1/go.mod new/werf-2.85.0/go.mod --- old/werf-2.84.1/go.mod 2026-10-29 16:27:18.000000000 +0100 +++ new/werf-2.85.0/go.mod 2026-11-12 13:24:51.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.20261028084433-60827212f828 + github.com/werf/kubedog v0.13.1-0.20261103161329-f1eefb59d19a 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.2-0.20261021180502-7d1c80c67c12 + github.com/werf/nelm v1.31.4-0.20261106121015-0b6185362de5 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.1/go.sum new/werf-2.85.0/go.sum --- old/werf-2.84.1/go.sum 2026-10-29 16:27:18.000000000 +0100 +++ new/werf-2.85.0/go.sum 2026-11-12 13:24:51.000000000 +0100 @@ -1402,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.20261028084433-60827212f828 h1:MLQbWY7disBz14F4qfy5AkPQDj3XOQMvVXNDdiJrTus= -github.com/werf/kubedog v0.13.1-0.20261028084433-60827212f828/go.mod h1:+pTZuZqy+xtj6yh49kfQuBGDMHdm7zVJbVl2s4xawe8= +github.com/werf/kubedog v0.13.1-0.20261103161329-f1eefb59d19a h1:5p/VgB4FrtGlvxQzjfw7PiHpHUg3AyJ39XlIyx8a8Bc= +github.com/werf/kubedog v0.13.1-0.20261103161329-f1eefb59d19a/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.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 v1.31.4-0.20261106121015-0b6185362de5 h1:W/ShpZgmdr0VERAqCKrhaO7ERPgAr+CW+arGN/W0O/A= +github.com/werf/nelm v1.31.4-0.20261106121015-0b6185362de5/go.mod h1:evjJBJlpANYoUEqA1KD0RS6r/vlzUo1+kQnXALicVDc= 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.1/pkg/buildah/native_linux.go new/werf-2.85.0/pkg/buildah/native_linux.go --- old/werf-2.84.1/pkg/buildah/native_linux.go 2026-10-29 16:27:18.000000000 +0100 +++ new/werf-2.85.0/pkg/buildah/native_linux.go 2026-11-12 13:24:51.000000000 +0100 @@ -423,22 +423,24 @@ } buildOpts := define.BuildOptions{ - Isolation: define.Isolation(b.Isolation), - Args: opts.BuildArgs, - SignaturePolicyPath: b.SignaturePolicyPath, - ReportWriter: opts.LogWriter, - OutputFormat: buildah.Dockerv2ImageManifest, - SystemContext: sysCtx, - ConfigureNetwork: define.NetworkEnabled, - CommonBuildOpts: &b.defaultCommonBuildOptions, - Target: opts.Target, - Platforms: targetPlatforms, - MaxPullPushRetries: MaxPullPushRetries, - PullPushRetryDelay: PullPushRetryDelay, - Layers: true, - LayerLabels: opts.Labels, - RemoveIntermediateCtrs: true, - ForceRmIntermediateCtrs: false, + Isolation: define.Isolation(b.Isolation), + Args: opts.BuildArgs, + SignaturePolicyPath: b.SignaturePolicyPath, + ReportWriter: opts.LogWriter, + OutputFormat: buildah.Dockerv2ImageManifest, + SystemContext: sysCtx, + ConfigureNetwork: define.NetworkEnabled, + CommonBuildOpts: &b.defaultCommonBuildOptions, + Target: opts.Target, + Platforms: targetPlatforms, + MaxPullPushRetries: MaxPullPushRetries, + PullPushRetryDelay: PullPushRetryDelay, + Layers: true, + LayerLabels: opts.Labels, + RemoveIntermediateCtrs: true, + // With Layers, buildah keeps the working container of a failed build for manual + // debugging; werf never exposes it, so it would only pin images in the storage. + ForceRmIntermediateCtrs: true, NoCache: false, Labels: opts.Labels, } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/werf-2.84.1/pkg/deploy/helm_for_werf_helm/chart_extender_for_werf_helm/werf_chart_stub.go new/werf-2.85.0/pkg/deploy/helm_for_werf_helm/chart_extender_for_werf_helm/werf_chart_stub.go --- old/werf-2.84.1/pkg/deploy/helm_for_werf_helm/chart_extender_for_werf_helm/werf_chart_stub.go 2026-10-29 16:27:18.000000000 +0100 +++ new/werf-2.85.0/pkg/deploy/helm_for_werf_helm/chart_extender_for_werf_helm/werf_chart_stub.go 2026-11-12 13:24:51.000000000 +0100 @@ -70,6 +70,10 @@ // ChartLoaded method for the chart.Extender interface func (wc *WerfChartStub) ChartLoaded(files []*chart.ChartExtenderBufferedFile) error { + if err := refuseWerfData(files); err != nil { + return err + } + cwd, err := os.Getwd() if err != nil { return fmt.Errorf("error getting current process working directory: %w", err) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/werf-2.84.1/pkg/deploy/helm_for_werf_helm/chart_extender_for_werf_helm/werf_chart_stub_test.go new/werf-2.85.0/pkg/deploy/helm_for_werf_helm/chart_extender_for_werf_helm/werf_chart_stub_test.go --- old/werf-2.84.1/pkg/deploy/helm_for_werf_helm/chart_extender_for_werf_helm/werf_chart_stub_test.go 1970-01-01 01:00:00.000000000 +0100 +++ new/werf-2.85.0/pkg/deploy/helm_for_werf_helm/chart_extender_for_werf_helm/werf_chart_stub_test.go 2026-11-12 13:24:51.000000000 +0100 @@ -0,0 +1,41 @@ +package chart_extender_for_werf_helm + +import ( + "context" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + + chart "github.com/werf/3p-helm-for-werf-helm/pkg/chart" + "github.com/werf/werf/v2/pkg/logging" +) + +var _ = DescribeTable("WerfChartStub refuses charts with .werf-data", + func(ctx context.Context, files []*chart.ChartExtenderBufferedFile, wantErr string) { + ctx = logging.WithLogger(ctx) + + stub := NewWerfChartStub(ctx, false) + Expect(stub.ChartCreated(&chart.Chart{})).To(Succeed()) + + err := stub.ChartLoaded(files) + if wantErr == "" { + Expect(err).To(Succeed()) + + return + } + + Expect(err).To(MatchError(ContainSubstring(wantErr))) + }, + Entry("chart without .werf-data", + []*chart.ChartExtenderBufferedFile{{Name: "values.yaml", Data: []byte("key: value\n")}}, + "", + ), + Entry("chart with .werf-data apiVersion v2", + []*chart.ChartExtenderBufferedFile{{Name: ".werf-data/metadata.yaml", Data: []byte("apiVersion: v2\n")}}, + `this chart has .werf-data/metadata.yaml with apiVersion "v2": it requires werf v3 or Nelm v2, or newer`, + ), + Entry(".werf-data metadata without apiVersion", + []*chart.ChartExtenderBufferedFile{{Name: ".werf-data/metadata.yaml", Data: []byte("values: {}\n")}}, + "", + ), +) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/werf-2.84.1/pkg/deploy/helm_for_werf_helm/chart_extender_for_werf_helm/werf_data.go new/werf-2.85.0/pkg/deploy/helm_for_werf_helm/chart_extender_for_werf_helm/werf_data.go --- old/werf-2.84.1/pkg/deploy/helm_for_werf_helm/chart_extender_for_werf_helm/werf_data.go 1970-01-01 01:00:00.000000000 +0100 +++ new/werf-2.85.0/pkg/deploy/helm_for_werf_helm/chart_extender_for_werf_helm/werf_data.go 2026-11-12 13:24:51.000000000 +0100 @@ -0,0 +1,36 @@ +package chart_extender_for_werf_helm + +import ( + "fmt" + + "sigs.k8s.io/yaml" + + chart "github.com/werf/3p-helm-for-werf-helm/pkg/chart" +) + +const werfDataMetadataFileName = ".werf-data/metadata.yaml" + +// refuseWerfData rejects charts published by werf v3 and Nelm v2 with a .werf-data directory: +// werf v2 would deploy them without their publish-time values and annotations. +func refuseWerfData(files []*chart.ChartExtenderBufferedFile) error { + for _, f := range files { + if f.Name != werfDataMetadataFileName { + continue + } + + var metadata struct { + APIVersion string `json:"apiVersion"` + } + if err := yaml.Unmarshal(f.Data, &metadata); err != nil { + return fmt.Errorf("parse %s: %w", werfDataMetadataFileName, err) + } + + if metadata.APIVersion == "" { + continue + } + + return fmt.Errorf("this chart has %s with apiVersion %q: it requires werf v3 or Nelm v2, or newer", werfDataMetadataFileName, metadata.APIVersion) + } + + return nil +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/werf-2.84.1/pkg/git_repo/remote_checksum_test.go new/werf-2.85.0/pkg/git_repo/remote_checksum_test.go --- old/werf-2.84.1/pkg/git_repo/remote_checksum_test.go 2026-10-29 16:27:18.000000000 +0100 +++ new/werf-2.85.0/pkg/git_repo/remote_checksum_test.go 2026-11-12 13:24:51.000000000 +0100 @@ -120,4 +120,33 @@ gomega.Expect(err).NotTo(gomega.HaveOccurred()) gomega.Expect(second).NotTo(gomega.Equal(first)) }) + + ginkgo.It("ignores a .gitmodules entry whose gitlink is gone from the tree", func(ctx ginkgo.SpecContext) { + source := newChecksumTestRepo(ctx) + gitmodules := "[submodule \"theme_common\"]\n\tpath = theme_common\n\turl = https://127.0.0.1:1/unreachable/theme.git\n" + gomega.Expect(os.WriteFile(filepath.Join(source, ".gitmodules"), []byte(gitmodules), 0o644)).To(gomega.Succeed()) + gomega.Expect(os.WriteFile(filepath.Join(source, "data"), []byte("content"), 0o644)).To(gomega.Succeed()) + commitChecksumTestRepo(ctx, source) + remote, err := OpenRemoteRepo("stale-gitmodules-checksums", source, nil) + gomega.Expect(err).NotTo(gomega.HaveOccurred()) + gomega.Expect(remote.CloneAndFetch(ctx)).To(gomega.Succeed()) + opts := ChecksumOptions{Commit: utils.GetHeadCommit(ctx, source), LsTreeOptions: LsTreeOptions{PathMatcher: path_matcher.NewTruePathMatcher(), AllFiles: true}} + checksum, err := remote.GetOrCreateChecksum(ctx, opts) + gomega.Expect(err).NotTo(gomega.HaveOccurred()) + gomega.Expect(checksum).NotTo(gomega.BeEmpty()) + }) + + ginkgo.It("does not read the index of a repository without submodules", func(ctx ginkgo.SpecContext) { + source := newChecksumTestRepo(ctx) + gomega.Expect(os.WriteFile(filepath.Join(source, "data"), []byte("content"), 0o644)).To(gomega.Succeed()) + commitChecksumTestRepo(ctx, source) + // go-git cannot decode a split index, so reading it would fail here. + utils.RunSucceedCommand(ctx, source, "git", "update-index", "--split-index") + local, err := OpenLocalRepo(ctx, "split-index-checksums", source, OpenLocalRepoOptions{}) + gomega.Expect(err).NotTo(gomega.HaveOccurred()) + opts := ChecksumOptions{Commit: utils.GetHeadCommit(ctx, source), LsTreeOptions: LsTreeOptions{PathMatcher: path_matcher.NewTruePathMatcher(), AllFiles: true}} + checksum, err := local.GetOrCreateChecksum(ctx, opts) + gomega.Expect(err).NotTo(gomega.HaveOccurred()) + gomega.Expect(checksum).NotTo(gomega.BeEmpty()) + }) }) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/werf-2.84.1/pkg/git_repo/repo_handle/interface.go new/werf-2.85.0/pkg/git_repo/repo_handle/interface.go --- old/werf-2.84.1/pkg/git_repo/repo_handle/interface.go 2026-10-29 16:27:18.000000000 +0100 +++ new/werf-2.85.0/pkg/git_repo/repo_handle/interface.go 2026-11-12 13:24:51.000000000 +0100 @@ -2,12 +2,15 @@ import ( "context" + "errors" "fmt" "sync" "github.com/go-git/go-git/v5" "github.com/go-git/go-git/v5/config" "github.com/go-git/go-git/v5/plumbing" + "github.com/go-git/go-git/v5/plumbing/filemode" + "github.com/go-git/go-git/v5/plumbing/format/index" "github.com/go-git/go-git/v5/plumbing/object" ) @@ -70,8 +73,24 @@ if err != nil { return nil, err } + if len(ss) == 0 { + return nil, nil + } + + idx, err := parentRepository.Storer.Index() + if err != nil { + return nil, fmt.Errorf("unable to read index: %w", err) + } for _, s := range ss { + // A .gitmodules entry left behind after the gitlink was removed is not a submodule for git, + // so `git submodule init` never registers it and go-git would report it as uninitialized. + if entry, err := idx.Entry(s.Config().Path); errors.Is(err, index.ErrEntryNotFound) || (err == nil && entry.Mode != filemode.Submodule) { + continue + } else if err != nil { + return nil, fmt.Errorf("unable to look up submodule %q in index: %w", s.Config().Path, err) + } + submoduleRepository, err := s.Repository() if err != nil { return nil, fmt.Errorf("unable to get submodule %q repository: %w", s.Config().Path, err) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/werf-2.84.1/pkg/tmp_manager/common.go new/werf-2.85.0/pkg/tmp_manager/common.go --- old/werf-2.84.1/pkg/tmp_manager/common.go 2026-10-29 16:27:18.000000000 +0100 +++ new/werf-2.85.0/pkg/tmp_manager/common.go 2026-11-12 13:24:51.000000000 +0100 @@ -10,8 +10,9 @@ ) const ( - projectDirMaxAge = time.Hour * 24 - contextPinMaxAge = time.Hour * 24 + projectDirMaxAge = time.Hour * 24 + contextPinMaxAge = time.Hour * 24 + gitContextDirMaxAge = time.Hour * 24 projectsServiceDir = "projects" dockerConfigsServiceDir = "docker_configs" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/werf-2.84.1/pkg/tmp_manager/gc.go new/werf-2.85.0/pkg/tmp_manager/gc.go --- old/werf-2.84.1/pkg/tmp_manager/gc.go 2026-10-29 16:27:18.000000000 +0100 +++ new/werf-2.85.0/pkg/tmp_manager/gc.go 2026-11-12 13:24:51.000000000 +0100 @@ -101,6 +101,7 @@ // everything else on the host, so only our own prefix is swept and no symlink is followed. newNoFollowGCPath(werf.GetTmpDir(), "werf-*-project-data-*", projectDirMaxAge), newNoFollowGCPath(werf.GetTmpDir(), "werf-project-data-*", projectDirMaxAge), + newNoFollowGCPath(werf.GetTmpDir(), "werf-*-git-context-*", gitContextDirMaxAge), } dirSlices := make([][]string, 0, len(gcPathList)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/werf-2.84.1/pkg/tmp_manager/git_context_dir_test.go new/werf-2.85.0/pkg/tmp_manager/git_context_dir_test.go --- old/werf-2.84.1/pkg/tmp_manager/git_context_dir_test.go 1970-01-01 01:00:00.000000000 +0100 +++ new/werf-2.85.0/pkg/tmp_manager/git_context_dir_test.go 2026-11-12 13:24:51.000000000 +0100 @@ -0,0 +1,79 @@ +package tmp_manager + +import ( + "context" + "os" + "path/filepath" + "time" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + "github.com/prashantv/gostub" + + "github.com/werf/werf/v2/pkg/werf" +) + +var _ = Describe("git context dir", func() { + var stubs *gostub.Stubs + + BeforeEach(func() { + stubs = gostub.New() + DeferCleanup(stubs.Reset) + + stubs.SetEnv("WERF_TMP_DIR", GinkgoT().TempDir()) + stubs.SetEnv("WERF_HOME", GinkgoT().TempDir()) + Expect(werf.Init("", "")).To(Succeed()) + }) + + DescribeTable("is collected by the tmp GC when orphaned by a killed process", + func(age time.Duration, shouldBeRemoved bool) { + dir, err := TempDir(context.Background(), "git-context-") + Expect(err).NotTo(HaveOccurred()) + payload := filepath.Join(dir, "data.txt") + Expect(os.WriteFile(payload, []byte("payload"), 0o644)).To(Succeed()) + past := time.Now().Add(-age) + Expect(os.Chtimes(dir, past, past)).To(Succeed()) + + Expect(RunGC(context.Background(), RunGCOptions{})).To(Succeed()) + if shouldBeRemoved { + Expect(dir).NotTo(BeADirectory()) + } else { + Expect(payload).To(BeARegularFile()) + } + }, + Entry("orphaned", gitContextDirMaxAge+time.Hour, true), + Entry("fresh", gitContextDirMaxAge-time.Hour, false), + ) + + It("never removes what a symlink in the tmp dir points at", func() { + target := GinkgoT().TempDir() + Expect(os.WriteFile(filepath.Join(target, "data.txt"), []byte("payload"), 0o644)).To(Succeed()) + + link := filepath.Join(werf.GetTmpDir(), commonPrefix+"git-context-123") + Expect(os.Symlink(target, link)).To(Succeed()) + // os.Chtimes follows the link, so the age of the link itself is faked instead + stubs.Stub(&timeSince, func(time.Time) time.Duration { return gitContextDirMaxAge + time.Hour }) + + Expect(RunGC(context.Background(), RunGCOptions{})).To(Succeed()) + Expect(filepath.Join(target, "data.txt")).To(BeARegularFile()) + Expect(link).NotTo(BeAnExistingFile()) + }) + + It("leaves foreign entries of the tmp dir alone", func() { + past := time.Now().Add(-gitContextDirMaxAge - time.Hour) + foreignPaths := []string{ + "git-context-123", + commonPrefix + "git-contexts", + } + for _, name := range foreignPaths { + path := filepath.Join(werf.GetTmpDir(), name) + Expect(os.Mkdir(path, 0o755)).To(Succeed()) + Expect(os.Chtimes(path, past, past)).To(Succeed()) + } + + Expect(RunGC(context.Background(), RunGCOptions{})).To(Succeed()) + for _, name := range foreignPaths { + Expect(filepath.Join(werf.GetTmpDir(), name)).To(BeADirectory()) + } + }) +}) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/werf-2.84.1/pkg/true_git/archive.go new/werf-2.85.0/pkg/true_git/archive.go --- old/werf-2.84.1/pkg/true_git/archive.go 2026-10-29 16:27:18.000000000 +0100 +++ new/werf-2.85.0/pkg/true_git/archive.go 2026-11-12 13:24:51.000000000 +0100 @@ -2,11 +2,9 @@ import ( "archive/tar" - "bytes" "context" "fmt" "io" - "io/ioutil" "maps" "os" "path/filepath" @@ -14,6 +12,7 @@ "strconv" "strings" + "github.com/go-git/go-git/v5/plumbing" "github.com/go-git/go-git/v5/plumbing/filemode" "github.com/werf/common-go/pkg/util" @@ -38,7 +37,7 @@ // TODO: 1.3 add git mapping type (dir, file, ...) to gitArchive stage digest func (opts ArchiveOptions) ID() string { if opts.ContentChecksum != "" { - args := []string{"dockerfile-context-v3", opts.ContentChecksum, opts.PathScope, opts.Owner, opts.Group} + args := []string{"dockerfile-context-v4", opts.ContentChecksum, opts.PathScope, opts.Owner, opts.Group} for _, path := range slices.Sorted(maps.Keys(opts.FileRenames)) { args = append(args, path, opts.FileRenames[path]) } @@ -57,6 +56,7 @@ opts.Commit, opts.PathScope, opts.PathMatcher.ID(), + "git-archive-v2", )..., ) } @@ -105,6 +105,12 @@ return err } + commit, err := repoHandle.Repository().CommitObject(plumbing.NewHash(opts.Commit)) + if err != nil { + return fmt.Errorf("read commit %s: %w", opts.Commit, err) + } + modTime := commit.Committer.When + tw := tar.NewWriter(out) logProcess := logboek.Context(ctx).Debug().LogProcess("ls-tree (%s)", opts.PathMatcher.String()) logProcess.Start() @@ -123,50 +129,23 @@ } logProcess.End() - if opts.ContentChecksum != "" { - tmpDir, err := tmp_manager.TempDir(ctx, "git-context-") - if err != nil { - return fmt.Errorf("create Git context export directory: %w", err) - } - defer func() { - if err := os.RemoveAll(tmpDir); err != nil { - logboek.Context(ctx).Warn().LogF("Remove Git context export directory %q: %s\n", tmpDir, err) - } - }() - absTmpDir, err := filepath.Abs(tmpDir) - if err != nil { - return fmt.Errorf("resolve Git context export directory: %w", err) - } - tmpDir = absTmpDir - exportDir := filepath.Join(tmpDir, "files") - if err := os.Mkdir(exportDir, 0o700); err != nil { - return fmt.Errorf("create Git context files directory: %w", err) - } - - var paths, entries []string - if err := result.Walk(func(entry *ls_tree.LsTreeEntry) error { - path := filepath.ToSlash(entry.FullFilepath) - paths = append(paths, path) - entries = append(entries, fmt.Sprintf("%o %s\t%s\x00", entry.Mode, entry.Hash.String(), path)) - return nil - }); err != nil { - return fmt.Errorf("collect Git context export paths: %w", err) - } - cmdOpts := &GitCmdOptions{RepoDir: workTreeDir, Env: []string{ - "GIT_ATTR_SOURCE=" + opts.Commit, - "GIT_INDEX_FILE=" + filepath.Join(tmpDir, "index"), - }} - indexCmd := NewGitCmd(ctx, cmdOpts, "-c", "core.hooksPath="+os.DevNull, "update-index", "-z", "--index-info") - indexCmd.Stdin = strings.NewReader(strings.Join(entries, "")) - if err := indexCmd.Run(ctx); err != nil { - return fmt.Errorf("prepare Git context export index: %w", err) - } - cmd := NewGitCmd(ctx, cmdOpts, "-c", "core.hooksPath="+os.DevNull, "checkout-index", "--prefix="+filepath.ToSlash(exportDir)+"/", "-z", "--stdin") - cmd.Stdin = strings.NewReader(strings.Join(paths, "\x00") + "\x00") - if err := cmd.Run(ctx); err != nil { - return fmt.Errorf("export Git context files: %w", err) + tmpDir, err := tmp_manager.TempDir(ctx, "git-context-") + if err != nil { + return fmt.Errorf("create Git files export directory: %w", err) + } + defer func() { + if err := os.RemoveAll(tmpDir); err != nil { + logboek.Context(ctx).Warn().LogF("Remove Git files export directory %q: %s\n", tmpDir, err) } - workTreeDir = exportDir + }() + absTmpDir, err := filepath.Abs(tmpDir) + if err != nil { + return fmt.Errorf("resolve Git files export directory: %w", err) + } + + exportedFiles, err := exportArchiveFiles(ctx, repoHandle, result, workTreeDir, absTmpDir) + if err != nil { + return err } logProcess = logboek.Context(ctx).Debug().LogProcess("ls-tree result walk (%s)", opts.PathMatcher.String()) @@ -174,13 +153,12 @@ creadedDirEntries := make(map[string]bool) - if err := result.Walk(func(lsTreeEntry *ls_tree.LsTreeEntry) error { + if err := result.WalkWithRepository(ctx, repoHandle, func(entryRepository ls_tree.EntryRepository, lsTreeEntry *ls_tree.LsTreeEntry) error { if debugArchive() { logboek.Context(ctx).Debug().LogF("ls-tree entry %s\n", lsTreeEntry.FullFilepath) } gitFileMode := lsTreeEntry.Mode - absFilepath := filepath.Join(workTreeDir, lsTreeEntry.FullFilepath) var tarEntryName string if renameToFileName, willRename := opts.FileRenames[filepath.ToSlash(filepath.Clean(lsTreeEntry.FullFilepath))]; willRename { @@ -189,11 +167,6 @@ tarEntryName = filepath.ToSlash(util.GetRelativeToBaseFilepath(opts.PathScope, lsTreeEntry.FullFilepath)) } - info, err := os.Lstat(absFilepath) - if err != nil { - return fmt.Errorf("lstat %q failed: %w", absFilepath, err) - } - dirEntry := filepath.Dir(tarEntryName) if dirEntry != "." { var p string @@ -217,9 +190,9 @@ Name: p, Typeflag: tar.TypeDir, Mode: 0o775, - ModTime: info.ModTime(), - AccessTime: info.ModTime(), - ChangeTime: info.ModTime(), + ModTime: modTime, + AccessTime: modTime, + ChangeTime: modTime, } applyOwnership(header, opts) @@ -233,14 +206,20 @@ switch gitFileMode { case filemode.Regular, filemode.Executable, filemode.Deprecated: + absFilepath := exportedFiles[filepath.ToSlash(lsTreeEntry.FullFilepath)] + info, err := os.Stat(absFilepath) + if err != nil { + return fmt.Errorf("stat file %s: %w", absFilepath, err) + } + header := &tar.Header{ Format: tar.FormatGNU, Name: tarEntryName, Mode: int64(gitFileMode), Size: info.Size(), - ModTime: info.ModTime(), - AccessTime: info.ModTime(), - ChangeTime: info.ModTime(), + ModTime: modTime, + AccessTime: modTime, + ChangeTime: modTime, } applyOwnership(header, opts) @@ -269,33 +248,20 @@ logboek.Context(ctx).Debug().LogF("Added archive file %q\n", tarEntryName) } case filemode.Symlink: - isSymlink := info.Mode()&os.ModeSymlink != 0 - - var linkname string - if isSymlink { - linkname, err = os.Readlink(absFilepath) - if err != nil { - return fmt.Errorf("cannot read symlink %s: %w", absFilepath, err) - } - } else { - data, err := ioutil.ReadFile(absFilepath) - if err != nil { - return fmt.Errorf("cannot read file %s: %w", absFilepath, err) - } - - linkname = string(bytes.TrimSpace(data)) + linkname, err := entryRepository.Handle.ReadBlobObjectContent(lsTreeEntry.Hash) + if err != nil { + return fmt.Errorf("read symlink %s: %w", lsTreeEntry.FullFilepath, err) } header := &tar.Header{ Format: tar.FormatGNU, Typeflag: tar.TypeSymlink, Name: tarEntryName, - Linkname: linkname, + Linkname: string(linkname), Mode: int64(gitFileMode), - Size: info.Size(), - ModTime: info.ModTime(), - AccessTime: info.ModTime(), - ChangeTime: info.ModTime(), + ModTime: modTime, + AccessTime: modTime, + ChangeTime: modTime, } applyOwnership(header, opts) @@ -329,6 +295,112 @@ return nil } +// exportArchiveFiles checks out regular files with Git filters applied. Paths that differ only by case +// go to separate directories, otherwise they overwrite each other on case-insensitive filesystems. +func exportArchiveFiles(ctx context.Context, repoHandle repo_handle.Handle, result *ls_tree.Result, workTreeDir, tmpDir string) (map[string]string, error) { + var repositories []ls_tree.EntryRepository + entriesByRepository := map[string][]*ls_tree.LsTreeEntry{} + if err := result.WalkWithRepository(ctx, repoHandle, func(repository ls_tree.EntryRepository, entry *ls_tree.LsTreeEntry) error { + if entry.Mode != filemode.Regular && entry.Mode != filemode.Executable && entry.Mode != filemode.Deprecated { + return nil + } + if _, ok := entriesByRepository[repository.Path]; !ok { + repositories = append(repositories, repository) + } + entriesByRepository[repository.Path] = append(entriesByRepository[repository.Path], entry) + return nil + }); err != nil { + return nil, fmt.Errorf("collect Git files to export: %w", err) + } + + exportedFiles := map[string]string{} + for repositoryIndex, repository := range repositories { + repositoryDir := filepath.Join(workTreeDir, repository.Path) + var indexEntries, paths []string + for _, entry := range entriesByRepository[repository.Path] { + path, err := filepath.Rel(repository.Path, entry.FullFilepath) + if err != nil { + return nil, fmt.Errorf("get Git file %q path in repository %q: %w", entry.FullFilepath, repository.Path, err) + } + path = filepath.ToSlash(path) + indexEntries = append(indexEntries, fmt.Sprintf("%o %s\t%s\x00", entry.Mode, entry.Hash.String(), path)) + paths = append(paths, path) + } + + groups := groupPathsCaseInsensitively(paths) + for group, groupPaths := range groups { + for _, path := range groupPaths { + exportedFiles[filepath.ToSlash(filepath.Join(repository.Path, path))] = filepath.Join(tmpDir, fmt.Sprintf("%d-%d", repositoryIndex, group), path) + } + } + + cmdOpts := &GitCmdOptions{RepoDir: repositoryDir, Env: []string{ + "GIT_ATTR_SOURCE=" + repository.Commit, + "GIT_INDEX_FILE=" + filepath.Join(tmpDir, fmt.Sprintf("index-%d", repositoryIndex)), + }} + indexCmd := NewGitCmd(ctx, cmdOpts, "-c", "core.hooksPath="+os.DevNull, "update-index", "-z", "--index-info") + indexCmd.Stdin = strings.NewReader(strings.Join(indexEntries, "")) + if err := indexCmd.Run(ctx); err != nil { + return nil, fmt.Errorf("prepare Git files export index: %w", err) + } + + for group, paths := range groups { + exportDir := filepath.Join(tmpDir, fmt.Sprintf("%d-%d", repositoryIndex, group)) + cmd := NewGitCmd(ctx, cmdOpts, "-c", "core.hooksPath="+os.DevNull, "checkout-index", "--prefix="+filepath.ToSlash(exportDir)+"/", "-z", "--stdin") + cmd.Stdin = strings.NewReader(strings.Join(paths, "\x00") + "\x00") + if err := cmd.Run(ctx); err != nil { + return nil, fmt.Errorf("export Git files to %s (distinct Git paths may be one path on this filesystem, e.g. on a case- or Unicode normalization-insensitive one): %w", exportDir, err) + } + } + } + + return exportedFiles, nil +} + +// groupPathsCaseInsensitively splits slash-separated paths into groups where no path is equal ignoring case +// to another path or to a parent directory of another path, so that every group can be checked out +// into its own directory on a case-insensitive filesystem. Parent directories equal ignoring case do not +// conflict with each other. Each path goes to the first group it does not conflict with. +func groupPathsCaseInsensitively(paths []string) [][]string { + type pathGroup struct { + paths []string + files map[string]bool + dirs map[string]bool + } + + var groups []*pathGroup + for _, path := range paths { + key := strings.ToLower(path) + var parents []string + for i, char := range key { + if char == '/' { + parents = append(parents, key[:i]) + } + } + + index := slices.IndexFunc(groups, func(group *pathGroup) bool { + return !group.files[key] && !group.dirs[key] && !slices.ContainsFunc(parents, func(parent string) bool { return group.files[parent] }) + }) + if index == -1 { + groups = append(groups, &pathGroup{files: map[string]bool{}, dirs: map[string]bool{}}) + index = len(groups) - 1 + } + + group := groups[index] + group.paths = append(group.paths, path) + group.files[key] = true + for _, parent := range parents { + group.dirs[parent] = true + } + } + + var result [][]string + for _, group := range groups { + result = append(result, group.paths) + } + return result +} + func applyOwnership(header *tar.Header, opts ArchiveOptions) { if opts.Owner != "" { if uid, err := strconv.Atoi(opts.Owner); err == nil { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/werf-2.84.1/pkg/true_git/archive_case_test.go new/werf-2.85.0/pkg/true_git/archive_case_test.go --- old/werf-2.84.1/pkg/true_git/archive_case_test.go 1970-01-01 01:00:00.000000000 +0100 +++ new/werf-2.85.0/pkg/true_git/archive_case_test.go 2026-11-12 13:24:51.000000000 +0100 @@ -0,0 +1,148 @@ +package true_git + +import ( + "archive/tar" + "bytes" + "io" + "path/filepath" + "time" + + "github.com/onsi/ginkgo/v2" + "github.com/onsi/gomega" + + "github.com/werf/werf/v2/pkg/path_matcher" + "github.com/werf/werf/v2/test/pkg/suite_init" +) + +var _ = ginkgo.DescribeTable("grouping paths for a case-insensitive filesystem", + func(paths []string, expected [][]string) { + gomega.Expect(groupPathsCaseInsensitively(paths)).To(gomega.Equal(expected)) + }, + ginkgo.Entry("no paths", nil, [][]string(nil)), + ginkgo.Entry("distinct paths stay in one group", []string{"a.h", "b.h", "Dir/x", "dir/y"}, [][]string{{"a.h", "b.h", "Dir/x", "dir/y"}}), + ginkgo.Entry("paths equal ignoring case go to separate groups", []string{"a.h", "A.h", "b.h"}, [][]string{{"a.h", "b.h"}, {"A.h"}}), + ginkgo.Entry("every further variant opens a new group", []string{"inc/x.h", "inc/X.h", "inc/x.H", "inc/y.h", "INC/Y.h"}, [][]string{{"inc/x.h", "inc/y.h"}, {"inc/X.h", "INC/Y.h"}, {"inc/x.H"}}), + ginkgo.Entry("file and directory equal ignoring case go to separate groups", []string{"a", "A/b"}, [][]string{{"a"}, {"A/b"}}), + ginkgo.Entry("directories equal ignoring case share a group", []string{"a", "A/b", "a/c"}, [][]string{{"a"}, {"A/b", "a/c"}}), + ginkgo.Entry("directories equal ignoring case stay in one group", []string{"A/x", "a/y"}, [][]string{{"A/x", "a/y"}}), + ginkgo.Entry("nested file and directory equal ignoring case go to separate groups", []string{"d/e", "D/E/f"}, [][]string{{"d/e"}, {"D/E/f"}}), + ginkgo.Entry("directory before file equal ignoring case go to separate groups", []string{"A/b", "a"}, [][]string{{"A/b"}, {"a"}}), + ginkgo.Entry("file and a deeper ancestor directory equal ignoring case go to separate groups", []string{"a", "A/b/c"}, [][]string{{"a"}, {"A/b/c"}}), + ginkgo.Entry("deeper ancestor directory before file equal ignoring case go to separate groups", []string{"A/b/c", "a"}, [][]string{{"A/b/c"}, {"a"}}), +) + +var _ = ginkgo.Describe("archive content of paths differing only by case", func() { + suite_init.NewWerfInitData(SuiteData.TmpDirData) + + ginkgo.DescribeTable("reads every tree entry from its own object", + func(ctx ginkgo.SpecContext, contentChecksum string) { + isolateGitConfig() + gomega.Expect(Init(ctx, Options{})).To(gomega.Succeed()) + commitTime := time.Date(2001, 2, 3, 4, 5, 6, 0, time.UTC) + setEnvForSpec("GIT_COMMITTER_DATE", commitTime.Format(time.RFC3339)) + + repoDir := filepath.Join(SuiteData.TestDirPath, "repo") + gitInitRepo(ctx, repoDir) + for path, entry := range map[string]struct{ mode, content string }{ + ".gitattributes": {"100644", "*.crlf text eol=crlf\n"}, + "inc/xt_connmark.h": {"100644", "lower\n"}, + "inc/xt_CONNMARK.h": {"100644", "UPPER\n"}, + "inc/eol.crlf": {"100644", "a\nb\n"}, + "inc/link": {"120000", "xt_CONNMARK.h"}, + } { + blob := gitSucceedWithStdin(ctx, repoDir, entry.content, "hash-object", "-w", "--stdin") + gitSucceed(ctx, repoDir, "update-index", "--add", "--cacheinfo", entry.mode+","+blob+","+path) + } + tree := gitSucceedTrimmed(ctx, repoDir, "write-tree") + commit := gitSucceedTrimmed(ctx, repoDir, "commit-tree", tree, "-m", "case collision") + + var output bytes.Buffer + gomega.Expect(Archive(ctx, &output, filepath.Join(repoDir, ".git"), filepath.Join(SuiteData.TestDirPath, "worktree-cache"), ArchiveOptions{ + Commit: commit, + ContentChecksum: contentChecksum, + PathScope: "inc", + PathMatcher: path_matcher.NewPathMatcher(path_matcher.PathMatcherOptions{BasePath: "inc"}), + })).To(gomega.Succeed()) + + files := map[string]string{} + links := map[string]string{} + modTimes := map[string]time.Time{} + reader := tar.NewReader(&output) + for { + header, err := reader.Next() + if err == io.EOF { + break + } + gomega.Expect(err).NotTo(gomega.HaveOccurred()) + modTimes[header.Name] = header.ModTime.UTC() + switch header.Typeflag { + case tar.TypeReg: + content, err := io.ReadAll(reader) + gomega.Expect(err).NotTo(gomega.HaveOccurred()) + files[header.Name] = string(content) + case tar.TypeSymlink: + links[header.Name] = header.Linkname + } + } + gomega.Expect(files).To(gomega.Equal(map[string]string{ + "xt_connmark.h": "lower\n", + "xt_CONNMARK.h": "UPPER\n", + "eol.crlf": "a\r\nb\r\n", + })) + gomega.Expect(links).To(gomega.Equal(map[string]string{"link": "xt_CONNMARK.h"})) + for name, modTime := range modTimes { + gomega.Expect(modTime).To(gomega.Equal(commitTime), "mtime of %q", name) + } + }, + ginkgo.Entry("Stapel", ""), + ginkgo.Entry("Dockerfile context", "context-checksum"), + ) + + ginkgo.DescribeTable("exports a file and a directory equal ignoring case", + func(ctx ginkgo.SpecContext, contentChecksum string) { + isolateGitConfig() + gomega.Expect(Init(ctx, Options{})).To(gomega.Succeed()) + + repoDir := filepath.Join(SuiteData.TestDirPath, "repo") + gitInitRepo(ctx, repoDir) + for path, content := range map[string]string{ + "inc/a": "file\n", + "inc/A/b": "nested\n", + } { + blob := gitSucceedWithStdin(ctx, repoDir, content, "hash-object", "-w", "--stdin") + gitSucceed(ctx, repoDir, "update-index", "--add", "--cacheinfo", "100644,"+blob+","+path) + } + tree := gitSucceedTrimmed(ctx, repoDir, "write-tree") + commit := gitSucceedTrimmed(ctx, repoDir, "commit-tree", tree, "-m", "case collision") + + var output bytes.Buffer + gomega.Expect(Archive(ctx, &output, filepath.Join(repoDir, ".git"), filepath.Join(SuiteData.TestDirPath, "worktree-cache"), ArchiveOptions{ + Commit: commit, + ContentChecksum: contentChecksum, + PathScope: "inc", + PathMatcher: path_matcher.NewPathMatcher(path_matcher.PathMatcherOptions{BasePath: "inc"}), + })).To(gomega.Succeed()) + + files := map[string]string{} + reader := tar.NewReader(&output) + for { + header, err := reader.Next() + if err == io.EOF { + break + } + gomega.Expect(err).NotTo(gomega.HaveOccurred()) + if header.Typeflag == tar.TypeReg { + content, err := io.ReadAll(reader) + gomega.Expect(err).NotTo(gomega.HaveOccurred()) + files[header.Name] = string(content) + } + } + gomega.Expect(files).To(gomega.Equal(map[string]string{ + "a": "file\n", + "A/b": "nested\n", + })) + }, + ginkgo.Entry("Stapel", ""), + ginkgo.Entry("Dockerfile context", "context-checksum"), + ) +}) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/werf-2.84.1/pkg/true_git/archive_test.go new/werf-2.85.0/pkg/true_git/archive_test.go --- old/werf-2.84.1/pkg/true_git/archive_test.go 2026-10-29 16:27:18.000000000 +0100 +++ new/werf-2.85.0/pkg/true_git/archive_test.go 2026-11-12 13:24:51.000000000 +0100 @@ -16,13 +16,16 @@ }, ginkgo.Entry("unguarded keys", "dockerfile-context-v1"), ginkgo.Entry("guarded content-only keys", "dockerfile-context-v2"), + ginkgo.Entry("archives before case-insensitive filesystem support", "dockerfile-context-v3"), ) - ginkgo.It("keeps the legacy identity when content checksums are not requested", func() { + ginkgo.It("separates archives from those written before case-insensitive filesystem support", func() { opts := ArchiveOptions{Commit: "commit-a", PathScope: "app", PathMatcher: path_matcher.NewPathMatcher(path_matcher.PathMatcherOptions{})} - gomega.Expect(opts.ID()).To(gomega.Equal(util.Sha256Hash(opts.Commit, opts.PathScope, opts.PathMatcher.ID()))) + gomega.Expect(opts.ID()).NotTo(gomega.Equal(util.Sha256Hash(opts.Commit, opts.PathScope, opts.PathMatcher.ID()))) + gomega.Expect(opts.ID()).To(gomega.Equal(util.Sha256Hash(opts.Commit, opts.PathScope, opts.PathMatcher.ID(), "git-archive-v2"))) opts.FileRenames = map[string]string{"app/a": "b"} - gomega.Expect(opts.ID()).To(gomega.Equal(util.Sha256Hash("app/a", "b", opts.Commit, opts.PathScope, opts.PathMatcher.ID()))) + gomega.Expect(opts.ID()).NotTo(gomega.Equal(util.Sha256Hash("app/a", "b", opts.Commit, opts.PathScope, opts.PathMatcher.ID()))) + gomega.Expect(opts.ID()).To(gomega.Equal(util.Sha256Hash("app/a", "b", opts.Commit, opts.PathScope, opts.PathMatcher.ID(), "git-archive-v2"))) }) ginkgo.DescribeTable("keys content archives independently of commit and filter identity", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/werf-2.84.1/pkg/true_git/ls_tree/result.go new/werf-2.85.0/pkg/true_git/ls_tree/result.go --- old/werf-2.84.1/pkg/true_git/ls_tree/result.go 2026-10-29 16:27:18.000000000 +0100 +++ new/werf-2.85.0/pkg/true_git/ls_tree/result.go 2026-11-12 13:24:51.000000000 +0100 @@ -183,6 +183,39 @@ }) } +type EntryRepository struct { + Handle repo_handle.Handle + // Path is relative to the main repository root, empty for the main repository. + Path string + Commit string +} + +func (r *Result) WalkWithRepository(ctx context.Context, repoHandle repo_handle.Handle, f func(repository EntryRepository, lsTreeEntry *LsTreeEntry) error) error { + repository := EntryRepository{Handle: repoHandle, Path: r.repositoryFullFilepath, Commit: r.commit} + if err := r.lsTreeEntriesWalk(func(lsTreeEntry *LsTreeEntry) error { + return f(repository, lsTreeEntry) + }); err != nil { + return err + } + + sort.Slice(r.submodulesResults, func(i, j int) bool { + return r.submodulesResults[i].repositoryFullFilepath < r.submodulesResults[j].repositoryFullFilepath + }) + + for _, submoduleResult := range r.submodulesResults { + submoduleHandle, err := submoduleResult.submoduleRepository(repoHandle) + if err != nil { + return fmt.Errorf("get submodule %q repository: %w", submoduleResult.submodulePath, err) + } + + if err := submoduleResult.Result.WalkWithRepository(ctx, submoduleHandle, f); err != nil { + return err + } + } + + return nil +} + func (r *Result) walkWithResult(f func(r *Result, sr *SubmoduleResult, lsTreeEntry *LsTreeEntry) error) error { if err := r.lsTreeEntriesWalkWithResult(f); err != nil { return err ++++++ werf.obsinfo ++++++ --- /var/tmp/diff_new_pack.nINlGe/_old 2026-12-02 17:08:12.397790460 +0100 +++ /var/tmp/diff_new_pack.nINlGe/_new 2026-12-02 17:08:12.400790587 +0100 @@ -1,5 +1,5 @@ name: werf -version: 2.84.1 -mtime: 1793287638 -commit: d6c03cd89f799cc11accfcd13c729401c96502a8 +version: 2.85.0 +mtime: 1794486291 +commit: 4caf990f4a382926ec34ac45366ba561e06b3c37
