Skip to content

Commit 6c05a55

Browse files
authored
Merge pull request #1105 from aryan9600/bump-git
Update dependencies; switch to `go-git/go-git` and `pkg/tar`
2 parents 75a30f9 + ef1df00 commit 6c05a55

9 files changed

+56
-80
lines changed

go.mod

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,29 +32,29 @@ require (
3232
github.com/distribution/distribution/v3 v3.0.0-20230519140516-983358f8e250
3333
github.com/docker/cli v24.0.1+incompatible
3434
github.com/docker/go-units v0.5.0
35-
github.com/fluxcd/go-git/v5 v5.0.0-20221219190809-2e5c9d01cfc4
3635
github.com/fluxcd/pkg/apis/event v0.5.0
3736
github.com/fluxcd/pkg/apis/meta v1.1.0
38-
github.com/fluxcd/pkg/git v0.12.1
39-
github.com/fluxcd/pkg/git/gogit v0.10.0
40-
github.com/fluxcd/pkg/gittestserver v0.8.3
37+
github.com/fluxcd/pkg/git v0.12.2
38+
github.com/fluxcd/pkg/git/gogit v0.11.1
39+
github.com/fluxcd/pkg/gittestserver v0.8.4
4140
github.com/fluxcd/pkg/helmtestserver v0.13.0
4241
github.com/fluxcd/pkg/lockedfile v0.1.0
4342
github.com/fluxcd/pkg/masktoken v0.2.0
44-
github.com/fluxcd/pkg/oci v0.26.1
43+
github.com/fluxcd/pkg/oci v0.27.0
4544
github.com/fluxcd/pkg/runtime v0.38.1
46-
github.com/fluxcd/pkg/sourceignore v0.3.3
45+
github.com/fluxcd/pkg/sourceignore v0.3.4
4746
github.com/fluxcd/pkg/ssh v0.7.4
47+
github.com/fluxcd/pkg/tar v0.2.0
4848
github.com/fluxcd/pkg/testserver v0.4.0
49-
github.com/fluxcd/pkg/untar v0.3.0
5049
github.com/fluxcd/pkg/version v0.2.2
5150
github.com/fluxcd/source-controller/api v1.0.0-rc.3
5251
github.com/go-git/go-billy/v5 v5.4.1
52+
github.com/go-git/go-git/v5 v5.7.0
5353
github.com/go-logr/logr v1.2.4
5454
github.com/google/go-containerregistry v0.15.2
5555
github.com/google/go-containerregistry/pkg/authn/k8schain v0.0.0-20230523181351-c3f8a49229d3
5656
github.com/google/uuid v1.3.0
57-
github.com/minio/minio-go/v7 v7.0.53
57+
github.com/minio/minio-go/v7 v7.0.54
5858
github.com/onsi/gomega v1.27.7
5959
github.com/opencontainers/go-digest v1.0.0
6060
github.com/opencontainers/go-digest/blake3 v0.0.0-20230329235805-65fac7b55eb7
@@ -177,11 +177,10 @@ require (
177177
github.com/felixge/httpsnoop v1.0.3 // indirect
178178
github.com/fluxcd/gitkit v0.6.0 // indirect
179179
github.com/fluxcd/pkg/apis/acl v0.1.0 // indirect
180-
github.com/fluxcd/pkg/tar v0.2.0 // indirect
181180
github.com/fsnotify/fsnotify v1.6.0 // indirect
182181
github.com/go-chi/chi v4.1.2+incompatible // indirect
183182
github.com/go-errors/errors v1.4.2 // indirect
184-
github.com/go-git/gcfg v1.5.0 // indirect
183+
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
185184
github.com/go-gorp/gorp/v3 v3.1.0 // indirect
186185
github.com/go-jose/go-jose/v3 v3.0.0 // indirect
187186
github.com/go-logr/stdr v1.2.2 // indirect
@@ -259,7 +258,7 @@ require (
259258
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
260259
github.com/miekg/pkcs11 v1.1.1 // indirect
261260
github.com/minio/md5-simd v1.1.2 // indirect
262-
github.com/minio/sha256-simd v1.0.0 // indirect
261+
github.com/minio/sha256-simd v1.0.1 // indirect
263262
github.com/mitchellh/copystructure v1.2.0 // indirect
264263
github.com/mitchellh/go-homedir v1.1.0 // indirect
265264
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
@@ -288,7 +287,7 @@ require (
288287
github.com/prometheus/common v0.42.0 // indirect
289288
github.com/prometheus/procfs v0.9.0 // indirect
290289
github.com/rivo/uniseg v0.4.2 // indirect
291-
github.com/rs/xid v1.4.0 // indirect
290+
github.com/rs/xid v1.5.0 // indirect
292291
github.com/rubenv/sql-migrate v1.3.1 // indirect
293292
github.com/russross/blackfriday/v2 v2.1.0 // indirect
294293
github.com/sassoftware/relic v7.2.1+incompatible // indirect

go.sum

Lines changed: 22 additions & 45 deletions
Large diffs are not rendered by default.

internal/controller/gitrepository_controller_fuzz_test.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,19 @@ import (
3535
"path/filepath"
3636
"strings"
3737
"sync"
38+
"testing"
3839
"time"
3940

4041
fuzz "github.com/AdaLogics/go-fuzz-headers"
41-
"github.com/fluxcd/go-git/v5"
42-
"github.com/fluxcd/go-git/v5/config"
43-
"github.com/fluxcd/go-git/v5/plumbing"
44-
"github.com/fluxcd/go-git/v5/plumbing/object"
45-
gitclient "github.com/fluxcd/go-git/v5/plumbing/transport/client"
46-
httptransport "github.com/fluxcd/go-git/v5/plumbing/transport/http"
47-
"github.com/fluxcd/go-git/v5/storage/memory"
4842
"github.com/go-git/go-billy/v5"
4943
"github.com/go-git/go-billy/v5/memfs"
44+
"github.com/go-git/go-git/v5"
45+
"github.com/go-git/go-git/v5/config"
46+
"github.com/go-git/go-git/v5/plumbing"
47+
"github.com/go-git/go-git/v5/plumbing/object"
48+
gitclient "github.com/go-git/go-git/v5/plumbing/transport/client"
49+
httptransport "github.com/go-git/go-git/v5/plumbing/transport/http"
50+
"github.com/go-git/go-git/v5/storage/memory"
5051
corev1 "k8s.io/api/core/v1"
5152
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
5253
"k8s.io/apimachinery/pkg/types"

internal/controller/gitrepository_controller_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ import (
2828
"testing"
2929
"time"
3030

31-
gogit "github.com/fluxcd/go-git/v5"
32-
"github.com/fluxcd/go-git/v5/config"
33-
"github.com/fluxcd/go-git/v5/plumbing"
34-
"github.com/fluxcd/go-git/v5/plumbing/object"
35-
"github.com/fluxcd/go-git/v5/storage/memory"
3631
"github.com/go-git/go-billy/v5/memfs"
32+
gogit "github.com/go-git/go-git/v5"
33+
"github.com/go-git/go-git/v5/config"
34+
"github.com/go-git/go-git/v5/plumbing"
35+
"github.com/go-git/go-git/v5/plumbing/object"
36+
"github.com/go-git/go-git/v5/storage/memory"
3737
. "github.com/onsi/gomega"
3838
sshtestdata "golang.org/x/crypto/ssh/testdata"
3939
corev1 "k8s.io/api/core/v1"

internal/controller/helmchart_controller.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ import (
6060
"github.com/fluxcd/pkg/runtime/patch"
6161
"github.com/fluxcd/pkg/runtime/predicates"
6262
rreconcile "github.com/fluxcd/pkg/runtime/reconcile"
63-
"github.com/fluxcd/pkg/untar"
63+
"github.com/fluxcd/pkg/tar"
6464

6565
sourcev1 "github.com/fluxcd/source-controller/api/v1"
6666
helmv1 "github.com/fluxcd/source-controller/api/v1beta2"
@@ -765,7 +765,7 @@ func (r *HelmChartReconciler) buildFromTarballArtifact(ctx context.Context, obj
765765
conditions.MarkTrue(obj, sourcev1.FetchFailedCondition, e.Reason, e.Err.Error())
766766
return sreconcile.ResultEmpty, e
767767
}
768-
if _, err = untar.Untar(f, sourceDir); err != nil {
768+
if err = tar.Untar(f, sourceDir, tar.WithMaxUntarSize(-1)); err != nil {
769769
_ = f.Close()
770770
return sreconcile.ResultEmpty, &serror.Event{
771771
Err: fmt.Errorf("artifact untar error: %w", err),

internal/controller/ocirepository_controller.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ import (
6262
"github.com/fluxcd/pkg/runtime/predicates"
6363
rreconcile "github.com/fluxcd/pkg/runtime/reconcile"
6464
"github.com/fluxcd/pkg/sourceignore"
65-
"github.com/fluxcd/pkg/untar"
65+
"github.com/fluxcd/pkg/tar"
6666
"github.com/fluxcd/pkg/version"
6767

6868
sourcev1 "github.com/fluxcd/source-controller/api/v1"
@@ -494,7 +494,7 @@ func (r *OCIRepositoryReconciler) reconcileSource(ctx context.Context, sp *patch
494494
// Persist layer content to storage using the specified operation
495495
switch obj.GetLayerOperation() {
496496
case ociv1.OCILayerExtract:
497-
if _, err = untar.Untar(blob, dir); err != nil {
497+
if err = tar.Untar(blob, dir, tar.WithMaxUntarSize(-1)); err != nil {
498498
e := serror.NewGeneric(
499499
fmt.Errorf("failed to extract layer contents from artifact: %w", err),
500500
ociv1.OCILayerOperationFailedReason,

internal/controller/ocirepository_controller_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ import (
6262
"github.com/fluxcd/pkg/runtime/conditions"
6363
conditionscheck "github.com/fluxcd/pkg/runtime/conditions/check"
6464
"github.com/fluxcd/pkg/runtime/patch"
65-
"github.com/fluxcd/pkg/untar"
65+
"github.com/fluxcd/pkg/tar"
6666

6767
sourcev1 "github.com/fluxcd/source-controller/api/v1"
6868
ociv1 "github.com/fluxcd/source-controller/api/v1beta2"
@@ -199,9 +199,8 @@ func TestOCIRepository_Reconcile(t *testing.T) {
199199
g.Expect(err).ToNot(HaveOccurred())
200200
defer os.RemoveAll(tmp)
201201

202-
ep, err := untar.Untar(f, tmp)
202+
err = tar.Untar(f, tmp, tar.WithMaxUntarSize(-1))
203203
g.Expect(err).ToNot(HaveOccurred())
204-
t.Logf("extracted summary: %s", ep)
205204

206205
for _, af := range tt.assertArtifact {
207206
expectedFile := filepath.Join(tmp, af.expectedPath)

internal/controller/storage.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ import (
3131
"time"
3232

3333
securejoin "github.com/cyphar/filepath-securejoin"
34-
"github.com/fluxcd/go-git/v5/plumbing/format/gitignore"
34+
"github.com/go-git/go-git/v5/plumbing/format/gitignore"
3535
"github.com/opencontainers/go-digest"
3636
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
3737
kerrors "k8s.io/apimachinery/pkg/util/errors"
3838

3939
"github.com/fluxcd/pkg/lockedfile"
4040
"github.com/fluxcd/pkg/sourceignore"
41-
"github.com/fluxcd/pkg/untar"
41+
pkgtar "github.com/fluxcd/pkg/tar"
4242

4343
v1 "github.com/fluxcd/source-controller/api/v1"
4444
intdigest "github.com/fluxcd/source-controller/internal/digest"
@@ -606,7 +606,7 @@ func (s Storage) CopyToPath(artifact *v1.Artifact, subPath, toPath string) error
606606

607607
// untar the artifact
608608
untarPath := filepath.Join(tmp, "unpack")
609-
if _, err = untar.Untar(f, untarPath); err != nil {
609+
if err = pkgtar.Untar(f, untarPath, pkgtar.WithMaxUntarSize(-1)); err != nil {
610610
return err
611611
}
612612

internal/controller/storage_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import (
3030
"testing"
3131
"time"
3232

33-
"github.com/fluxcd/go-git/v5/plumbing/format/gitignore"
33+
"github.com/go-git/go-git/v5/plumbing/format/gitignore"
3434
. "github.com/onsi/gomega"
3535

3636
sourcev1 "github.com/fluxcd/source-controller/api/v1"

0 commit comments

Comments
 (0)