How to set plan variables on queueBuild

Description

queueBuild has the ability to set plan variables for the build. This makes it easy to script the running of builds that have different inputs for testing or other purposes. Moreover, using the wait parameter allows you to serialize the running of the plan with different parameters. The parameters that are important for this are:

  1. The fields parameter can be used to set an arbitrary number of Bamboo build parameters in field:value pairs, but is more difficult to use than the next approach.
  2. Up to 8 Bamboo build parameters can be set. This is done using the field1 / value1 combined parameters or their equivalent field2/value2, field3/value3, field4/value4 parameters. It is easier to set variables this way without worrying about list separators and quoting that may be necessary with the more general fields parameter.

Example - Simple

Set a single plan parameter
bamboo --action queueBuild --build "DEMO-example" --wait --field1 "exitCode" --value1 "0"

or

bamboo --action queueBuild --build "DEMO-example" --wait --fields "exitCode: 0"  
 
or (CLI 8.0 or higher)

bamboo --action queueBuild --build "DEMO-example" --wait --field "exitCode=0"  

Example - runFromList

This shows running the same build with a number of different parameters. These are serialized (because of the --wait parameter).

runFromList
bamboo --action runFromList --list "exitCode:0,exitCode:1" --common "--action queueBuild --build DEMO-example --wait --timeout 90 --fields @entry@"