Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ArgoCD AppSet does not recognize hidden directories that start with a dot #17915

Open
3 tasks done
BarAshkenazi opened this issue Apr 21, 2024 · 2 comments · May be fixed by #17957
Open
3 tasks done

ArgoCD AppSet does not recognize hidden directories that start with a dot #17915

BarAshkenazi opened this issue Apr 21, 2024 · 2 comments · May be fixed by #17957
Labels
bug Something isn't working

Comments

@BarAshkenazi
Copy link

Checklist:

  • I've searched in the docs and FAQ for my answer: https://bit.ly/argocd-faq.
  • I've included steps to reproduce the bug.
  • I've pasted the output of argocd version.

Describe the bug
ArgoCD AppSet does not recognize hidden directories that start with a dot within the Git generator.
It does recognize it when reading files:

 - git:
              repoURL: https://gitlab.comp.com/test/test-argocd.git
              revision: HEAD
              pathParamPrefix: serviceRepo
              files:
                 - path: .meta/app/*

but when changing the configuration to read directories it doesn’t read anything:

 - git:
              repoURL: https://gitlab.comp.com/test/test-argocd.git
              revision: HEAD
              pathParamPrefix: serviceRepo
              directories:
                 - path: .meta/app/*

It seems like an unplanned behavior ignoring the directories starting with a dot. this seems to be the root cause of this bug:

if strings.HasPrefix(fname, ".") { // Skip all folders starts with "."

It is probably needed to add a flag to support hidden directories so It will not be a breaking change because of this bug.

To Reproduce

  1. Create an ApplictionSet that is based on a git generator that reads directories from a folder that starts with "." (hidden).
    e.g:
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
  name: app-set-test
  namespace: argocd-new
spec:
  goTemplate: true
  goTemplateOptions: [ "missingkey=error" ]
  generators:
    - git:
        repoURL: https://gitlab.comp.com/poc/my-poc.git
        revision: HEAD
        pathParamPrefix: serviceRepo
        directories:
          - path: ".meta/app/*"
  template:
    metadata:
      name: 'my-test-{{index .serviceRepo.path.segments 2}}'
      labels:
        platform.io/control-plane: my
    spec:
      project: default
      source:
        repoURL: https://gitlab.comp.com/bar.ashkenazi/bar-test-argocd.git
        targetRevision: HEAD
        path: dep
      destination:
        server: 'https://kubernetes.default.svc'
        namespace: 'app-set-test-1'
      syncPolicy:
        syncOptions:
          - CreateNamespace=true
  1. in the source of the git generator (repoURL), create the following structure:
.meta
   app
     foo
        deployment.yaml
      bar
        deployment.yaml

3.sync the application-set.

Expected behavior

2 apps should have been created: my-test-foo and my-test-bar.
the actual behavior is that nothing was created because the hidden directory was skipped.

Screenshots

Version

argoCD Server: v2.10.6
applicationSet controller: v2.10.6

argocd: v2.10.2+fcf5d8c.dirty
  BuildDate: 2024-03-02T00:44:38Z
  GitCommit: fcf5d8c2381b68ab1621b90be63913b12cca2eb7
  GitTreeState: dirty
  GoVersion: go1.22.0
  Compiler: gc
  Platform: darwin/amd64
argocd-server: v2.10.6+d504d2b

Logs

time="2024-04-21T12:58:30Z" level=info msg="applications result from the repo service" allPaths="[]" pathParamPrefix=serviceRepo repoURL="https://gitlab.comp.com/my-repo/my-poc.git" revision=HEAD total=0
time="2024-04-21T12:58:30Z" level=info msg="generated 0 applications" applicationset=argocd-new/app-set-test generator="{nil nil &GitGenerator{RepoURL:https://gitlab.comp.com/my-repo/my-poc.git,Directories:[]GitDirectoryGeneratorItem{GitDirectoryGeneratorItem{Path:.meta/app/*,Exclude:false,},},Files:[]GitFileGeneratorItem{},Revision:HEAD,RequeueAfterSeconds:nil,Template:ApplicationSetTemplate{ApplicationSetTemplateMeta:ApplicationSetTemplateMeta{Name:,Namespace:,Labels:map[string]string{},Annotations:map[string]string{},Finalizers:[],},Spec:ApplicationSpec{Source:nil,Destination:ApplicationDestination{Server:,Namespace:,Name:,},Project:,SyncPolicy:nil,IgnoreDifferences:[]ResourceIgnoreDifferences{},Info:[]Info{},RevisionHistoryLimit:nil,Sources:[]ApplicationSource{},},},PathParamPrefix:serviceRepo,Values:map[string]string{},} nil nil nil nil nil nil nil}"
time="2024-04-21T12:58:30Z" level=info msg="end reconcile" applicationset=argocd-new/app-set-test requeueAfter=3m0s
@BarAshkenazi BarAshkenazi added the bug Something isn't working label Apr 21, 2024
@BarAshkenazi BarAshkenazi changed the title ArgoCD AppSet does not recognize hidden directories that start with dot ArgoCD AppSet does not recognize hidden directories that start with a dot Apr 21, 2024
@Killpit
Copy link

Killpit commented Apr 22, 2024

And so it does with other applications that we create hidden repositories such as .gitignore, so one of the solutions are using public repos but using .gitignore files even though it might now work for some cases

@BarAshkenazi
Copy link
Author

Attaching pull request (WIP)
#17957

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants