【发布时间】:2015-07-17 08:18:39
【问题描述】:
我在 VS Team Services 中的 powershell 脚本末尾收到以下错误:
任务 PowerShell 失败。这导致作业失败。查看任务的日志以了解更多详细信息。
但是,脚本并没有失败。它做了我想做的一切。有什么方法可以向 VS Team Services 解释吗?
该脚本从 VS Team Services 获取已编译和测试的代码,并将其推送到 bitbucket 上的 git 存储库。这样,我可以从它自动创建一个 docker 容器并更新我的应用程序。这是脚本:
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
此脚本运行并正确执行所有操作。但是,我的 Visual Studio Team Services 日志到此结束:
******************************************************************************
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
******************************************************************************
从此输出中,以下几行是红色的,类似于错误行:
Cloning into 'example-repo'...
和
To BITBUCKET_URL/example-repo.git
b861c96..afd33e6 master -> master
难道这里的某些东西返回的不是 0,这就是 VS Team Services “检测”失败的原因?
我怎样才能防止这种情况发生?
更新:
仅运行 git clone 已经表明存在错误,因此 git clone 和 git push 似乎确实会导致 VS Team Services 将其视为错误。
【问题讨论】:
标签: git powershell continuous-integration azure-devops