0
votes

I am trying to create plugin, which deploys my application in pre-integration-phase and runs the test against it. Now my application requires some property called LOOKUPLOCATOR which should be unique per envrionment. Now i have multiple agents configured in teamcity and many builds can run in parallel and if all the builds will have same property they will interfere with each other and test results will be unexpected.

Is there a way so that when my build run and in my java code if somehow get to know the agent name, and i will maintain a hardcoded value for LOOKUPLOCATOR for each agent, we can set that value. So my property will be per agent

2
Can you say which kind of deployment ? Apart from that i would take a look into teamcity documentation for such informationskhmarbaise
Its a gigaspace grid deploymemtAmbuj Jauhari
I checked the documentation, i could see that agent.name is a parameter predifined. So i wrote a small test to check if property agent.name exists or not. assert (System.getProperties().containsKey("agent.name")); But the test fails. Any idea how can i access this property in my unit tests ? How ever if i see my build configuration, agent.name appearsAmbuj Jauhari

2 Answers

0
votes

Teamcity has some pre-defined variables which are available while a build is running. Agent name can be found in %teamcity.agent.name%.

0
votes

Here is how to set agent-specific parameters

If additional applications/libraries are available in the environment, the administrator can manually define the property in the /conf/buildAgent.properties file. These properties can be used for setting various build configuration options, for defining build configuration requirements (for example, existence or absence of some property) and inside build scripts.