1

I created some system properties in TC build configuration. The value of these properties are passed to a maven configuration this way:

clean test -Dargument1=%system.property1% -Dargument2=%system.property2%

And this works as expected. What I want to do now is to modify the value of the system properties when the build finish, so the next build will get these values. Is it possible to do that programmatically, through Java or using Maven? Is this the correct approach?

Cœur
  • 37,241
  • 25
  • 195
  • 267
  • Can you describe your use-case for this? – Andrew Logvinov Apr 11 '13 at 16:32
  • I have a big list of test cases to run. In every build I want to run just a part, so I need two variables (where_to_start and how_many_to_run). When the build finishes and according to the result of the test cases I want to change these values. Of course I could store this in a file, but it would also be handy if I/other people could manually change these values without editing that file through ssh. – josemartins88 Apr 12 '13 at 09:21
  • I see. Yes, it's possible. Take a look at [this link](http://confluence.jetbrains.com/display/TCD7/Build+Script+Interaction+with+TeamCity#BuildScriptInteractionwithTeamCity-AddingorChangingaBuildParameter). – Andrew Logvinov Apr 13 '13 at 11:05
  • I tried but this only changes the value for the current build. In the next one all the system properties will have the value I set up in the beginning. – josemartins88 Apr 15 '13 at 12:44
  • Ah, yes, I didn't think about this. You should probably ask this question on TeamCity forum. – Andrew Logvinov Apr 15 '13 at 14:57

2 Answers2

0

You can define build properties for this. Once your build finishes, you can craft a Maven plugin that sends a post request to TeamCity and alters the values for these build properties for the build type.

carlspring
  • 31,231
  • 29
  • 115
  • 197
0

If I where you, I would craft maven task, which will update your properties via TeamCity restAPI on build completion.

It looks like mostly elegant way to do this task.

Full explanation for restAPI plugin could be found here: http://confluence.jetbrains.com/display/TW/REST+API+Plugin What is needed for your use-case is described here: Build Configuration And Template Settings

Build configuration parameters: GET/DELETE/PUT http://*teamcity_url_goes_here*/httpAuth/app/rest/buildTypes//parameters/ (accepts/produces text/plain) You could craft a request to update your parameters.

One more interesting thing: If you want to execute requests to REST API inside a TeamCity build running on the same server, you can use %teamcity.serverUrl% predefined parameter to construct URL

Anton Kuryan
  • 607
  • 6
  • 20