2

I'm currently building a Pipeline to deploy my PHP Symfony Project from Dev Ops Repo to my Server. I use a SSH Task to execute the commands on the Server. The SSH Connection works fine, but some outputs of the executed commands are threaded as errors, like for git pull:

Starting: Run shell inline on remote machine
==============================================================================
Task         : SSH
Description  : Run shell commands or a script on a remote machine using SSH
Version      : 0.177.0
Author       : Microsoft Corporation
Help         : https://learn.microsoft.com/azure/devops/pipelines/tasks/deploy/ssh
==============================================================================
Trying to establish an SSH connection to ***@xxx
Successfully connected.
chmod +x ./sshscript_32bf87de-91b8-45b5-bae1-02400a139bfc
./sshscript_32bf87de-91b8-45b5-bae1-02400a139bfc
##[error]From vs-ssh.visualstudio.com:v3/xxx
 * branch            master     -> FETCH_HEAD

Already up-to-date.

##[error]Command failed with errors on remote machine.
Finishing: Run shell inline on remote machine

This is my Configuration:

trigger:
- master

pool:
  vmImage: 'ubuntu-latest'

steps:
- task: SSH@0
  displayName: 'Clean and Pull Git'
  continueOnError: false
  inputs:
    sshEndpoint: 'xxx'
    runOptions: inline
    inline: |-
      cd xxx
      git clean -xdf
      git pull origin master

How can I solve this Issue? (e.g. composer install has the same problem)

I know I could redirect stdout, but I want to keep the Output Messages

2
  • Hey @iF4yt, are you sure that they are some commands, or isn't there only the git commands? As far as I know, git command printed to stderr in general. To handle this, I use $env:GIT_REDIRECT_STDERR = '2>&1' for PowerShell scripts. Hope this helps. Check here for more information. Commented Jan 17, 2021 at 15:06
  • Hey @MarTin Thank you for the Tip! And yes. I'm sure that multiple Commands have this Problem. E,g, composer install: ##[error] - Installing composer/package-versions-deprecated (1.11.99.1): Extracting archive ##[error] - Installing symfony/flex (v1.11.0): Extracting archive ##[error] - Installing symfony/routing (v4.4.18): Extracting archive Commented Jan 17, 2021 at 18:42

1 Answer 1

0

You can try setting the failOnStdErr to false to slove this question.

Just like the following:

steps:
- task: SSH@0
  displayName: 'Clean and Pull Git'
  continueOnError: false
  inputs:
    sshEndpoint: 'xxx'
    runOptions: inline
    failOnStdErr: false
    inline: |-
      cd xxx
      git clean -xdf
      git pull origin master
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.