mirror of
https://github.com/helm/helm.git
synced 2026-04-15 21:59:50 -04:00
Fix helm pull untar dir check with repo urls
The existing check worked for `helm pull downloaded-repo/chart-name`, but often does not work when using `--repo-url`, depending on the urls used by the charts. Signed-off-by: Luna Stadler <luc@spreadshirt.net>
This commit is contained in:
parent
4b8e61093d
commit
1031b67fff
2 changed files with 15 additions and 2 deletions
|
|
@ -114,6 +114,7 @@ func (p *Pull) Run(chartRef string) (string, error) {
|
|||
defer os.RemoveAll(dest)
|
||||
}
|
||||
|
||||
downloadSourceRef := chartRef
|
||||
if p.RepoURL != "" {
|
||||
chartURL, err := repo.FindChartInRepoURL(
|
||||
p.RepoURL,
|
||||
|
|
@ -128,10 +129,10 @@ func (p *Pull) Run(chartRef string) (string, error) {
|
|||
if err != nil {
|
||||
return out.String(), err
|
||||
}
|
||||
chartRef = chartURL
|
||||
downloadSourceRef = chartURL
|
||||
}
|
||||
|
||||
saved, v, err := c.DownloadTo(chartRef, p.Version, dest)
|
||||
saved, v, err := c.DownloadTo(downloadSourceRef, p.Version, dest)
|
||||
if err != nil {
|
||||
return out.String(), err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -147,6 +147,18 @@ func TestPullCmd(t *testing.T) {
|
|||
failExpect: "Failed to fetch chart version",
|
||||
wantError: true,
|
||||
},
|
||||
{
|
||||
name: "Chart fetch using repo URL with untardir",
|
||||
args: "signtest --version=0.1.0 --untar --untardir repo-url-test --repo " + srv.URL(),
|
||||
expectFile: "./signtest",
|
||||
expectDir: true,
|
||||
},
|
||||
{
|
||||
name: "Chart fetch using repo URL with untardir and previous pull",
|
||||
args: "signtest --version=0.1.0 --untar --untardir repo-url-test --repo " + srv.URL(),
|
||||
failExpect: "failed to untar",
|
||||
wantError: true,
|
||||
},
|
||||
{
|
||||
name: "Fetch OCI Chart",
|
||||
args: fmt.Sprintf("oci://%s/u/ocitestuser/oci-dependent-chart --version 0.1.0", ociSrv.RegistryURL),
|
||||
|
|
|
|||
Loading…
Reference in a new issue