helm/oci: Add context to download failure
Add chart address in the OCI chart download failure error message to make it clear about the chart URL that was attempted to download. Signed-off-by: Sunny <darkowlzz@protonmail.com>
This commit is contained in:
parent
b00658d07e
commit
f9927e7d46
|
@ -225,7 +225,7 @@ entries:
|
|||
}
|
||||
}
|
||||
|
||||
func TestRemoteBuilder_BuildFromOCIChatRepository(t *testing.T) {
|
||||
func TestRemoteBuilder_BuildFromOCIChartRepository(t *testing.T) {
|
||||
g := NewWithT(t)
|
||||
|
||||
chartGrafana, err := os.ReadFile("./../testdata/charts/helmchart-0.1.0.tgz")
|
||||
|
@ -293,7 +293,7 @@ func TestRemoteBuilder_BuildFromOCIChatRepository(t *testing.T) {
|
|||
name: "chart version not in repository",
|
||||
reference: RemoteReference{Name: "grafana", Version: "1.1.1"},
|
||||
repository: mockRepoWithoutChart(),
|
||||
wantErr: "failed to download chart for remote reference",
|
||||
wantErr: "failed to download chart for remote reference: failed to get",
|
||||
},
|
||||
{
|
||||
name: "invalid version metadata",
|
||||
|
|
|
@ -231,7 +231,11 @@ func (r *OCIChartRepository) DownloadChart(chart *repo.ChartVersion) (*bytes.Buf
|
|||
defer transport.Release(t)
|
||||
|
||||
// trim the oci scheme prefix if needed
|
||||
return r.Client.Get(strings.TrimPrefix(u.String(), fmt.Sprintf("%s://", registry.OCIScheme)), clientOpts...)
|
||||
b, err := r.Client.Get(strings.TrimPrefix(u.String(), fmt.Sprintf("%s://", registry.OCIScheme)), clientOpts...)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to get '%s': %w", ref, err)
|
||||
}
|
||||
return b, nil
|
||||
}
|
||||
|
||||
// Login attempts to login to the OCI registry.
|
||||
|
|
Loading…
Reference in New Issue