azure-cli: The `az acr build` command throws `TypeError: 'NoneType' object is not callable` exception

Resource Provider Azure CLI, running:

az acr build

Description of Feature or Work Requested Trying to build the container in Azure DevOps pipeline for deployment. The job fails on running the command with the following Python exception from the CLI:

ERROR: The command failed with an unexpected error. Here is the traceback:
ERROR: 'NoneType' object is not callable
Traceback (most recent call last):
  File "/opt/az/lib/python3.6/site-packages/knack/cli.py", line 231, in invoke
    cmd_result = self.invocation.execute(args)
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 657, in execute
    raise ex
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 720, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 691, in _run_job
    result = cmd_copy(params)
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 328, in __call__
    return self.handler(*args, **kwargs)
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
    return op(**command_args)
  File "/opt/az/lib/python3.6/site-packages/azure/cli/command_modules/acr/build.py", line 109, in acr_build
    variant=platform_variant
TypeError: 'NoneType' object is not callable
To open an issue, please run: 'az feedback'
##[error]Script failed with exit code: 1
/usr/bin/az account clear
Finishing: Azure CLI - ACR remote build

Target Date Immediate deployment - business critical issue.

It’s a business critical issue for us, so I’m happy to escalate as a priority level 1 if needed.

Agent job:

Pool: Azure Pipelines
Image: ubuntu-20.04
Agent: Hosted Agent
Started: Today at 10:49
Duration: 11s

Build initialisation:

Starting: Azure CLI - ACR remote build
==============================================================================
Task         : Azure CLI
Description  : Run Azure CLI commands against an Azure subscription in a PowerShell Core/Shell script when running on Linux agent or PowerShell/PowerShell Core/Batch script when running on Windows agent.
Version      : 2.1.0
Author       : Microsoft Corporation
Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/deploy/azure-cli
==============================================================================
/usr/bin/az --version
WARNING: You have 2 updates available. Consider updating your CLI installation with 'az upgrade'
azure-cli                         2.26.0 *

Please let us know how we are doing: https://aka.ms/azureclihats
and let us know if you're interested in trying out our newest features: https://aka.ms/CLIUXstudy

core                              2.26.0 *
telemetry                          1.0.6

Extensions:
azure-devops                      0.18.0

Python location '/opt/az/bin/python3'
Extensions directory '/opt/az/azcliextensions'

Python (Linux) 3.6.10 (default, Jul  2 2021, 06:40:29) 
[GCC 9.3.0]

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 5
  • Comments: 21 (1 by maintainers)

Most upvoted comments

Is there any ETA on when the release will be updated on the Cloud Shell as well? It’s still running the 2.26.0 version.

Yep, we applied this workaround and it actually works (failed to mention it in this thread but did mention here: https://github.com/actions/virtual-environments/issues/3735). Thanks @xenatisch !

This has been brought up in https://github.com/actions/virtual-environments/issues/3735 where they mentioned that they will update the runners by Wed/Thurs… in the mean time there’s a workaround to run az cli upgrade to 2.26.1 (it adds about 5 mins to your workflow)

az upgrade --yes az upgrade is not supported by Cloud Shell. Kindly improve AZ test quality and TEAM. we are facing lot of issues and people keep on posting and facing lot issues in AZ tools. Never expect these kind of lot issues from AZ CLI tools. And downloading Az CLI very slow.

Working in AZ cli local { “azure-cli”: “2.26.1”, “azure-cli-core”: “2.26.1”, “azure-cli-telemetry”: “1.0.6”, “extensions”: {} }

The issue is apparently solved by the yesterday’s release of az-cli. At least az acr build started working locally after the upgrade. In our case, we depend on github runners, so I expect it to disappear soon, once they start rolling out machines with updated az-cli.

@marcin-vt yeah, it won’t work on the pipeline. There is another workaround, but it’ll be messy @JotaP. You can build directly using docker build, then log in and push the built image into the registry.

Not very feasible if you have several pipelines for different things, connected to different branches like we do. It’ll take a day to update and test them all.

Thanks for the workaround but sadly enough it’s a big mess for us as we have a lot of different pipelines and automated stuff around them. Anyways, thanks for the idea @xenatisch