Skip to content

Commit

Permalink
Re-add GHCR pull
Browse files Browse the repository at this point in the history
Signed-off-by: willdavsmith <willdavsmith@gmail.com>
  • Loading branch information
willdavsmith committed Apr 5, 2024
1 parent c0348d5 commit ff6aec9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkg/cli/helm/helm.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,16 @@ func helmChartFromContainerRegistry(version string, config *helm.Configuration,
_, err = pull.Run(chartRef)

Check warning on line 131 in pkg/cli/helm/helm.go

View check run for this annotation

Codecov / codecov/patch

pkg/cli/helm/helm.go#L131

Added line #L131 was not covered by tests
if err != nil {
// Error handling for a specific case where credentials are stale.
// This happens for ghcr in particular because ghcr does not use
// subdomains - the scope of a login is all of ghcr.io.
// https://github.com/helm/helm/issues/12584
var errUnexpectedStatus containerdErrors.ErrUnexpectedStatus
if errors.As(err, &errUnexpectedStatus) {
unwrappedErr := UnwrapAll(err)
unexpectedStatusErr, ok := unwrappedErr.(containerdErrors.ErrUnexpectedStatus)
if ok {
if unexpectedStatusErr.StatusCode == http.StatusForbidden {
return nil, fmt.Errorf("recieved 403 unauthorized when downloading helm chart from the registry. you may want to perform a `docker logout` and re-try the command")
if unexpectedStatusErr.StatusCode == http.StatusForbidden && strings.Contains(unexpectedStatusErr.RequestURL, "ghcr.io") {
return nil, fmt.Errorf("recieved 403 unauthorized when downloading helm chart from the registry. you may want to perform a `docker logout ghcr.io` and re-try the command")

Check warning on line 143 in pkg/cli/helm/helm.go

View check run for this annotation

Codecov / codecov/patch

pkg/cli/helm/helm.go#L137-L143

Added lines #L137 - L143 were not covered by tests
}
}
}
Expand Down

0 comments on commit ff6aec9

Please sign in to comment.