mirror of
https://github.com/argoproj/argo-cd
synced 2026-05-24 01:38:43 +00:00
Repo names containing underscores were not being accepted (resolves #258)
This commit is contained in:
parent
85078bdb66
commit
44a33b0a5f
2 changed files with 3 additions and 1 deletions
|
|
@ -123,7 +123,8 @@ func repoURLToSecretName(repo string) string {
|
|||
h := fnv.New32a()
|
||||
_, _ = h.Write([]byte(repo))
|
||||
parts := strings.Split(strings.TrimSuffix(repo, ".git"), "/")
|
||||
return fmt.Sprintf("repo-%s-%v", parts[len(parts)-1], h.Sum32())
|
||||
shortName := strings.Replace(parts[len(parts)-1], "_", "-", -1)
|
||||
return fmt.Sprintf("repo-%s-%v", shortName, h.Sum32())
|
||||
}
|
||||
|
||||
// repoToStringData converts a repository object to string data for serialization to a secret
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ func TestRepoURLToSecretName(t *testing.T) {
|
|||
"https://github.com/argoproj/ARGO-cd": "repo-argo-cd-821842295",
|
||||
"https://github.com/argoproj/argo-cd": "repo-argo-cd-821842295",
|
||||
"https://github.com/argoproj/argo-cd.git": "repo-argo-cd-821842295",
|
||||
"https://github.com/argoproj/argo_cd.git": "repo-argo-cd-1049844989",
|
||||
"ssh://git@github.com/argoproj/argo-cd.git": "repo-argo-cd-1019298066",
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue