Skip to content
This repository has been archived by the owner on Oct 12, 2023. It is now read-only.

Add the ability to exclude files when using the git file generator #468

Open
adamjohnson01 opened this issue Jan 19, 2022 · 9 comments · May be fixed by #514
Open

Add the ability to exclude files when using the git file generator #468

adamjohnson01 opened this issue Jan 19, 2022 · 9 comments · May be fixed by #514

Comments

@adamjohnson01
Copy link

adamjohnson01 commented Jan 19, 2022

When using the git directory generator it is possible to exclude specific paths like this

  - git:
      repoURL: https://github.com/argoproj-labs/applicationset.git
      revision: HEAD
      directories:
      - path: examples/git-generator-directory/excludes/cluster-addons/*
      - path: examples/git-generator-directory/excludes/cluster-addons/exclude-helm-guestbook
        exclude: true

When using the git file generator I would like to be able to add files using a wildcard and then exclude specific files like this

spec:
  generators:
  - git:
      repoURL: https://github.com/argoproj-labs/applicationset.git
      revision: HEAD
      files:
      - path: "examples/git-generator-files-discovery/cluster-config/**/config.json"
      - path  "examples/git-generator-files-discovery/cluster-config/staging/config.json"
        exclude: true

Of course if there is another way to do this that I am not aware of then I would be happy to use that. If not I am also happy to implement this change if it is agreed.

@crenshaw-dev
Copy link
Collaborator

@adamjohnson01 I'm not aware of a workaround. Would you be willing to contribute the feature?

@adamjohnson01
Copy link
Author

@crenshaw-dev yes I am happy to contribute.

@templarfelix
Copy link

i need same feature, @adamjohnson01 you make this chances? if not call for me i write this.

@adamjohnson01
Copy link
Author

@templarfelix, I have this working. Will create a PR soon.

adamjohnson01 pushed a commit to adamjohnson01/applicationset that referenced this issue Feb 20, 2022
…tor (argoproj#468)

Signed-off-by: Adam Johnson <adamjohnson01gmail.com>
adamjohnson01 pushed a commit to adamjohnson01/applicationset that referenced this issue Feb 20, 2022
…tor (argoproj#468)

Signed-off-by: Adam Johnson <adamjohnson01@gmail.com>
adamjohnson01 added a commit to adamjohnson01/applicationset that referenced this issue Feb 21, 2022
…tor (argoproj#468)

Signed-off-by: Adam Johnson <adamjohnson01@gmail.com>
adamjohnson01 added a commit to adamjohnson01/applicationset that referenced this issue Feb 23, 2022
…tor (argoproj#468)

Signed-off-by: Adam Johnson <adamjohnson01@gmail.com>
adamjohnson01 added a commit to adamjohnson01/applicationset that referenced this issue Feb 26, 2022
…tor (argoproj#468)

Signed-off-by: Adam Johnson <adamjohnson01@gmail.com>
adamjohnson01 added a commit to adamjohnson01/applicationset that referenced this issue Feb 26, 2022
…tor (argoproj#468)

Signed-off-by: Adam Johnson <adamjohnson01@gmail.com>
adamjohnson01 added a commit to adamjohnson01/applicationset that referenced this issue Feb 27, 2022
…tor (argoproj#468)

Signed-off-by: Adam Johnson <adamjohnson01@gmail.com>
adamjohnson01 added a commit to adamjohnson01/applicationset that referenced this issue Feb 27, 2022
…tor (argoproj#468)

Signed-off-by: Adam Johnson <adamjohnson01@gmail.com>
adamjohnson01 added a commit to adamjohnson01/applicationset that referenced this issue Feb 27, 2022
…tor (argoproj#468)

Signed-off-by: Adam Johnson <adamjohnson01@gmail.com>
adamjohnson01 added a commit to adamjohnson01/applicationset that referenced this issue Feb 27, 2022
…tor (argoproj#468)

Signed-off-by: Adam Johnson <adamjohnson01@gmail.com>
adamjohnson01 added a commit to adamjohnson01/applicationset that referenced this issue Feb 27, 2022
…tor (argoproj#468)

Signed-off-by: Adam Johnson <adamjohnson01@gmail.com>
adamjohnson01 added a commit to adamjohnson01/applicationset that referenced this issue Feb 28, 2022
…tor (argoproj#468)

Signed-off-by: Adam Johnson <adamjohnson01@gmail.com>
@ErikLundJensen
Copy link

Will this feature also support exclude directories like /foo/** or /foo in the git files generator?

@adamjohnson01
Copy link
Author

adamjohnson01 commented Mar 3, 2022

Will this feature also support exclude directories like /foo/** or /foo in the git files generator?

Neither /foo/* or /foo would not work as the file list does not contain a full path. It is the output of git ls-files

foo/** would work but foo would not as the entire path needs to match. There needs to be either a ** or any pattern that is accepted by path.Match

pattern:
   { term }
term:
   '*'         matches any sequence of non-/ characters
   '?'         matches any single non-/ character
   '[' [ '^' ] { character-range } ']'
               character class (must be non-empty)
   c           matches character c (c != '*', '?', '\\', '[')
   '\\' c      matches character c

character-range:
   c           matches character c (c != '\\', '-', ']')
   '\\' c      matches character c
   lo '-' hi   matches character c for lo <= c <= hi

adamjohnson01 added a commit to adamjohnson01/applicationset that referenced this issue Mar 13, 2022
…tor (argoproj#468)

Signed-off-by: Adam Johnson <adamjohnson01@gmail.com>
adamjohnson01 added a commit to adamjohnson01/applicationset that referenced this issue Mar 13, 2022
…tor (argoproj#468)

Signed-off-by: Adam Johnson <adamjohnson01@gmail.com>
@DjoleLepi
Copy link

Any updates on this?
For me this would simplify the definition of ApplicationSets a lot

@crenshaw-dev
Copy link
Collaborator

@DjoleLepi I'm not sure if this PR was ever moved over to argoproj/argo-cd after applicationset was integrated with that repo.

@abelnieva
Copy link

HI that would great to have this feature

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants