Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TeamCity build status parameter

I may be overlooking a built in parameter in TeamCity.. I'm trying to send the build status as a parameter to a console application. The console application is a build step that needs to run even if previous steps have failed. If previous steps failed it will do one thing, and if the previous steps are successful it will do another.

I have the console app set up to take a build status parameter, but I'm not finding a built in build status parameter to use (Success/Failure). Am I missing something easy? How can I access the build status?

Thanks!

like image 764
user2097151 Avatar asked Jul 31 '14 20:07

user2097151


People also ask

What are configuration parameters in TeamCity?

Edit page. Last modified: 08 November 2022. Build parameters are name-value pairs, defined by a user or provided by TeamCity, which can be used in a build. They help flexibly share settings and pass them to build steps.

How do you tag a build in TeamCity?

Apart from the Actions menu, you can tag a build in the Run Custom Build dialog and in the Pin Build dialog. You can also add and modify build tags using TeamCity REST API.

How do I change my TeamCity build number?

Go to the General Settings of the build configuration. Click the orange Show advanced options. Set the Build counter to your desired value. Set the Build number format to %build.

What is build counter in TeamCity?

The third group (“34”) is the build counter in Teamcity and is used to separate different builds with the same major and minor versions from each other.


1 Answers

I've had to do a similar thing in the past and didn't manage to find a built in property that I could inject to pass the status.

In the end I used service messages in a previous build step to pass parameters into the subsequent step - printing out a message like ##teamcity[setParameter name='build.state' value='ok'] can be used to create a build property to thread state from one step to another.

I've seen someone take an approach of using the TeamCity REST API to query the status of the running build from a build step, but the prior approach was simple enough for me.

like image 76
russw_uk Avatar answered Sep 21 '22 02:09

russw_uk