Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to pass bamboo build variables from one pipeline to child pipeline(bamboo spec)

Vetri June 21, 2021

i have two Bamboo pipelines  Dev & Test and  we have many variables defined in  file on DEV pipeline,

now i need that variables for child build (TEST)  pipeline -its already integrated with DEV pipeline ,so i dont knw how to get that values here to make one condition in the test pipeline script file.

In the Bamboo sites/guide there is options to add global variables in UI, bt here they are using bamboo spec concepts that options r disabled now , so i cant able add global variables manually in Bamboo Ul,  

so pls tell me how to create global variables using bamboo spec concepts?

how to get that values in child pipeline?

please provide the correct logic if you have , kindly help me its very urgent..

Thanks in advance..!


1 answer

0 votes
Dave Attard February 26, 2023

Are you changing the variables? As global variables are read only. When i want to pass variables between staged i create a file with the variable and values in them in the working directory and then use the inject variables, 



  - script:
      interpreter: WINDOWS_POWER_SHELL
      - |-
        Set-Location ./${bamboo.solution}
        dotnet test -c Release --logger "trx;LogFileName=${bamboo.solution}_TestResults-Build_${bamboo.buildNumber}.trx" -v q
        $found = Get-ChildItem -Path . -Filter *.trx -Recurse -ErrorAction SilentlyContinue -Force
        $string = "testResultsExist=false"
        if($null -ne $found) {
            $string = "testResultsExist=true"
        $string | Set-Content "testsExist.txt"
      description: UnitTest
  - inject-variables:
      file: ${bamboo.solution}\testsExist.txt
      scope: RESULT
      namespace: inject
  - any-task:
      plugin-key: com.atlassian.bamboo.plugin.dotnet:mstest
        mstestTestResultsDirectory: '**/TestResults/*.trx'
        pickupOutdatedFiles: 'false'
      - variable:
            inject.testResultsExist: 'true'

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events