The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

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 package.sh  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

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Dave Attard
Contributor
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, 

EG:

 

  - script:
      interpreter: WINDOWS_POWER_SHELL
      scripts:
      - |-
        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
  final-tasks:
  - inject-variables:
      file: ${bamboo.solution}\testsExist.txt
      scope: RESULT
      namespace: inject
  - any-task:
      plugin-key: com.atlassian.bamboo.plugin.dotnet:mstest
      configuration:
        mstestTestResultsDirectory: '**/TestResults/*.trx'
        pickupOutdatedFiles: 'false'
      conditions:
      - variable:
          equals:
            inject.testResultsExist: 'true'
TAGS
AUG Leaders

Atlassian Community Events