Skip to content

helm/oci: Add context to chart download failure #1013

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 31, 2023
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: 2 additions & 2 deletions internal/helm/chart/builder_remote_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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",
Expand Down
6 changes: 5 additions & 1 deletion internal/helm/repository/oci_chart_repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down