Open andysbolton opened 2 years ago
Thanks for reporting. Invoke-AzContainerInstanceCommand
establishes standard output channel between PowerShell console can ContainerInstance. We have no idea what difference is in ADO. We are contacting engineering team.
@andysbolton , I know it's far but I am encountering the same issue, running Invoke-AzContainerInstanceCommand locally works but in my azure devops pipeline, it takes less than one second and i find that the command didn't properly run in the container. Did you by any chance find a solution ?
@lbouriez I haven't tested newer versions of azure-powershell and am not currently utilizing it, but when I was running into this issue initially, I worked around by manually making a post to the Containers endpoint and streaming back the results via the websocket address in the response. https://gist.github.com/andysbolton/88d70684e447fcb3a291f161d8631641
Thank you for your answer, I will have a look :)
Description
When I run this command in an Azure Devops pipeline with an ubuntu-20.04 image and the Azure Powershell Task, I notice that it it returns immediately and continues running the pipeline script. If I run locally, it blocks for 10 seconds before returning.
Because of this, I'm not able to determine in the pipeline whether the executed command has succeeded or failed.
(FYI I also created an issue in the azure-pipelines-task repo: https://github.com/microsoft/azure-pipelines-tasks/issues/16590)
I'm not sure if this is because the pipeline task is run in NonInteractive mode (although the above command works in NonInteractive mode locally).
If I execute a command that writes to standard out and then put in a
Start-Sleep
command in the pipeline task, I receive all of the standard out, so it seems the websockets are working correctly, but it is not waiting for the executed command to finish.Should this command be expected to block in the pipeline or is there some limitation in the pipeline/task or the PowerShell library that is preventing that from happening?
Issue script & Debug output
(Apologies for the garbled output, it's due to the pipeline obfuscating secrets)
Environment data
Module versions
This output is very garbled, but it should be Az.ContainerInstance 3.0.1 and Az.Accounts 2.9.1.
Error output