From 8647fd39fa2b7ef496e5831e83723d112dc5d98a Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Thu, 30 May 2024 15:28:04 -0700 Subject: [PATCH] Disable recursive cloning of submodules given a Git URL --- moby-engine/debian/changelog | 6 +++ .../debian/patches/git-no-submodules.patch | 37 +++++++++++++++++++ moby-engine/debian/patches/series | 1 + 3 files changed, 44 insertions(+) create mode 100644 moby-engine/debian/patches/git-no-submodules.patch diff --git a/moby-engine/debian/changelog b/moby-engine/debian/changelog index a29b430..a4c9466 100644 --- a/moby-engine/debian/changelog +++ b/moby-engine/debian/changelog @@ -1,3 +1,9 @@ +moby-engine (23.0.11-3) UNRELEASED; urgency=medium + + * Disable recursive cloning of submodules given a Git URL + + -- Tianon Gravi Thu, 30 May 2024 15:27:02 -0700 + moby-engine (23.0.11-2) unstable; urgency=medium * Add patch to fix buildkit on mips64le diff --git a/moby-engine/debian/patches/git-no-submodules.patch b/moby-engine/debian/patches/git-no-submodules.patch new file mode 100644 index 0000000..9ae4b7c --- /dev/null +++ b/moby-engine/debian/patches/git-no-submodules.patch @@ -0,0 +1,37 @@ +Description: disable recursive cloning of submodules given a Git URL +Forwarded: https://github.com/moby/buildkit/issues/4974, https://github.com/moby/moby/pull/3463#issuecomment-31778263 + +diff --git a/builder/remotecontext/git/gitutils.go b/builder/remotecontext/git/gitutils.go +index c20f8da75b..09e2b99e76 100644 +--- a/builder/remotecontext/git/gitutils.go ++++ b/builder/remotecontext/git/gitutils.go +@@ -80,13 +80,6 @@ func (repo gitRepo) clone() (checkoutDir string, err error) { + return "", err + } + +- cmd := exec.Command("git", "submodule", "update", "--init", "--recursive", "--depth=1") +- cmd.Dir = root +- output, err := cmd.CombinedOutput() +- if err != nil { +- return "", errors.Wrapf(err, "error initializing submodules: %s", output) +- } +- + return checkoutDir, nil + } + +diff --git a/vendor/github.com/moby/buildkit/source/git/gitsource.go b/vendor/github.com/moby/buildkit/source/git/gitsource.go +index 7b52c11330..9830cd5a63 100644 +--- a/vendor/github.com/moby/buildkit/source/git/gitsource.go ++++ b/vendor/github.com/moby/buildkit/source/git/gitsource.go +@@ -588,11 +588,6 @@ func (gs *gitSourceHandler) Snapshot(ctx context.Context, g session.Group) (out + } + } + +- _, err = gitWithinDir(ctx, gitDir, checkoutDir, sock, knownHosts, gs.auth, "submodule", "update", "--init", "--recursive", "--depth=1") +- if err != nil { +- return nil, errors.Wrapf(err, "failed to update submodules for %s", urlutil.RedactCredentials(gs.src.Remote)) +- } +- + if idmap := mount.IdentityMapping(); idmap != nil { + u := idmap.RootPair() + err := filepath.Walk(gitDir, func(p string, f os.FileInfo, err error) error { diff --git a/moby-engine/debian/patches/series b/moby-engine/debian/patches/series index 11f4e07..cdec7a2 100644 --- a/moby-engine/debian/patches/series +++ b/moby-engine/debian/patches/series @@ -1,3 +1,4 @@ buildkit-noclip.patch containerd-arm64-v8.patch +git-no-submodules.patch mips64le.patch