Relative paths in remote agent capabilities are incorrectly referenced to agent's directory after upgrade

Still need help?

The Atlassian Community is here for you.

Ask the community

Symptoms

An agent has a capability where it finds and runs "Ruby.exe" at a relative path (Ex. : ".\3rdParty\ruby\bin\ruby.exe") from within the existing Perforce workspace directory which is different for each plan - (Ex.: D:\views\<NAME-OF-PERFORCE-WORKSPACE>). After upgrading from Bamboo 4.4.4 to Bamboo 5.3, this relative path gets incorrectly mapped to remote agent's directory (Ex.: "C:\_remote_agent_directory\.\3rdParty\ruby\bin\ruby.exe" instead of staying at: "D:\views\<NAME-OF-PERFORCE-WORKSPACE>\.\3rdParty\ruby\bin\ruby.exe"), which causes all the builds set up with this capability to fail.

Cause

Library used by Bamboo 4.4.4 to spawn external processes adds the following decoration for each invocation:

cmd /C /A call actual-command

The same library is used by Bamboo 5.3 but it only adds that decoration for ".bat" and ".cmd" scripts. So a native Windows call gets executed which fails if the command name is not just a command name but "directory/command-name".

Workaround

Add a "ruby.bat" script to the same directory where "ruby.exe" exists with the following content: 

@ECHO OFF
IF NOT "%~f0" == "~f0" GOTO :WinNT
ECHO.This version of Ruby has not been built with support for Windows 95/98/Me.
GOTO :EOF
:WinNT
@"%~dp0ruby.exe" %*

Then alter the _WorkspaceRuby_ to be:

.\3rdParty\Ruby\win32\bin\ruby.bat
Last modified on Feb 3, 2014

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.