1
votes

I'm using the CI available with VS Team Services to build a web app and deploy to Azure. It essentially uses the "local git repo" method described here: https://azure.microsoft.com/en-us/documentation/articles/web-sites-publish-source-control/

I run the deployment using a PowerShell script like so:

$sourcePath = Get-Location
cd ..
mkdir deploy
cd deploy
$deployPath = Get-Location
git init
git config core.safecrlf false
git remote add azure <fill-in>
git pull azure master --quiet
git rm -rf .
git clean -fxd
git reset
Copy-Item $sourcePath\* $deployPath -Recurse
git add -A
git commit -m "Deploy"
git push azure master --porcelain

What I noticed was that several git operations like push and pull cause PowerShell to see errors (even though the operations are successful). This is why I used the "quiet" and "porcelain" options.

Now the tricky part is, after the push operation, Azure will run some deployment scripts automatically. This causes the PowerShell to see errors, even if the operation was successful, and...I have no way to control this.

How to get PowerShell to properly recognize true errors?

By the way, if you see a better or more efficient way, I'll be happy to learn about it.

1
Are you running the powershell script from VSTS build or release?Eddie Chen - MSFT
I'm running it from the VSTS Build.phandinhlan
Did you try the solution in the link?Eddie Chen - MSFT
Yep. Looks like it works. Thanks.phandinhlan

1 Answers

1
votes

Try to call the git command with following format:

git pull 2>&1 | Write-Host

Refer to Pascal Berger's answer in this question for details: Visual Studio Online Build treats git output as errors