Skip to content

ACR task fails to download source code if given a credential with an empty password #23384

@ToxicGLaDOS

Description

@ToxicGLaDOS

Describe the bug

When adding a credential for a remote container registry az acr task run will fail to download the source code if the password given in the credential is the empty string. If given the incorrect password it fails once it tries to pull the container from the remote registry (as expected). The empty string should behave the same as an incorrect password.

Command Name
az acr task credential add
az acr task run

Errors:

Queued a run with ID: cj46
Waiting for an agent...
2022/07/29 16:06:05 Downloading source code...
Run ID: cj46 failed after 3s. Error: failed to download context. Please check if the URL is incorrect. If it has credentials, please check if they are expired

To Reproduce:

Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

  • az acr task create --registry {} --name {} --context {} --git-access-token {} --file {} --subscription {}
  • az acr task credential add --login-server {} --name {} --username {} --registry {} --password "" --subscription {}
  • az acr task run --registry {} --name {} --subscription {}

Expected Behavior

The command fails once it tries to pull from the remote registry, not on downloading source code. Like in this example taken from a run where the password is incorrect, but not empty:

Queued a run with ID: cj47
Waiting for an agent...
2022/07/29 16:07:10 Downloading source code...
2022/07/29 16:07:18 Finished downloading source code
2022/07/29 16:07:19 Alias support enabled for version >= 1.1.0, please see https://aka.ms/acr/tasks/task-aliases for more information.
2022/07/29 16:07:19 Creating Docker network: acb_default_network, driver: 'bridge'
2022/07/29 16:07:19 Successfully set up Docker network: acb_default_network
2022/07/29 16:07:19 Setting up Docker configuration...
2022/07/29 16:07:20 Successfully set up Docker configuration
2022/07/29 16:07:20 Logging in to registry: <myacr>.azurecr.io
2022/07/29 16:07:21 Successfully logged into <myacr>.azurecr.io
2022/07/29 16:07:21 Logging in to registry: <remote_registry>.com
failed to login, ran out of retries: failed to set docker credentials: Error response from daemon: login attempt to https://<remote_registry>.com/v2/ failed with status: 400 Bad Request          
: exit status 1 

Environment Summary

Linux-5.18.14_1-x86_64-with-glibc2.32, Void Linux
Python 3.10.5
Installer: PIP

azure-cli 2.38.0

Extensions:
account 0.2.3
azure-devops 0.22.0
aks-preview 0.5.48

Dependencies:
msal 1.18.0b1
azure-mgmt-resource 21.1.0b1

Additional Context

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions