3
votes

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.

enter image description here

1
Odd. Have you tried printing $LastExitCode from the script to see if it's 0 when running under VSO build? - David Ebbo
In which script? Do you mean in the PowerShell script right after executing FAKE? - Fyodor Soikin
Tried it just now. At the very end of my PowerShell script, the $LastExitCode is zero. It seems that VSO makes the judgement purely based on the text output. - Fyodor Soikin
Really not sure what VSO is doing here. It may be that some of the output is sent to stderr instead of stdout, and they treat this as an error condition regardless of the exit code. Though that would be very questionable behavior, and it's only a wild guess. I work on the Kudu part, and I'm not very familiar with what's happening on the VSO part that's calling it. - David Ebbo
Does this only occur when run git pull and push command? - Eddie Chen - MSFT

1 Answers

3
votes

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