The Script Console is the place for running one-off ad hoc scripts, and for learning and experimenting with the Bamboo API.

Either enter your script directly in the browser, or click the File tab, and type the path to a file. The file can be a fully-qualified path name to a .groovy file accessible to the server. If you provide a relative path name the file is resolved relative to your script roots.

Read more about script roots and script plugins.

Samples

Take one of these samples and use it as a starting point for your own needs.

List all build plans

Let’s just return all the names of all the build plans:

import com.atlassian.bamboo.plan.PlanManager
import com.atlassian.sal.api.component.ComponentLocator

def planMgr = ComponentLocator.getComponent(PlanManager)

def plans = planMgr.getAllPlansUnrestricted()

def output = ""
plans.each {
    output += "${it.name}</br>"
}

output

List the status of all build jobs

Let’s just return all the names of all the build jobs:

import com.atlassian.bamboo.plan.PlanManager
import com.atlassian.sal.api.component.ComponentLocator

def planMgr = ComponentLocator.getComponent(PlanManager)

def plans = planMgr.getAllPlansUnrestricted()

def output = ""
plans.each {
    output += "<hr>"
    it.getAllJobs().each { job ->
        output += "${job.name} = ${job.getCurrentStatus()}</br>"
    }
    output += "<hr>"
}
output

For how-to questions please ask on Atlassian Answers where there is a very active community. Adaptavist staff are also likely to respond there.

Ask a question about ScriptRunner for JIRA, for for Bitbucket Server, or for Confluence.