Skip to content

Commit 95546d6

Browse files
authored
Add missing requirement for Azure Devops function git clone (#1609)
1 parent f08d3a5 commit 95546d6

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

components/buildless-serverless/cmd/jobinit/main.go

+7
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package main
22

33
import (
44
"fmt"
5+
"github.com/go-git/go-git/v5/plumbing/protocol/packp/capability"
56
"github.com/go-git/go-git/v5/plumbing/transport"
67
"github.com/go-git/go-git/v5/plumbing/transport/http"
78
serverlessv1alpha2 "github.com/kyma-project/serverless/api/v1alpha2"
@@ -40,6 +41,12 @@ func main() {
4041
auth, err := chooseAuth(cfg)
4142
failOnErr(err, "unable to choose auth")
4243

44+
// required by Azure Devops (works with Github, Gitlab, Bitbucket)
45+
// https://github.com/go-git/go-git/blob/master/_examples/azure_devops/main.go#L21-L36
46+
transport.UnsupportedCapabilities = []capability.Capability{
47+
capability.ThinPack,
48+
}
49+
4350
log.Printf("Clone repo from url: %s and commit: %s...\n", cfg.RepositoryURL, cfg.RepositoryCommit)
4451
err = clone(cfg, auth)
4552
failOnErr(err, "while cloning repository from commit")

components/buildless-serverless/internal/controller/git/commit_checker.go

+8
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ package git
33
import (
44
"github.com/go-git/go-git/v5"
55
"github.com/go-git/go-git/v5/plumbing"
6+
"github.com/go-git/go-git/v5/plumbing/protocol/packp/capability"
7+
"github.com/go-git/go-git/v5/plumbing/transport"
68
"github.com/go-git/go-git/v5/storage/memory"
79
"github.com/kyma-project/serverless/internal/controller/cache"
810
"github.com/pkg/errors"
@@ -52,6 +54,12 @@ func (g GoGitCommitChecker) GetLatestCommit(url, reference string, gitAuth *GitA
5254
cloneOptions.Auth = auth
5355
}
5456

57+
// required by Azure Devops (works with Github, Gitlab, Bitbucket)
58+
// https://github.com/go-git/go-git/blob/master/_examples/azure_devops/main.go#L21-L36
59+
transport.UnsupportedCapabilities = []capability.Capability{
60+
capability.ThinPack,
61+
}
62+
5563
r, err := git.Clone(memory.NewStorage(), nil, &cloneOptions)
5664
if err != nil {
5765
return "", err

0 commit comments

Comments
 (0)