Skip to content

Commit 730932f

Browse files
committed
Update source-controller with libgit2 race fixes
Also, removes the panic recovery code added in cloneInto() as the underlying Checkout() in SC already has a panic handler. The issues were due to goroutine panicking, which are now handled in the SC libgit managed transport. Signed-off-by: Sunny <[email protected]>
1 parent c0962f7 commit 730932f

File tree

5 files changed

+11
-17
lines changed

5 files changed

+11
-17
lines changed

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ CACHE := cache
2121

2222
# Version of the source-controller from which to get the GitRepository CRD.
2323
# Pulls source-controller/api's version set in go.mod.
24-
SOURCE_VER ?= $(shell go list -m github.com/fluxcd/source-controller/api | awk '{print $$2}')
24+
# SOURCE_VER ?= $(shell go list -m github.com/fluxcd/source-controller/api | awk '{print $$2}')
25+
SOURCE_VER = v0.25.0
2526

2627
# Version of the image-reflector-controller from which to get the ImagePolicy CRD.
2728
# Pulls image-reflector-controller/api's version set in go.mod.

controllers/imageupdateautomation_controller.go

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -542,9 +542,7 @@ func (r repoAccess) remoteCallbacks(ctx context.Context) libgit2.RemoteCallbacks
542542
// can be `nil`). It returns a `*libgit2.Repository` since that is used
543543
// for committing changes.
544544
func cloneInto(ctx context.Context, access repoAccess, ref *sourcev1.GitRepositoryRef,
545-
path string) (_ *libgit2.Repository, err error) {
546-
defer recoverPanic(&err)
547-
545+
path string) (*libgit2.Repository, error) {
548546
opts := git.CheckoutOptions{}
549547
if ref != nil {
550548
opts.Tag = ref.Tag
@@ -983,9 +981,3 @@ func templateMsg(messageTemplate string, templateValues *TemplateData) (string,
983981
}
984982
return b.String(), nil
985983
}
986-
987-
func recoverPanic(err *error) {
988-
if r := recover(); r != nil {
989-
*err = fmt.Errorf("recovered from git2go panic: %v", r)
990-
}
991-
}

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ require (
1515
github.com/fluxcd/pkg/gittestserver v0.5.4
1616
github.com/fluxcd/pkg/runtime v0.16.1
1717
github.com/fluxcd/pkg/ssh v0.4.1
18-
github.com/fluxcd/source-controller v0.25.0
19-
github.com/fluxcd/source-controller/api v0.25.0
18+
github.com/fluxcd/source-controller v0.25.1-0.20220602201518-7f7490ebf021
19+
github.com/fluxcd/source-controller/api v0.25.1-0.20220602201518-7f7490ebf021
2020
github.com/go-logr/logr v1.2.3
2121
github.com/google/go-containerregistry v0.9.0
2222
github.com/libgit2/git2go/v33 v33.0.9

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,10 +196,10 @@ github.com/fluxcd/pkg/ssh v0.4.1 h1:O5FCjb5NIZ9PeRjdF2iL9jaPNM+RL+IjrMBZPkqF9W4=
196196
github.com/fluxcd/pkg/ssh v0.4.1/go.mod h1:KGgOUOy1uI6RC6+qxIBLvP1AeOOs/nLB25Ca6TZMIXE=
197197
github.com/fluxcd/pkg/version v0.1.0 h1:v+SmCanmCB5Tj2Cx9TXlj+kNRfPGbAvirkeqsp7ZEAQ=
198198
github.com/fluxcd/pkg/version v0.1.0/go.mod h1:V7Z/w8dxLQzv0FHqa5ox5TeyOd2zOd49EeuWFgnwyj4=
199-
github.com/fluxcd/source-controller v0.25.0 h1:57FnGVTeMGfGIoRyekSPkhqMqbg+haaW/k/GlxQI7v0=
200-
github.com/fluxcd/source-controller v0.25.0/go.mod h1:S/VQ8B0bsr5BqhQ5ts5yc662znMkhnNNF8k+De2NI3M=
201-
github.com/fluxcd/source-controller/api v0.25.0 h1:+uL+hQb/6h2MHuE9/Iq054TrDWF70puAuWBcoBrZK5M=
202-
github.com/fluxcd/source-controller/api v0.25.0/go.mod h1:tuMrqHHpRt7mxdLeRXGIMtTKAMufLwLTm5uXkEOJWFw=
199+
github.com/fluxcd/source-controller v0.25.1-0.20220602201518-7f7490ebf021 h1:ULVxVtcKtjOndJWx+oRQAsGhDItlP7Nl8Eg1mApPH8M=
200+
github.com/fluxcd/source-controller v0.25.1-0.20220602201518-7f7490ebf021/go.mod h1:S/VQ8B0bsr5BqhQ5ts5yc662znMkhnNNF8k+De2NI3M=
201+
github.com/fluxcd/source-controller/api v0.25.1-0.20220602201518-7f7490ebf021 h1:d/6UEayIf3P09shP7oTnhvbYRzHwjEnSLvrqUtge1LM=
202+
github.com/fluxcd/source-controller/api v0.25.1-0.20220602201518-7f7490ebf021/go.mod h1:tuMrqHHpRt7mxdLeRXGIMtTKAMufLwLTm5uXkEOJWFw=
203203
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc=
204204
github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k=
205205
github.com/form3tech-oss/jwt-go v3.2.3+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k=

tests/fuzz/oss_fuzz_build.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ echo "replace github.com/fluxcd/image-automation-controller => ../../" >> go.mod
7070

7171
# Version of the source-controller from which to get the GitRepository CRD.
7272
# Pulls source-controller/api's version set in go.mod.
73-
SOURCE_VER=$(go list -m github.com/fluxcd/source-controller/api | awk '{print $2}')
73+
# SOURCE_VER=$(go list -m github.com/fluxcd/source-controller/api | awk '{print $2}')
74+
SOURCE_VER=v0.25.0
7475

7576
# Version of the image-reflector-controller from which to get the ImagePolicy CRD.
7677
# Pulls image-reflector-controller/api's version set in go.mod.

0 commit comments

Comments
 (0)