Bamboo does not expands a variable on an environment variables property in a Task

XMLWordPrintable

    • 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

      1. Create a script task
      2. On the "Environment variables" property of the task, add CUSTOM_VAR=${bamboo.custom.variable}
      3. Use the following on the script field:
        echo My Custom variable value is: ${CUSTOM_VAR}
      4. Run the Plan
      5. 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}
      

              Assignee:
              Jacek Krawczyk (Inactive)
              Reporter:
              Eduardo Alvarenga (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: