How to Identify and remove Bamboo agent dedication via database queries

Still need help?

The Atlassian Community is here for you.

Ask the community


Platform notice: Server and Data Center only. This article only applies to Atlassian products on the server and data center platforms.

Summary

The purpose of this article is to identify agent dedication in Bamboo via database and how to remove them via database delete queries.

Building SQL statements for reporting purposes is not part of the Atlassian Support scope and this work is provided "as-is", on a best-effort basis. Queries may work better or worse than expected, your mileage may vary. It is up to each customer to analyse each query individually and understand if that is enough for their specific needs.


Environment

The queries have been tested in PostgreSQL and might require changes for other database types. 

Solution

Agent dedication can be done in Bamboo via GUI, please refer agent dedication via Bamboo gui for further details.

To view which agents are dedicated we can use the below query.

 SELECT DISTINCT AA.ASSIGNMENT_ID,
                Q.TITLE,
                Q.AGENT_TYPE,
                AA.EXECUTABLE_ID
FROM   AGENT_ASSIGNMENT AA,
       QUEUE Q
WHERE  AA.EXECUTOR_ID = Q.QUEUE_ID 


To get the details of executables ( build_plan, build_project, job, deployment_project, deployment_environment) we can use the below query.

SELECT *
FROM   BUILD
WHERE  BUILD_ID = EXECUTABLE_ID

SELECT *
FROM   PROJECT
WHERE  PROJECT_ID = EXECUTABLE_ID

SELECT *
FROM   DEPLOYMENT_PROJECT
WHERE  DEPLOYMENT_PROJECT_ID = EXECUTABLE_ID

SELECT *
FROM   DEPLOYMENT_ENVIRONMENT
WHERE  ENVIRONMENT_ID = EXECUTABLE_ID 

(info) executable_id will be generated from the previous query

To remove the agent dedication via database queries, first identify the assignment_id which needs to be removed using the first query in the page above, post which below delete query cab be run.

DELETE FROM AGENT_ASSIGNMENT
WHERE  ASSIGNMENT_ID = ASSIGNMENT_ID 

Please create a backup of the database before running any delete statement, this will be required if any rollback is required on the tables.







Last modified on Nov 28, 2022

Was this helpful?

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