mirror of
https://github.com/helm/helm.git
synced 2026-05-28 04:35:48 -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
73c269f31d
commit
e5e101cced
2 changed files with 15 additions and 2 deletions
|
|
@ -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),
|
||||
|
|
|
|||
|
|
@ -121,15 +121,16 @@ func (p *Pull) Run(chartRef string) (string, error) {
|
|||
defer os.RemoveAll(dest)
|
||||
}
|
||||
|
||||
downloadSourceRef := chartRef
|
||||
if p.RepoURL != "" {
|
||||
chartURL, err := repo.FindChartInAuthAndTLSAndPassRepoURL(p.RepoURL, p.Username, p.Password, chartRef, p.Version, p.CertFile, p.KeyFile, p.CaFile, p.InsecureSkipTLSverify, p.PassCredentialsAll, getter.All(p.Settings))
|
||||
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
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue