I have an executable that I want to share across all agents that simply references a global bamboo variable in the path like ${bamboo.myPath}\bin\prog.exe, myPath is defined in my global variables inside of bamboo but when the command runs, it's not replacing ${bamboo.myPath} with my global variable? Is it possible to use global variables in the definition for executable paths?
If your variable is correctly declared this should work for you (assuming you are on windows):
%BAMBOO_MYPATH%\bin\prog.exe
Variables should be referenced in a different manner when used on terminal or scripts. Please take a look at the comment below that should be also visible in the global variables page:
For task configuration fields, use the syntax ${bamboo.myvariablename}. Bamboo also supports nested variables. For instance, if you set variableName = world, and variable.value = Hello ${bamboo.variableName}, Bamboo will resolve it as Hello world. For inline scripts, variables are exposed as shell environment variables which can be accessed using the syntax $bamboo_MY_VARIABLE_NAME (Linux/Mac OS X) or %BAMBOO_MY_VARIABLE_NAME% (Windows).
Please let us know if that resolves the issue.
I tried a few different versions of the environment variable structure you listed, like %BAMBOO_MYVARIABLE%, %bamboo_myvariable%, %bamboo_my_variable% and none worked.
Each time I can see in my logs it's unable to resolve because it's not actually placing my global variable into the command.
Is there some guidance as to how the spaces are determined in the variable name? Could that be my problem?
Please let me know if there's more information I could provide.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can you try this in your script task?
echo dir > dir_command.bat
%bamboo_working_directory%\dir_command.bat
⚠️Please make sure you set the interpreter to "shell" or "bin/sh or cmd.exe".
What are the results you get?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Just to clarify this was not with a script task. This is in the global executable where it simply asks for a path.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can you tell me how the command failing is called?
What is the task involved?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I also fumbled with this as documentation is not specific (or may even be considered misleading.)
For the question -
"Is it possible to use global variables in the definition for executable paths?"
The answer is no, bamboo variables cannot be used when defining a command task's executable path. Instead, a script task must be used.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.