Azure / azure-devops-cli-extension

Azure DevOps Extension for Azure CLI
https://docs.microsoft.com/en-us/cli/azure/ext/azure-devops/?view=azure-cli-latest
MIT License
622 stars 241 forks source link

[Bug] Fails to download artifacts due to artifacttool not available for aarch #1006

Closed luiscborbon closed 2 years ago

luiscborbon commented 4 years ago

Describe the bug There is not possible to download universal packages from Azure Artifacts because there is not artifactool for ARM architectures.

To Reproduce Azure Cli Version: azure-cli (2.6.0)

Azure-Devops extension version: azure-devops (0.18.0)

Artifact Tool Version: ArtifactTool (0.2.128)

Steps to reproduce the behavior:

  1. Spin up a virtual machine based on ARM architecture. For example, an a1 or m6g EC2 instance in AWS.
  2. Install the az-cli
  3. Install the azure-devops extension
  4. Login using az login
  5. Run command to download an universal package
    az artifacts universal download \
    --organization "https://dev.azure.com/YourOrganizationURL/" \
    --project "your-project-id" \
    --scope project \
    --feed "your-feed" \
    --name "your-package" \
    --version "0.0.1" \
    --debug \
    --path .
  6. See error
    Failed to update Universal Packages tooling.
    No release could be found based on the provided information.

Expected behavior Being able to download the universal package.

For instance, this is the output from a virtual machine on x86_64 architecture.

{
  "Description": "Welcome to Universal Packages",
  "ManifestId": "0A539BD27044A234CE0C72F4434121D60A329113071851BBD2A3D8C780CAAA4601",
  "SuperRootId": "1FEEC4C2C58BB34AB1F3854421B31AD813D15137E498EA7EACDF127D67507Z3602",
  "Version": "0.0.1"
}

Debug logs Output of the az artifacts universal download command with debug mode.

az artifacts universal download \
>                 --organization "https://dev.azure.com/YourOrganizationURL/" \
>                 --project "your-project-id" \
>                 --scope project \
>                 --feed "your-feed" \
>                 --name "your-package" \
>                 --version "0.0.1" \
>                 --debug \
>                 --path .
Command arguments: ['artifacts', 'universal', 'download', '--organization', 'https://dev.azure.com/YourOrganizationURL/', '--project',
 'project-id, '--scope', 'project', '--feed', 'your-feed', '--name', 'your-package', '--version', '0.0.
1', '--debug', '--path', '.']
Event: Cli.PreExecute []
Event: CommandParser.OnGlobalArgumentsCreate [<function CLILogging.on_global_arguments at 0xffffa40cedd0>, <function OutputProduc
er.on_global_arguments at 0xffffa32ed320>, <function CLIQuery.on_global_arguments at 0xffffa3276440>]
Event: CommandInvoker.OnPreCommandTableCreate []
Installed command modules ['acr', 'acs', 'advisor', 'ams', 'apim', 'appconfig', 'appservice', 'aro', 'backup', 'batch', 'batchai'
, 'billing', 'botservice', 'cdn', 'cloud', 'cognitiveservices', 'configure', 'consumption', 'container', 'cosmosdb', 'deploymentm
anager', 'dla', 'dls', 'dms', 'eventgrid', 'eventhubs', 'extension', 'feedback', 'find', 'hdinsight', 'interactive', 'iot', 'iotc
entral', 'keyvault', 'kusto', 'lab', 'managedservices', 'maps', 'monitor', 'natgateway', 'netappfiles', 'network', 'policyinsight
s', 'privatedns', 'profile', 'rdbms', 'redis', 'relay', 'reservations', 'resource', 'role', 'search', 'security', 'servicebus', '
servicefabric', 'signalr', 'sql', 'sqlvm', 'storage', 'vm']
Loaded module 'acr' in 0.034 seconds.
Loaded module 'acs' in 0.012 seconds.
Loaded module 'advisor' in 0.002 seconds.
Event: CommandLoader.OnLoadCommandTable []
Loaded module 'ams' in 0.012 seconds.
Loaded module 'apim' in 0.003 seconds.
Loaded module 'appconfig' in 0.005 seconds.
Loaded module 'appservice' in 0.022 seconds.
Loaded module 'aro' in 0.007 seconds.
Loaded module 'backup' in 0.007 seconds.
Event: CommandLoader.OnLoadCommandTable []
Loaded module 'batch' in 0.051 seconds.
Loaded module 'batchai' in 0.006 seconds.
Loaded module 'billing' in 0.002 seconds.
Loaded module 'botservice' in 0.007 seconds.
Event: CommandLoader.OnLoadCommandTable []
Loaded module 'cdn' in 0.011 seconds.
Loaded module 'cloud' in 0.002 seconds.
Loaded module 'cognitiveservices' in 0.003 seconds.
Loaded module 'configure' in 0.002 seconds.
Loaded module 'consumption' in 0.004 seconds.
Loaded module 'container' in 0.003 seconds.
Loaded module 'cosmosdb' in 0.016 seconds.
Loaded module 'deploymentmanager' in 0.005 seconds.
Loaded module 'dla' in 0.009 seconds.
Loaded module 'dls' in 0.006 seconds.
Loaded module 'dms' in 0.004 seconds.
Loaded module 'eventgrid' in 0.006 seconds.
Loaded module 'eventhubs' in 0.006 seconds.
Loaded module 'extension' in 0.001 seconds.
Loaded module 'feedback' in 0.001 seconds.
Loaded module 'find' in 0.001 seconds.
Loaded module 'hdinsight' in 0.004 seconds.
Loaded module 'interactive' in 0.001 seconds.
Loaded module 'iot' in 0.010 seconds.
Loaded module 'iotcentral' in 0.002 seconds.
Loaded module 'keyvault' in 0.013 seconds.
Loaded module 'kusto' in 0.003 seconds.
Loaded module 'lab' in 0.006 seconds.
Loaded module 'managedservices' in 0.002 seconds.
Loaded module 'maps' in 0.004 seconds.

Loaded module 'monitor' in 0.016 seconds.
Loaded module 'natgateway' in 0.002 seconds.
Event: CommandLoader.OnLoadCommandTable []
Loaded module 'netappfiles' in 0.006 seconds.
Loaded module 'network' in 0.072 seconds.
Loaded module 'policyinsights' in 0.005 seconds.
Loaded module 'privatedns' in 0.009 seconds.
Loaded module 'profile' in 0.002 seconds.
Loaded module 'rdbms' in 0.016 seconds.
Loaded module 'redis' in 0.004 seconds.
Loaded module 'relay' in 0.006 seconds.
Loaded module 'reservations' in 0.003 seconds.
Loaded module 'resource' in 0.022 seconds.
Loaded module 'role' in 0.009 seconds.
Loaded module 'search' in 0.003 seconds.
Loaded module 'security' in 0.005 seconds.
Loaded module 'servicebus' in 0.010 seconds.
Loaded module 'servicefabric' in 0.005 seconds.
Loaded module 'signalr' in 0.003 seconds.
Loaded module 'sql' in 0.019 seconds.
Loaded module 'sqlvm' in 0.004 seconds.
Event: CommandLoader.OnLoadCommandTable []
Loaded module 'storage' in 0.080 seconds.
Loaded module 'vm' in 0.075 seconds.
Loaded all modules in 0.669 seconds. (note: there's always an overhead with the first module loaded)
Found 2 extensions: ['interactive', 'azure-devops']
Extension compatibility result: is_compatible=True cli_core_version=2.6.0 min_required=2.0.62 max_required=None
Extensions directory: '/root/.azure/cliextensions/interactive'
Loaded extension 'interactive' in 0.001 seconds.
Extension compatibility result: is_compatible=True cli_core_version=2.6.0 min_required=2.2.0 max_required=None
Extensions directory: '/root/.azure/cliextensions/azure-devops'
Loaded extension 'azure-devops' in 0.044 seconds.
Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0xffffa32260e0>]
az_command_data_logger : command args: artifacts universal download --organization {} --project {} --scope {} --feed {} --name {}
 --version {} --debug --path {}
metadata file logging enabled - writing logs to '/root/.azure/commands'.
Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument.<locals>.add_subscription_parameter at 0
xffffa24c1cb0>]
Event: CommandInvoker.OnPostArgumentLoad []
Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument.<locals>.add_ids_arguments at 0xffffa24e5e60>, <f
unction register_cache_arguments.<locals>.add_cache_arguments at 0xffffa246f170>]
Event: CommandInvoker.OnCommandTableLoaded []
Event: CommandInvoker.OnPreParseArgs [<function _documentdb_deprecate at 0xffffa1ccee60>]
Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0xffffa32ed3b0>, <function CLIQuery.han
dle_query_parameter at 0xffffa32764d0>, <function register_ids_argument.<locals>.parse_ids_arguments at 0xffffa24e5ef0>, <functio
n handler at 0xffffa1b4f560>, <function DevCommandsLoader.post_parse_args at 0xffffa11b6a70>]
az_command_data_logger : extension name: azure-devops
az_command_data_logger : extension version: 0.18.0

Checking for a new ArtifactTool
Checking for ArtifactTool updates
PAT is present which can be used against this instance
Current cloud config:
AzureCloud
az login is not present
There are no active accounts.
Traceback (most recent call last):
  File "/root/lib/azure-cli/lib/python3.7/site-packages/azure/cli/core/_profile.py", line 494, in get_current_account_user
    active_account = self.get_subscription()
  File "/root/lib/azure-cli/lib/python3.7/site-packages/azure/cli/core/_profile.py", line 503, in get_subscription
    raise CLIError(_AZ_LOGIN_MESSAGE)
knack.util.CLIError: Please run 'az login' to setup account.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/root/.azure/cliextensions/azure-devops/azext_devops/dev/common/services.py", line 61, in _get_credentials
    token_from_az_login = get_token_from_az_logins(organization, pat_token_present)
  File "/root/.azure/cliextensions/azure-devops/azext_devops/dev/common/services.py", line 118, in get_token_from_az_logins
    dummy_user = profile.get_current_account_user()     # noqa: F841
  File "/root/lib/azure-cli/lib/python3.7/site-packages/azure/cli/core/_profile.py", line 496, in get_current_account_user
    raise CLIError('There are no active accounts.')
knack.util.CLIError: There are no active accounts.
received PAT from environment variable
Creating connection with personal access token.
msrest.universal_http.requests : Configuring retry: max_retries=3, backoff_factor=0.8, max_backoff=90
Azure devops telemetry disabled.
msrest.universal_http.requests : Configuring retry: max_retries=3, backoff_factor=0.8, max_backoff=90
azext_devops.devops_sdk._file_cache : Loading cache file: /root/.azure-devops/python-sdk/cache/resources.json
azext_devops.devops_sdk._file_cache : attempting to read file /root/.azure-devops/python-sdk/cache/resources.json as utf-8-sig
azext_devops.devops_sdk.connection : File cache hit for resources on: https://dev.azure.com/yourorganizationurl
msrest.universal_http.requests : Configuring retry: max_retries=3, backoff_factor=0.8, max_backoff=90
Looking up current version of ArtifactTool...
azext_devops.devops_sdk._file_cache : Loading cache file: /root/.azure-devops/python-sdk/cache/options.json
azext_devops.devops_sdk._file_cache : attempting to read file /root/.azure-devops/python-sdk/cache/options.json as utf-8-sig
azext_devops.devops_sdk.client : File cache hit for options on: https://vsblob.dev.azure.com/yourorganizationurl
azext_devops.devops_sdk.client : Route template: _apis/{area}/{toolName}/{resource}
azext_devops.devops_sdk.client : Api version '5.0-preview'
azext_devops.devops_sdk.client : GET https://vsblob.dev.azure.com/YourOrganizationURL/_apis/clienttools/ArtifactTool/release?osName=Li
nux&arch=aarch64&distroName=amzn&distroVersion=2
azext_devops.devops_sdk.client : Request content: None
msrest.universal_http : Configuring redirects: allow=True, max=30
msrest.universal_http : Configuring request: timeout=100, verify=True, cert=None
msrest.universal_http : Configuring proxies: ''
msrest.universal_http : Evaluate proxies against ENV settings: True
urllib3.connectionpool : Starting new HTTPS connection (1): vsblob.dev.azure.com:443
urllib3.connectionpool : https://vsblob.dev.azure.com:443 "GET /YourOrganizationURL/_apis/clienttools/ArtifactTool/release?osName=Linu
x&arch=aarch64&distroName=amzn&distroVersion=2 HTTP/1.1" 404 326
azext_devops.devops_sdk.client : Response content: b'{"$id":"1","innerException":null,"message":"No release could be found based
on the provided information.","typeName":"Microsoft.VisualStudio.Services.BlobStore.WebApi.Exceptions.ClientToolNotFoundException
, Microsoft.VisualStudio.Services.BlobStore.WebApi","typeKey":"ClientToolNotFoundException","errorCode":0,"eventId":3000}'
msrest.exceptions : No release could be found based on the provided information.
No release could be found based on the provided information.
Traceback (most recent call last):
  File "/root/.azure/cliextensions/azure-devops/azext_devops/dev/common/artifacttool_updater.py", line 59, in _get_artifacttool
    release = _get_current_release(organization, override_version)
  File "/root/.azure/cliextensions/azure-devops/azext_devops/dev/common/artifacttool_updater.py", line 167, in _get_current_relea
se
    version=override_version)
  File "/root/.azure/cliextensions/azure-devops/azext_devops/dev/common/client_tool/client_tool_client.py", line 48, in get_clien
ttool_release
    query_parameters=query_parameters)
  File "/root/.azure/cliextensions/azure-devops/azext_devops/devops_sdk/client.py", line 90, in _send
    response = self._send_request(request=request, headers=headers, content=content, media_type=media_type)
  File "/root/.azure/cliextensions/azure-devops/azext_devops/devops_sdk/client.py", line 54, in _send_request
    self._handle_error(request, response)
  File "/root/.azure/cliextensions/azure-devops/azext_devops/devops_sdk/client.py", line 233, in _handle_error
    raise AzureDevOpsServiceError(wrapped_exception)
azext_devops.devops_sdk.exceptions.AzureDevOpsServiceError: No release could be found based on the provided information.
handling generic error
cli.azure.cli.core.util : Failed to update Universal Packages tooling.
 No release could be found based on the provided information.
Failed to update Universal Packages tooling.
 No release could be found based on the provided information.
Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0xffffa3233200>]
az_command_data_logger : exit code: 1
command ran in 1.136 seconds.

Additional context The azure-devops extension relies on the artifacttool to download universal packages from Azure Artifacts.

The artifacttool is available for x86_64 architectures, but it seems to do not be available for aarch or aarch64 architectures.

Log section when the artifact is being downloaded from an x86 architecture.

urllib3.connectionpool : https://vsblob.dev.azure.com:443 "GET /ARMCloudRunner/_apis/clienttools/ArtifactTool/release?osName=Linu
x&arch=x86_64&distroName=ubuntu&distroVersion=18.04 HTTP/1.1" 200 448
azext_devops.devops_sdk.client : Response content: b'{"name":"ArtifactTool","rid":"linux-x64","version":"0.2.128","uri":"https://
08wvsblobprodsu6weus73.vsblob.vsassets.io/artifacttool/artifacttool-linux-x64-Release_0.2.128.zip?sv=2019-02-02&sr=b&sig=QUIvDAHS
gh0pklwy9oc4aWowV1q2HpHjnztvPJo4HGM%3D&spr=https&se=2020-05-19T22%3A36%3A45Z&sp=r&P1=1589927505&P2=11&P3=2&P4=1YR3onUr%2f%2b4r8pH
LxKRpztr%2bJsra5H%2bFvbkCXWB47S8%3d"}'
Checking if we already have ArtifactTool release 'ArtifactTool_linux-x64_0.2.128'
Not updating ArtifactTool because the current release already exists at '/home/user/.azure/azuredevops/cli/tools/artifacttool/
ArtifactTool_linux-x64_0.2.128'

Log section when the artifact is being downloaded from an aarch64 architecture.

urllib3.connectionpool : https://vsblob.dev.azure.com:443 "GET /YourOrganizationURL/_apis/clienttools/ArtifactTool/release?osName=Linu
x&arch=aarch64&distroName=amzn&distroVersion=2 HTTP/1.1" 404 326
azext_devops.devops_sdk.client : Response content: b'{"$id":"1","innerException":null,"message":"No release could be found based
on the provided information.","typeName":"Microsoft.VisualStudio.Services.BlobStore.WebApi.Exceptions.ClientToolNotFoundException
, Microsoft.VisualStudio.Services.BlobStore.WebApi","typeKey":"ClientToolNotFoundException","errorCode":0,"eventId":3000}'
msrest.exceptions : No release could be found based on the provided information.
No release could be found based on the provided information.

File type of the artifacttool from x86_64 architecture.

file /home/user/.azure/azuredevops/cli/tools/artifacttool/ArtifactTool_linux-x64_0.2.128/artifacttool
/home/user/.azure/azuredevops/cli/tools/artifacttool/ArtifactTool_linux-x64_0.2.128/artifacttool: ELF 64-bit LSB executable, x
86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/l, for GNU/Linux 2.6.32, BuildID[sha1]=4ec13ff8901e49db678f8c4ba0
0bb6da52ef55b3, stripped

There is required to build the artifacttool for aarch and aarch64 architectures.

makoto0701 commented 3 years ago

I face same issue on my env. Is there any updates for this item?

oscrx commented 3 years ago

I am also experiencing this issue for artifact publishing on an M1 mac. Same versions as above.

nubgamerz commented 3 years ago

Also experiencing this issue on M1 Mac. Works fine on Intel chip macbook.

adrastogi commented 3 years ago

Hit this problem recently as well, so adding another vote for requesting this support.

MacJot commented 3 years ago

The same problem in azcli container, pulled from mcr.microsoft.com/azure-cli:

az version
{
  "azure-cli": "2.26.0",
  "azure-cli-core": "2.26.0",
  "azure-cli-telemetry": "1.0.6",
  "extensions": {
    "azure-devops": "0.18.0"
  }
}

Some latest logs from az artifacts universal publish ... --debug command:

msrest.universal_http: Evaluate proxies against ENV settings: True
urllib3.connectionpool: Starting new HTTPS connection (1): vsblob.dev.azure.com:443
urllib3.connectionpool: https://dev.azure.com:443 "POST /project1/_apis/CustomerIntelligence/Events HTTP/1.1" 204 0
urllib3.connectionpool: https://vsblob.dev.azure.com:443 "GET /project1/_apis/clienttools/ArtifactTool/release?osName=Linux&arch=x86_64&distroName=alpine&distroVersion=3.13.5 HTTP/1.1" 404 326
azext_devops.devops_sdk.client: Response content: b'{"$id":"1","innerException":null,"message":"No release could be found based on the provided information.","typeName":"Microsoft.VisualStudio.Services.BlobStore.WebApi.Exceptions.ClientToolNotFoundException, Microsoft.VisualStudio.Services.BlobStore.WebApi","typeKey":"ClientToolNotFoundException","errorCode":0,"eventId":3000}'
msrest.exceptions: No release could be found based on the provided information.
cli.azext_devops.dev.common.artifacttool_updater: No release could be found based on the provided information.
MacJot commented 3 years ago

1138 seems to be the same reason... and there is a solution with preparing own docker image - maybe could be useful.

chill-uk commented 3 years ago

Yep, same for Mac M1 running macOS Big Sur and also Window10 ARM edition (via parallels)

urllib3.connectionpool: https://xxxxxxxxxx.vsblob.visualstudio.com:443 “GET /_apis/clienttools/ArtifactTool/release?osName=Darwin&arch=arm64&distroName=darwin&distroVersion=20.5.0 HTTP/1.1” 404 326
azext_devops.devops_sdk.client: Response content: b’{“$id”:“1”,“innerException”:null,“message”:“No release could be found based on the provided
javierjim commented 2 years ago

Any chance to getting this issue completed soon? We took #1210 and tested on an M1 (see @ansorod 's comment in the PR).

It would be nice to get a new version and just update to it instead of people building their own versions :) I understand it's important to test this fully though!

michaelJWarner commented 2 years ago

This was closed but the build failed on master. Is this available now by just upgrading my CLI version?

nubgamerz commented 2 years ago

This needs to be re-opened. It's still broken after upgrading to the latest version of CLI.

joyl1216 commented 2 years ago

Any update on this issue? I still got it on my Apple M1

test2012cui commented 2 years ago

I have same problem with azure-cli version 2.30.0 Down grade to azure-cli 2.28.0 *. I can pass it. It looks regression. Below link tells how to install particular version. Hope this helps. https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-linux?pivots=apt

renerogerZ commented 2 years ago

Same problem here. az tools on EC2 ARM instances are not working. M1 workaround is not available here. @jmyersmsft : please reopen.

mlasch commented 1 year ago

This is still an issue on Raspberry Pi 3B with aarch64. Installed azure cli via pip.

$ pip install azure-cli

$ az version
{
  "azure-cli": "2.48.1",
  "azure-cli-core": "2.48.1",
  "azure-cli-telemetry": "1.0.8",
  "extensions": {
    "azure-devops": "0.26.0"
  }
}
az pipelines runs artifact download ...
urllib3.connectionpool: https://vsblob.dev.azure.com:443 "GET /HQV-Gardena/_apis/clienttools/ArtifactTool/release?osName=Linux&arch=aarch64&distroName=debian&distroVersion=11 HTTP/1.1" 404 326
azext_devops.devops_sdk.client: Response content: b'{"$id":"1","innerException":null,"message":"No release could be found based on the provided information.","typeName":"Microsoft.VisualStudio.Services.BlobStore.WebApi.Exceptions.ClientToolNotFoundException, Microsoft.VisualStudio.Services.BlobStore.WebApi","typeKey":"ClientToolNotFoundException","errorCode":0,"eventId":3000}'
msrest.exceptions: No release could be found based on the provided information.
pwrmiller commented 1 year ago

This needs to be reopened, and appears to be an issue both on Windows and M1 in the latest release.

chirs1985 commented 1 year ago

Do your ArtifactTool support the OS= Linux and Arch =armv7l ? I use the ARCH linux in raspberry PI 4.

mla2 commented 11 months ago

This is also an issue when running ARM64 (aarch64) CI pipelines. Then there is no option to run anything in Rosetta.

Shaked commented 11 months ago

Is this going to be fixed at some point?

CC @jmyersmsft

crNewton commented 8 months ago

This is an issue on RPI 4B, running Raspberry OS 32x or 64x. 32x uses :
ttps://company.vsblob.visualstudio.com/_apis/clienttools/ArtifactTool/release?osName=Linux&arch=armv7l&distroName=raspbian&distroVersion=12

64x uses: ttps://company.vsblob.visualstudio.com/_apis/clienttools/ArtifactTool/release?osName=Linux&arch=aarch64&distroName=raspbian&distroVersion=12