My 2.6.1 bamboo agents run via a simple batch file and I'm switching them over to run as services using the same user as the batch file.
My plan Sets PATH in System Environment Variables field and runs a Pre Build Command on the agent. In each case my batch file executes set and my "script" executes set displaying the environment.
In both cases, the Script field performs as expected with System Environment Variable's PATH. I can easily set PATH properly in my Pre Build Command batch script file.
I'm perplexed as to why such a thing would happen and from where bamboo was getting the idea of PATH since it didn't match the user's, wrapper confs, or System Environment Variable's PATH.
Please let me know if you have any clue why I'd see this behavior change.
I dont think so, but I have run into that one before. I'm changing the path variable in the execution environment via the plan not via the control panel applet.
The funny thing is that the setting of PATH from the plan works for the "script" execution in either case but only for the pre-build script has a problem in the service case. It's weird because I set JAVA_HOME and that works in all cases, but path not so much. My solution was to move path into the script = set PATH=%JAVA_HOME%\bin;%PATH% I'd expect that to fail if environment variables aren't set.
Another possibility is that the pre-build-script forks a shell whci gets variables from the plan setting and the registry setting. He who sets the variable last wins and the env var set by bamboo is overriden by those from the registry. Since JAVA_HOME isn't in the user's env on the plan's notion of env it goes through.
In the case of the run-from script the execution environment fro pre-build-script is a subshell but when run from the service it is different for some reason having to do with service magic.
We have found that Bamboo remote agents are sometime subject to problems that seem to have been addressed in Bamboo proper. In our situation, we noticed that our process had two PATH environment variables, but they were different case. Essentially, we suffered from https://jira.atlassian.com/browse/BAM-1660 on our Bamboo 3.1 remote agent, while that particular issue was supposed to have been fixed in Bamboo 1.2.3. The clue was that the Path and PATH environment variables were listed multiple times in the build log.
The solution was to make sure that the case of the PATH environment variable matched everywhere so that the Bamboo remote agent could decorate it properly. If we use PATH in our build plan, we needed to ensure that the environment variable was named PATH on the remote agent. Your situation doesn't sound exactly like ours, but it is a suggestion.
It's officially Tuesday, which means it's officially time for another tip to help you better navigate this space we call the Atlassian Community. 😄 I got a great question from community member, Sa...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs