From 3d484bee7bbdf4263ae38c6021dcd0f5b37c740a Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Sun, 20 Feb 2022 22:50:37 +0000 Subject: [PATCH] feat: add the ability to exclude files when using the git file generator (#468) Signed-off-by: Adam Johnson --- api/v1alpha1/applicationset_types.go | 18 ++--- api/v1alpha1/zz_generated.deepcopy.go | 49 ++++-------- docs/Generators-Git.md | 37 +++++++++ .../engineering/test/config.json | 9 +++ .../excludes/git-generator-files.yaml | 26 +++++++ go.mod | 3 +- .../crds/argoproj.io_applicationsets.yaml | 6 ++ manifests/install.yaml | 6 ++ pkg/generators/git.go | 44 +++++++---- pkg/generators/git_test.go | 78 +++++++++++++++---- pkg/generators/matrix_test.go | 4 +- .../e2e/applicationset/applicationset_test.go | 6 +- test/e2e/applicationset/matrix_e2e_test.go | 4 +- test/e2e/applicationset/merge_e2e_test.go | 4 +- 14 files changed, 210 insertions(+), 84 deletions(-) create mode 100644 examples/git-generator-files-discovery/cluster-config/engineering/test/config.json create mode 100644 examples/git-generator-files-discovery/excludes/git-generator-files.yaml diff --git a/api/v1alpha1/applicationset_types.go b/api/v1alpha1/applicationset_types.go index b6dc6bc1..7a223205 100644 --- a/api/v1alpha1/applicationset_types.go +++ b/api/v1alpha1/applicationset_types.go @@ -272,23 +272,19 @@ type DuckTypeGenerator struct { } type GitGenerator struct { - RepoURL string `json:"repoURL"` - Directories []GitDirectoryGeneratorItem `json:"directories,omitempty"` - Files []GitFileGeneratorItem `json:"files,omitempty"` - Revision string `json:"revision"` - RequeueAfterSeconds *int64 `json:"requeueAfterSeconds,omitempty"` - Template ApplicationSetTemplate `json:"template,omitempty"` + RepoURL string `json:"repoURL"` + Directories []GitGeneratorItem `json:"directories,omitempty"` + Files []GitGeneratorItem `json:"files,omitempty"` + Revision string `json:"revision"` + RequeueAfterSeconds *int64 `json:"requeueAfterSeconds,omitempty"` + Template ApplicationSetTemplate `json:"template,omitempty"` } -type GitDirectoryGeneratorItem struct { +type GitGeneratorItem struct { Path string `json:"path"` Exclude bool `json:"exclude,omitempty"` } -type GitFileGeneratorItem struct { - Path string `json:"path"` -} - // SCMProviderGenerator defines a generator that scrapes a SCMaaS API to find candidate repos. type SCMProviderGenerator struct { // Which provider to use and config for it. diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index 4248a934..260c2406 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -468,47 +468,17 @@ func (in *DuckTypeGenerator) DeepCopy() *DuckTypeGenerator { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *GitDirectoryGeneratorItem) DeepCopyInto(out *GitDirectoryGeneratorItem) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GitDirectoryGeneratorItem. -func (in *GitDirectoryGeneratorItem) DeepCopy() *GitDirectoryGeneratorItem { - if in == nil { - return nil - } - out := new(GitDirectoryGeneratorItem) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *GitFileGeneratorItem) DeepCopyInto(out *GitFileGeneratorItem) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GitFileGeneratorItem. -func (in *GitFileGeneratorItem) DeepCopy() *GitFileGeneratorItem { - if in == nil { - return nil - } - out := new(GitFileGeneratorItem) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *GitGenerator) DeepCopyInto(out *GitGenerator) { *out = *in if in.Directories != nil { in, out := &in.Directories, &out.Directories - *out = make([]GitDirectoryGeneratorItem, len(*in)) + *out = make([]GitGeneratorItem, len(*in)) copy(*out, *in) } if in.Files != nil { in, out := &in.Files, &out.Files - *out = make([]GitFileGeneratorItem, len(*in)) + *out = make([]GitGeneratorItem, len(*in)) copy(*out, *in) } if in.RequeueAfterSeconds != nil { @@ -529,6 +499,21 @@ func (in *GitGenerator) DeepCopy() *GitGenerator { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GitGeneratorItem) DeepCopyInto(out *GitGeneratorItem) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GitGeneratorItem. +func (in *GitGeneratorItem) DeepCopy() *GitGeneratorItem { + if in == nil { + return nil + } + out := new(GitGeneratorItem) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ListGenerator) DeepCopyInto(out *ListGenerator) { *out = *in diff --git a/docs/Generators-Git.md b/docs/Generators-Git.md index c0ffe5e7..a3ead7fb 100644 --- a/docs/Generators-Git.md +++ b/docs/Generators-Git.md @@ -233,6 +233,43 @@ In addition to the flattened key/value pairs from the configuration file, the fo - `{{path.basename}}`: Basename of the path to the folder containing the configuration file (e.g. `clusterA`, with the above example.) - `{{path.basenameNormalized}}`: This field is the same as `path.basename` with unsupported characters replaced with `-` (e.g. a `path` of `/directory/directory_2`, and `path.basename` of `directory_2` would produce `directory-2` here). +### Exclude files + +The Git file generator also supports an `exclude` option in order to exclude files in the repository from being scanned by the ApplicationSet controller: + +```yaml +apiVersion: argoproj.io/v1alpha1 +kind: ApplicationSet +metadata: + name: cluster-addons +spec: + generators: + - git: + repoURL: https://github.com/argoproj/applicationset.git + revision: HEAD + directories: + - path: "examples/git-generator-files-discovery/cluster-config/**/config.json" + - path: "examples/git-generator-files-discovery/cluster-config/*/test/config.json" + exclude: true + template: + metadata: + name: '{{path.basename}}' + spec: + project: default + source: + repoURL: https://github.com/argoproj/applicationset.git + targetRevision: HEAD + path: '{{path}}' + destination: + server: https://kubernetes.default.svc + namespace: '{{path.basename}}' +``` +(*The full example can be found [here](https://github.com/argoproj/applicationset/tree/master/examples/git-generator-files-discovery/excludes).*) + +This example excludes the config.json file in the `test` directory from the list of files scanned for this `ApplictionSet` resource. + +!!! note "Exclude rules are the same as for the Directory generator" + ## Webhook Configuration When using a Git generator, ApplicationSet polls Git repositories every three minutes to detect changes. To eliminate diff --git a/examples/git-generator-files-discovery/cluster-config/engineering/test/config.json b/examples/git-generator-files-discovery/cluster-config/engineering/test/config.json new file mode 100644 index 00000000..4c70f57e --- /dev/null +++ b/examples/git-generator-files-discovery/cluster-config/engineering/test/config.json @@ -0,0 +1,9 @@ +{ + "aws_account": "123456", + "asset_id": "11223344", + "cluster": { + "owner": "cluster-admin@company.com", + "name": "engineering-test", + "address": "http://1.2.3.4" + } +} diff --git a/examples/git-generator-files-discovery/excludes/git-generator-files.yaml b/examples/git-generator-files-discovery/excludes/git-generator-files.yaml new file mode 100644 index 00000000..abbc0486 --- /dev/null +++ b/examples/git-generator-files-discovery/excludes/git-generator-files.yaml @@ -0,0 +1,26 @@ +apiVersion: argoproj.io/v1alpha1 +kind: ApplicationSet +metadata: + name: guestbook +spec: + generators: + - git: + repoURL: https://github.com/argoproj/applicationset.git + revision: HEAD + files: + - path: "examples/git-generator-files-discovery/cluster-config/**/config.json" + - path: "examples/git-generator-files-discovery/cluster-config/**/config.json" + exclude: true + template: + metadata: + name: '{{cluster.name}}-guestbook' + spec: + project: default + source: + repoURL: https://github.com/argoproj/applicationset.git + targetRevision: HEAD + path: "examples/git-generator-files-discovery/apps/guestbook" + destination: + server: https://kubernetes.default.svc + #server: '{{cluster.address}}' + namespace: guestbook diff --git a/go.mod b/go.mod index 81f7868a..bdec706e 100644 --- a/go.mod +++ b/go.mod @@ -7,6 +7,7 @@ require ( github.com/argoproj/gitops-engine v0.5.1-0.20220126184517-b0c5e00ccfa5 github.com/argoproj/pkg v0.11.1-0.20211203175135-36c59d8fafe0 github.com/go-logr/logr v1.2.2 + github.com/gobwas/glob v0.2.3 github.com/google/go-github/v35 v35.0.0 github.com/imdario/mergo v0.3.12 github.com/jeremywohl/flatten v1.0.1 @@ -58,7 +59,6 @@ require ( github.com/go-openapi/swag v0.19.14 // indirect github.com/go-redis/cache/v8 v8.4.2 // indirect github.com/go-redis/redis/v8 v8.11.3 // indirect - github.com/gobwas/glob v0.2.3 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang-jwt/jwt/v4 v4.2.0 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect @@ -97,6 +97,7 @@ require ( github.com/opencontainers/go-digest v1.0.0 // indirect github.com/patrickmn/go-cache v2.1.0+incompatible // indirect github.com/peterbourgon/diskv v2.0.1+incompatible // indirect + github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/prometheus/client_golang v1.11.0 // indirect github.com/prometheus/client_model v0.2.0 // indirect diff --git a/manifests/crds/argoproj.io_applicationsets.yaml b/manifests/crds/argoproj.io_applicationsets.yaml index 7eda3253..9720e70a 100644 --- a/manifests/crds/argoproj.io_applicationsets.yaml +++ b/manifests/crds/argoproj.io_applicationsets.yaml @@ -667,6 +667,8 @@ spec: files: items: properties: + exclude: + type: boolean path: type: string required: @@ -1879,6 +1881,8 @@ spec: files: items: properties: + exclude: + type: boolean path: type: string required: @@ -4021,6 +4025,8 @@ spec: files: items: properties: + exclude: + type: boolean path: type: string required: diff --git a/manifests/install.yaml b/manifests/install.yaml index fec1e96d..8f07d8ad 100644 --- a/manifests/install.yaml +++ b/manifests/install.yaml @@ -666,6 +666,8 @@ spec: files: items: properties: + exclude: + type: boolean path: type: string required: @@ -1878,6 +1880,8 @@ spec: files: items: properties: + exclude: + type: boolean path: type: string required: @@ -4020,6 +4024,8 @@ spec: files: items: properties: + exclude: + type: boolean path: type: string required: diff --git a/pkg/generators/git.go b/pkg/generators/git.go index f41dab4c..9c47b147 100644 --- a/pkg/generators/git.go +++ b/pkg/generators/git.go @@ -11,6 +11,7 @@ import ( argoprojiov1alpha1 "github.com/argoproj/applicationset/api/v1alpha1" "github.com/argoproj/applicationset/pkg/services" + "github.com/gobwas/glob" "github.com/jeremywohl/flatten" log "github.com/sirupsen/logrus" "sigs.k8s.io/yaml" @@ -85,7 +86,7 @@ func (g *GitGenerator) generateParamsForGitDirectories(appSetGenerator *argoproj "revision": appSetGenerator.Git.Revision, }).Info("applications result from the repo service") - requestedApps := g.filterApps(appSetGenerator.Git.Directories, allPaths) + requestedApps := g.filterPaths(appSetGenerator.Git.Directories, allPaths) res := g.generateParamsFromApps(requestedApps, appSetGenerator) @@ -114,9 +115,11 @@ func (g *GitGenerator) generateParamsForGitFiles(appSetGenerator *argoprojiov1al } sort.Strings(allPaths) + filteredPaths := g.filterPaths(appSetGenerator.Git.Files, allPaths) + // Generate params from each path, and return res := []map[string]string{} - for _, path := range allPaths { + for _, path := range filteredPaths { // A JSON / YAML file path can contain multiple sets of parameters (ie it is an array) paramsArray, err := g.generateParamsFromGitFile(path, allFiles[path]) @@ -174,29 +177,36 @@ func (g *GitGenerator) generateParamsFromGitFile(filePath string, fileContent [] } -func (g *GitGenerator) filterApps(Directories []argoprojiov1alpha1.GitDirectoryGeneratorItem, allPaths []string) []string { +func (g *GitGenerator) filterPaths(items []argoprojiov1alpha1.GitGeneratorItem, allPaths []string) []string { res := []string{} - for _, appPath := range allPaths { - appInclude := false - appExclude := false - // Iterating over each appPath and check whether directories object has requestedPath that matches the appPath - for _, requestedPath := range Directories { - match, err := path.Match(requestedPath.Path, appPath) - if err != nil { - log.WithError(err).WithField("requestedPath", requestedPath). - WithField("appPath", appPath).Error("error while matching appPath to requestedPath") - continue + for _, itemPath := range allPaths { + include := false + exclude := false + for _, requestedPath := range items { + var match bool + var err error + if strings.Contains(requestedPath.Path, "**") { + pathGlob := glob.MustCompile(requestedPath.Path) + match = pathGlob.Match(itemPath) + } else { + match, err = path.Match(requestedPath.Path, itemPath) + if err != nil { + log.WithError(err).WithField("requestedPath", requestedPath). + WithField("appPath", itemPath).Error("error while matching appPath to requestedPath") + continue + } } + if match && !requestedPath.Exclude { - appInclude = true + include = true } if match && requestedPath.Exclude { - appExclude = true + exclude = true } } // Whenever there is a path with exclude: true it wont be included, even if it is included in a different path pattern - if appInclude && !appExclude { - res = append(res, appPath) + if include && !exclude { + res = append(res, itemPath) } } return res diff --git a/pkg/generators/git_test.go b/pkg/generators/git_test.go index cada8ba7..ba1e7d98 100644 --- a/pkg/generators/git_test.go +++ b/pkg/generators/git_test.go @@ -50,7 +50,7 @@ func TestGitGenerateParamsFromDirectories(t *testing.T) { cases := []struct { name string - directories []argoprojiov1alpha1.GitDirectoryGeneratorItem + directories []argoprojiov1alpha1.GitGeneratorItem repoApps []string repoError error expected []map[string]string @@ -58,7 +58,7 @@ func TestGitGenerateParamsFromDirectories(t *testing.T) { }{ { name: "happy flow - created apps", - directories: []argoprojiov1alpha1.GitDirectoryGeneratorItem{{Path: "*"}}, + directories: []argoprojiov1alpha1.GitGeneratorItem{{Path: "*"}}, repoApps: []string{ "app1", "app2", @@ -75,7 +75,7 @@ func TestGitGenerateParamsFromDirectories(t *testing.T) { }, { name: "It filters application according to the paths", - directories: []argoprojiov1alpha1.GitDirectoryGeneratorItem{{Path: "p1/*"}, {Path: "p1/*/*"}}, + directories: []argoprojiov1alpha1.GitGeneratorItem{{Path: "p1/*"}, {Path: "p1/*/*"}}, repoApps: []string{ "app1", "p1/app2", @@ -91,7 +91,7 @@ func TestGitGenerateParamsFromDirectories(t *testing.T) { }, { name: "It filters application according to the paths with Exclude", - directories: []argoprojiov1alpha1.GitDirectoryGeneratorItem{{Path: "p1/*", Exclude: true}, {Path: "*"}, {Path: "*/*"}}, + directories: []argoprojiov1alpha1.GitGeneratorItem{{Path: "p1/*", Exclude: true}, {Path: "*"}, {Path: "*/*"}}, repoApps: []string{ "app1", "app2", @@ -109,7 +109,7 @@ func TestGitGenerateParamsFromDirectories(t *testing.T) { }, { name: "Expecting same exclude behavior with different order", - directories: []argoprojiov1alpha1.GitDirectoryGeneratorItem{{Path: "*"}, {Path: "*/*"}, {Path: "p1/*", Exclude: true}}, + directories: []argoprojiov1alpha1.GitGeneratorItem{{Path: "*"}, {Path: "*/*"}, {Path: "p1/*", Exclude: true}}, repoApps: []string{ "app1", "app2", @@ -127,7 +127,7 @@ func TestGitGenerateParamsFromDirectories(t *testing.T) { }, { name: "handles empty response from repo server", - directories: []argoprojiov1alpha1.GitDirectoryGeneratorItem{{Path: "*"}}, + directories: []argoprojiov1alpha1.GitGeneratorItem{{Path: "*"}}, repoApps: []string{}, repoError: nil, expected: []map[string]string{}, @@ -135,12 +135,30 @@ func TestGitGenerateParamsFromDirectories(t *testing.T) { }, { name: "handles error from repo server", - directories: []argoprojiov1alpha1.GitDirectoryGeneratorItem{{Path: "*"}}, + directories: []argoprojiov1alpha1.GitGeneratorItem{{Path: "*"}}, repoApps: []string{}, repoError: fmt.Errorf("error"), expected: []map[string]string{}, expectedError: fmt.Errorf("error"), }, + { + name: "glob works for directories as well", + directories: []argoprojiov1alpha1.GitGeneratorItem{{Path: "p1/*", Exclude: true}, {Path: "**"}}, + repoApps: []string{ + "app1", + "app2", + "p1/app2", + "p1/app3", + "p2/app3", + }, + repoError: nil, + expected: []map[string]string{ + {"path": "app1", "path.basename": "app1", "path.basenameNormalized": "app1"}, + {"path": "app2", "path.basename": "app2", "path.basenameNormalized": "app2"}, + {"path": "p2/app3", "path.basename": "app3", "path[0]": "p2", "path.basenameNormalized": "app3"}, + }, + expectedError: nil, + }, } for _, testCase := range cases { @@ -189,7 +207,7 @@ func TestGitGenerateParamsFromFiles(t *testing.T) { cases := []struct { name string // files is the list of paths/globs to match - files []argoprojiov1alpha1.GitFileGeneratorItem + files []argoprojiov1alpha1.GitGeneratorItem // repoFileContents maps repo path to the literal contents of that path repoFileContents map[string][]byte // if repoPathsError is non-nil, the call to GetPaths(...) will return this error value @@ -199,7 +217,7 @@ func TestGitGenerateParamsFromFiles(t *testing.T) { }{ { name: "happy flow: create params from git files", - files: []argoprojiov1alpha1.GitFileGeneratorItem{{Path: "**/config.json"}}, + files: []argoprojiov1alpha1.GitGeneratorItem{{Path: "**/config.json"}}, repoFileContents: map[string][]byte{ "cluster-config/production/config.json": []byte(`{ "cluster": { @@ -253,7 +271,7 @@ func TestGitGenerateParamsFromFiles(t *testing.T) { }, { name: "handles error during getting repo paths", - files: []argoprojiov1alpha1.GitFileGeneratorItem{{Path: "**/config.json"}}, + files: []argoprojiov1alpha1.GitGeneratorItem{{Path: "**/config.json"}}, repoFileContents: map[string][]byte{}, repoPathsError: fmt.Errorf("paths error"), expected: []map[string]string{}, @@ -261,7 +279,7 @@ func TestGitGenerateParamsFromFiles(t *testing.T) { }, { name: "test invalid JSON file returns error", - files: []argoprojiov1alpha1.GitFileGeneratorItem{{Path: "**/config.json"}}, + files: []argoprojiov1alpha1.GitGeneratorItem{{Path: "**/config.json"}}, repoFileContents: map[string][]byte{ "cluster-config/production/config.json": []byte(`invalid json file`), }, @@ -271,7 +289,7 @@ func TestGitGenerateParamsFromFiles(t *testing.T) { }, { name: "test JSON array", - files: []argoprojiov1alpha1.GitFileGeneratorItem{{Path: "**/config.json"}}, + files: []argoprojiov1alpha1.GitGeneratorItem{{Path: "**/config.json"}}, repoFileContents: map[string][]byte{ "cluster-config/production/config.json": []byte(` [ @@ -320,7 +338,7 @@ func TestGitGenerateParamsFromFiles(t *testing.T) { }, { name: "Test YAML flow", - files: []argoprojiov1alpha1.GitFileGeneratorItem{{Path: "**/config.yaml"}}, + files: []argoprojiov1alpha1.GitGeneratorItem{{Path: "**/config.yaml"}}, repoFileContents: map[string][]byte{ "cluster-config/production/config.yaml": []byte(` cluster: @@ -368,7 +386,7 @@ cluster: }, { name: "test YAML array", - files: []argoprojiov1alpha1.GitFileGeneratorItem{{Path: "**/config.yaml"}}, + files: []argoprojiov1alpha1.GitGeneratorItem{{Path: "**/config.yaml"}}, repoFileContents: map[string][]byte{ "cluster-config/production/config.yaml": []byte(` - cluster: @@ -406,6 +424,38 @@ cluster: }, expectedError: nil, }, + { + name: "Check that files are filtered", + files: []argoprojiov1alpha1.GitGeneratorItem{{Path: "**/config.yaml"}, + {Path: "cluster-config/staging/config.yaml", Exclude: true}}, + repoFileContents: map[string][]byte{ + "cluster-config/production/config.yaml": []byte(` +cluster: + owner: john.doe@example.com + name: production + address: https://kubernetes.default.svc +`), + "cluster-config/staging/config.yaml": []byte(` +cluster: + owner: foo.bar@example.com + name: staging + address: https://kubernetes.default.svc +`), + }, + repoPathsError: nil, + expected: []map[string]string{ + { + "cluster.owner": "john.doe@example.com", + "cluster.name": "production", + "cluster.address": "https://kubernetes.default.svc", + "path": "cluster-config/production", + "path.basename": "production", + "path[0]": "cluster-config", + "path.basenameNormalized": "production", + }, + }, + expectedError: nil, + }, } for _, testCase := range cases { diff --git a/pkg/generators/matrix_test.go b/pkg/generators/matrix_test.go index a961f524..216baa5f 100644 --- a/pkg/generators/matrix_test.go +++ b/pkg/generators/matrix_test.go @@ -15,7 +15,7 @@ func TestMatrixGenerate(t *testing.T) { gitGenerator := &argoprojiov1alpha1.GitGenerator{ RepoURL: "RepoURL", Revision: "Revision", - Directories: []argoprojiov1alpha1.GitDirectoryGeneratorItem{{Path: "*"}}, + Directories: []argoprojiov1alpha1.GitGeneratorItem{{Path: "*"}}, } listGenerator := &argoprojiov1alpha1.ListGenerator{ @@ -183,7 +183,7 @@ func TestMatrixGetRequeueAfter(t *testing.T) { gitGenerator := &argoprojiov1alpha1.GitGenerator{ RepoURL: "RepoURL", Revision: "Revision", - Directories: []argoprojiov1alpha1.GitDirectoryGeneratorItem{{Path: "*"}}, + Directories: []argoprojiov1alpha1.GitGeneratorItem{{Path: "*"}}, } listGenerator := &argoprojiov1alpha1.ListGenerator{ diff --git a/test/e2e/applicationset/applicationset_test.go b/test/e2e/applicationset/applicationset_test.go index 0e50691e..87ba084c 100644 --- a/test/e2e/applicationset/applicationset_test.go +++ b/test/e2e/applicationset/applicationset_test.go @@ -191,7 +191,7 @@ func TestSimpleGitDirectoryGenerator(t *testing.T) { { Git: &v1alpha1.GitGenerator{ RepoURL: "https://github.com/argoproj/argocd-example-apps.git", - Directories: []v1alpha1.GitDirectoryGeneratorItem{ + Directories: []v1alpha1.GitGeneratorItem{ { Path: "*guestbook*", }, @@ -300,7 +300,7 @@ func TestSimpleGitFilesGenerator(t *testing.T) { { Git: &v1alpha1.GitGenerator{ RepoURL: "https://github.com/argoproj/applicationset.git", - Files: []v1alpha1.GitFileGeneratorItem{ + Files: []v1alpha1.GitGeneratorItem{ { Path: "examples/git-generator-files-discovery/cluster-config/**/config.json", }, @@ -384,7 +384,7 @@ func TestSimpleGitFilesPreserveResourcesOnDeletion(t *testing.T) { { Git: &v1alpha1.GitGenerator{ RepoURL: "https://github.com/argoproj/applicationset.git", - Files: []v1alpha1.GitFileGeneratorItem{ + Files: []v1alpha1.GitGeneratorItem{ { Path: "examples/git-generator-files-discovery/cluster-config/**/config.json", }, diff --git a/test/e2e/applicationset/matrix_e2e_test.go b/test/e2e/applicationset/matrix_e2e_test.go index be5d8bb2..2e3d87eb 100644 --- a/test/e2e/applicationset/matrix_e2e_test.go +++ b/test/e2e/applicationset/matrix_e2e_test.go @@ -89,7 +89,7 @@ func TestListMatrixGenerator(t *testing.T) { { Git: &v1alpha1.GitGenerator{ RepoURL: "https://github.com/argoproj/argocd-example-apps.git", - Directories: []v1alpha1.GitDirectoryGeneratorItem{ + Directories: []v1alpha1.GitGeneratorItem{ { Path: "*guestbook*", }, @@ -216,7 +216,7 @@ func TestClusterMatrixGenerator(t *testing.T) { { Git: &v1alpha1.GitGenerator{ RepoURL: "https://github.com/argoproj/argocd-example-apps.git", - Directories: []v1alpha1.GitDirectoryGeneratorItem{ + Directories: []v1alpha1.GitGeneratorItem{ { Path: "*guestbook*", }, diff --git a/test/e2e/applicationset/merge_e2e_test.go b/test/e2e/applicationset/merge_e2e_test.go index 4ed34544..484e613e 100644 --- a/test/e2e/applicationset/merge_e2e_test.go +++ b/test/e2e/applicationset/merge_e2e_test.go @@ -78,7 +78,7 @@ func TestListMergeGenerator(t *testing.T) { { Git: &v1alpha1.GitGenerator{ RepoURL: "https://github.com/argoproj/argocd-example-apps.git", - Directories: []v1alpha1.GitDirectoryGeneratorItem{ + Directories: []v1alpha1.GitGeneratorItem{ { Path: "*guestbook*", }, @@ -220,7 +220,7 @@ func TestClusterMergeGenerator(t *testing.T) { { Git: &v1alpha1.GitGenerator{ RepoURL: "https://github.com/argoproj/argocd-example-apps.git", - Directories: []v1alpha1.GitDirectoryGeneratorItem{ + Directories: []v1alpha1.GitGeneratorItem{ { Path: "*guestbook*", },