0

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) ?
Aleksei Semidotskii
  • 1,385
  • 1
  • 10
  • 18
  • 1
    Hi @Aleksei, thanks for your sharing! Just a remind, you could [accept your answer](https://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work/5235#5235), and this may help others find the answer quickly. – Antonia Wu-MSFT Dec 26 '22 at 01:55

2 Answers2

0

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

Aleksei Semidotskii
  • 1,385
  • 1
  • 10
  • 18
0

Will a stderr redirect + grep work for you?

docker compose up -d 2> >(grep -i error)

Happy path: enter image description here

With error: enter image description here

Yiping
  • 971
  • 10
  • 31