-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[ARM] Fix: az bicep install
: Use CA bundle environment variables if set
#26013
base: dev
Are you sure you want to change the base?
Conversation
❌AzureCLI-FullTest
|
Thank you for your contribution wwmoraes! We will review the pull request and get back to you soon. |
ARM |
@zhoxing-ms Could you take a look at the PR? Thanks. @wwmoraes It seems there are code style errors to fix. The CI logs expired, but you can see the errors locally by running |
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
context = ssl.create_default_context(cafile=( | ||
os.environ.get("REQUESTS_CA_BUNDLE") | ||
or os.environ.get("CURL_CA_BUNDLE") | ||
or certifi.where() | ||
)) | ||
request = urlopen(_get_bicep_download_url(system, release_tag, target_platform=target_platform), context=context) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we consider using requests.get
instead of urlopen
, which may make the code more concise and consistent with the approach of get_bicep_available_release_tags()
and get_bicep_latest_release_tag()
Could you please resolve these flake8 related issues? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Directly using urllib.request.urlopen
should be forbidden. Please see #26008
@wwmoraes Any update? |
added a fallback order equivalent to the one found in the requests package. Also removed the unneeded setdefaults.
️✔️AzureCLI-BreakingChangeTest
|
The individual test case reported as an error works fine when ran directly with It is beyond the objective of this PR to refactor this entire suite of unit tests. @zhoxing-ms would you be so kind as to review it once again? |
src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource_bicep.py
Show resolved
Hide resolved
I guess we can solve this CI problem through mock @mock.patch("azure.cli.command_modules.resource._bicep._get_bicep_installation_path")
@mock.patch("azure.cli.command_modules.resource._bicep._get_bicep_installed_version") @shenglol Do you have any thoughts or suggestions regarding this testing issue? |
It seems the |
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
Related command
az bicep install
Description
Added a fallback order equivalent to the one found in the requests package. Also removed the unneeded setdefaults. See #21807 for history, and the recent comment done by @jiasli
closes #26007
Testing Guide
A clean environment should use the certifi CA bundle path:
If either
REQUESTS_CA_BUNDLE
orCURL_CA_BUNDLE
is set, then it should be picked up:If both
REQUESTS_CA_BUNDLE
andCURL_CA_BUNDLE
are set, then it should useREQUESTS_CA_BUNDLE
(this is by definition of the requests package).History Notes
[ARM]
az bicep install
: Use CA bundle environment variables if setThis checklist is used to make sure that common guidelines for a pull request are followed.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.
I adhere to the Error Handling Guidelines.