Bamboo module

API reference

class atlassian.bamboo.Bamboo(url: str, username: str | None = None, password: str | None = None, timeout: int = 75, api_root: str = 'rest/api', api_version: str | int = 'latest', verify_ssl: bool = True, session: Session | None = None, oauth: dict | None = None, oauth2: dict | None = None, cookies: CookieJar | None = None, advanced_mode: bool | None = None, kerberos: object = None, cloud: bool = False, proxies: MutableMapping[str, str] | None = None, token: str | None = None, cert: str | Tuple[str, str] | None = None, backoff_and_retry: bool = False, retry_status_codes: List[int] = [413, 429, 503], max_backoff_seconds: int = 1800, max_backoff_retries: int = 1000, backoff_factor=1.0, backoff_jitter=1.0, retry_with_header=True, header=None)

Private methods

activity(busy=None)

Return active online agents and their current build activity.

The former dashboard AJAX endpoint was an internal Bamboo UI endpoint and is not present in current Bamboo releases. The supported agent REST resource exposes active and busy for each online agent.

Parameters:

busy – Optional filter for busy (True) or idle (False) agents. By default, return all active online agents.

Returns:

List of active agent dictionaries, including busy.

add_agent_capability(agent_id, data)

Add a capability to an agent using Bamboo’s capability payload.

add_users_into_group(group_name, users)

Add multiple users to a group. The list of usernames should be passed as request body. The authenticated user must have restricted administrative permission or higher to use this resource. :param group_name: :param users: list :return:

agent_capabilities(agent_id, include_shared=True)

List agent’s capabilities.

Parameters:
  • agent_id – Bamboo agent ID (integer number)

  • include_shared – Include shared capabilities

Returns:

agents

agent_details(agent_id, expand=None)

Provides details of an agent with given id.

Parameters:
  • agent_id – Bamboo agent ID (integer number)

  • expand – Expand fields (None, capabilities, executableEnvironments, executableJobs)

Returns:

agent_disable(agent_id)

Disable agent

Parameters:

agent_id – Bamboo agent ID (integer number)

Returns:

None

agent_enable(agent_id)

Enable agent

Parameters:

agent_id – Bamboo agent ID (integer number)

Returns:

None

agent_is_online(agent_id)

Get agent online status.

Parameters:

agent_id – Bamboo agent ID (integer number)

Returns:

True/False

agent_remote(online=False)

Provides a list of all agent authentication statuses.

Parameters:

online – list only online agents (default False = all)

Returns:

list of agent-describing dictionaries

agent_status(online=False)

Provides a list of all agents.

Parameters:

online – filter only online agents (default False = all)

Returns:

base_list_call(resource, expand, favourite, clover_enabled, max_results, label=None, start_index=0, **kwargs)
build_latest_result(plan_key, expand=None, include_all_states=False)

Returns details of the latest build result :param expand: expands build result details on request. Possible values are: artifacts, comments, labels, Jira Issues, stages. stages expand is available only for top level plans. It allows to drill down to job results using stages.stage.results.result. All expand parameters should contain results. Result prefix. :param plan_key: Should be in the form XX-YY[-ZZ] :param include_all_states:

build_result(build_key, expand=None, include_all_states=False, start=0, max_results=25)

Returns details of a specific build result :param expand: expands build result details on request. Possible values are: artifacts, comments, labels, Jira Issues, stages. stages expand is available only for top level plans. It allows to drill down to job results using stages.stage.results.result. All expand parameters should contain results. Result prefix. :param build_key: Should be in the form XX-YY[-ZZ]-99, that is, the last token should be an integer representing the build number :param include_all_states :param start: :param max_results:

chart(report_key, build_keys, group_by_period, date_filter=None, date_from=None, date_to=None, width=None, height=None, start_index=9, max_results=25)

Get chart data :param report_key: :param build_keys: :param group_by_period: :param date_filter: :param date_from: :param date_to: :param width: :param height: :param start_index: :param max_results: :return:

check_plugin_manager_status()

Check plugin manager status :return:

comments(project_key, plan_key, build_number, start_index=0, max_results=25)

Get comments for a specific build :param project_key: :param plan_key: :param build_number: :param start_index: :param max_results: :return:

create_branch(plan_key, branch_name, vcs_branch=None, enabled=False, cleanup_enabled=False)

Method for creating branch for a specified plan. You can use vcsBranch query param to define which vcsBranch should newly created branch use. If not specified it will not override vcsBranch from the main plan.

Parameters:
  • plan_key – str TST-BLD

  • branch_name – str new-shiny-branch

  • vcs_branch – str feature/new-shiny-branch, /refs/heads/new-shiny-branch

  • enabled – bool

  • cleanup_enabled – bool - enable/disable automatic cleanup of branch

Returns:

PUT request

create_comment(project_key, plan_key, build_number, comment)

Create a comment for a specific build :param project_key: :param plan_key: :param build_number: :param comment: :return:

create_elastic_configuration(json)

Create an elastic configuration :param json: :return:

create_group(group_name)

Create a new group. The authenticated user must have restricted administrative permission or higher to use this resource. :param group_name: :return:

create_label(project_key, plan_key, build_number, label)

Create a label for a specific build :param project_key: :param plan_key: :param build_number: :param label: :return:

create_plan_variable(plan_key, data)

Create a plan variable from Bamboo’s variable request body.

delete_agent_capability(agent_id, capability_key)

Delete one agent capability by its Bamboo capability key.

delete_all_agent_capabilities(agent_id)

Delete every capability assigned directly to an agent.

delete_build_result(build_key)

Deleting result for specific build :param build_key: Take full build key, example: PROJECT-PLAN-8

delete_deployment_project(project_id)

Deletes a deployment project. :param project_id: :return:

delete_elastic_configuration(configuration_id)

Delete an elastic configuration :param configuration_id: :return:

delete_group(group_name)

Deletes the specified group, removing it from the system. The authenticated user must have restricted administrative permission or higher to use this resource. :param group_name: :return:

delete_label(project_key, plan_key, build_number, label)

Delete a label for a specific build :param project_key: :param plan_key: :param build_number: :param label: :return:

delete_plan(plan_key)

Marks plan for deletion. Plan will be deleted by a batch job. :param plan_key: :return:

delete_plan_variable(plan_key, variable_name)

Delete a plan variable.

delete_plugin(plugin_key)

Delete plugin :param plugin_key: :return:

delete_project(project_key)

Marks project for deletion. Project will be deleted by a batch job.

deployment_dashboard(project_id=None)

Returns the current status of each deployment environment If no project id is provided, returns all projects.

deployment_environment_results(env_id, expand=None, max_results=25)

Get deployment environment results :param env_id: :param expand: :param max_results: :return:

deployment_project(project_id)

Returns a deployment project. :param project_id: :return:

deployment_projects()

Returns all deployment projects. :return:

disable_plan(plan_key)

Disable plan. :param plan_key: str TST-BLD :return: DELETE request

disable_plugin(plugin_key)

Disable a plugin :param plugin_key: :return:

enable_plan(plan_key)

Enable plan. :param plan_key: str TST-BLD :return: POST request

enable_plugin(plugin_key)

Enable a plugin :param plugin_key: :return:

execute_build(plan_key, stage=None, execute_all_stages=True, custom_revision=None, **bamboo_variables)

Fire build execution for specified plan. !IMPORTANT! NOTE: for some reason, this method always execute all stages :param plan_key: str TST-BLD :param stage: str stage-name :param execute_all_stages: bool :param custom_revision: str revisionName :param bamboo_variables: dict {variable=value} :return: POST request

get_branch_info(plan_key, branch_name)

Get information about a plan branch :param plan_key: :param branch_name: :return:

get_build_queue(expand='queuedBuilds')

Lists all the builds waiting in the build queue, adds or removes a build from the build queue. May be used also to resume build on manual stage or rerun failed jobs. :return:

get_custom_expiry(limit=25)

Get list of all plans where user has admin permission and which override global expiry settings. If global expiry is not enabled it returns empty response. :param limit:

get_deployment_groups(deployment_id, filter_name=None, start=0, limit=25)

Retrieve a list of groups with their deployment project permissions. The list can be filtered by some attributes. This resource is paged returns a single page of results. :param deployment_id: :param filter_name: :param start: :param limit: :return:

get_deployment_projects_for_plan(plan_key)

Returns deployment projects associated with a build plan. :param plan_key: The key of the plan.

get_deployment_queue(expand='queuedDeployments')

Provide list of deployment results scheduled for execution and waiting in queue. :return:

get_deployment_users(deployment_id, filter_name=None, start=0, limit=25)

Retrieve a list of users with their explicit permissions to given resource. The list can be filtered by some attributes. This resource is paged and returns a single page of results. :param deployment_id: :param filter_name: :param start: :param limit: :return:

get_elastic_bamboo()

Get elastic bamboo configuration :return:

get_elastic_configuration(configuration_id)

Get information of an elastic configuration :param configuration_id: :return:

get_elastic_configurations()

Get list of all elastic configurations :return:

get_elastic_instance_logs(instance_id)

Get logs from an EC2 instance :param instance_id: :return:

get_environment_groups(environment_id, filter_name=None, start=0, limit=25)

Retrieve a list of groups with their deployment environment permissions. The list can be filtered by some attributes. This resource is paged returns a single page of results. :param environment_id: :param filter_name: :param start: :param limit: :return:

get_environment_users(environment_id, filter_name=None, start=0, limit=25)

Retrieve a list of users with their explicit permissions to given resource. The list can be filtered by some attributes. This resource is paged and returns a single page of results. :param environment_id: :param filter_name: :param start: :param limit: :return:

get_groups(start=0, limit=25)

Retrieve a paginated list of groups. The authenticated user must have restricted administrative permission or higher to use this resource. :param start: :param limit: :return:

get_plan(plan_key, expand=None)

Get plan information. :param plan_key: :param expand: optional :return:

get_plan_specs(plan_key, package=None, format='YAML')

Export a plan as Bamboo Specs source code.

Bamboo does not provide a repositories-only REST endpoint. The response’s spec.code field contains the plan definition, including its repositories section. YAML is the most convenient format for repository audits; Bamboo also supports JAVA on compatible releases.

Parameters:
  • plan_key – Full plan key, for example PROJECT-PLAN.

  • package – Optional Java package name when exporting Java Specs.

  • format – Export format, normally YAML or JAVA.

Returns:

The RestPlanSpec response containing spec.code.

get_plan_variable(plan_key, variable_name)

Return one plan variable by name.

get_plan_variables(plan_key)

Return variables configured for a plan.

get_plugin_info(plugin_key)

Provide plugin info :return a json of installed plugins

get_plugin_license_info(plugin_key)

Provide plugin license information :return a json specific License query

get_plugins_info()

Provide plugins info :return a json of installed plugins

get_project(project_key)

Method used to retrieve information for project specified as project key. Possible expand parameters: plans, list of plans for project. plans.plan, list of plans with plan details (only plans visible - READ permission for user)

get_project_linked_repositories(project_key)

Return linked repositories authorized for Bamboo Specs in a project.

property get_projects

Method used to list all projects defined in Bamboo. Projects without any plan are not listed. :return: GET request

get_users_from_group(group_name, filter_users=None, start=0, limit=25)

Retrieves a list of users that are members of a specified group. The authenticated user must have restricted administrative permission or higher to use this resource. :param filter_users: :param group_name: :param start: :param limit: :return:

get_users_in_global_permissions(start=0, limit=25)

Provide users in global permissions configuration :param start: :param limit: :return:

get_users_not_in_group(group_name, filter_users='', start=0, limit=25)

Retrieves a list of users that are not members of a specified group. The authenticated user must have restricted administrative permission or higher to use this resource. :param filter_users: :param group_name: :param start: :param limit: :return:

get_vcs_branches(plan_key, max_results=25)

Get all vcs names for the current plan :param plan_key: str TST-BLD :param max_results :return:

grant_group_to_deployment(deployment_id, group, permissions)

Grants deployment project permissions to a given group. :param deployment_id: :param group: :param permissions: :return:

grant_group_to_environment(environment_id, group, permissions)

Grants deployment environment permissions to a given group. :param environment_id: :param group: :param permissions: :return:

grant_user_to_deployment(deployment_id, user, permissions)

Grants deployment project permissions to a given user. :param deployment_id: :param user: :param permissions: :return:

grant_user_to_environment(environment_id, user, permissions)

Grants deployment environment permissions to a given user. :param environment_id: :param user: :param permissions: :return:

health_check()

Get health status https://confluence.atlassian.com/jirakb/how-to-retrieve-health-check-results-using-rest-api-867195158.html :return:

labels(project_key, plan_key, build_number, start_index=0, max_results=25)

Get labels for a build :param project_key: :param plan_key: :param build_number: :param start_index: :param max_results: :return:

latest_results(expand=None, favourite=False, clover_enabled=False, label=None, issue_key=None, start_index=0, max_results=25, include_all_states=False)

Get the latest Results :param expand: :param favourite: :param clover_enabled: :param label: :param issue_key: :param start_index: :param max_results: :param include_all_states: :return:

latest_successful_plan_result(project_key, plan_key, max_results=25, **kwargs)

Return the newest successful plan result, or None when absent.

Authorize an existing linked repository for Bamboo Specs in a project.

This grants a repository-stored Bamboo Specs repository permission to create or edit plans in project_key. It does not change the repositories checked out by an existing plan; update and apply that plan’s Bamboo Specs for plan-level repository changes.

oldest_failed_plan_result(project_key, plan_key, max_results=25, **kwargs)

Return the oldest failed plan result, or None when absent.

ordered_plan_results(project_key, plan_key, order='descending', build_state=None, max_results=25, **kwargs)

Return retrieved plan results ordered by completion time.

Bamboo’s result API does not expose a server-side sort parameter. This helper orders the result page client-side by buildCompletedTime. Set max_results high enough to include the history being compared; this method returns a list rather than the lazy generator returned by plan_results().

Parameters:
  • order"ascending" for oldest first or "descending" for newest first.

  • build_state – Optional Successful or Failed filter.

  • max_results – Number of results Bamboo should return to sort.

Returns:

A list of build results ordered by completion time.

plan_branches(plan_key, expand=None, favourite=False, clover_enabled=False, max_results=25)

Get all plan Branches api/1.0/plan/{projectKey}-{buildKey}/branch :param plan_key: :param expand: :param favourite: :param clover_enabled: :param max_results: :return:

plan_directory_info(plan_key)

Returns information about the directories where artifacts, build logs, and build results will be stored. Disabled by default. See https://confluence.atlassian.com/display/BAMBOO/Plan+directory+information+REST+API for more information. :param plan_key: :return:

plan_results(project_key, plan_key, expand=None, favourite=False, clover_enabled=False, label=None, issue_key=None, start_index=0, max_results=25, include_all_states=False, build_state=None)

Get Plan results :param project_key: :param plan_key: :param expand: :param favourite: :param clover_enabled: :param label: :param issue_key: :param start_index: :param max_results: :param include_all_states: :param build_state: Optional Bamboo result state, such as

Successful or Failed.

Returns:

plans(expand=None, favourite=False, clover_enabled=False, start_index=0, max_results=25)

Get all build plans :param expand: :param favourite: :param clover_enabled: :param start_index: :param max_results: :return:

project(project_key, expand=None, favourite=False, clover_enabled=False)

Get a single project by the key :param project_key: :param expand: :param favourite: :param clover_enabled: :return:

project_latest_results(project_key, expand=None, favourite=False, clover_enabled=False, label=None, issue_key=None, start_index=0, max_results=25, include_all_states=False)

Get the latest Project Results :param project_key: :param expand: :param favourite: :param clover_enabled: :param label: :param issue_key: :param start_index: :param max_results: :param include_all_states: :return:

project_plans(project_key, start_index=0, max_results=25)

Get all build plans in a project Returns a generator with the plans in a given project. :param project_key: project key :param start_index: :param max_results: :return: Generator with plans

projects(expand=None, favourite=False, clover_enabled=False, max_results=25)

Get all Projects :param expand: :param favourite: :param clover_enabled: :param max_results: :return:

queue_build(plan_key, params=None)

Add a plan to the Bamboo build queue.

params maps directly to Bamboo’s queue request parameters. For example, pass {"bamboo.variable.release": "1.2.3"} to set a custom plan variable. Builds execute all stages by default; provide an explicit executeAllStages or stage value to override that behavior. The supplied mapping is never modified.

Parameters:
  • plan_key – Full plan key, for example PROJECT-PLAN.

  • params – Optional queue parameters and custom variables.

Returns:

The queued build response.

reindex()

Returns status of the current indexing operation. reindexInProgress - reindex is currently performed in background reindexPending - reindex is required (i.e. it failed before or some upgrade task asked for it)

remove_users_from_group(group_name, users)

Remove multiple users from a group. The list of usernames should be passed as request body. The authenticated user must have restricted administrative permission or higher to use this resource. :param group_name: :param users: list :return:

reports(max_results=25)
results(project_key=None, plan_key=None, job_key=None, build_number=None, expand=None, favourite=False, clover_enabled=False, issue_key=None, label=None, start_index=0, max_results=25, include_all_states=False, build_state=None)

Get results as generic method :param project_key: :param plan_key: :param job_key: :param build_number: :param expand: :param favourite: :param clover_enabled: :param issue_key: :param label: A label string or an iterable of labels. :param start_index: :param max_results: :param include_all_states: :param build_state: Optional Bamboo result state, such as

Successful or Failed.

Returns:

revoke_group_from_deployment(deployment_id, group, permissions=['READ', 'WRITE', 'BUILD'])

Revokes deployment project permissions from a given group. :param deployment_id: :param group: :param permissions: :return:

revoke_group_from_environment(environment_id, group, permissions=['READ', 'WRITE', 'BUILD'])

Revokes deployment environment permissions from a given group. :param environment_id: :param group: :param permissions: :return:

revoke_user_from_deployment(deployment_id, user, permissions=['READ', 'WRITE', 'BUILD'])

Revokes deployment project permissions from a given user. :param deployment_id: :param user: :param permissions: :return:

revoke_user_from_environment(environment_id, user, permissions=['READ', 'WRITE', 'BUILD'])

Revokes deployment environment permissions from a given user. :param environment_id: :param user: :param permissions: :return:

search_branches(plan_key, include_default_branch=True, max_results=25, start=0)

Search Branches :param plan_key: :param include_default_branch: :param max_results: :param start: :return:

search_linked_repositories(search_term=None)

Search globally configured Bamboo linked repositories.

The public Bamboo REST API can search existing linked repositories but does not create or update their connection configuration. Create those connections in Bamboo administration, then use the returned repository ID with link_repository_to_project().

Parameters:

search_term – Optional repository-name fragment.

Returns:

Bamboo’s paged linked-repository response.

search_plans(search_term, fuzzy=True, start_index=0, max_results=25)

Search plans by name :param search_term: str :param fuzzy: bool optional :param start_index: optional :param max_results: optional :return: GET request

server_info()
set_elastic_bamboo(data)

Set elastic bamboo configuration :return:

stop_build(plan_key)

Stop the build which is in progress at the moment. :param plan_key: str TST-BLD :return: GET request

stop_reindex()

Kicks off a reindex. Requires system admin permissions to perform this reindex.

trigger_deployment_for_version_on_environment(version_id, environment_id)

Triggers a deployment for a release version on the given environment. Example: trigger_deployment_for_version_on_environment(version_id=’3702785’, environment_id=’3637249’) :param version_id: str or int id of the release version. :param environment_id: str or int id of the deployment environment. :return:

Remove a project-level Bamboo Specs repository authorization.

update_elastic_configuration(configuration_id, data)

Update an elastic configuration :param configuration_id: :param data: :return:

update_plan_variable(plan_key, variable_name, data)

Update a plan variable.

update_plugin_license(plugin_key, raw_license)

Update license for plugin :param plugin_key: :param raw_license: :return:

upload_plugin(plugin_path)

Provide plugin path for upload into Jira e.g. useful for auto deploy :param plugin_path: :return:

Projects & Plans

# Get all Projects
projects(expand=None, favourite=False, clover_enabled=False, max_results=25)

# Alternative way to get all Projects where pagination used only for soft iteration
jira.get_projects(start=0, limit=25)

# Get a single project by the key
project(project_key, expand=None, favourite=False, clover_enabled=False)

# Get all build plans in a project
project_plans(project_key)

# Get all build plans
plans(expand=None, favourite=False, clover_enabled=False, start_index=0, max_results=25)

# Get information about plan build directory
# Returns information about the directories where artifacts, build logs, and build results will be stored.
plan_directory_info(plan_key)

# Get plan information
get_plan(plan_key)

# Add a plan to the build queue, including optional custom variables
bamboo.queue_build("PROJECT-PLAN", {"bamboo.variable.release": "1.2.3"})

# Export the plan's Bamboo Specs source, including its repositories section
spec = bamboo.get_plan_specs(plan_key, format="YAML")
print(spec["spec"]["code"])

# Search for a plan by name
search_plans(name, name, fuzzy=True, start_index=0, max_results=25)

# Delete a plan (or a plan branch)
delete_plan(plan_key)

# Disable plan
disable_plan(plan_key)

# Enable plan
enable_plan(plan_key)

# Retrieve information for project specified as project key.
get_project(project_key)

# Delete project
delete_project(project_key)

Linked repositories and Bamboo Specs

Bamboo’s public REST API can search existing global linked repositories and authorize one for a project’s Repository-Stored Bamboo Specs. It does not create a connection on the Linked repositories administration page, nor does it directly change the repositories checked out by an existing plan. Create the global connection in Bamboo administration; change plan repositories through that plan’s Bamboo Specs and apply the Specs.

candidates = bamboo.search_linked_repositories("build-specs")
repository_id = candidates["searchResults"][0]["id"]

bamboo.link_repository_to_project("PROJECT", repository_id)
allowed = bamboo.get_project_linked_repositories("PROJECT")
# Revoke the project-level Repository-Stored Specs authorization:
bamboo.unlink_repository_from_project("PROJECT", repository_id)

Branches

# Search Branches
search_branches(plan_key, include_default_branch=True, max_results=25)

# Get all plan Branches
plan_branches(plan_key, expand=None, favourite=False, clover_enabled=False, max_results=25)

# Get branch information
get_branch_info(plan_key, branch_name)

# Create new branch (vcs or simple)
create_branch(plan_key, branch_name, vcs_branch=None, enabled=False, cleanup_enabled=False)

# Get VCS Branches
get_vcs_branches(plan_key, max_results=25)

Build results

# Get build results (Scalable from a single result to all build results)
results(project_key=None, plan_key=None, job_key=None, build_number=None, expand=None, favourite=False,
        clover_enabled=False, issue_key=None, label=None, start_index=0, max_results=25, include_all_states=False)

# ``label`` accepts one label or multiple labels (sent as repeated query parameters)
plan_results("PROJECT", "PLAN", label=["release", "production"])

# Get latest build results
latest_results(expand=None, favourite=False, clover_enabled=False, label=None, issue_key=None,
               start_index=0, max_results=25, include_all_states=False)

# Get latest build results for the project
project_latest_results(project_key, expand=None, favourite=False, clover_enabled=False, label=None,
                       issue_key=None, start_index=0, max_results=25, include_all_states=False)

# Get build results for a single plan
plan_results(project_key, plan_key, expand=None, favourite=False, clover_enabled=False, label=None,
             issue_key=None, start_index=0, max_results=25, include_all_states=False)

# Bamboo has no server-side result sort; order the retrieved history locally.
newest_success = bamboo.latest_successful_plan_result("PROJECT", "PLAN", max_results=1000)
oldest_failed = bamboo.oldest_failed_plan_result("PROJECT", "PLAN", max_results=1000)

# Get a single build result
build_result(build_key, expand=None, include_all_states=False)

# Get latest results for a plan
build_latest_result(plan_key, expand=None, include_all_states=False)

# Delete build result
delete_build_result(build_key)

# Execute build
execute_build(plan_key, stage=None, execute_all_stages=True, custom_revision=None, **bamboo_variables)

# Stop Build
stop_build(plan_key)

Comments & Labels

# Get comments for a specific build
comments(project_key, plan_key, build_number, start_index=0, max_results=25)

# Create a comment for a specific build
create_comment(project_key, plan_key, build_number, comment)

# Get labels for a build
labels(project_key, plan_key, build_number, start_index=0, max_results=25)

# Create a label for a specific build
create_label(project_key, plan_key, build_number, label)

# Delete a label for a specific build
delete_label(project_key, plan_key, build_number, label)

Deployments

# Get all deployment projects.
deployment_projects()

# Get deployments for a single project
deployment_project(project_id)

# Get deployment environment results
deployment_environment_results(env_id, expand=None, max_results=25)

# Get deployment dashboard
deployment_dashboard(project_id=None)

# Delete deployment project
delete_deployment_project(project_id)

# Returns deployment projects associated with a build plan.
get_deployment_projects_for_plan(plan_key)

# Triggers a deployment for a release version on the given environment.
trigger_deployment_for_version_on_environment(version_id, environment_id)

Agents and plan variables

# activity() filters active online agents using the supported REST agent
# resource rather than removed Bamboo dashboard endpoints.
busy_agents = bamboo.activity(busy=True)

capabilities = bamboo.agent_capabilities(agent_id, include_shared=True)
bamboo.add_agent_capability(agent_id, {"type": "system", "key": "jdk", "value": "17"})
bamboo.delete_agent_capability(agent_id, capability_key)

variables = bamboo.get_plan_variables("PROJ-PLAN")
bamboo.create_plan_variable("PROJ-PLAN", {"name": "release", "value": "1.0"})
bamboo.update_plan_variable("PROJ-PLAN", "release", {"value": "1.1"})
bamboo.delete_plan_variable("PROJ-PLAN", "release")

Users & Groups

# Get users in global permissions
get_users_in_global_permissions(start=0, limit=25)

# Get Groups
get_groups(start=0, limit=25)

# Create Group
create_group(group_name)

# Delete Group
delete_group(group_name)

# Add users into Group
add_users_into_group(group_name, users)

# Remove users from Group
remove_users_from_group(group_name, users)

# Get users from Group
get_users_from_group(group_name, filter_users=None, start=0, limit=25)

# Get users without Group
get_users_not_in_group(group_name, filter_users='', start=0, limit=25)

# Get deployment users
get_deployment_users(self, deployment_id, filter_name=None, start=0, limit=25)

# Revoke user from deployment
revoke_user_from_deployment(self, deployment_id, user, permissions=['READ', 'WRITE', 'BUILD'])

# Grant user to deployment
grant_user_to_deployment(self, deployment_id, user, permissions)

# Get deployment groups
get_deployment_groups(self, deployment_id, filter_name=None, start=0, limit=25)

# Revoke group from deployment
revoke_group_from_deployment(self, deployment_id, group, permissions=['READ', 'WRITE', 'BUILD'])

# Grant group to deployment
grant_group_to_deployment(self, deployment_id, group, permissions)

# Get environment user
get_environment_users(self, environment_id, filter_name=None, start=0, limit=25)

# Revoke user from environment
revoke_user_from_environment(self, environment_id, user, permissions=['READ', 'WRITE', 'BUILD'])

# Grant user to environment
grant_user_to_environment(self, environment_id, user, permissions)

# Get environment groups
get_environment_groups(self, environment_id, filter_name=None, start=0, limit=25)

# Revoke group from environment
revoke_group_from_environment(self, environment_id, group, permissions=['READ', 'WRITE', 'BUILD'])

# Grant group to environment
grant_group_to_environment(self, environment_id, group, permissions)

Agents

# Get agents statuses
agent_status(online=False)

# Get remote agents. Currently (version 7.2.2) output is the same as for
# agent_status but uses different API
agent_remote(online=False)

# Check if agent is online
agent_is_online(agent_id=123456)

# Enable agent
agent_enable(agent_id=123456)

# Disable agent
agent_disable(agent_id)

# Get agent details
agent_details(agent_id=123456)
agent_details(agent_id=123456, expand="capabilities,executableEnvironments,executableJobs")

# Get agent capabilities
agent_capabilities(agent_id=123456):
agent_capabilities(agent_id=123456, include_shared=False):

Other actions

# Get build queue
get_build_queue(expand='queuedBuilds')

# Get deployment queue
get_deployment_queue(expand='queuedDeployments')

# Get server information
server_info()

# Get active online agents, including each agent's ``busy`` state
activity()

# Get only idle active agents
activity(busy=False)

# Get custom expiry
get_custom_expiry(limit=25)

# Get reports
reports(max_results=25)

# Get charts
chart(report_key, build_keys, group_by_period, date_filter=None, date_from=None, date_to=None,
          width=None, height=None, start_index=9, max_results=25)

# Returns status of the current indexing operation.
reindex()

# Kicks off a reindex.
stop_reindex()

# Health check
health_check()

# Upload plugin
upload_plugin(plugin_path)

Elastic Bamboo

# Get elastic bamboo instance logs
get_elastic_instance_logs('i-12ab34cd56ef')

# Get elastic bamboo configurations
get_elastic_configurations()

# Create elastic bamboo configuration
create_elastic_configuration({"name": "value"})

# Get elastic bamboo configuration
get_elastic_configuration('123456')

# Update elastic bamboo configuration
update_elastic_configuration('123456')

# Delete elastic bamboo configuration
delete_elastic_configuration('123456')

# Get elastic bamboo configuration
get_elastic_bamboo()

# Set elastic bamboo configuration
set_elastic_bamboo({"enabled": True, "awsCredentialsType": "INSTANCE_PROFILE", "region": "ASIA_PACIFIC_SE_2",
"privateKeyFile": "", "certificateFile": "", "maxNumOfElasticInstances": 1, "allocatePublicIpToVpcInstances": False,
"elasticInstanceManagement": {"type": "Disabled"}, "uploadAwsAccountIdentifierToElasticInstances": False,
"elasticAutoTermination": { "enabled": True, "shutdownDelay": 300}})

Plugins information

# Get plugins information
get_plugins_info()

# Get plugin information
get_plugin_info(plugin_key)

# Provide plugin license information
get_plugin_license_info(plugin_key)

# Provide plugin path for upload into Bamboo e.g. useful for auto deploy
upload_plugin(plugin_path)

# Disable plugin
disable_plugin(plugin_key)

# Enable plugin
enable_plugin(plugin_key)

# Uninstall plugin
delete_plugin(plugin_key)

# Check plugin manager status
get_plugin_module_info(plugin_key, module_key)

# Update license for plugin (app)
update_plugin_license(plugin_key, raw_license)