Skip to content
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

Switch Radius Helm chart pull from ACR to GHCR #7455

Merged
merged 10 commits into from
Jun 17, 2024

Conversation

willdavsmith
Copy link
Contributor

Description

  • Switch Radius Helm chart pull from ACR to GHCR
  • Add error handling for 403 from GHCR

Example outputs:

Expired credentials:

❯ 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

  • This pull request adds or changes features of Radius and has an approved issue (issue link required).

Fixes: #6801

Copy link

codecov bot commented Apr 5, 2024

Codecov Report

Attention: Patch coverage is 30.00000% with 14 lines in your changes missing coverage. Please review.

Project coverage is 60.95%. Comparing base (b2c8878) to head (b847900).

Files Patch % Lines
pkg/cli/helm/helm.go 30.00% 14 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7455      +/-   ##
==========================================
- Coverage   60.95%   60.95%   -0.01%     
==========================================
  Files         518      518              
  Lines       26673    26690      +17     
==========================================
+ Hits        16259    16269      +10     
- Misses       8972     8981       +9     
+ Partials     1442     1440       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

// https://github.com/helm/helm/issues/12584
var errUnexpectedStatus containerdErrors.ErrUnexpectedStatus
if errors.As(err, &errUnexpectedStatus) {
unwrappedErr := UnwrapAll(err)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a better way to do this?

pkg/cli/helm/helm.go Outdated Show resolved Hide resolved
@radius-functional-tests
Copy link

radius-functional-tests bot commented Apr 8, 2024

Radius functional test overview

🔍 Go to test action run

Name Value
Repository willdavsmith/radius
Commit ref 7691dbb
Unique ID func399c0e0bba
Image tag pr-func399c0e0bba
Click here to see the list of tools in the current test run
  • gotestsum 1.10.0
  • KinD: v0.20.0
  • Dapr: 1.12.0
  • Azure KeyVault CSI driver: 1.4.2
  • Azure Workload identity webhook: 1.1.0
  • Bicep recipe location ghcr.io/radius-project/dev/test/testrecipes/test-bicep-recipes/<name>:pr-func399c0e0bba
  • Terraform recipe location http://tf-module-server.radius-test-tf-module-server.svc.cluster.local/<name>.zip (in cluster)
  • applications-rp test image location: ghcr.io/radius-project/dev/applications-rp:pr-func399c0e0bba
  • controller test image location: ghcr.io/radius-project/dev/controller:pr-func399c0e0bba
  • ucp test image location: ghcr.io/radius-project/dev/ucpd:pr-func399c0e0bba
  • deployment-engine test image location: ghcr.io/radius-project/deployment-engine:latest

Test Status

⌛ Building Radius and pushing container images for functional tests...
✅ Container images build succeeded
⌛ Publishing Bicep Recipes for functional tests...
✅ Recipe publishing succeeded
⌛ Starting samples functional tests...
⌛ Starting daprrp functional tests...
⌛ Starting shared functional tests...
⌛ Starting cli functional tests...
⌛ Starting datastoresrp functional tests...
⌛ Starting kubernetes functional tests...
⌛ Starting msgrp functional tests...
⌛ Starting ucp functional tests...
✅ samples functional tests succeeded
✅ kubernetes functional tests succeeded
✅ msgrp functional tests succeeded
✅ daprrp functional tests succeeded
✅ ucp functional tests succeeded
✅ datastoresrp functional tests succeeded
✅ cli functional tests succeeded
✅ shared functional tests succeeded

@radius-functional-tests
Copy link

radius-functional-tests bot commented Apr 8, 2024

Radius functional test overview

🔍 Go to test action run

Name Value
Repository willdavsmith/radius
Commit ref 3296758
Unique ID func6c6ccb774a
Image tag pr-func6c6ccb774a
Click here to see the list of tools in the current test run
  • gotestsum 1.10.0
  • KinD: v0.20.0
  • Dapr: 1.12.0
  • Azure KeyVault CSI driver: 1.4.2
  • Azure Workload identity webhook: 1.1.0
  • Bicep recipe location ghcr.io/radius-project/dev/test/testrecipes/test-bicep-recipes/<name>:pr-func6c6ccb774a
  • Terraform recipe location http://tf-module-server.radius-test-tf-module-server.svc.cluster.local/<name>.zip (in cluster)
  • applications-rp test image location: ghcr.io/radius-project/dev/applications-rp:pr-func6c6ccb774a
  • controller test image location: ghcr.io/radius-project/dev/controller:pr-func6c6ccb774a
  • ucp test image location: ghcr.io/radius-project/dev/ucpd:pr-func6c6ccb774a
  • deployment-engine test image location: ghcr.io/radius-project/deployment-engine:latest

Test Status

⌛ Building Radius and pushing container images for functional tests...
✅ Container images build succeeded
⌛ Publishing Bicep Recipes for functional tests...
✅ Recipe publishing succeeded
⌛ Starting cli functional tests...
⌛ Starting datastoresrp functional tests...
⌛ Starting daprrp functional tests...
⌛ Starting ucp functional tests...
⌛ Starting kubernetes functional tests...
⌛ Starting samples functional tests...
⌛ Starting shared functional tests...
⌛ Starting msgrp functional tests...
✅ kubernetes functional tests succeeded
✅ ucp functional tests succeeded
✅ samples functional tests succeeded
✅ daprrp functional tests succeeded
✅ msgrp functional tests succeeded
✅ cli functional tests succeeded
✅ datastoresrp functional tests succeeded
✅ shared functional tests succeeded

@willdavsmith
Copy link
Contributor Author

a note about the code coverage - the majority of changes in this PR are not tested by our unit tests and have not been so far

@radius-functional-tests
Copy link

radius-functional-tests bot commented Apr 9, 2024

Radius functional test overview

🔍 Go to test action run

Name Value
Repository willdavsmith/radius
Commit ref 2b4c56d
Unique ID func2201206f35
Image tag pr-func2201206f35
Click here to see the list of tools in the current test run
  • gotestsum 1.10.0
  • KinD: v0.20.0
  • Dapr: 1.12.0
  • Azure KeyVault CSI driver: 1.4.2
  • Azure Workload identity webhook: 1.1.0
  • Bicep recipe location ghcr.io/radius-project/dev/test/testrecipes/test-bicep-recipes/<name>:pr-func2201206f35
  • Terraform recipe location http://tf-module-server.radius-test-tf-module-server.svc.cluster.local/<name>.zip (in cluster)
  • applications-rp test image location: ghcr.io/radius-project/dev/applications-rp:pr-func2201206f35
  • controller test image location: ghcr.io/radius-project/dev/controller:pr-func2201206f35
  • ucp test image location: ghcr.io/radius-project/dev/ucpd:pr-func2201206f35
  • deployment-engine test image location: ghcr.io/radius-project/deployment-engine:latest

Test Status

⌛ Building Radius and pushing container images for functional tests...
✅ Container images build succeeded
⌛ Publishing Bicep Recipes for functional tests...
✅ Recipe publishing succeeded
⌛ Starting cli functional tests...
⌛ Starting ucp functional tests...
⌛ Starting kubernetes functional tests...
⌛ Starting daprrp functional tests...
⌛ Starting msgrp functional tests...
⌛ Starting shared functional tests...
⌛ Starting samples functional tests...
⌛ Starting datastoresrp functional tests...
✅ kubernetes functional tests succeeded
✅ ucp functional tests succeeded
✅ msgrp functional tests succeeded
✅ samples functional tests succeeded
✅ daprrp functional tests succeeded
✅ datastoresrp functional tests succeeded
✅ shared functional tests succeeded
✅ cli functional tests succeeded

pkg/cli/helm/helm.go Outdated Show resolved Hide resolved
pkg/cli/helm/helm.go Outdated Show resolved Hide resolved
} else {
// For OCI registries (like radius), we will use the
// repo URL + the releaseName as the chartRef.
// pull.Run("oci://ghcr.io/radius-project/helm-chart/radius")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we check if repoUrl is of this type oci://ghcr.io/radius-project?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code should work for all oci registries if we need to add them in the future. So I don't think we need to hard code it. the registry.IsOCI() call should determine if it's an oci registry or not.

Comment on lines 183 to 189
for {
unwrapped := errors.Unwrap(err)
if unwrapped == nil {
return err
}
err = unwrapped
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is to unwrap until you can't find any more errors, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exactly

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if there's a better way to do this though

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the problem you're trying to solve by doing this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like you're doing an errors.As and then ignoring the result ....

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep this is exactly what I was doing. no idea how I missed that functionality for errors.As()....

Signed-off-by: willdavsmith <willdavsmith@gmail.com>
Signed-off-by: willdavsmith <willdavsmith@gmail.com>
Signed-off-by: willdavsmith <willdavsmith@gmail.com>
@radius-functional-tests
Copy link

radius-functional-tests bot commented Jun 3, 2024

Radius functional test overview

🔍 Go to test action run

Name Value
Repository willdavsmith/radius
Commit ref 1878b92
Unique ID func87cbaf260c
Image tag pr-func87cbaf260c
Click here to see the list of tools in the current test run
  • gotestsum 1.10.0
  • KinD: v0.20.0
  • Dapr: 1.12.0
  • Azure KeyVault CSI driver: 1.4.2
  • Azure Workload identity webhook: 1.1.0
  • Bicep recipe location ghcr.io/radius-project/dev/test/testrecipes/test-bicep-recipes/<name>:pr-func87cbaf260c
  • Terraform recipe location http://tf-module-server.radius-test-tf-module-server.svc.cluster.local/<name>.zip (in cluster)
  • applications-rp test image location: ghcr.io/radius-project/dev/applications-rp:pr-func87cbaf260c
  • controller test image location: ghcr.io/radius-project/dev/controller:pr-func87cbaf260c
  • ucp test image location: ghcr.io/radius-project/dev/ucpd:pr-func87cbaf260c
  • deployment-engine test image location: ghcr.io/radius-project/deployment-engine:latest

Test Status

⌛ Building Radius and pushing container images for functional tests...
✅ Container images build succeeded
⌛ Publishing Bicep Recipes for functional tests...
✅ Recipe publishing succeeded
⌛ Starting cli functional tests...
⌛ Starting samples functional tests...
⌛ Starting ucp functional tests...
⌛ Starting daprrp functional tests...
⌛ Starting shared functional tests...
⌛ Starting datastoresrp functional tests...
⌛ Starting kubernetes functional tests...
✅ msgrp functional tests succeeded
✅ samples functional tests succeeded
✅ ucp functional tests succeeded
✅ kubernetes functional tests succeeded
✅ daprrp functional tests succeeded
✅ datastoresrp functional tests succeeded
✅ cli functional tests succeeded
✅ shared functional tests succeeded

Signed-off-by: willdavsmith <willdavsmith@gmail.com>
@radius-functional-tests
Copy link

radius-functional-tests bot commented Jun 7, 2024

Radius functional test overview

🔍 Go to test action run

Name Value
Repository willdavsmith/radius
Commit ref 8efe737
Unique ID funca97e87f082
Image tag pr-funca97e87f082
Click here to see the list of tools in the current test run
  • gotestsum 1.10.0
  • KinD: v0.20.0
  • Dapr: 1.12.0
  • Azure KeyVault CSI driver: 1.4.2
  • Azure Workload identity webhook: 1.1.0
  • Bicep recipe location ghcr.io/radius-project/dev/test/testrecipes/test-bicep-recipes/<name>:pr-funca97e87f082
  • Terraform recipe location http://tf-module-server.radius-test-tf-module-server.svc.cluster.local/<name>.zip (in cluster)
  • applications-rp test image location: ghcr.io/radius-project/dev/applications-rp:pr-funca97e87f082
  • controller test image location: ghcr.io/radius-project/dev/controller:pr-funca97e87f082
  • ucp test image location: ghcr.io/radius-project/dev/ucpd:pr-funca97e87f082
  • deployment-engine test image location: ghcr.io/radius-project/deployment-engine:latest

Test Status

⌛ Building Radius and pushing container images for functional tests...
✅ Container images build succeeded
⌛ Publishing Bicep Recipes for functional tests...
✅ Recipe publishing succeeded
⌛ Starting ucp functional tests...
⌛ Starting datastoresrp functional tests...
⌛ Starting kubernetes functional tests...
⌛ Starting shared functional tests...
⌛ Starting daprrp functional tests...
⌛ Starting cli functional tests...
⌛ Starting samples functional tests...
⌛ Starting msgrp functional tests...
✅ kubernetes functional tests succeeded
✅ ucp functional tests succeeded
✅ samples functional tests succeeded
✅ msgrp functional tests succeeded
✅ datastoresrp functional tests succeeded
✅ daprrp functional tests succeeded
✅ cli functional tests succeeded
✅ shared functional tests succeeded

Signed-off-by: willdavsmith <willdavsmith@gmail.com>
}
}

return nil
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to also handle the case where the error is NOT an containerderrors.ErrUnexpectedStatus. Think about a case where the user is not connected to the internet.

Every time we special case one type of error, we need to also handle the case where it's some other type of error.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, nevermind. I see you did that above.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

var errUnexpectedStatus containerderrors.ErrUnexpectedStatus
if errors.As(err, &errUnexpectedStatus) {
if errUnexpectedStatus.StatusCode == http.StatusForbidden && strings.Contains(errUnexpectedStatus.RequestURL, "ghcr.io") {
return 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")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest using clierrors.Message for this.

if err != nil {
return nil, err
}

return nil, fmt.Errorf("error downloading helm chart from the registry for version: %s, release name: %s. Error: %w", version, releaseName, err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest using clierrors.Message for this. rad has special formatting for that type.

Basically it's helpful to know the difference between:

  • You made a mistake, and it's not a bug in Radius. (clierrors.Message)
  • Something weird happened, no idea 🤷 (any other error)

Signed-off-by: willdavsmith <willdavsmith@gmail.com>
Signed-off-by: willdavsmith <willdavsmith@gmail.com>
Copy link
Contributor

@rynowak rynowak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit: - awesome, thanks @willdavsmith

@radius-functional-tests
Copy link

radius-functional-tests bot commented Jun 17, 2024

Radius functional test overview

🔍 Go to test action run

Name Value
Repository willdavsmith/radius
Commit ref b847900
Unique ID func1c9f8b4917
Image tag pr-func1c9f8b4917
Click here to see the list of tools in the current test run
  • gotestsum 1.10.0
  • KinD: v0.20.0
  • Dapr: 1.12.0
  • Azure KeyVault CSI driver: 1.4.2
  • Azure Workload identity webhook: 1.1.0
  • Bicep recipe location ghcr.io/radius-project/dev/test/testrecipes/test-bicep-recipes/<name>:pr-func1c9f8b4917
  • Terraform recipe location http://tf-module-server.radius-test-tf-module-server.svc.cluster.local/<name>.zip (in cluster)
  • applications-rp test image location: ghcr.io/radius-project/dev/applications-rp:pr-func1c9f8b4917
  • controller test image location: ghcr.io/radius-project/dev/controller:pr-func1c9f8b4917
  • ucp test image location: ghcr.io/radius-project/dev/ucpd:pr-func1c9f8b4917
  • deployment-engine test image location: ghcr.io/radius-project/deployment-engine:latest

Test Status

⌛ Building Radius and pushing container images for functional tests...
✅ Container images build succeeded
⌛ Publishing Bicep Recipes for functional tests...
✅ Recipe publishing succeeded
⌛ Starting ucp functional tests...
⌛ Starting cli functional tests...
⌛ Starting samples functional tests...
⌛ Starting shared functional tests...
⌛ Starting msgrp functional tests...
⌛ Starting daprrp functional tests...
⌛ Starting datastoresrp functional tests...
⌛ Starting kubernetes functional tests...
✅ samples functional tests succeeded
✅ ucp functional tests succeeded
✅ msgrp functional tests succeeded
✅ cli functional tests succeeded
✅ daprrp functional tests succeeded
✅ datastoresrp functional tests succeeded
✅ shared functional tests succeeded

@willdavsmith willdavsmith merged commit d26a411 into radius-project:main Jun 17, 2024
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Migrate chart location from ACR to GHCR
4 participants