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

Use correct cloud environment in azcore client #3799

Merged
merged 3 commits into from
Dec 17, 2024
Merged

Conversation

thomas11
Copy link
Contributor

When instantiating the new azcore-based Azure client, the cloud environment (public, usgov, etc.) was looked up in a wrong way. Since it defaults to "public", it didn't error and worked for most users. This PR refactors and adds more tests for more solid coverage.

Fixes #3795.

@thomas11 thomas11 requested a review from a team December 17, 2024 08:47

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
@thomas11 thomas11 force-pushed the tkappler/azcore-cloud branch from 7764f12 to cb21f55 Compare December 17, 2024 08:47
Copy link

Does the PR have any schema changes?

Looking good! No breaking changes found.
No new resources/functions.

Copy link

@VenelinMartinov VenelinMartinov left a comment

Choose a reason for hiding this comment

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

Thanks for adding the tests, lgtm!

One possible typo.

Copy link

@flostadler flostadler left a comment

Choose a reason for hiding this comment

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

Looks good to me!

envName := a.Environment
env, err := azureEnv.EnvironmentFromName(envName)
if err != nil {
env, err = azureEnv.EnvironmentFromName(fmt.Sprintf("AZURE%sCLOUD", envName))

Choose a reason for hiding this comment

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

It seems like they're planning to deprecate that format to some extent. They have a //TODO: deprecate comment next to AZUREUSGOVERNMENTCLOUD. https://github.com/Azure/go-autorest/blob/f7ea664c9cff3a5257b6dbc4402acadfd8be79f1/autorest/azure/environments.go#L38C3-L39

I only found Azure/go-autorest#624 which seems to allude to them not being able to change it any time soon

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We're actually going to remove this whole code soon-ish, since Autorest is deprecated.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
@thomas11 thomas11 enabled auto-merge (squash) December 17, 2024 09:33
Copy link

codecov bot commented Dec 17, 2024

Codecov Report

Attention: Patch coverage is 80.95238% with 4 lines in your changes missing coverage. Please review.

Project coverage is 57.00%. Comparing base (071c1d4) to head (0506227).
Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
provider/pkg/provider/auth.go 80.00% 2 Missing and 1 partial ⚠️
provider/pkg/provider/provider.go 80.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3799   +/-   ##
=======================================
  Coverage   56.99%   57.00%           
=======================================
  Files          78       78           
  Lines       12029    12035    +6     
=======================================
+ Hits         6856     6860    +4     
- Misses       4674     4675    +1     
- Partials      499      500    +1     

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

@thomas11 thomas11 merged commit c57661c into master Dec 17, 2024
23 checks passed
@thomas11 thomas11 deleted the tkappler/azcore-cloud branch December 17, 2024 10:05
@pulumi-bot
Copy link
Contributor

This PR has been shipped in release v2.78.0.

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.

New AzCore API Breaks Environment
4 participants