Uploaded image for project: 'Bamboo Data Center'
  1. Bamboo Data Center
  2. BAM-21309

Allow expanded variables for task conditions

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • None
    • Tasks
    • None
    • 0
    • Our product teams collect and evaluate feedback from a number of different sources. To learn more about how we use customer feedback in the planning process, check out our new feature policy.

    Description

      Issue description

      Conditional tasks do not allow for matching to result of a variable expansion. The match is done as plain text.

      Example

      1. Create a build variable called TEST_BRANCH
      2. Add condition to plan:
        Variable planRepository.branch equals ${bamboo.TEST_BRANCH}
      3. Save

      Suggestion

      Allow variable expansion for task conditions

      Workaround

      You can effectively add these conditions by using a Script task instead of the conditional task:

      Shell
      # only run git commands on specific "test branch"
      if [[ ${bamboo.planRepository.branch} -eq ${bamboo.TEST_BRANCH} ]]; then
        # git commands
      else
       echo "Skipping, condition not met";
      fi
      
      Powershell
      # only run git commands on specific "test branch"
      if ($bamboo_planRepository_branch -eq $bamboo_TEST_BRANCH) {
        # git commands
      } else {
        write-host "Skipping, condition not met"
      }
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            ezeidan Elias Zeidan (they/them)
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: