Skip to content

Commit ff716dd

Browse files
authored
chore: Update argocd, k8s & kustomize deps (#46)
* Update argocd dep Signed-off-by: Siddhesh Ghadi <[email protected]> * go mod tidy Signed-off-by: Siddhesh Ghadi <[email protected]> * Upgrade kustomize dep Signed-off-by: Siddhesh Ghadi <[email protected]> * Fix gofmt Signed-off-by: Siddhesh Ghadi <[email protected]> * Fix gomod Signed-off-by: Siddhesh Ghadi <[email protected]> --------- Signed-off-by: Siddhesh Ghadi <[email protected]>
1 parent d83d568 commit ff716dd

File tree

11 files changed

+615
-1157
lines changed

11 files changed

+615
-1157
lines changed

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
default: test
22

3+
.PHONY: build
4+
build:
5+
go build -v ./...
6+
37
.PHONY: test
48
test:
59
go test `go list ./... | grep -v test`

go.mod

Lines changed: 126 additions & 149 deletions
Large diffs are not rendered by default.

go.sum

Lines changed: 432 additions & 960 deletions
Large diffs are not rendered by default.

pkg/cmd/root.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"log"
77
"net/http"
88

9-
argoV1aplha1 "github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1"
9+
argoV1aplha1 "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
1010
"github.com/prometheus/client_golang/prometheus/promhttp"
1111
"github.com/spf13/cobra"
1212
"github.com/spf13/viper"

pkg/gitfs/gitfs.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@ package gitfs
33
import (
44
"fmt"
55
"path"
6+
"path/filepath"
67
"strings"
78

89
"github.com/go-git/go-git/v5"
910
"github.com/go-git/go-git/v5/plumbing/object"
1011
"github.com/go-git/go-git/v5/plumbing/storer"
1112
"github.com/go-git/go-git/v5/storage/memory"
12-
"sigs.k8s.io/kustomize/pkg/fs"
13+
fs "sigs.k8s.io/kustomize/kyaml/filesys"
1314
)
1415

1516
// gitFS is an internal implementation of the Kustomize
@@ -136,6 +137,16 @@ func (g gitFS) WriteFile(name string, data []byte) error {
136137
return errNotSupported("WriteFile")
137138
}
138139

140+
// Walk implementation for fs.FileSystem
141+
func (g gitFS) Walk(path string, walkFn filepath.WalkFunc) error {
142+
return errNotSupported("Walk")
143+
}
144+
145+
// ReadDir implementation for fs.FileSystem
146+
func (g gitFS) ReadDir(path string) ([]string, error) {
147+
return []string{}, errNotSupported("ReadDir")
148+
}
149+
139150
func errNotSupported(s string) error {
140151
return notSupported(s)
141152
}

pkg/gitfs/gitfs_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"testing"
66

77
"github.com/google/go-cmp/cmp"
8-
"sigs.k8s.io/kustomize/pkg/fs"
8+
fs "sigs.k8s.io/kustomize/kyaml/filesys"
99

1010
"github.com/redhat-developer/gitops-backend/test"
1111
)

pkg/httpapi/api.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
"net/url"
1313
"strings"
1414

15-
argoV1aplha1 "github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1"
15+
argoV1aplha1 "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
1616
"github.com/julienschmidt/httprouter"
1717
corev1 "k8s.io/api/core/v1"
1818
"k8s.io/apimachinery/pkg/types"

pkg/httpapi/api_test.go

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
"testing"
1414
"time"
1515

16-
argoV1aplha1 "github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1"
16+
argoV1aplha1 "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
1717
gogit "github.com/go-git/go-git/v5"
1818
"github.com/google/go-cmp/cmp"
1919
"github.com/redhat-developer/gitops-backend/pkg/git"
@@ -32,6 +32,18 @@ const (
3232
testRef = "7638417db6d59f3c431d3e1f261cc637155684cd"
3333
)
3434

35+
func makeTestClient() ctrlclient.Client {
36+
_ = argoV1aplha1.AddToScheme(scheme.Scheme)
37+
builder := fake.NewClientBuilder().WithIndex(
38+
&argoV1aplha1.Application{},
39+
"metadata.name",
40+
func(o ctrlclient.Object) []string {
41+
return []string{o.GetName()}
42+
},
43+
)
44+
return builder.Build()
45+
}
46+
3547
func TestGetPipelines(t *testing.T) {
3648
ts, c := makeServer(t)
3749
c.addContents("example/gitops", "pipelines.yaml", "HEAD", "testdata/pipelines.yaml")
@@ -403,13 +415,8 @@ func TestListApplications_badURL(t *testing.T) {
403415
}
404416

405417
func TestGetApplicationDetails(t *testing.T) {
406-
err := argoV1aplha1.AddToScheme(scheme.Scheme)
407-
if err != nil {
408-
t.Fatal(err)
409-
}
410-
411-
builder := fake.NewClientBuilder()
412-
kc := builder.Build()
418+
var err error
419+
kc := makeTestClient()
413420

414421
ts, _ := makeServer(t, func(router *APIRouter) {
415422
router.k8sClient = kc
@@ -510,13 +517,8 @@ func TestGetApplicationDetails(t *testing.T) {
510517
}
511518

512519
func TestGetApplicationHistory(t *testing.T) {
513-
err := argoV1aplha1.AddToScheme(scheme.Scheme)
514-
if err != nil {
515-
t.Fatal(err)
516-
}
517-
518-
builder := fake.NewClientBuilder()
519-
kc := builder.Build()
520+
var err error
521+
kc := makeTestClient()
520522

521523
ts, _ := makeServer(t, func(router *APIRouter) {
522524
router.k8sClient = kc

pkg/httpapi/conversion.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
package httpapi
22

33
import (
4-
log "github.com/sirupsen/logrus"
5-
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
64
"sort"
75
"strings"
86

9-
argoV1aplha1 "github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1"
7+
log "github.com/sirupsen/logrus"
8+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
9+
10+
argoV1aplha1 "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
1011
)
1112

1213
// TODO: this should really import the config from the upstream and use it to

pkg/httpapi/conversion_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@ package httpapi
22

33
import (
44
"fmt"
5-
argoV1aplha1 "github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1"
65
"testing"
76
"time"
87

8+
argoV1aplha1 "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
9+
910
"github.com/google/go-cmp/cmp"
1011
)
1112

0 commit comments

Comments
 (0)