From f7212fcdd43e3650c25668388b3e9c900b2aedc8 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 ++++++++++++ docs/assets/broken-link-ignore-list.txt | 1 + .../engineering/test/config.json | 9 +++ .../excludes/git-generator-files.yaml | 26 ++++++++ go.mod | 2 + go.sum | 2 + .../crds/argoproj.io_applicationsets.yaml | 6 ++ manifests/install.yaml | 6 ++ pkg/generators/git.go | 37 +++++++++++- pkg/generators/git_test.go | 60 ++++++++++++++----- 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 +- 16 files changed, 203 insertions(+), 68 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..d2966a76 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. + +File exclude paths are matched using [doublestar.Match](https://github.com/bmatcuk/doublestar/blob/master/match.go#L8) + ## Webhook Configuration When using a Git generator, ApplicationSet polls Git repositories every three minutes to detect changes. To eliminate diff --git a/docs/assets/broken-link-ignore-list.txt b/docs/assets/broken-link-ignore-list.txt index 8463f045..2a71ffa4 100644 --- a/docs/assets/broken-link-ignore-list.txt +++ b/docs/assets/broken-link-ignore-list.txt @@ -8,3 +8,4 @@ https://github.com/argoproj/applicationset/commit https://github.com/infra-team/cluster-deployments.git https://gitlab.example.com/ https://kubernetes.default.svc +https://github.com/argoproj/applicationset/tree/master/examples/git-generator-files-discovery/excludes 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..ddb47788 --- /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/*/test/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..ec855870 100644 --- a/go.mod +++ b/go.mod @@ -6,6 +6,7 @@ require ( github.com/argoproj/argo-cd/v2 v2.3.0-rc5.0.20220206192056-4b04a3918029 github.com/argoproj/gitops-engine v0.5.1-0.20220126184517-b0c5e00ccfa5 github.com/argoproj/pkg v0.11.1-0.20211203175135-36c59d8fafe0 + github.com/bmatcuk/doublestar/v4 v4.0.2 github.com/go-logr/logr v1.2.2 github.com/google/go-github/v35 v35.0.0 github.com/imdario/mergo v0.3.12 @@ -97,6 +98,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/go.sum b/go.sum index 9474b218..354e45e6 100644 --- a/go.sum +++ b/go.sum @@ -148,6 +148,8 @@ github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJm github.com/bketelsen/crypt v0.0.4/go.mod h1:aI6NrJ0pMGgvZKL1iVgXLnfIFJtfV+bKCoqOes/6LfM= github.com/blang/semver v3.5.0+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= +github.com/bmatcuk/doublestar/v4 v4.0.2 h1:X0krlUVAVmtr2cRoTqR8aDMrDqnB36ht8wpWTiQ3jsA= +github.com/bmatcuk/doublestar/v4 v4.0.2/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc= github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps= github.com/bombsimon/logrusr/v2 v2.0.1 h1:1VgxVNQMCvjirZIYaT9JYn6sAVGVEcNtRE0y4mvaOAM= github.com/bombsimon/logrusr/v2 v2.0.1/go.mod h1:ByVAX+vHdLGAfdroiMg6q0zgq2FODY2lc5YJvzmOJio= 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..0321ad6a 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/bmatcuk/doublestar/v4" "github.com/jeremywohl/flatten" log "github.com/sirupsen/logrus" "sigs.k8s.io/yaml" @@ -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,7 +177,7 @@ func (g *GitGenerator) generateParamsFromGitFile(filePath string, fileContent [] } -func (g *GitGenerator) filterApps(Directories []argoprojiov1alpha1.GitDirectoryGeneratorItem, allPaths []string) []string { +func (g *GitGenerator) filterApps(Directories []argoprojiov1alpha1.GitGeneratorItem, allPaths []string) []string { res := []string{} for _, appPath := range allPaths { appInclude := false @@ -202,6 +205,36 @@ func (g *GitGenerator) filterApps(Directories []argoprojiov1alpha1.GitDirectoryG return res } +func (g *GitGenerator) filterPaths(items []argoprojiov1alpha1.GitGeneratorItem, allPaths []string) []string { + res := []string{} + for _, itemPath := range allPaths { + include := false + exclude := false + for _, requestedPath := range items { + var match bool + var err error + match, err = doublestar.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 { + include = true + } + if match && requestedPath.Exclude { + 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 include && !exclude { + res = append(res, itemPath) + } + } + return res +} + func (g *GitGenerator) generateParamsFromApps(requestedApps []string, _ *argoprojiov1alpha1.ApplicationSetGenerator) []map[string]string { // TODO: At some point, the appicationSetGenerator param should be used diff --git a/pkg/generators/git_test.go b/pkg/generators/git_test.go index cada8ba7..03294da7 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,7 +135,7 @@ 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{}, @@ -189,7 +189,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 +199,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 +253,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 +261,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 +271,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 +320,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 +368,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 +406,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*", },