Is there a way to set the environment from TeamCity on a build agent to test manually

We occasionally have build agents that fail due to environment setup problems (performance, file associations...), and we would like to run the build locally on the agent to see what changes need to be made.  Currently we need to setup the environment, so we have to copy all the environment variables/setup and know what the execution should be.  Is there a way to connect to TeamCity to initialize a command prompt or shell so I can run a build manually?  Or is there a URL that I could use that would give me all the environment variables that are set prior to executing the build along with the execution command?

Thanks.

5 comments
Comment actions Permalink

Chris,

Do you try to eliminate false red builds visible to everybody?

If so, you can probably try to run a personal builds from IDE: the build will be visible to you and will not affect build configuration status and build history visible no other users. You can also disable an agent (so that automatic builds will not trigger on it) and run a personal build directly assigning a build to a disabled agent.

You can also be interested in TW-287 that addresses ability to delete a build form a build history.


As to listing environment variables... A connected agent has all the environment variables that it gets form the system listed on Environment variables tab. A build will get those + user-defined "env." properties in a build configuration + several TeamCity-provided ones.

0
Comment actions Permalink

Yegor,

I would like to eliminate false failing builds (so I'll follow the other request0, but that's not really what I'm talking about here.  I'm stating that I want to physically login to the build agent and run the build there manually as we have a lot of Acceptance Tests that run GUIs on the build agent that can only be seen when locally logging on.  Also we have this less now that our environment is stabilizing, but when we have new builds come on and then build on a build agent, if a failure isn't obvious, we like to physically login to the build agent and run the build from there to try different settings...  But I currently have to go to the logs, and copy/paste the environment variables, go to the build agent and copy/paste any env variables there... before I can run the build.

So I'm asking if there's a URL maybe that could give me for a build configuration the environment variables that would be set and the command that would be invoked.  Then I could create a small wrapper on build agents that accesses the URL for a given build config and sets a shell up to run.  Thanks.

0
Comment actions Permalink

Chris,

Do you mean the environment variables that you have configured for the build configuraiton at "Properties and Environment Variables" build configuration settings?
There is no way other then copy-paste them from the web UI for now.

We are considering adding REST API to TeamCity and already have a prototype version of the plugin. It is possible to get build configuration settings including the properties in this prototype. Chances are the plugin will be bundled with TeamCIty in one of the next releases.

0
Comment actions Permalink

Yegor,

Yes, I'm talking about environment variables to be set for a build configuration.

So for instance with a maven build there are at least 4 that get set
MAVEN_OPTS=All system variables + JVM parameters set on Build Runner page...
JAVA_HOME
PATH
M2_HOME

plus all the environment properties set for a given build configuration or run.  So it would be great to either give a build config through a REST api and get back all env variables to set and then the command line to run the build (i.e. mvn clean integration-test...) or give a build id and have it get the exact env variables/command line for that build.

Thanks.

0
Comment actions Permalink

Chris,

So, with REST API it will probably be possible to get the environment variables set by a user for a build configuration (the same that you see in "Properties and Environment Variables" in web UI).

As to the rest of environment that is set by TeamCity runner and the actual command line used, this is not currently available and requires separate feature implementation. Actually, these are calculated on the agent and are not passed to the server at al currently. You might be interested in the following issues in our tracker:

TW-5701 - Display build parameters that were actually passed to the build
TW-7184 - Special build log mode with "debug" information

For now, it seems you can modify your build script to dump all the necessary information into the build log (or a file) and then use it to reproduce the build.

0

Please sign in to leave a comment.