GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — ACR Login: Use Azure SDK library to get the credential and token by dbalseiro · Pull Request #3398 · knative/func Conversation
Contributor
Changes
/kind bug Fixes #3288 Release Note
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
|
There was an error while loading. Please reload this page.
|
Welcome @dbalseiro! It looks like this is your first PR to knative/func 🎉 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Hi @dbalseiro. Thanks for your PR. I'm waiting for a knative member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
/ok-to-test Thanks for the PR! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@ ## main #3398 +/- ## ========================================== + Coverage 54.50% 54.54% +0.03% ========================================== Files 173 179 +6 Lines 19694 20260 +566 ========================================== + Hits 10735 11051 +316 - Misses 7836 8037 +201 - Partials 1123 1172 +49
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Looks good! I have one minor improvement worth at least exploring the feasability of (plumbing through a context object) and one concern worth double-checking (that there's no other code depending on creds.ErrCredentialsNotFound being returned).
/approve
/hold pending possible changes per the above
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| }, nil | ||
| } | ||
| scope := "https://containerregistry.azure.net/.default" | ||
| token, err := azCredentials.GetToken(context.Background(), policy.TokenRequestOptions{ |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
We might want to plumb through a context object to GetACRCredentialLoader in case this thing can lock up or need canceling.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
giving it a try :)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| if err != nil { | ||
| return oci.Credentials{}, fmt.Errorf("failed to get azure access token: %w", err) | ||
| } | ||
| return oci.Credentials{}, creds.ErrCredentialsNotFound |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I notice that creds.ErrCredentialsNotFound is no longer returned. This sentinel value may be depended upon by other systems to fall-through (despite using error types as flow-control being an antipattern; it's life). It might be a good idea to double-check that there's no other code depending on exactly that error type to ensure we're not breaking any "error fallback" systems if one of the other generic errors is returned instead.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Yes, we are still returning ErrCredentialsNotFound when the registry's domain is not azure.io. And if I'm not mistaken, returning ErrCredentialsNotFound in this line made sense at the time, because it was trying to fetch the token from a JSON file. But now we try to generate the token using the SDK. I think if the SDK fails, we should return a plain error. What do you think?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
@lkingland Thanks for the review! Sorry it took me so long to do it, but I addressed your comments. Let me know what you think.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| if err != nil { | ||
| return oci.Credentials{}, fmt.Errorf("failed to get azure access token: %w", err) | ||
| } | ||
| return oci.Credentials{}, creds.ErrCredentialsNotFound |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Yes, we are still returning ErrCredentialsNotFound when the registry's domain is not azure.io. And if I'm not mistaken, returning ErrCredentialsNotFound in this line made sense at the time, because it was trying to fetch the token from a JSON file. But now we try to generate the token using the SDK. I think if the SDK fails, we should return a plain error. What do you think?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| }, nil | ||
| } | ||
| scope := "https://containerregistry.azure.net/.default" | ||
| token, err := azCredentials.GetToken(context.Background(), policy.TokenRequestOptions{ |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
giving it a try :)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
/ok-to-test |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Where's all our tests I wonder? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
/retest |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@gauron99 you were right I had force-pushed a bad rebase :( Now everything is how it's supposed to be We are using a version of this in our project and I'd greatly appreciate if it can go upstream. Thanks for your time! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
721088b to
8347f44
Compare
|
/retest |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@gauron99 @lkingland Just bumping this one in case it got buried. The PR is rebased and ready for another look. We’re already using this change in our project, so it’d be great to get it upstream. Happy to address any remaining concerns to unblock the merge. Thanks! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@dbalseiro hi, thanks for the reminder, indeed these get buried quite easily lately, sorry about that. It seems there is a review dog error flagged so far, I'll take a look at the code hopefully today. What project are you using func in? if its not a secret 🙂 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I'm not sure I can disclose the project. But it's an internal low-code platform for a US law firm. We primarily use functions but have been playing a little bit with knative services lately. I'll address the linting errors :) thank you |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
/retest |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
/cla |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
/easycla |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@dbalseiro hey it seems the cla check is failing now, once fixed |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@lkingland in case you have some pointers as you have reviewed this before |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
85f8816 to
4499b14
Compare
|
@gauron99 sorry I had commited with my "work" email... I amended the author of my last commit now and CLA is passing |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
4499b14 to
b1b14eb
Compare
|
/retest |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@gauron99 rebased and tests passing |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
/lgtm |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dbalseiro, gauron99, lkingland The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Agreed on a plain error being the right call. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
Azure Container Repository Login Fails
There was an error while loading. Please reload this page.