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
- activate_quick_filter(filter_id)¶
Activate a quick filter. :param filter_id: str - filter id :return:
- 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
activeandbusyfor 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_trusted_key(data)¶
Add a trusted key. :param data: dict - key representation :return: created key
- 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_access_token()¶
Create a new access token for the current user.
- 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_deployment_environment(project_id, data)¶
Create a deployment environment in a deployment project. :param project_id: str - deployment project id :param data: dict - environment representation :return: created environment
- create_deployment_project(data)¶
Create a new deployment project. :param data: dict - deployment project representation :return: created deployment project
- create_deployment_version(project_id, data)¶
Create a deployment version. :param project_id: str - deployment project id :param data: dict - version representation :return: created version
- create_elastic_configuration(json)¶
Create an elastic configuration :param json: :return:
- create_global_variable(data)¶
Create a global variable. :param data: dict - variable representation :return: created variable
- 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.
- create_quick_filter(data)¶
Create a quick filter. :param data: dict - filter representation :return: created filter
- create_security_group(data)¶
Create a security group. :param data: dict - group representation :return: created group
- create_user(data)¶
Create a new user. :param data: dict - user representation :return: created user
- deactivate_quick_filters(data)¶
Deactivate quick filters. :param data: dict - filter ids :return:
- delete_access_token(token_id)¶
Delete an access token. :param token_id: str - token id :return:
- 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_environment(environment_id)¶
Delete a deployment environment. :param environment_id: str - environment id :return:
- delete_deployment_project(project_id)¶
Deletes a deployment project. :param project_id: :return:
- delete_deployment_version(version_id)¶
Delete a deployment version. :param version_id: str - version id :return:
- delete_elastic_configuration(configuration_id)¶
Delete an elastic configuration :param configuration_id: :return:
- delete_global_variable(variable_id)¶
Delete a global variable. :param variable_id: str - variable 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_im_server_config()¶
Delete instant messaging server configuration.
- 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_mail_server_config()¶
Delete mail server configuration.
- 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.
- delete_quick_filter(filter_id)¶
Delete a quick filter. :param filter_id: str - filter id :return:
- delete_trusted_key(key_id)¶
Delete a trusted key. :param key_id: str - key id :return:
- delete_user(username)¶
Delete a user. :param username: str - username :return:
- delete_user_access_token(username, token_id)¶
Delete an access token for a user. :param username: str - username :param token_id: str - token id :return:
- delete_user_alias(username)¶
Delete a user’s alias. :param username: str - username :return:
- 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_access_tokens()¶
Get all access tokens for the current user.
- get_active_quick_filters()¶
Get active quick filters.
- get_agent_config()¶
Get agent configuration list.
- get_artifact_handler_config(handler_name)¶
Get configuration for an artifact handler. :param handler_name: str - handler name (agentLocal, bambooRemote, s3, sftp) :return: configuration
- get_audit_log_config()¶
Get audit log configuration.
- get_available_groups_for_permission(resource_type, resource_id, start=0, limit=25)¶
Get groups available for granting permission to a resource. :param resource_type: str - deployment, environment, project, plan, repository :param resource_id: str - resource id :param start: int - start index :param limit: int - maximum number of results :return: available groups
- get_available_users_for_permission(resource_type, resource_id, start=0, limit=25)¶
Get users available for granting permission to a resource. :param resource_type: str - deployment, environment, project, plan, repository :param resource_id: str - resource id :param start: int - start index :param limit: int - maximum number of results :return: available users
- get_branch_info(plan_key, branch_name)¶
Get information about a plan branch :param plan_key: :param branch_name: :return:
- get_broken_build(plan_result_key_or_plan_key)¶
Get responsibility information for a broken build or plan. :param plan_result_key_or_plan_key: str - plan result key or plan key :return: responsibility info
- get_broken_builds_by_user(username)¶
Get broken builds for which a user has taken responsibility. :param username: str - username :return: list of broken builds
- get_build_concurrency_config()¶
Get build concurrency configuration.
- get_build_monitoring_config()¶
Get build monitoring configuration.
- 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_current_user()¶
Get information about the current user.
- 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_dark_feature(key)¶
Get a dark feature. :param key: str - feature key :return: feature status
- get_dark_feature_user(key, username)¶
Get dark feature status for a user. :param key: str - feature key :param username: str - username :return: feature status
- get_dark_features()¶
Get all dark features.
- get_deployment_dashboard_paginate(project_id=None, start=0, limit=25)¶
Get paginated deployment dashboard. :param project_id: str - optional deployment project id :param start: int - start index :param limit: int - maximum number of results :return: dashboard data
- get_deployment_dashboard_status(data)¶
Get deployment dashboard status for given environments. :param data: dict - request body with environment ids :return: dashboard status
- get_deployment_environment(environment_id)¶
Get a deployment environment. :param environment_id: str - environment id :return: environment
- 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_deployment_version(version_id)¶
Get a deployment version. :param version_id: str - version id :return: version
- get_deployment_versions(project_id, start=0, limit=25)¶
Get versions for a deployment project. :param project_id: str - deployment project id :param start: int - start index for paging :param limit: int - maximum number of results :return: versions
- 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_general_config()¶
Get general configuration.
- get_global_variable(variable_id)¶
Get a global variable. :param variable_id: str - variable id :return: variable
- get_global_variables()¶
Get all global variables.
- 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_im_server_config()¶
Get instant messaging server configuration.
- get_mail_server_config()¶
Get mail server configuration.
- get_my_broken_builds()¶
Get broken builds for which the current user has taken responsibility.
- get_offline_agent_removal_config()¶
Get offline agent removal configuration.
- get_permission_groups(resource_type, resource_id, filter_name=None, start=0, limit=25)¶
Get groups with explicit permissions to a resource. :param resource_type: str - deployment, environment, project, plan, repository :param resource_id: str - resource id :param filter_name: str - optional name filter :param start: int - start index :param limit: int - maximum number of results :return: groups
- get_permission_users(resource_type, resource_id, filter_name=None, start=0, limit=25)¶
Get users with explicit permissions to a resource. :param resource_type: str - deployment, environment, project, plan, repository :param resource_id: str - resource id :param filter_name: str - optional name filter :param start: int - start index :param limit: int - maximum number of results :return: users
- 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.codefield contains the plan definition, including itsrepositoriessection.YAMLis the most convenient format for repository audits; Bamboo also supportsJAVAon 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
YAMLorJAVA.
- Returns:
The
RestPlanSpecresponse containingspec.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_quarantine_config()¶
Get quarantine configuration.
- get_quick_filter(filter_id)¶
Get a quick filter. :param filter_id: str - filter id :return: filter
- get_quick_filters()¶
Get all quick filters.
- get_remote_agent_support_config()¶
Get remote agent support configuration.
- get_roles_for_permission(resource_type, resource_id)¶
Get roles with permissions for a resource. :param resource_type: str - deployment, environment, project, plan, repository :param resource_id: str - resource id :return: roles
- get_security_groups()¶
Get security groups.
- get_security_settings()¶
Get security settings.
- get_server()¶
Get Bamboo server information.
- get_server_nodes()¶
Get Bamboo server nodes.
- get_trusted_keys()¶
Get trusted keys.
- get_user_access_tokens(username)¶
Get access tokens for a user. :param username: str - username :return: access tokens
- get_user_alias(username)¶
Get a user’s alias. :param username: str - username :return: alias
- get_users(start=0, limit=25)¶
Get a paginated list of users. :param start: int - start index :param limit: int - maximum number of results :return: users
- 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:
- get_visible_quick_filters()¶
Get visible quick filters.
- grant_group_permission(resource_type, resource_id, group_name, permissions)¶
Grant permissions to a group for a resource. :param resource_type: str - deployment, environment, project, plan, repository :param resource_id: str - resource id :param group_name: str - group name :param permissions: list - list of permissions :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_role_permission(resource_type, resource_id, role_name, permissions)¶
Grant permissions to a role for a resource. :param resource_type: str - deployment, environment, project, plan, repository :param resource_id: str - resource id :param role_name: str - role name :param permissions: list - list of permissions :return:
- grant_user_permission(resource_type, resource_id, user_name, permissions)¶
Grant permissions to a user for a resource. :param resource_type: str - deployment, environment, project, plan, repository :param resource_id: str - resource id :param user_name: str - username :param permissions: list - list of 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
Nonewhen absent.
- link_repository_to_project(project_key, repository_id)¶
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
Nonewhen 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. Setmax_resultshigh enough to include the history being compared; this method returns a list rather than the lazy generator returned byplan_results().- Parameters:
order –
"ascending"for oldest first or"descending"for newest first.build_state – Optional
SuccessfulorFailedfilter.max_results – Number of results Bamboo should return to sort.
- Returns:
A list of build results ordered by completion time.
- pause_build_in_queue(project_key, build_key, build_number)¶
Pause a build in the queue. :param project_key: str - project key :param build_key: str - build key :param build_number: int - build number :return:
- pause_server()¶
Pause the Bamboo server.
- 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
SuccessfulorFailed.- 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:
- prepare_for_restart()¶
Prepare the Bamboo server for restart.
- 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.
paramsmaps 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 explicitexecuteAllStagesorstagevalue 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)
- remote_trigger_change_detection()¶
Trigger remote repository change detection for all linked repositories.
- remove_build_from_queue(project_key, build_key, build_number)¶
Remove a build from the queue. :param project_key: str - project key :param build_key: str - build key :param build_number: int - build number :return:
- remove_deployment_from_queue(deployment_result_id)¶
Remove a deployment from the queue. :param deployment_result_id: str - deployment result id :return:
- remove_responsibility(plan_result_key_or_plan_key, username)¶
Remove responsibility for a broken build. :param plan_result_key_or_plan_key: str - plan result key or plan key :param username: str - username :return:
- 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:
- rename_user(data)¶
Rename a user. :param data: dict - rename request :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
SuccessfulorFailed.- Returns:
- resume_server()¶
Resume the Bamboo server.
- 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_group_permission(resource_type, resource_id, group_name, permissions)¶
Revoke permissions from a group for a resource. :param resource_type: str - deployment, environment, project, plan, repository :param resource_id: str - resource id :param group_name: str - group name :param permissions: list - list of permissions :return:
- revoke_role_permission(resource_type, resource_id, role_name, permissions)¶
Revoke permissions from a role for a resource. :param resource_type: str - deployment, environment, project, plan, repository :param resource_id: str - resource id :param role_name: str - role name :param permissions: list - list of 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:
- revoke_user_permission(resource_type, resource_id, user_name, permissions)¶
Revoke permissions from a user for a resource. :param resource_type: str - deployment, environment, project, plan, repository :param resource_id: str - resource id :param user_name: str - username :param permissions: list - list of 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:
- set_user_alias(username, data)¶
Set a user’s alias. :param username: str - username :param data: dict - alias request :return:
- set_visible_quick_filters(data)¶
Set visible quick filters. :param data: dict - filter ids :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.
- take_responsibility(plan_result_key_or_plan_key, username)¶
Take responsibility for a broken build. :param plan_result_key_or_plan_key: str - plan result key or plan key :param username: str - username taking responsibility :return:
- 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:
- unlink_repository_from_project(project_key, repository_id)¶
Remove a project-level Bamboo Specs repository authorization.
- update_artifact_handler_config(handler_name, data)¶
Update configuration for an artifact handler. :param handler_name: str - handler name :param data: dict - handler configuration :return:
- update_audit_log_config(data)¶
Update audit log configuration. :param data: dict - configuration :return:
- update_build_concurrency_config(data)¶
Update build concurrency configuration. :param data: dict - configuration :return:
- update_build_monitoring_config(data)¶
Update build monitoring configuration. :param data: dict - configuration :return:
- update_dark_feature(key, enabled)¶
Enable or disable a dark feature. :param key: str - feature key :param enabled: bool - enabled status :return:
- update_dark_feature_user(key, username, enabled)¶
Enable or disable a dark feature for a user. :param key: str - feature key :param username: str - username :param enabled: bool - enabled status :return:
- update_deployment_environment(environment_id, data)¶
Update a deployment environment. :param environment_id: str - environment id :param data: dict - environment representation :return:
- update_deployment_project(project_id, data)¶
Update a deployment project. :param project_id: str - deployment project id :param data: dict - deployment project representation :return:
- update_elastic_configuration(configuration_id, data)¶
Update an elastic configuration :param configuration_id: :param data: :return:
- update_general_config(data)¶
Update general configuration. :param data: dict - configuration :return:
- update_global_variable(variable_id, data)¶
Update a global variable. :param variable_id: str - variable id :param data: dict - variable representation :return:
- update_im_server_config(data)¶
Update instant messaging server configuration. :param data: dict - configuration :return:
- update_mail_server_config(data)¶
Update mail server configuration. :param data: dict - configuration :return:
- update_offline_agent_removal_config(data)¶
Update offline agent removal configuration. :param data: dict - configuration :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:
- update_quarantine_config(data)¶
Update quarantine configuration. :param data: dict - configuration :return:
- update_quick_filter(filter_id, data)¶
Update a quick filter. :param filter_id: str - filter id :param data: dict - filter representation :return:
- update_remote_agent_support_config(data)¶
Update remote agent support configuration. :param data: dict - configuration :return:
- update_security_settings(data)¶
Update security settings. :param data: dict - security settings :return:
- update_user_credentials(data)¶
Update user credentials. :param data: dict - credentials request :return:
- upload_plugin(plugin_path)¶
Provide plugin path for upload into Jira e.g. useful for auto deploy :param plugin_path: :return:
- verify_global_variables(data)¶
Verify global variables. :param data: dict - variables to verify :return: verification result
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)
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)
Responsibility and triggers¶
bamboo.get_broken_builds_by_user("ada")
bamboo.get_my_broken_builds()
bamboo.get_broken_build("PROJ-PLAN-42")
bamboo.take_responsibility("PROJ-PLAN-42", "ada")
bamboo.remove_responsibility("PROJ-PLAN-42", "ada")
bamboo.remote_trigger_change_detection()
Access tokens¶
bamboo.get_access_tokens()
bamboo.create_access_token()
bamboo.delete_access_token("token-id")
Deployment management¶
bamboo.create_deployment_project({"name": "Deploy PROJ"})
bamboo.update_deployment_project("project-id", {"name": "New name"})
bamboo.create_deployment_environment("project-id", {"name": "Staging"})
bamboo.get_deployment_environment("environment-id")
bamboo.update_deployment_environment("environment-id", {"name": "Production"})
bamboo.delete_deployment_environment("environment-id")
bamboo.get_deployment_versions("project-id")
bamboo.create_deployment_version("project-id", {"name": "1.2.3"})
bamboo.get_deployment_version("version-id")
bamboo.delete_deployment_version("version-id")
bamboo.get_deployment_dashboard_paginate()
bamboo.get_deployment_dashboard_paginate("project-id")
bamboo.get_deployment_dashboard_status({"environmentIds": [1]})
Admin configuration¶
# Artifact handlers
bamboo.get_artifact_handler_config("s3")
bamboo.update_artifact_handler_config("s3", {"bucketName": "artifacts"})
# General system configuration
bamboo.get_agent_config()
bamboo.get_offline_agent_removal_config()
bamboo.update_offline_agent_removal_config({"enabled": True})
bamboo.get_general_config()
bamboo.update_general_config({"baseUrl": "https://bamboo.example.test"})
bamboo.get_build_concurrency_config()
bamboo.update_build_concurrency_config({"numberOfConcurrentBuilds": 10})
bamboo.get_build_monitoring_config()
bamboo.update_build_monitoring_config({"enabled": True})
bamboo.get_mail_server_config()
bamboo.update_mail_server_config({"host": "smtp.example.test"})
bamboo.delete_mail_server_config()
bamboo.get_im_server_config()
bamboo.update_im_server_config({"host": "xmpp.example.test"})
bamboo.delete_im_server_config()
bamboo.get_remote_agent_support_config()
bamboo.update_remote_agent_support_config({"enabled": True})
bamboo.get_quarantine_config()
bamboo.update_quarantine_config({"enabled": True})
bamboo.get_audit_log_config()
bamboo.update_audit_log_config({"enabled": True})
# Dark features
bamboo.get_dark_features()
bamboo.get_dark_feature("feature-key")
bamboo.update_dark_feature("feature-key", True)
bamboo.get_dark_feature_user("feature-key", "ada")
bamboo.update_dark_feature_user("feature-key", "ada", True)
# Global variables and security
bamboo.get_global_variables()
bamboo.create_global_variable({"key": "KEY", "value": "value"})
bamboo.get_global_variable("variable-id")
bamboo.update_global_variable("variable-id", {"value": "new"})
bamboo.delete_global_variable("variable-id")
bamboo.verify_global_variables({"variables": []})
bamboo.get_security_settings()
bamboo.update_security_settings({"captchaEnabled": True})
bamboo.get_security_groups()
bamboo.create_security_group({"name": "admins"})
bamboo.get_trusted_keys()
bamboo.add_trusted_key({"key": "ssh-rsa ..."})
bamboo.delete_trusted_key("key-id")
Resource permissions¶
# Available principals
bamboo.get_available_users_for_permission("deployment", "resource-id")
bamboo.get_available_groups_for_permission("deployment", "resource-id")
bamboo.get_roles_for_permission("deployment", "resource-id")
# Users
bamboo.get_permission_users("deployment", "resource-id")
bamboo.grant_user_permission("deployment", "resource-id", "ada", ["READ", "BUILD"])
bamboo.revoke_user_permission("deployment", "resource-id", "ada", ["READ", "BUILD"])
# Groups
bamboo.get_permission_groups("deployment", "resource-id")
bamboo.grant_group_permission("deployment", "resource-id", "bamboo-admins", ["ADMIN"])
bamboo.revoke_group_permission("deployment", "resource-id", "bamboo-admins", ["ADMIN"])
# Roles
bamboo.grant_role_permission("deployment", "resource-id", "ROLE_ADMIN", ["READ", "BUILD"])
bamboo.revoke_role_permission("deployment", "resource-id", "ROLE_ADMIN", ["READ", "BUILD"])
Admin users¶
bamboo.get_users()
bamboo.create_user({"name": "ada", "email": "ada@example.com"})
bamboo.delete_user("ada")
bamboo.update_user_credentials({"name": "ada", "password": "new-password"})
bamboo.rename_user({"oldName": "ada", "newName": "ada2"})
bamboo.get_user_access_tokens("ada")
bamboo.delete_user_access_token("ada", "token-id")
bamboo.get_user_alias("ada")
bamboo.set_user_alias("ada", {"alias": "alias-ada"})
bamboo.delete_user_alias("ada")
Server, queue and quick filters¶
bamboo.get_server()
bamboo.get_server_nodes()
bamboo.pause_server()
bamboo.resume_server()
bamboo.prepare_for_restart()
bamboo.get_current_user()
bamboo.remove_build_from_queue("PROJ", "PLAN", 42)
bamboo.pause_build_in_queue("PROJ", "PLAN", 42)
bamboo.remove_deployment_from_queue("deployment-result-id")
bamboo.get_quick_filters()
bamboo.create_quick_filter({"name": "My builds"})
bamboo.get_active_quick_filters()
bamboo.get_visible_quick_filters()
bamboo.set_visible_quick_filters([1, 2])
bamboo.deactivate_quick_filters([1, 2])
bamboo.get_quick_filter("filter-id")
bamboo.update_quick_filter("filter-id", {"name": "Updated"})
bamboo.delete_quick_filter("filter-id")
bamboo.activate_quick_filter("filter-id")
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)
Comments & Labels¶