Configuring automatic labeling of job build results

On this page

Still need help?

The Atlassian Community is here for you.

Ask the community

For each job of a plan, you can (as an option) specify a label that can be applied to the job's build results automatically after each build of that job.

Automatic labeling of job builds is built into Bamboo itself. There are a number of third-party plugin modules available that can provide additional post actions (e.g. the Pre-Post Build Command plugin). You can also write your own plugins to provide additional post actions for a job. See the Bamboo Plugin Guide for further details.

Labels can also be applied to build results manually by Bamboo users.

On this page:

Related pages:

Specifying labels for a job's build results

To specify labels for a job's build results:

  1. Navigate to a job's configuration pages, as described on Configuring jobs.
  2. Select the Other tab.
  3. Using Regex Pattern, you can either:
    • Specify a regular expression to match content in the log files of this job's builds. Labels will be applied to a build of this job if this regular expression matches content in the build's log files (see the examples below).
      (info) For more information about regular expressions, please refer to the Java documentation on regular expression constructs.
    • Leave this field blank to label every build of this job.
  4. In the Labels field, type the word (or multiple words, separated by commas and/or spaces) with which the plan's build results are to be labeled.
  5. Select Save.

Regex examples

See http://www.regular-expressions.info/reference.html for examples.

A simple regex example:

'There are \d+ results'

In the above regex, '\d+' represents any number with one or more digits. ('\d' means 'any digit', and '+' means 'one or more times'. When combined, they mean 'any sequence of one or more digits'.) Therefore, positive matches would include:

  • 'There are 0 results'
  • 'There are 123 results'

A regex example with multiple labels:
You can use "capturing groups" with Bamboo 1.2.1 or later to create different labels for different purposes.

For example, the following settings will label your builds with PERFORMANCE_IMPROVED if "PERFORMANCE_IMPROVED" appears in the build log, and PERFORMANCE_DETERIORATED if "PERFORMANCE_DETERIORATED" appears in the build log. If both strings appear in a log, then both labels are applied to the build.

  • Enter the following into the Regex Pattern field:

    (PERFORMANCE_IMPROVED|PERFORMANCE_DETERIORATED)
    
  • Enter the following into the Labels field:

    \1
    
Last modified on Aug 10, 2021

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.