[ACR] az acr login: Fix login status code when command fails#31692
[ACR] az acr login: Fix login status code when command fails#31692zhoxing-ms merged 1 commit intoAzure:devfrom
az acr login: Fix login status code when command fails#31692Conversation
️✔️AzureCLI-FullTest
|
|
Hi @ronlv4, |
️✔️AzureCLI-BreakingChangeTest
|
|
Thank you for your contribution! We will review the pull request and get back to you soon. |
|
The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR. Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions). pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>
|
There was a problem hiding this comment.
Pull Request Overview
This PR ensures that az acr login correctly fails (non-zero exit code) when the Docker command returns an error code without writing to stderr, and fixes typos in the breaking-change reporting docs.
- Updated login logic in
acr_loginto check the Docker process’s return code. - Corrected spelling of
generate-breaking-change-reportin documentation.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/azure-cli/azure/cli/command_modules/acr/custom.py | Changed the failure condition to include non-zero process return codes |
| doc/how_to_introduce_breaking_changes.md | Fixed typo in azdev generate-breaking-change-report command |
Comments suppressed due to low confidence (1)
src/azure-cli/azure/cli/command_modules/acr/custom.py:358
- Add a unit test to simulate a Docker failure where stderr is empty but the process return code is non-zero, verifying that the command returns the correct non-zero exit status.
if stderr or return_code != 0: # when docker command process returns non-zero
|
Thank you for your contribution @ronlv4! We will review the pull request and get back to you soon. |
|
/azp run |
|
Commenter does not have sufficient privileges for PR 31692 in repo Azure/azure-cli |
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
|
Since ACR team @northtyphoon and @johnsonshi approved the same code change in PR #30917, so I will merge this PR |
Related command
az acr login
Description
When az acr login fails for docker login, the command should return a non-zero status code.
Why wasn't this the case? the check was if stderr is not empty. In the case docker is not running, stderr is empty and the error is written to stdout:
fixes #27907
Testing Guide
History Notes
[Component Name 1] BREAKING CHANGE:
az command a: Make some customer-facing breaking change[Component Name 2]
az command b: Add some customer-facing featureThis 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.