Azure / cli

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

Azure/CLI@V1 Error on Self-Hosted Runner on Azure AKS #116

Open moulidz opened 9 months ago

moulidz commented 9 months ago

Hi,

I am facing an error while using Azure/CLI@V1 on my self-hosted runner on Azure Kubernetes Service.

The error: ERROR: Please run 'az login' to setup account. Error: Error: az cli script failed.

CLi version: 2.52.0 pre-installed on the AKS actions-runner image along with Azure powershell modules.

The Azure/Login@V1 is successful and Azure/Powershell@V1 is also successful. Only the Azure/CLI@V1 has the error.

On inspecting the docker image for the CLI, I found that the .azure folder is empty.

image

When I run the same workflow on an Azure VM self-hosted runner instead of AKS, the Azure/CLI@V1 works and it is the same version - 2.52.0

image

Is the error because of the latest version of CLI? Should I revert to 2.30.0?

Thanks Mouli

MoChilia commented 9 months ago

Hi @moulidz, Sorry for the delay. This issue could be due to docker incorrectly mounting the .azure folder created by the azure/login action. From my understanding, this issue is specific to self-hosted runners in AKS and appears to be a bug in the azure/cli action, unrelated to the Azure CLI version. I'll need some time to investigate and resolve this. Thank you for your patience.

moulidz commented 9 months ago

Hi @MoChilia,

Sure. I will also test on my side with different configurations and update here if i find anything.

spowser commented 4 months ago

Hello @MoChilia ,

This may be related. I am also getting an error when running the agent from an attached disk in Azure. The agent runs on a Linux VM from a mounted drive at /mnt/blah/whatever/action-runner. The error I'm seeing is

Starting script execution via docker image mcr.microsoft.com/azure-cli:2.57.0
Error: Error: docker: Error response from daemon: create undefined/.azure: "undefined/.azure" includes invalid characters for a local volume name, only "[a-zA-Z0-9][a-zA-Z0-9_.-]" are allowed. If you intended to pass a host directory, use absolute path.

Hope this helps either reproduce it or narrow down the root cause

moulidz commented 4 months ago

Hi,

I tried the az cli action from a new self-hosted runner using the github arc runner. Got a different error here:

Starting script execution via docker image mcr.microsoft.com/azure-cli:2.57.0 Error: Error: docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.

Thanks mouli