Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Teamcity interaction with powershell script

I have a powershell script that runs for ~30 minutes (waiting on various process' to finish). At the end, it writes a message to the event log, determining if the process was a success or failure. I plan on hosting this script on teamcity and want the build to fail, but don't know how to handle the interaction between the script and teamcity in order for this to happen.

I'm looking for a way to make a powershell script that is ran remotely to communicate to teamcity whether it was a failure or success. I've read up on a lot of the teamcity documentation and I'm still not sure how to start going about this.

like image 878
Speerian Avatar asked Aug 24 '15 23:08

Speerian


1 Answers

You should probably consider using TeamCity Service Messages, or specifically Reporting Build Problems.

An example of how to emit a service message using PowerShell (assuming you're using the PowerShell build step):

Write-Output "##teamcity[buildStatus text='I am a successful build']"

or

Write-Output "##teamcity[buildProblem description='$powershell_error_message']"

where you can inject the captured powershell error message.

like image 64
SteveChapman Avatar answered Nov 15 '22 03:11

SteveChapman