Search code examples
gitpowershellazureappveyor

remote messages for git push let Appveyor build fail


I try to build and deploy a website using appveyor. The created site will be pushed to a gitrepo on an Azure web app that will then deploy the files.

The problem however, the azure server gives feedback while pushing which git returns to the stderr.

remote: Omitting next output lines...        
remote: Finished successfully.        
remote: Running post deployment command(s)...        
remote: Deployment successful.   

Using --quiet and --porcelain did not help.

Setting this in the PowerShell $ErrorActionPreference= 'silentlycontinue' suppressed all but one error. And Build still fails. The last error I can't suppress is

Command executed with exception: remote: Deployment successful.        

The site actually deploys and everything is fine, except the build in AppVeyor is marked as failed and I receive an mail.

It is annoying and it is easy to miss actual problems.


Solution

  • I have not found out how to suppress the output of the remote. :(

    But I could configure the server so it will no longer send messages that will get print to error.

    On Azure under your deployment folder edit the deployment hook(d:\home\site\repository\.git\hooks).

    The original script was:

    #!/bin/sh
    read i
    echo $i > pushinfo
    "$KUDU_EXE" "$KUDU_APPPATH" "$KUDU_MSBUILD" "$KUDU_DEPLOYER"
    

    I then redirected the std stream to null. The new script looks like this:

    #!/bin/sh
    read i
    echo $i > pushinfo
    if ! "$KUDU_EXE" "$KUDU_APPPATH" "$KUDU_MSBUILD" "$KUDU_DEPLOYER" > /dev/null ; then
      echo 'Build on Azure Failed'
    fi
    

    I guess when en error happens it still sends the error output to the client, but I'm not sure. So I added an check, that just echos to the client that something was wrong. Which then will fail the AppVeyor build.