Visual Studio Team Services says "PowerShell Error", although it is not

At the end of the powershell script in VS Team Services, I get the following error:

PowerShell task failed. This caused a malfunction. See the logs for the task for more details.

However, the script did not fail. He did everything he wanted. Is there any way to explain this VS Team Services?

The script takes the compiled and tested code from VS Team Services and puts it in the git repository on bitbucket. Thus, I can automatically create a Docker container from it and update my application. Here is the scenario:

git clone BITBUCKET_URL/example-repo.git
cd example-repo

echo "Clean app-folder and remove Dockerfile"

remove-item app -recurse -force
remove-item Dockerfile -force

new-item -name app -itemtype directory

echo "Copy new files into repository"

cp ../deploy/Dockerfile .
cp ../ExampleApp/bin/Debug/* ./app

echo "Set email, name and include all files"

git config user.email "EMAIL"
git config user.name "NAME"
git add -A

echo "What has changed:"
git status

echo "Commit and Push..."
git commit -m "VS Online Commit"
git push origin master

This script runs and does everything right. However, this is the end of my Visual Studio Team Services log:

******************************************************************************
Starting task: Powershell: deploy/deploy.ps1
******************************************************************************
Cloning into 'example-repo'...
Clean app-folder and remove Dockerfile
    Directory: C:\PROJECT\example-repo
Mode                LastWriteTime     Length Name                                                                      
----                -------------     ------ ----                                                                      
d----         7/17/2015   7:59 AM            app                                                                       
Copy new files into repository
Set email, name and include all files
What has changed:
On branch master
Your branch is up-to-date with 'origin/master'.
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)
    modified:   app/App.exe
    modified:   app/App.pdb
Commit and Push...
 VS Online Commit
 2 files changed, 0 insertions(+), 0 deletions(-)
To BITBUCKET_URL/example-repo.git
b861c96..afd33e6 master -> master
******************************************************************************
Finishing task: PowerShell
******************************************************************************
Task PowerShell failed. This caused the job to fail. Look at the logs for the task for more details.
******************************************************************************
Finishing Build
******************************************************************************

From this output, the following lines were red and similar to the error line:

Cloning into 'example-repo'...

and

To BITBUCKET_URL/example-repo.git
b861c96..afd33e6 master -> master

, - -, 0, VS Team Services "" ?

?

:

git clone , , , git clone git push -, VS Team Services .

+5
2

Vesper , git stderr, VS Team Services , - .

stderr . :

git clone --quiet ...
git push --porcelain ...

git stderr (--quiet) stdout (--porcelain).

Update:

git add , :

git config core.safecrlf false

, core.autocrlf .

+2

Visual Studio , script . git , script 2>&1, $ErrorActionPreference silentlyContinue script, git, 2>&1.

- script exit <code>, , git Powershell, script, script $lastExitCode, , .

+1

Source: https://habr.com/ru/post/1598336/


All Articles