-
Type:
Bug
-
Resolution: Won't Fix
-
Priority:
Low
-
None
-
Affects Version/s: 9.6.4, 12.1.0, 10.2.12
-
Component/s: Variables
-
None
-
Severity 2 - Major
Issue Summary
When using the ${bamboo.variableName} syntax in a Bamboo script task, variable values containing the special character $are truncated. This does not occur when using the alternative $bamboo_variableName syntax.
Same is observed when using encrypted variables trough Bamboo Specs.
Steps to Reproduce
- Create variable secret_testing and assign value that includes "$"(Absc3$kweb)
- Create a plan with script task like below:
echo ${bamboo.secret_testing} > secret.txt echo $bamboo_secret_testing >> secret.txt
- Configure secret.txt as a build artifact.
- Run the plan.
Alternatively use Bamboo Spec below( you will need to update encrypted variable secret_testing below using Bamboo Specs encryption )
--- version: 2 plan: project-key: TES1 key: TES1 name: test1 stages: - Default Stage: manual: false final: false jobs: - Default Job Default Job: key: JOB1 tasks: - script: interpreter: SHELL scripts: - |- echo ${bamboo.secret_testing} > secret.txt echo $bamboo_secret_testing >> secret.txt description: extract artifacts: - name: secret pattern: secret.txt shared: true required: true artifact-subscriptions: [] variables: secret_testing: BAMSCRT@0@0@NvH0myaLSHV2nwvHRkZn+Q== repositories: [] # Remove line above if want to set repository with YAML file as primary repository of plan triggers: [] branches: create: manually delete: never link-to-jira: true notifications: [] labels: [] dependencies: require-all-stages-passing: false enabled-for-branches: true block-strategy: none plans: [] other: concurrent-build-plugin: system-default --- version: 2 plan: key: TES-TES plan-permissions: - users: - admin permissions: - view - edit - build - clone - admin - view-configuration
Expected Results
Non truncated variables value in secret.txt
Actual Results
Truncated value using syntax ${bamboo.variableName}:
# Find artifact on server /home/ubuntu/bamboo-shared/builds# find / -name secret.txt /home/ubuntu/bamboo-shared/artifacts/plan-753665/shared/build-00003/secret/secret.txt /home/ubuntu/bamboo-shared/artifacts/plan-753665/shared/build-00002/secret/secret.txt /home/ubuntu/bamboo-shared/artifacts/plan-753665/shared/build-00004/secret/secret.txt # Print artifact /home/ubuntu/bamboo-shared/builds# cat /home/ubuntu/bamboo-shared/artifacts/plan-753665/shared/build-00004/secret/secret.txt Absc3 Absc3$kweb
Workaround
Use alternative syntax $bamboo_variableName.