azure-devopsdocker-composeazure-pipelinesazure-pipelines-release-pipelineazure-pipelines-release-task

Azure DevOps SSH release pipeline task and Docker Compose STDERR


I am using Classic release pipelines in Azure DevOps and configured simple SSH task what calls docker-compose:

cd /home/asem/platform/$(ServiceName) && sudo docker-compose up -d --force-recreate

Azure DevOps SSH release pipeline task

Azure DevOps SSH release pipeline task configuration

Issue: task fails with errors:

SSH task errors

Docker-compose returns 0 exit code, but write some messages in STDERR. Pipeline task treat them as errors and fails.

Questions:

  1. Why docker-compose designed that way what EXIT code = 0, but there are some errors were written in STDERR ?
  2. Any good solution (please see found workarounds in my answer below) ?

Solution

  • Workaround 1: pipe docker compose STDERR to STDOUT like cd /home/asem/platform/$(ServiceName) && sudo docker-compose up -d --force-recreate 2 >&1

    sudo docker-compose up -d --force-recreate 2 >&1

    That works, but I don’t like it because it can hide some real errors

    Workaround 2: Uncheck “Fail on STDERR” for task

    SSH task unchecked Fail on STDERR

    That works, but release stage displays errors which is not good though.

    release stage errors