How to add labels to current build with Bamboo task using Run CLI Actions in Bamboo

This article explains how to add labels to the current build with Bamboo task using Run CLI actions in Bamboo.

Instructions

  1. Log in to Bamboo with Plan admin permissions.
  2. Navigate to the required plan and select Actions > Configure plan.
  3. Click Default Job to add tasks in the default stage.
  4. Click Add Task to add a Bamboo CLI task in Default Job.
  5. Search for Bamboo CLI using the search bar and select the Bamboo CLI task.
  6. Add the addLabels action to Script body to add labels to current build and click Save to save the configuration.

    --action addLabels --plan DEMO-CLI --labels "qa-pass"  --number ${bamboo.buildNumber} --server "Bamboo_Server" --user "BambooUser_username" --password "BambooUser_Password"

With this, the specified labels are added to the current build after the build run is completed.

In the given CLI action:

  • --plan value refers to plan key. 

  • --labels value refers to labels name.
  • --number value refers to a Bamboo variable named as ${bamboo.buildNumber} to define current build number.
  • --server value refers to the Bamboo server URL.
  • --user value refers to the Bamboo username.
  • --password value refers to the Bamboo password.