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

[Bug] az artifacts universal download: Bad CPU type in executable: 'artifacttool'

Open seung-hyun-moon opened this issue 1 year ago • 1 comments

Describe the bug

When using az artifacts universal download command on apple silicon M2 machine, I get the following error. The azcli is downloaded via homebrew using Formula, Not the API.

[Errno 86] Bad CPU type in executable: '/Users/ansible-pipeline/.azure/azuredevops/cli/tools/artifacttool/ArtifactTool_osx-x64_0.2.372/artifacttool'

Versions info

$ az -v                               
azure-cli                         2.67.0

core                              2.67.0
telemetry                          1.1.0

Extensions:
azure-devops                       1.0.1

Dependencies:
msal                              1.31.0
azure-mgmt-resource               23.1.1

Python location '/opt/homebrew/Cellar/ypso-azure-cli2/2.67.0/libexec/bin/python'
Extensions directory '/Users/ansible-pipeline/.azure/cliextensions'

Python (Darwin) 3.12.7 (main, Oct  1 2024, 02:05:46) [Clang 16.0.0 (clang-1600.0.26.3)]

Legal docs and information: aka.ms/AzureCliLegal


Your CLI is up-to-date.

To Reproduce

Steps to reproduce the behavior:

  1. set homebrew to use Formula to download. $ HOMEBREW_NO_INSTALL_FROM_API=1 then $ brew tap --force homebrew/core
  2. download azcli $ brew install --build-from-source azure-cli
  3. add extention $ az extension add --name azure-devops
  4. az login az login --service-principal -u {} -p {} --tenant {}
  5. run az command
az artifacts universal download \
--organization "https://dev.azure.com/YourOrganizationURL/" \
--project "your-project-id" \
--scope project \
--feed "your-feed" \
--name "your-package" \
--version "your-version" \
--debug \
--path .

Error Message

$ az extension add --name azure-devops
$ az artifacts universal download --organization "https://dev.azure.com/YPSOMEDAG/" --project "89d13375-4607-4bce-b0f5-94320d4f027b" --scope project --feed "smartMDI" --name "openjdk-mac" --version "0.0.1" --path .
The command failed with an unexpected error. Here is the traceback:
[Errno 86] Bad CPU type in executable: '/Users/ansible-pipeline/.azure/azuredevops/cli/tools/artifacttool/ArtifactTool_osx-x64_0.2.372/artifacttool'
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/ypso-azure-cli2/2.67.0/libexec/lib/python3.12/site-packages/knack/cli.py", line 233, in invoke
    cmd_result = self.invocation.execute(args)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/ypso-azure-cli2/2.67.0/libexec/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 666, in execute
    raise ex
  File "/opt/homebrew/Cellar/ypso-azure-cli2/2.67.0/libexec/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 733, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/ypso-azure-cli2/2.67.0/libexec/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 725, in _run_job
    return cmd_copy.exception_handler(ex)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ansible-pipeline/.azure/cliextensions/azure-devops/azext_devops/dev/common/exception_handler.py", line 31, in azure_devops_exception_handler
    reraise(*sys.exc_info())
  File "/opt/homebrew/Cellar/ypso-azure-cli2/2.67.0/libexec/lib/python3.12/site-packages/six.py", line 719, in reraise
    raise value
  File "/opt/homebrew/Cellar/ypso-azure-cli2/2.67.0/libexec/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 703, in _run_job
    result = cmd_copy(params)
             ^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/ypso-azure-cli2/2.67.0/libexec/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 336, in __call__
    return self.handler(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/ypso-azure-cli2/2.67.0/libexec/lib/python3.12/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
    return op(**command_args)
           ^^^^^^^^^^^^^^^^^^
  File "/Users/ansible-pipeline/.azure/cliextensions/azure-devops/azext_devops/dev/artifacts/universal.py", line 98, in download_package
    return artifact_tool.download_universal(organization, project, feed, name, version, path, file_filter)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ansible-pipeline/.azure/cliextensions/azure-devops/azext_devops/dev/common/artifacttool.py", line 42, in download_universal
    return self.run_artifacttool(organization, args, "Downloading")
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ansible-pipeline/.azure/cliextensions/azure-devops/azext_devops/dev/common/artifacttool.py", line 67, in run_artifacttool
    proc = self._tool_invoker.run(command_args, new_env, initial_progress_message, _process_stderr)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ansible-pipeline/.azure/cliextensions/azure-devops/azext_devops/dev/common/external_tool.py", line 74, in run
    self.start(command_args, env)
  File "/Users/ansible-pipeline/.azure/cliextensions/azure-devops/azext_devops/dev/common/external_tool.py", line 33, in start
    self._proc = subprocess.Popen(
                 ^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/[email protected]/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/opt/homebrew/Cellar/[email protected]/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/subprocess.py", line 1955, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
OSError: [Errno 86] Bad CPU type in executable: '/Users/ansible-pipeline/.azure/azuredevops/cli/tools/artifacttool/ArtifactTool_osx-x64_0.2.372/artifacttool'
To check existing issues, please visit: https://github.com/Azure/azure-cli/issues

Let me know if you need further information

seung-hyun-moon avatar Nov 21 '24 10:11 seung-hyun-moon

My team members have been able to use the azure-devops extension to download from the artifacts feed on apple silicon mac books using az version 2.68, but trying to do the same on an M4 with az version 2.77 throws the cpu error. so far i have not found an acceptable solution as installing homebrew and the cli for x86-64 as stated in this thread breaks my workflow

awkjacobs avatar Sep 09 '25 17:09 awkjacobs