microsoft / azure-pipelines-tasks

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

SSH: Command is run successfully but the agent thinks that's failed. #10485

Closed siegrainwong closed 5 years ago

siegrainwong commented 5 years ago

Required Information

Question, Bug, or Feature?
Type: Bug

Enter Task Name: SSH

Environment

Issue Description

Script commands is really simple like this:

cd path-to-docker-file && docker-compose up -d

But the log is pretty weird, my command is run successfully but the agent thinks that's failed. image

Task logs

ReleaseLogs_156.zip

Error logs

2019-05-27T04:31:55.8268243Z Trying to establish an SSH connection to ***@34.92.176.132:22
2019-05-27T04:31:55.8897184Z Successfully connected.
2019-05-27T04:31:55.8898861Z ##[debug]Running command cd /home/***/ancorazor/build && docker run --rm     -v /var/run/docker.sock:/var/run/docker.sock     -v "$PWD:$PWD"     -w="$PWD"     docker/compose:1.24.0 up -d on remote machine.
2019-05-27T04:31:55.8899468Z cd /home/***/ancorazor/build && docker run --rm     -v /var/run/docker.sock:/var/run/docker.sock     -v "$PWD:$PWD"     -w="$PWD"     docker/compose:1.24.0 up -d
2019-05-27T04:31:55.8900232Z ##[debug]command = cd /home/***/ancorazor/build && docker run --rm     -v /var/run/docker.sock:/var/run/docker.sock     -v "$PWD:$PWD"     -w="$PWD"     docker/compose:1.24.0 up -d
2019-05-27T04:31:57.2626271Z ##[debug]stderr = elasticsearch is up-to-date
2019-05-27T04:31:57.2627091Z 
2019-05-27T04:31:57.2691425Z ##[error]elasticsearch is up-to-date
2019-05-27T04:31:57.2702656Z ##[debug]Processed: ##vso[task.issue type=error;]elasticsearch is up-to-date
2019-05-27T04:31:57.2702870Z 
2019-05-27T04:31:57.2703149Z ##[debug]stderr = oap is up-to-date
2019-05-27T04:31:57.2703264Z 
2019-05-27T04:31:57.2703601Z ##[error]oap is up-to-date
2019-05-27T04:31:57.2703905Z ##[debug]Processed: ##vso[task.issue type=error;]oap is up-to-date
2019-05-27T04:31:57.2703979Z 
2019-05-27T04:31:57.2704170Z ##[debug]stderr = ui is up-to-date
2019-05-27T04:31:57.2704234Z 
2019-05-27T04:31:57.2704442Z ##[error]ui is up-to-date
2019-05-27T04:31:57.2704673Z ##[debug]Processed: ##vso[task.issue type=error;]ui is up-to-date
2019-05-27T04:31:57.2704768Z 
2019-05-27T04:31:57.2705513Z ##[debug]stderr = ancorazor is up-to-date
2019-05-27T04:31:57.2705604Z 
2019-05-27T04:31:57.2705875Z ##[error]ancorazor is up-to-date
2019-05-27T04:31:57.2706135Z ##[debug]Processed: ##vso[task.issue type=error;]ancorazor is up-to-date
2019-05-27T04:31:57.2706209Z 
2019-05-27T04:31:57.5523184Z ##[debug]code = 0, signal = undefined
2019-05-27T04:31:57.5524525Z ##[debug]task result: Failed
2019-05-27T04:31:57.5525360Z ##[error]Command failed with errors on remote machine.
2019-05-27T04:31:57.5525794Z ##[debug]Processed: ##vso[task.issue type=error;]Command failed with errors on remote machine.
2019-05-27T04:31:57.5550683Z ##[debug]Processed: ##vso[task.complete result=Failed;]Command failed with errors on remote machine.
2019-05-27T04:31:57.5551081Z ##[debug]Closing the SSH client connection.
2019-05-27T04:31:57.5680835Z ##[section]Finishing: Run script
siegrainwong commented 5 years ago

Sorry, I just learned that every command of mine output as stderr. I have no idea why but it shouldn't be your problem.

julianhandl commented 5 years ago

@siegrainwong Did you fix your problem somehow? I got the same one. Can I tell docker to output to stdout instead of stderr?

siegrainwong commented 5 years ago

@julianhandl I redirect them like this:

docker-compose up -d 2> docker-compose.log
cat docker-compose.log
julianhandl commented 5 years ago

@siegrainwong Thank you! I came up with nearly the exact same solution in the meantime. 😄