Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions reposerver/repository/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -1022,6 +1022,10 @@ func getHelmDependencyRepos(appPath string) ([]*v1alpha1.Repository, error) {
repos = append(repos, &v1alpha1.Repository{
Name: r.Repository[1:],
})
} else if strings.HasPrefix(r.Repository, "alias:") {
repos = append(repos, &v1alpha1.Repository{
Name: strings.TrimPrefix(r.Repository, "alias:"),
})
} else if u, err := url.Parse(r.Repository); err == nil && (u.Scheme == "https" || u.Scheme == "oci") {
repo := &v1alpha1.Repository{
// trimming oci:// prefix since it is currently not supported by Argo CD (OCI repos just have no scheme)
Expand Down
17 changes: 17 additions & 0 deletions reposerver/repository/repository_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1440,6 +1440,7 @@ func TestListApps(t *testing.T) {
"out-of-bounds-values-file-link": "Helm",
"values-files": "Helm",
"helm-with-dependencies": "Helm",
"helm-with-dependencies-alias": "Helm",
}
assert.Equal(t, expectedApps, res.Apps)
}
Expand Down Expand Up @@ -2938,6 +2939,22 @@ func TestGetHelmRepo_NamedRepos(t *testing.T) {
assert.Equal(t, helmRepos[0].Repo, "https://example.com")
}

func TestGetHelmRepo_NamedReposAlias(t *testing.T) {
src := argoappv1.ApplicationSource{Path: "."}
q := apiclient.ManifestRequest{Repo: &argoappv1.Repository{}, ApplicationSource: &src, Repos: []*argoappv1.Repository{{
Name: "custom-repo-alias",
Repo: "https://example.com",
Username: "test-alias",
}}}

helmRepos, err := getHelmRepos("./testdata/helm-with-dependencies-alias", q.Repos, q.HelmRepoCreds)
assert.Nil(t, err)

assert.Equal(t, len(helmRepos), 1)
assert.Equal(t, helmRepos[0].Username, "test-alias")
assert.Equal(t, helmRepos[0].Repo, "https://example.com")
}

func Test_getResolvedValueFiles(t *testing.T) {
tempDir := t.TempDir()
paths := io.NewRandomizedTempPaths(tempDir)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: v2
name: helm-with-dependencies-alias
version: v1.0.0
dependencies:
- name: helm
repository: "alias:custom-repo-alias"
version: v1.0.0