-
Type:
Bug
-
Resolution: Fixed
-
Priority:
Medium
-
None
-
Affects Version/s: 8.2.6, 9.0.1, 9.1.0
-
Component/s: Documentation (User)
-
None
-
Severity 3 - Minor
Issue Summary
This is reproducible in Data Center: ![]()
On a script task, when using the Environment variables property and declaring a variable based on another Global/Project/Plan variable such as:
CUSTOM_VAR=${bamboo.custom.variable}
Bamboo will consider ${bamboo.custom.variable} as a literal string and will not expand it
Environment
Bamboo 8.2, 9.0, 9.1
Steps to Reproduce
- Create a script task
- On the "Environment variables" property of the task, add CUSTOM_VAR=${bamboo.custom.variable}
- Use the following on the script field:
echo My Custom variable value is: ${CUSTOM_VAR} - Run the Plan
- Check the build output
Expected Results
- Bamboo should set ${CUSTOM_VAR} as the value of the ${bamboo.custom.variable} variable or set it as an empty string in case the variable doesn't exist
- The output is expected to be:
30-Nov-2022 10:11:23 My Custom variable value is: something
Actual Results
- Bamboo understands ${bamboo.custom.variable} is a literal string:
30-Nov-2022 10:14:46 My Custom variable value is: ${bamboo.custom.variable}
Workaround
Load and evaluate the variables directly from the Script body/file and not from the Script task environment variables property:
#!/bin/bash
# Load variables
# Use ${bamboo_variable} format (with underscores) as we are running it from a script
CUSTOM_VAR=${bamboo_custom_variable}
echo My Custom variable value is: ${CUSTOM_VAR}
- mentioned in
-
Page Loading...