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

Get "error listing repos: 404 Not Found" error when scmProvider generator filter include GitLab archived repo #21340

Open
ZeBidule opened this issue Dec 31, 2024 · 1 comment
Labels
bug Something isn't working component:application-sets Bulk application management related version:2.13 Latest confirmed affected version is 2.13

Comments

@ZeBidule
Copy link

Describe the bug

All my ApplicationSet that use scmProvider generator filter that include at least one GitLab archived repo are not healthy with the message "error listing repos: 404 Not Found".
The problem is solved when I modify the filters to exclude the archived GitLab repo (restrict the labelMatch or repositoryMatch). I can also solve the issue by deleting the filtered branch (state in my case) from each archived GitLab repo.

To Reproduce

Deploy an ApplicationSet using scmProvider generator filter that include at least one GitLab archived repo, example :

apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
  name: tinyeh
  namespace: argocd
  annotations:
    argocd.argoproj.io/sync-options: Prune=false
spec:
  generators:
  - scmProvider:
      requeueAfterSeconds: 600
      cloneProtocol: ssh
      gitlab:
        group: teh
        allBranches: true
        api: https://xxx.xxx/
        includeSubgroups: true
        tokenRef:
          key: token
          secretName: gitlab-appset-token
      filters:
      - branchMatch: ^state$
        labelMatch: ^deploy$
        pathsExist: [integ/eu-central-1]
        repositoryMatch: \.deploy$
  template:
    metadata:
      name: 'tinyeh-{{repository}}'
      labels:
        app.kubernetes.io/name: tinyeh
        app.kubernetes.io/part-of: tinyeh
    spec:
      destination:
        namespace: tinyeh
        server: https://kubernetes.default.svc
      project: tinyeh
      source:
        path: integ/eu-central-1
        repoURL: '{{ url }}'
        targetRevision: '{{ branch }}'
      syncPolicy:
        automated:
          prune: true
          selfHeal: true

Expected behavior

The ApplicationSet generator should discover all the GitLab repos that match the filters, but should exclude archived GitLab repos. The pull request 20736 sould resolve my problem when it will be merged.

Screenshots

image

Version

GitLab version: v17.7.0

argocd: v2.13.2
  BuildDate: unknown
  GitCommit: v2.13.2
  GitTreeState: clean
  GitTag: v2.13.2
  GoVersion: go1.23.3
  Compiler: gc
  Platform: linux/amd64
argocd-server: v2.13.2
  BuildDate: unknown
  GitCommit: v2.13.2
  GitTreeState: clean
  GitTag: v2.13.2
  GoVersion: go1.23.3
  Compiler: gc
  Platform: linux/amd64
  Kustomize Version: 5.5.0 unknown

Logs

argocd-applicationset-controller logs extarct :

time="2024-12-31T14:01:37Z" level=error msg="Reconciler error" ApplicationSet=argocd/tinyeh controller=applicationset controllerGroup=argoproj.io controllerKind=ApplicationSet error="error listing repos: 404 Not Found" name=tinyeh namespace=argocd reconcileID=133384e3-93fa-41aa-b34c-dc88540a747b
time="2024-12-31T14:01:57Z" level=error msg="error generating params" error="error listing repos: 404 Not Found" generator="&{0xc0007a5440 <nil> { [] true 0xc0011775a0}}"
time="2024-12-31T14:01:57Z" level=error msg="error generating application from params" applicationset=argocd/tinyeh error="error listing repos: 404 Not Found" generator="{nil nil nil &SCMProviderGenerator{Github:nil,Gitlab:&SCMProviderGeneratorGitlab{Group:teh,IncludeSubgroups:true,API:https://xxx.xxx/,TokenRef:&SecretRef{SecretName:gitlab-appset-token,Key:token,},AllBranches:true,Insecure:false,IncludeSharedProjects:nil,Topic:,CARef:nil,},Bitbucket:nil,BitbucketServer:nil,Gitea:nil,AzureDevOps:nil,Filters:[]SCMProviderGeneratorFilter{SCMProviderGeneratorFilter{RepositoryMatch:*\\.deploy$,PathsExist:[integ/eu-central-1],PathsDoNotExist:[],LabelMatch:*^deploy$,BranchMatch:*^state$,},},CloneProtocol:ssh,RequeueAfterSeconds:*600,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{},},},Values:map[string]string{},AWSCodeCommit:nil,} nil nil nil nil nil nil}"
time="2024-12-31T14:01:57Z" level=error msg="Reconciler error" ApplicationSet=argocd/tinyeh controller=applicationset controllerGroup=argoproj.io controllerKind=ApplicationSet error="error listing repos: 404 Not Found" name=tinyeh namespace=argocd reconcileID=f8015446-aec0-4d76-bfd5-f9d1f01dedac
@ZeBidule ZeBidule added the bug Something isn't working label Dec 31, 2024
@andrii-korotkov-verkada andrii-korotkov-verkada added component:application-sets Bulk application management related version:2.13 Latest confirmed affected version is 2.13 labels Jan 1, 2025
@ZeBidule
Copy link
Author

ZeBidule commented Jan 3, 2025

I think that this issue is linked to an API change in the version 17.7.0 of GitLab because it was working fine when we were in 17.6.2.
For example, this change could be a probable cause : https://gitlab.com/gitlab-org/gitlab/-/commit/1739a9d16a46b332c2bc4aeb7e1cefbaa56dfe04

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working component:application-sets Bulk application management related version:2.13 Latest confirmed affected version is 2.13
Projects
None yet
Development

No branches or pull requests

2 participants