From 8e18552a3de0dbbb957ec908c0604af069304d3f Mon Sep 17 00:00:00 2001 From: tooptoop4 <33283496+tooptoop4@users.noreply.github.com> Date: Thu, 7 Nov 2024 08:19:45 +1100 Subject: [PATCH 1/2] Signed-off-by: tooptoop4 <33283496+tooptoop4@users.noreply.github.com> --- workflow/artifacts/git/git.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/workflow/artifacts/git/git.go b/workflow/artifacts/git/git.go index 54a754b012a7..192411283301 100644 --- a/workflow/artifacts/git/git.go +++ b/workflow/artifacts/git/git.go @@ -6,10 +6,12 @@ import ( "io" "os" "regexp" + "strings" "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" @@ -85,6 +87,20 @@ 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) + var newCaps []capability.Capability + if a.Repo && strings.Contains(a.Repo, "dev.azure.com") { + 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 { From 0aca7c84a9ac80bf4b130536cbccd839f363a9fa Mon Sep 17 00:00:00 2001 From: tooptoop4 <33283496+tooptoop4@users.noreply.github.com> Date: Thu, 7 Nov 2024 08:29:35 +1100 Subject: [PATCH 2/2] Signed-off-by: tooptoop4 <33283496+tooptoop4@users.noreply.github.com> --- workflow/artifacts/git/git.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workflow/artifacts/git/git.go b/workflow/artifacts/git/git.go index 192411283301..f5cad5d69bce 100644 --- a/workflow/artifacts/git/git.go +++ b/workflow/artifacts/git/git.go @@ -91,7 +91,7 @@ func (g *ArtifactDriver) Load(inputArtifact *wfv1.Artifact, path string) error { // 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) var newCaps []capability.Capability - if a.Repo && strings.Contains(a.Repo, "dev.azure.com") { + if strings.Contains(a.Repo, "dev.azure.com") { for _, c := range transport.UnsupportedCapabilities { if c == capability.MultiACK || c == capability.MultiACKDetailed { continue