Update path after install build step

Hi all,

 

Very new to teamcity so thanks for any help in advance.  I have created a Build configuration that pulls a machine from aws.  Unfortunately, this machines doesn't have anything I need so in one build step, I install java silently.  On the next step, I call java ....

As a result I get an error saying java isn't a recognized command.  This has me believe that the path isn't updated between build steps?  Does anyone know of a workaround for this?

I know this does not seem practical and the machines should have already everything installed that I need but in this instance my hands are tied and I need to install java during the process.

Any pointers would be very helpful!!

0
1 comment

Hi Jin,

It's very likely that the PATH variable is not updated. The build agent's process is already running, so even if the log in config is updated to show the new PATH, this usually won't take effect until the user logs out and back in.

All the build steps in a build configuration will be run in the same agent and under the same process, so you could simply add the PATH at the end of the java installation to the current PATH and it should work. Another option would be to set the PATH to the java binary even before installing it, at either the build agent level or even the build configuration level. The path might not initially exist, but once the application is installed, it should pick it up properly. If you are passing the installation path as a variable, that might make it even easier to handle.

Edit: You can decide whether to do it per the script level, but TeamCity offers you also a way to modify environment variables, which it holds as "environment parameters". More information on that here: https://confluence.jetbrains.com/display/TCD10/Configuring+Build+Parameters

0

Please sign in to leave a comment.