update remote fetch logic

Signed-off-by: yxxhero <aiopsclub@163.com>
This commit is contained in:
yxxhero
2024-02-11 13:35:07 +08:00
parent 9c05f999e6
commit ff48be2534
7 changed files with 151 additions and 33 deletions
+4
View File
@@ -4,6 +4,7 @@ import (
"fmt"
"os"
"path/filepath"
"strings"
"github.com/helmfile/chartify"
@@ -134,6 +135,9 @@ func (st *HelmState) goGetterChart(chart, dir, cacheDir string, force bool) (str
chart = dir
}
if strings.HasPrefix(chart, "oci://") {
return chart, nil
}
_, err := remote.Parse(chart)
if err != nil {
if force {
+2 -2
View File
@@ -42,7 +42,7 @@ func TestStorage_resolveFile(t *testing.T) {
wantErr: false,
},
{
name: "non existing file in repo produce skip",
name: "non existing file in repo produce non skip",
args: args{
path: "git::https://github.com/helmfile/helmfile.git@examples/values/non-existing-file.yaml?ref=v0.145.2",
title: "values",
@@ -107,7 +107,7 @@ func TestStorage_resolveFile(t *testing.T) {
title: "values",
missingFileHandler: &infoHandler,
},
wantFiles: []string{fmt.Sprintf("%s/%s", cacheDir, "values/https_github_com_helmfile_helmfile_git.ref=v0.145.2/examples/values/replica-values.yaml")},
wantFiles: []string{fmt.Sprintf("%s/%s", cacheDir, "values/https_github_com_helmfile_helmfile_git.ref=v0.145.2/origin/examples/values/replica-values.yaml")},
wantSkipped: false,
wantErr: false,
},