argoproj / argo-cd

Declarative Continuous Deployment for Kubernetes
https://argo-cd.readthedocs.io
Apache License 2.0
17.5k stars 5.32k forks source link

Internal desc = Failed to fetch default: `git fetch origin --tags --force --prune` #16532

Open thoefkens opened 9 months ago

thoefkens commented 9 months ago

Checklist:

Describe the bug

I have tried connecting a new repository from our gitlab instance containing kustomize overlays to ArgoCD in our K8S cluster. This has worked fine, both using SSH and HTTPS the repo shows as "Connected". However, when setting up an application that uses that repo, the application fails to refresh its state with this error:

stream read failed: rpc error: code = Unknown desc = error getting app resource tree: error getting cached app resource tree: ComparisonError: rpc error: code = Internal desc = Failed to fetch default:git fetch origin --tags --force --prunefailed timeout after 1m30s

The application looks like this:

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: proj-dev-new-app
  namespace: argocd
spec:
  project: proj-dev
  source:
    repoURL: https://git.xxxcom/pimcore/backend-code.git --> this is the repo configured with the same URL under "Repositories"
    targetRevision: feature/test_new_deployment
    path: backend-code-kustomize/overlay/dev
  destination:
    server: https://kubernetes.default.svc
    namespace: proj-dev-new
  syncPolicy:
    syncOptions:
    - CreateNamespace=true
    automated:
      selfHeal: true
      prune: true

I have been unable to find out why this happens. We have another repo connected from the same gitlab instance and those applications sync fine.

To Reproduce

  1. Create a repo. (SSH or HTTPS)
  2. Add an application for that Repo URL.

Expected behavior

Applications based on repo URL will work fine if the repo is connected and the target revision/path exist.

Version

argocd-server: v2.7.14+a40c95a.dirty BuildDate: 2023-09-07T16:50:42Z GitCommit: a40c95a6383baa0d9f670586a5c295021f59337c GitTreeState: dirty GoVersion: go1.19.10 Compiler: gc Platform: linux/amd64 Kustomize Version: v5.0.1 2023-03-14T01:32:48Z Helm Version: v3.11.2+g912ebc1 Kubectl Version: v0.24.2 Jsonnet Version: v0.19.1 Logs

Puvendhan commented 2 months ago

I am also seeing similar issue, Any fix on this?

Puvendhan commented 1 month ago

Any fix for this?, can anyone look into this?

deer-wmde commented 1 month ago

I'm also experiencing this with argo-cd v2.10.7.

This is a full Application manifest that I'm encountering this with, hopefully someone can reproduce it:

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: redis
  namespace: argocd
  finalizers:
  - resources-finalizer.argocd.argoproj.io
spec:
  destination:
    namespace: default
    server: https://kubernetes.default.svc
  project: default
  source:
    repoURL: https://github.com/bitnami/charts.git
    path: bitnami/redis
    targetRevision: HEAD

  syncPolicy:
    automated:
      selfHeal: false
      prune: true
gka038 commented 1 month ago

I am facing this issue too.

dangerousidea commented 2 weeks ago

I'm facing the similar issue.

Root Application -> AppSet -> Applications

When I first configure the project, it works fine. But when the appset tries to fetch new git revision, it just reports "Failed to fetch default"

However, if I make some changes to the root application, delete the appset without cascade, trigger it to init again, then it can fetch the latest git revision without any problem. But sometime later, when appset tries to fetch latest revision, it brokes again... So I'm pretty sure my credentials doesn't have problem.

petrlebedev commented 2 weeks ago

Hope using SSH for repos will fix that

deer-wmde commented 2 weeks ago

Hope using SSH for repos will fix that

As far as I understand, for public repositories, SSH effectively can't be used as you can't anonymously clone them like with HTTPS.

petrlebedev commented 2 weeks ago

Using SSH instead of HTTPS will help with that problem (I know that this is workaround and issue should be fixed separately) @deer-wmde Why not? you can just use SSH for git

image
petrlebedev commented 2 weeks ago

So i added new CredentialsTemplate for my org in github using SSH key and changed source and it started working. from repoURL: https://github.com/myorg/infra-argocd.git to repoURL: ssh://git@github.com/myorg/infra-argocd.git

deer-wmde commented 2 weeks ago

So i added new CredentialsTemplate for my org in github using SSH key

@petrlebedev that's what I mean with public repositories: repos that you don't have control over/can't add a ssh key, e.g. https://github.com/bitnami/charts.git