Skip to content

Commit

Permalink
Merge pull request #459 from aryan9600/bump-git-v0.7.0
Browse files Browse the repository at this point in the history
bump pkg/git, pkg/git/gogit and pkg/git/libgit2
  • Loading branch information
Paulo Gomes authored Nov 16, 2022
2 parents 1b8d307 + 1cacafa commit 92603f3
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 51 deletions.
22 changes: 15 additions & 7 deletions controllers/imageupdateautomation_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ import (
"github.com/fluxcd/pkg/git"
"github.com/fluxcd/pkg/git/gogit"
"github.com/fluxcd/pkg/git/libgit2"
"github.com/fluxcd/pkg/git/repository"
"github.com/fluxcd/pkg/runtime/acl"
helper "github.com/fluxcd/pkg/runtime/controller"
"github.com/fluxcd/pkg/runtime/logger"
Expand Down Expand Up @@ -262,18 +263,25 @@ func (r *ImageUpdateAutomationReconciler) Reconcile(ctx context.Context, req ctr
gitImplementation = sourcev1.GoGitImplementation
}

var gitClient git.RepositoryClient
var gitClient repository.Client
switch gitImplementation {
case sourcev1.LibGit2Implementation:
gitClient, err = libgit2.NewClient(tmp, authOpts)
clientOpts := []libgit2.ClientOption{libgit2.WithDiskStorage()}
if authOpts.Transport == git.HTTP {
clientOpts = append(clientOpts, libgit2.WithInsecureCredentialsOverHTTP())
}
gitClient, err = libgit2.NewClient(tmp, authOpts, clientOpts...)
case sourcev1.GoGitImplementation, "":
opts := make([]gogit.ClientOption, 0)
clientOpts := []gogit.ClientOption{gogit.WithDiskStorage()}
forcePush, _ := features.Enabled(features.GitForcePushBranch)
if forcePush && pushBranch != ref.Branch {
opts = append(opts, gogit.WithDiskStorage, gogit.WithForcePush())
clientOpts = append(clientOpts, gogit.WithForcePush())
}
if authOpts.Transport == git.HTTP {
clientOpts = append(clientOpts, gogit.WithInsecureCredentialsOverHTTP())
}

gitClient, err = gogit.NewClient(tmp, authOpts, opts...)
gitClient, err = gogit.NewClient(tmp, authOpts, clientOpts...)
default:
err = fmt.Errorf("failed to create git client; referred GitRepository has invalid implementation: %s", gitImplementation)
}
Expand All @@ -282,7 +290,7 @@ func (r *ImageUpdateAutomationReconciler) Reconcile(ctx context.Context, req ctr
}
defer gitClient.Close()

opts := git.CloneOptions{}
opts := repository.CloneOptions{}
if ref != nil {
opts.Tag = ref.Tag
opts.SemVer = ref.SemVer
Expand Down Expand Up @@ -376,7 +384,7 @@ func (r *ImageUpdateAutomationReconciler) Reconcile(ctx context.Context, req ctr
},
Message: message,
},
git.WithSigner(signingEntity),
repository.WithSigner(signingEntity),
); err != nil {
if err != git.ErrNoStagedFiles {
return failWithError(err)
Expand Down
28 changes: 14 additions & 14 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,24 @@ require (
github.com/fluxcd/pkg/apis/acl v0.1.0
github.com/fluxcd/pkg/apis/event v0.1.0
github.com/fluxcd/pkg/apis/meta v0.17.0
github.com/fluxcd/pkg/git v0.6.1
github.com/fluxcd/pkg/git/gogit v0.0.0-20221102123958-2ee90dd5b2ec
github.com/fluxcd/pkg/git/libgit2 v0.0.0-20221102123958-2ee90dd5b2ec
github.com/fluxcd/pkg/gittestserver v0.7.0
github.com/fluxcd/pkg/git v0.7.0
github.com/fluxcd/pkg/git/gogit v0.2.0
github.com/fluxcd/pkg/git/libgit2 v0.3.0
github.com/fluxcd/pkg/gittestserver v0.8.0
github.com/fluxcd/pkg/runtime v0.23.0
github.com/fluxcd/pkg/ssh v0.6.0
github.com/fluxcd/pkg/ssh v0.7.0
github.com/fluxcd/source-controller/api v0.31.0
github.com/go-git/go-billy/v5 v5.3.1
github.com/go-git/go-git/v5 v5.4.2
github.com/go-logr/logr v1.2.3
github.com/google/go-containerregistry v0.12.0
github.com/libgit2/git2go/v34 v34.0.0
github.com/onsi/gomega v1.24.0
github.com/onsi/gomega v1.24.1
github.com/otiai10/copy v1.9.0
github.com/spf13/pflag v1.0.5
golang.org/x/crypto v0.1.0
golang.org/x/crypto v0.2.0
k8s.io/api v0.25.3
k8s.io/apimachinery v0.25.3
k8s.io/apimachinery v0.25.4
k8s.io/client-go v0.25.3
k8s.io/kube-openapi v0.0.0-20221106113015-f73e7dbcfe29
sigs.k8s.io/controller-runtime v0.13.1
Expand All @@ -72,7 +72,7 @@ require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/chai2010/gettext-go v1.0.2 // indirect
github.com/cloudflare/circl v1.2.0 // indirect
github.com/cloudflare/circl v1.3.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/elazarl/goproxy v0.0.0-20221015165544-a0805db90819 // indirect
github.com/emicklei/go-restful/v3 v3.9.0 // indirect
Expand All @@ -81,8 +81,8 @@ require (
github.com/evanphx/json-patch/v5 v5.6.0 // indirect
github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d // indirect
github.com/fluxcd/gitkit v0.6.0 // indirect
github.com/fluxcd/pkg/gitutil v0.2.0 // indirect
github.com/fluxcd/pkg/http/transport v0.0.1 // indirect
github.com/fluxcd/go-git/v5 v5.0.0-20221104190732-329fd6659b10 // indirect
github.com/fluxcd/pkg/http/transport v0.1.0 // indirect
github.com/fluxcd/pkg/version v0.2.0 // indirect
github.com/fsnotify/fsnotify v1.5.4 // indirect
github.com/go-errors/errors v1.0.1 // indirect
Expand Down Expand Up @@ -149,10 +149,10 @@ require (
go.uber.org/multierr v1.8.0 // indirect
go.uber.org/zap v1.23.0 // indirect
golang.org/x/mod v0.6.0 // indirect
golang.org/x/net v0.1.0 // indirect
golang.org/x/net v0.2.0 // indirect
golang.org/x/oauth2 v0.1.0 // indirect
golang.org/x/sys v0.1.0 // indirect
golang.org/x/term v0.1.0 // indirect
golang.org/x/sys v0.2.0 // indirect
golang.org/x/term v0.2.0 // indirect
golang.org/x/text v0.4.0 // indirect
golang.org/x/time v0.1.0 // indirect
golang.org/x/tools v0.2.0 // indirect
Expand Down
Loading

0 comments on commit 92603f3

Please sign in to comment.