forked from radius-project/radius
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch Radius Helm chart pull from ACR to GHCR (radius-project#7455)
# Description * Switch Radius Helm chart pull from ACR to GHCR * Add error handling for 403 from GHCR Example outputs: Expired credentials: ```sh ❯ go run ./cmd/rad/main.go install kubernetes --reinstall # command-line-arguments ld: warning: -bind_at_load is deprecated on macOS Reinstalling Radius version edge to namespace: radius-system... Error: failed to load Helm chart, err: 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, Helm output: TraceId: dff0bdbe3da3f80fc6e8a84a9b5d38ea exit status 1 ``` ## Type of change <!-- Please select **one** of the following options that describes your change and delete the others. Clearly identifying the type of change you are making will help us review your PR faster, and is used in authoring release notes. If you are making a bug fix or functionality change to Radius and do not have an associated issue link please create one now. --> - This pull request adds or changes features of Radius and has an approved issue (issue link required). <!-- Please update the following to link the associated issue. This is required for some kinds of changes (see above). --> Fixes: radius-project#6801 --------- Signed-off-by: willdavsmith <[email protected]>
- Loading branch information
1 parent
b2c8878
commit d26a411
Showing
3 changed files
with
93 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package helm | ||
|
||
import ( | ||
"errors" | ||
"fmt" | ||
"net/http" | ||
"testing" | ||
|
||
containerderrors "github.com/containerd/containerd/remotes/errors" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func Test_isHelm403Error(t *testing.T) { | ||
var err error | ||
var result bool | ||
|
||
err = errors.New("error") | ||
result = isHelm403Error(err) | ||
assert.False(t, result) | ||
|
||
err = fmt.Errorf("%w: wrapped error", errors.New("error")) | ||
result = isHelm403Error(err) | ||
assert.False(t, result) | ||
|
||
err = fmt.Errorf("%w: wrapped error", containerderrors.ErrUnexpectedStatus{}) | ||
result = isHelm403Error(err) | ||
assert.False(t, result) | ||
|
||
err = fmt.Errorf("%w: wrapped error", containerderrors.ErrUnexpectedStatus{StatusCode: http.StatusForbidden, RequestURL: "ghcr.io/myregistry"}) | ||
result = isHelm403Error(err) | ||
assert.True(t, result) | ||
|
||
err = containerderrors.ErrUnexpectedStatus{StatusCode: http.StatusForbidden, RequestURL: "ghcr.io/myregistry"} | ||
result = isHelm403Error(err) | ||
assert.True(t, result) | ||
|
||
err = containerderrors.ErrUnexpectedStatus{StatusCode: http.StatusUnauthorized, RequestURL: "ghcr.io/myregistry"} | ||
result = isHelm403Error(err) | ||
assert.False(t, result) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters