Skip to content

Commit

Permalink
Merge pull request #1013 from fluxcd/helm-oci-download-err
Browse files Browse the repository at this point in the history
helm/oci: Add context to chart download failure
  • Loading branch information
darkowlzz authored Jan 31, 2023
2 parents b00658d + f9927e7 commit d54a655
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
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

0 comments on commit d54a655

Please sign in to comment.