From ba1fdaae28cff30d58499dbf62d51b9f803c2aa9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20L=C3=BCtke=20Stetzkamp?= Date: Wed, 31 Jan 2024 15:12:47 +0100 Subject: [PATCH] fix: Fixes git over azure devops Fixes #11705 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Christian Lütke Stetzkamp --- workflow/artifacts/git/git.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/workflow/artifacts/git/git.go b/workflow/artifacts/git/git.go index fb611ffe75e2..d8444938d4c1 100644 --- a/workflow/artifacts/git/git.go +++ b/workflow/artifacts/git/git.go @@ -10,6 +10,7 @@ import ( "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/protocol/packp/capability" "github.com/go-git/go-git/v5/plumbing/transport" "github.com/go-git/go-git/v5/plumbing/transport/http" ssh2 "github.com/go-git/go-git/v5/plumbing/transport/ssh" @@ -84,6 +85,19 @@ func (g *ArtifactDriver) Delete(s *wfv1.Artifact) error { func (g *ArtifactDriver) Load(inputArtifact *wfv1.Artifact, path string) error { a := inputArtifact.Git + + // Azure DevOps requires multi_ack* capabilities which go-git does not currently support + // Workaround: removing these from UnsupportedCapabilities allows clones to work (see https://github.com/go-git/go-git/pull/613) + // TODO: remove this once https://github.com/go-git/go-git/issues/64 is fully fixed + var newCaps []capability.Capability + for _, c := range transport.UnsupportedCapabilities { + if c == capability.MultiACK || c == capability.MultiACKDetailed { + continue + } + newCaps = append(newCaps, c) + } + transport.UnsupportedCapabilities = newCaps + sshUser := GetUser(a.Repo) closer, auth, err := g.auth(sshUser) if err != nil {