Support ArgoCD repository credentials when cloning Git repositories #99
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This change allows Nyl to automatically use ArgoCD's repository credentials instead of requiring basic auth to be embedded in HTTPS URLs when cloning Git repositories for Helm charts.
Problem
Previously, when referencing a Helm chart from a private Git repository, users had to embed credentials directly in the HTTPS URL using Nyl templating:
This approach had several drawbacks:
Solution
Nyl now automatically queries ArgoCD repository credentials from Kubernetes and applies them during Git cloning operations. The same example now works with clean URLs:
Implementation
The implementation adds a new
argocd_repo_credentialsmodule that:Queries ArgoCD credentials: Searches for Kubernetes secrets with labels
argocd.argoproj.io/secret-type: repositoryorargocd.argoproj.io/secret-type: repo-credsImplements credential matching: Uses ArgoCD's matching logic with exact URL matches taking precedence over prefix matches
Applies authentication: For HTTPS repositories, embeds username/password credentials in the Git clone URL
Maintains compatibility: Only activates when both ArgoCD credentials exist and Kubernetes connectivity is available
Authentication Support
Benefits
The feature gracefully falls back to the original behavior when no matching credentials are found, ensuring full backward compatibility.
Fixes #28.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.