argoproj / argo-cd

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

Enable git submodule #19184

Open pazfelipe opened 1 month ago

pazfelipe commented 1 month ago

Checklist:

Describe the bug

I'm trying to create an application that contains a submodule in its root path. I've already configured other applications, however, their submodules were in different location, like a subfolder for example. For this particular resource, I can't create the application due to this limitation.

I have already added applicationsetcontroller.enable.git.submodule: "true" in the argocd-cmd-params-cm, added reposerver.enable.git.submodule: "true", added

- name: ARGOCD_GIT_MODULES_ENABLED
          valueFrom:
            configMapKeyRef:
              key: applicationsetcontroller.enable.git.submodule
              name: argocd-cmd-params-cm
              optional: true

in the argocd-server deployment and none of them worked.

To Reproduce

Create an application which have a git submodule in its root folder

Expected behavior

To be able to create the application with no problem related to the submodule or ignore the submodule and create the application considering the target branch and path only

Screenshots

Version

argocd: v2.6.6+6d4de2e
  BuildDate: 2023-03-16T22:25:45Z
  GitCommit: 6d4de2ec5d49fa2c6823f2b7d101607a839be3fa
  GitTreeState: clean
  GoVersion: go1.18.10
  Compiler: gc
  Platform: linux/amd64

Logs

Unable to create application: application spec for backend-fetcher is invalid: InvalidSpecError: Unable to generate manifests in k8s/staging: rpc error: code = Internal desc = Failed to checkout FETCH_HEAD: `git submodule update --init --recursive` failed exit status 1: Cloning into '.path'... ERROR: Repository not found. fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. fatal: clone of 'git@github.com:user/repo.git' into submodule path '.path' failed Failed to clone 'repo'. Retry scheduled Cloning into '.path'... ERROR: Repository not found. fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. fatal: clone of 'git@github.com:user/repo.git' into submodule path '.path' failed Failed to clone 'repo' a second time, aborting
hmkmartini commented 1 month ago

I am also facing the same issue.

dircksen commented 1 month ago

Looking forward to see this bug fixed

crenshaw-dev commented 1 month ago

According to the error message, enabling submodules worked fine. The problem is that repo-server doesn't have access to pull the submodule. What steps have you taken to try to grant access?

pazfelipe commented 1 month ago

@crenshaw-dev , thanks for replying back.

As mentioned in the above messages, I’ve configured the ConfigMap and added the environment variable directly to the ArgoCD server deployment referring to the ConfigMap. I also created an SSH key inside the pod and added this key to the GitHub repository. I was even able to clone the repository into the ArgoCD server pod. However, when I try to create the application via yaml or the UI, I get the error shared above