azure-cli icon indicating copy to clipboard operation
azure-cli copied to clipboard

[ACR] `az acr login`: Fix login status code when command fails

Open ronlv4 opened this issue 11 months ago • 20 comments

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:

The command 'docker' could not be found in this WSL 2 distro.
We recommend to activate the WSL integration in Docker Desktop settings.

For details about using Docker Desktop with WSL 2, visit:

https://docs.docker.com/go/wsl2/

fixes #27907

Testing Guide Test acr module

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 feature


This checklist is used to make sure that common guidelines for a pull request are followed.

ronlv4 avatar Mar 01 '25 11:03 ronlv4

️✔️AzureCLI-FullTest
️✔️acr
️✔️latest
️✔️3.12
️✔️3.9
️✔️acs
️✔️latest
️✔️3.12
️✔️3.9
️✔️advisor
️✔️latest
️✔️3.12
️✔️3.9
️✔️ams
️✔️latest
️✔️3.12
️✔️3.9
️✔️apim
️✔️latest
️✔️3.12
️✔️3.9
️✔️appconfig
️✔️latest
️✔️3.12
️✔️3.9
️✔️appservice
️✔️latest
️✔️3.12
️✔️3.9
️✔️aro
️✔️latest
️✔️3.12
️✔️3.9
️✔️backup
️✔️latest
️✔️3.12
️✔️3.9
️✔️batch
️✔️latest
️✔️3.12
️✔️3.9
️✔️batchai
️✔️latest
️✔️3.12
️✔️3.9
️✔️billing
️✔️latest
️✔️3.12
️✔️3.9
️✔️botservice
️✔️latest
️✔️3.12
️✔️3.9
️✔️cdn
️✔️latest
️✔️3.12
️✔️3.9
️✔️cloud
️✔️latest
️✔️3.12
️✔️3.9
️✔️cognitiveservices
️✔️latest
️✔️3.12
️✔️3.9
️✔️compute_recommender
️✔️latest
️✔️3.12
️✔️3.9
️✔️computefleet
️✔️latest
️✔️3.12
️✔️3.9
️✔️config
️✔️latest
️✔️3.12
️✔️3.9
️✔️configure
️✔️latest
️✔️3.12
️✔️3.9
️✔️consumption
️✔️latest
️✔️3.12
️✔️3.9
️✔️container
️✔️latest
️✔️3.12
️✔️3.9
️✔️containerapp
️✔️latest
️✔️3.12
️✔️3.9
️✔️core
️✔️latest
️✔️3.12
️✔️3.9
️✔️cosmosdb
️✔️latest
️✔️3.12
️✔️3.9
️✔️databoxedge
️✔️latest
️✔️3.12
️✔️3.9
️✔️dls
️✔️latest
️✔️3.12
️✔️3.9
️✔️dms
️✔️latest
️✔️3.12
️✔️3.9
️✔️eventgrid
️✔️latest
️✔️3.12
️✔️3.9
️✔️eventhubs
️✔️latest
️✔️3.12
️✔️3.9
️✔️feedback
️✔️latest
️✔️3.12
️✔️3.9
️✔️find
️✔️latest
️✔️3.12
️✔️3.9
️✔️hdinsight
️✔️latest
️✔️3.12
️✔️3.9
️✔️identity
️✔️latest
️✔️3.12
️✔️3.9
️✔️iot
️✔️latest
️✔️3.12
️✔️3.9
️✔️keyvault
️✔️latest
️✔️3.12
️✔️3.9
️✔️lab
️✔️latest
️✔️3.12
️✔️3.9
️✔️managedservices
️✔️latest
️✔️3.12
️✔️3.9
️✔️maps
️✔️latest
️✔️3.12
️✔️3.9
️✔️marketplaceordering
️✔️latest
️✔️3.12
️✔️3.9
️✔️monitor
️✔️latest
️✔️3.12
️✔️3.9
️✔️mysql
️✔️latest
️✔️3.12
️✔️3.9
️✔️netappfiles
️✔️latest
️✔️3.12
️✔️3.9
️✔️network
️✔️latest
️✔️3.12
️✔️3.9
️✔️policyinsights
️✔️latest
️✔️3.12
️✔️3.9
️✔️privatedns
️✔️latest
️✔️3.12
️✔️3.9
️✔️profile
️✔️latest
️✔️3.12
️✔️3.9
️✔️rdbms
️✔️latest
️✔️3.12
️✔️3.9
️✔️redis
️✔️latest
️✔️3.12
️✔️3.9
️✔️relay
️✔️latest
️✔️3.12
️✔️3.9
️✔️resource
️✔️latest
️✔️3.12
️✔️3.9
️✔️role
️✔️latest
️✔️3.12
️✔️3.9
️✔️search
️✔️latest
️✔️3.12
️✔️3.9
️✔️security
️✔️latest
️✔️3.12
️✔️3.9
️✔️servicebus
️✔️latest
️✔️3.12
️✔️3.9
️✔️serviceconnector
️✔️latest
️✔️3.12
️✔️3.9
️✔️servicefabric
️✔️latest
️✔️3.12
️✔️3.9
️✔️signalr
️✔️latest
️✔️3.12
️✔️3.9
️✔️sql
️✔️latest
️✔️3.12
️✔️3.9
️✔️sqlvm
️✔️latest
️✔️3.12
️✔️3.9
️✔️storage
️✔️latest
️✔️3.12
️✔️3.9
️✔️synapse
️✔️latest
️✔️3.12
️✔️3.9
️✔️telemetry
️✔️latest
️✔️3.12
️✔️3.9
️✔️util
️✔️latest
️✔️3.12
️✔️3.9
️✔️vm
️✔️latest
️✔️3.12
️✔️3.9

️✔️AzureCLI-BreakingChangeTest
️✔️Non Breaking Changes

Thank you for your contribution! We will review the pull request and get back to you soon.

yonzhan avatar Mar 01 '25 11:03 yonzhan

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). After that please run the following commands to enable git hooks:

pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>

github-actions[bot] avatar Mar 01 '25 11:03 github-actions[bot]

Please note that the PR for breaking change must be released in the breaking change window, but you need to consider pre-pronouncing the breaking change to the customer in advance. For more details, please refer to this doc: https://github.com/Azure/azure-cli/blob/dev/doc/how_to_introduce_breaking_changes.md

zhoxing-ms avatar Mar 24 '25 10:03 zhoxing-ms

@microsoft-github-policy-service agree company="Microsoft"

ronlv4 avatar Mar 24 '25 18:03 ronlv4

@johnsonshi Could you please help review this ACR related PR as well?

zhoxing-ms avatar May 12 '25 09:05 zhoxing-ms

/azp run

zhoxing-ms avatar May 12 '25 09:05 zhoxing-ms

Azure Pipelines successfully started running 3 pipeline(s).

azure-pipelines[bot] avatar May 12 '25 09:05 azure-pipelines[bot]

@onlv4 @johnsonshi Please note that Azure CLI will have a code freeze on 05/13/2025 07:00 UTC for the upcoming release. Please address the comments ASAP, otherwise it has to be postponed to next breaking change window sprint (around November).

zhoxing-ms avatar May 12 '25 11:05 zhoxing-ms

I was just suddenly looped into this issue. I understand the need to have non-zero exit code when az acr login fails to align with the non-zero exit code from non-az tools on authentication failure.

image

However, I would like an ACR engineering counterpart to sign off on this.

johnsonshi avatar May 12 '25 19:05 johnsonshi

I should be more precise on the issue, the status code is 0 when the command fails for docker login, meaning it passed the internal az acr validations (for existing subscription and acr). so for valid arguments you can reproduce the issue: image

ronlv4 avatar May 13 '25 06:05 ronlv4

please note that Azure CLI will have a code freeze on 05/27/2025 07:00 UTC for the upcoming release. Please address these CI issues ASAP, otherwise it has to be postponed to next sprint (07-01).

zhoxing-ms avatar May 26 '25 08:05 zhoxing-ms

/azp run

zhoxing-ms avatar Jun 04 '25 08:06 zhoxing-ms

Azure Pipelines successfully started running 3 pipeline(s).

azure-pipelines[bot] avatar Jun 04 '25 08:06 azure-pipelines[bot]

/azp run

zhoxing-ms avatar Jun 04 '25 08:06 zhoxing-ms

Azure Pipelines successfully started running 3 pipeline(s).

azure-pipelines[bot] avatar Jun 04 '25 08:06 azure-pipelines[bot]

Could you please pull the latest code from remote dev branch to see if it can resolve this CI issue?

zhoxing-ms avatar Jun 05 '25 03:06 zhoxing-ms

Could you please pull the latest code from remote dev branch to see if it can resolve this CI issue?

done

ronlv4 avatar Jun 08 '25 13:06 ronlv4

/azp run

zhoxing-ms avatar Jun 23 '25 10:06 zhoxing-ms

/azp run

zhoxing-ms avatar Jun 23 '25 14:06 zhoxing-ms

@ronlv4 This PR encountered some issues of Github that prevented it from triggering the CI pipeline again. Could you please create a new PR with the same functionality? Then we will replace this PR with the new one, and then merge the new PR

zhoxing-ms avatar Jun 23 '25 14:06 zhoxing-ms

@ronlv4 This PR encountered some issues of Github that prevented it from triggering the CI pipeline again. Could you please create a new PR with the same functionality? Then we will replace this PR with the new one, and then merge the new PR

opened #31692 . let me know if it's still not working, I'll delete the repo and clone it again

ronlv4 avatar Jun 23 '25 17:06 ronlv4

opened https://github.com/Azure/azure-cli/pull/31692 .

Thanks for your quick response, I will close this PR, since this PR has been replaced by #31692

zhoxing-ms avatar Jun 24 '25 02:06 zhoxing-ms