Visual Studio Online Build treats git output as er

2019-02-19 01:57发布

问题:

My build in Visual Studio Online tries to deploy my Azure web site via Kudu. The script works fine, and deployment goes through, but VSO treats git output as errors for some reason, and declares the whole build failed. Take a look at the screenshot below.

Some details:

  1. This is a "new scripted" build, not a XAML-defined one.
  2. Build definition has just one step, which executes a PowerShell script, which runs F# FAKE (not sure if this is relevant).
  3. When I run the same script on my local machine, I don't see any "strange" output, including the [K at the end of each line.
  4. After running on my local, $LastExitCode is zero.
  5. I very much would like to keep the build to one step, so I can continue leveraging the power of FAKE.

回答1:

Git outputs its content to the error stream which Visual Studio Team Services interprets as error.

You need to redirect Gits output in your script like this to make it working:

git pull 2>&1 | Write-Host