Azure / cli

Automate your GitHub workflows using Azure CLI scripts
MIT License
124 stars 52 forks source link

Unable to fetch all az cli versions #111

Closed ffisc closed 8 months ago

ffisc commented 11 months ago

When using azure/CLI@v1 inside a GHA workflow , I got the message

Warning: Unable to fetch all az cli versions, please report it as an issue on https://github.com/Azure/CLI/issues. Output: Ref A: C4AA9AE9E1C64A6FA0EF62CBF329B6F9 Ref B: DM2EDGE0411 Ref C: 2023-07-31T18:08:31Z
, Error: SyntaxError: Unexpected token R in JSON at position 0
Starting script execution via docker image mcr.microsoft.com/azure-cli:2.50.0

So here I am reporting it as an issue 🙂

MoChilia commented 11 months ago

Hi @ffisc, The error happened when it failed to get the version list of azure-cli. Please run the following command in your workflow and check the output.

curl --location -s https://mcr.microsoft.com/v2/azure-cli/tags/list
runningmanGBG commented 9 months ago

Hi,

I have the same issue and when curling the location in powershell I get the following, but the error occurs for me when ACT is running the self-hosted runner for debugging purposes.

runningmanGBG commented 9 months ago

This is the result I got

StatusCode : 200 StatusDescription : OK Content : { "name": "azure-cli", "tags": [ "0.10.0", "0.10.1", "0.10.10", "0.10.11", "0.10.12", "0.10.13", "0.10.14", "0.10.2", "0.10.3", "0.10.4", "0.10.5", ... RawContent : HTTP/1.1 200 OK X-Cache: TCP_HIT x-ms-request-id: 40011052-101e-0068-5636-edb524000000 x-ms-version: 2009-09-19 x-ms-lease-status: unlocked x-ms-blob-type: BlockBlob x-mcr-privacy: https://priva... Forms : {} Headers : {[X-Cache, TCP_HIT], [x-ms-request-id, 40011052-101e-0068-5636-edb524000000], [x-ms-version, 2009-09-19], [x-ms-lease-status, unlocked]...} Images : {} InputFields : {} Links : {} ParsedHtml : mshtml.HTMLDocumentClass RawContentLength : 2571

runningmanGBG commented 9 months ago

My problem starts when trying to run the azure/login which fails due to the lack of the Azure CLI in the ACT runner and therefore I am trying to use this one to get it installed.

ffisc commented 9 months ago

Hi @ffisc, The error happened when it failed to get the version list of azure-cli. Please run the following command in your workflow and check the output.

curl --location -s https://mcr.microsoft.com/v2/azure-cli/tags/list

It only happened once

runningmanGBG commented 9 months ago

For me it was everytime, but I hope it is solved now by using the full ubuntu image instead when running.

MoChilia commented 9 months ago

Hi @runningmanGBG, It appears that you have successfully retrieved the Azure CLI version. The issue experienced by ffisc may have been due to an intermittent Internet problem, as it occurred only once. Based on your description, it seems you are attempting to use the azure/cli action to install Azure CLI. However, this is not the correct usage of the azure/cli action. This action runs within a Docker container that already has the Azure CLI preinstalled and does not install it on your runner. Once the azure/cli action completes, it will clean up the container.

ffisc commented 8 months ago

The issue experienced by ffisc may have been due to an intermittent Internet problem, as it occurred only once.

This happened inside a GHA run, do intermittent Internet problems apply?

runningmanGBG commented 8 months ago

The problem ess fixad by using a different base image in ACT that was more complete in its mirroring of the actual GitHub runner.

MoChilia commented 7 months ago

The issue experienced by ffisc may have been due to an intermittent Internet problem, as it occurred only once.

This happened inside a GHA run, do intermittent Internet problems apply?

Certainly, azure/cli action uses curl to fetch az cli versions from remote url. If the internet connection of your runner drops during a workflow run, it can lead to connection timeouts when the action tries to fetch data from the internet.

ffisc commented 7 months ago

Interesting, I never assumed there could be internet connection issues with GH-hosted runners