microsoft / azure-pipelines-tasks

Tasks for Azure Pipelines
https://aka.ms/tfbuild
MIT License
3.5k stars 2.61k forks source link

[BUG]: DockerCompose@1 not running on linux system #20368

Closed p-hlp closed 4 weeks ago

p-hlp commented 2 months ago

New issue checklist

Task name

DockerCompose

Task version

1.243.1

Issue Description

We've been getting the docker compose v1 deprecation warning for a while (using DockerCompose@0) and wanted to swap over to the new DockerCompose@1 task, but ran into the following issue when testing:

The current operating system is not capable of running this task. That typically means the task was written for Windows only. For example, written for Windows Desktop PowerShell.

The docs for the DockerCompose@1 don't say anything about windows only, so I'm kinda surprised.

Environment:

Environment type (Please select at least one enviroment where you face this issue)

Azure DevOps Server type

dev.azure.com (formerly visualstudio.com)

Azure DevOps Server Version (if applicable)

No response

Operation system

20.04.6 LTS

Relevant log output

2024-08-29T07:06:33.6402445Z ##[section]Starting: Compose Up
2024-08-29T07:06:33.6411241Z ==============================================================================
2024-08-29T07:06:33.6411585Z Task         : Docker Compose
2024-08-29T07:06:33.6411761Z Description  : Build, push or run multi-container Docker applications. Task can be used with Docker or Azure Container registry.
2024-08-29T07:06:33.6412086Z Version      : 1.243.1
2024-08-29T07:06:33.6412230Z Author       : Microsoft Corporation
2024-08-29T07:06:33.6412416Z Help         : https://aka.ms/azpipes-docker-compose-tsg
2024-08-29T07:06:33.6412616Z ==============================================================================
2024-08-29T07:06:33.6547697Z ##[error]The current operating system is not capable of running this task. That typically means the task was written for Windows only. For example, written for Windows Desktop PowerShell.
2024-08-29T07:06:33.6559695Z ##[section]Finishing: Compose Up

Full task logs with system.debug enabled

No response

Repro steps

jobs:
  - deployment: ${{ parameters.jobName }}
    displayName: ${{ parameters.displayName }}
    environment:
      name: ${{ parameters.environmentName }}
      resourceName: ${{ parameters.resourceName }}
      resourceType: ${{ parameters.resourceType }}
    strategy:
      runOnce:
        preDeploy:
          steps:
            - checkout: self
              clean: true
        deploy:
          steps:
            - download: none
            - task: DockerCompose@1
              inputs:
                containerregistrytype: 'Azure Container Registry'
                azureSubscription: 'ExampleSubscription'
                azureContainerRegistry: '{"loginServer":"example.azurecr.io", "id" : "/subscriptions/example"}'
                dockerComposeFile: ${{ parameters.dockerComposeFile }}
                action: 'Run a Docker Compose command'
                dockerComposeCommand: 'up -d'
                projectName: ${{ parameters.dockerProjectName }}
              displayName: Compose Up
              env:
                # Some secrets
v-schhabra commented 2 months ago

Hi @p-hlp Thanks for reporting this issue. Will check and update here.

chamindu commented 2 months ago

I am facing the same issue.

tomdess commented 2 months ago

hello, same issue here, is it required powershell even on linux now?

ndege7 commented 1 month ago

gettig the same error any update

p-hlp commented 1 month ago

@v-schhabra any updates on this?

v-schhabra commented 1 month ago

Hi, apologies for replying late. Our team was occupied with some high priority issues. We have started investigation on this issue now.

v-schhabra commented 1 month ago

Hi @p-hlp @chamindu @tomdess @ndege7 Could you please share your docker compose file at v-schhabra@microsoft.com? We are unable to repro the issue at our end.

v-schhabra commented 1 month ago

Hi @p-hlp @chamindu @tomdess @ndege7 Could you please let us know which agent version you are using in your task?

tomdess commented 1 month ago

hello, i'm having the error "2024-09-25T12:29:46.9383033Z ##[error]The current operating system is not capable of running this task. That typically means the task was written for Windows only. For example, written for Windows Desktop PowerShell." running a release pipeline (classic) in which the DockerCompose@0 tasks are replaced with DockerCompose@1 tasks (the pipeline works fine with DockerCompose@0 tasks). The pipeline is running on a Deployment group target with agent version "3.230.0" (self-hosted agent), docker release installed 24.0.6, Debian 10.

v-schhabra commented 1 month ago

For DockerComposeV1 task we are using Node20_1 executor and this handler support minimum agent version 3.232.1. (https://github.com/microsoft/azure-pipelines-tasks/blob/c79a3c71c8ce5df6d5982ead885e6369216ab0bd/Tasks/DockerComposeV1/task.json#L338C6-L338C14) https://github.com/microsoft/azure-pipelines-tasks/blob/c79a3c71c8ce5df6d5982ead885e6369216ab0bd/docs/migrateNode20.md#specify-minimumagentversion Could you please upgrade your agent and check if the issue is still occurring or not?

tomdess commented 1 month ago

bingo! after agent upgrade (to release 3.244.1) the issue is solved, thank you.

The agent auto-update is not working on this machine, maybe because behind a proxy, but this is another story....

v-schhabra commented 1 month ago

Hi @tomdess Could you please add variable system.debug to "true" and share the complete pipeline failed logs?

tomdess commented 1 month ago

sorry but i have no other agents with old version (< 3.232.1), it was the only one

p-hlp commented 1 month ago

@v-schhabra Sorry for the late reply. Our agents are on version 3.241.0. Here's a failed run with diagnostics on / system.debug = true.

2024-10-02T11:47:38.3225580Z ##[debug]Evaluating condition for step: 'Compose Up'
2024-10-02T11:47:38.3228334Z ##[debug]Evaluating: SucceededNode()
2024-10-02T11:47:38.3229274Z ##[debug]Evaluating SucceededNode:
2024-10-02T11:47:38.3231131Z ##[debug]=> True
2024-10-02T11:47:38.3231909Z ##[debug]Result: True
2024-10-02T11:47:38.3232498Z ##[section]Starting: Compose Up
2024-10-02T11:47:38.3242444Z ==============================================================================
2024-10-02T11:47:38.3242838Z Task         : Docker Compose
2024-10-02T11:47:38.3243024Z Description  : Build, push or run multi-container Docker applications. Task can be used with Docker or Azure Container registry.
2024-10-02T11:47:38.3243346Z Version      : 1.243.1
2024-10-02T11:47:38.3243521Z Author       : Microsoft Corporation
2024-10-02T11:47:38.3243719Z Help         : https://aka.ms/azpipes-docker-compose-tsg
2024-10-02T11:47:38.3244194Z ==============================================================================
2024-10-02T11:47:38.3391633Z ##[error]The current operating system is not capable of running this task. That typically means the task was written for Windows only. For example, written for Windows Desktop PowerShell.
2024-10-02T11:47:38.3405157Z ##[debug]System.InvalidOperationException: The current operating system is not capable of running this task. That typically means the task was written for Windows only. For example, written for Windows Desktop PowerShell.
   at Microsoft.VisualStudio.Services.Agent.Worker.TaskRunner.RunAsync() in /home/vsts/work/1/s/src/Agent.Worker/TaskRunner.cs:line 168
   at Microsoft.VisualStudio.Services.Agent.Worker.StepsRunner.RunStepAsync(IStep step, CancellationToken jobCancellationToken) in /home/vsts/work/1/s/src/Agent.Worker/StepsRunner.cs:line 223
2024-10-02T11:47:38.3407252Z ##[section]Finishing: Compose Up

Doesn't really provide any extra information, but we're at least on a higher version than 3.232.1 which you mentioned as the minimum.

v-schhabra commented 1 month ago

Hi @p-hlp Could you pls share complete pipeline logs not just this task logs?

v-schhabra commented 4 weeks ago

Closing this issue as we didnt received complete debugged logs to continue our investigation.