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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With