Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Bulk update requirements across plans

Wouter
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 18, 2024

Is it possible to add a requirement to existing tasks in multiple (200+) plans in bulk? 

The use case: Bamboo is assigning agents to tasks that meet the minimum capabilities (eg Java) but run under a different OS (Linux vs Windows) which breaks legacy scripts, and I want to add a system.os requirement without having to manually edit every task.

1 answer

1 accepted

2 votes
Answer accepted
Shashank Kumar
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 18, 2024

Hello Wouter,

Welcome to Atlassian community.

I guess this feature request covers what you are looking for BAM-8476-Increase the number of autodetected agent capabilities (eg, operating system, platform, architecture, etc) . Unfortunately this has not been actioned in a long time.

From Bamboo GUI, you cannot edit the requirement of Jobs from 200+ plans in bulk. This can be achieved via Rest API. You can try to follow the below steps

1. List the full_key of all the Jobs using the below SQL query, this will list all the Jobs which you have in your system, probably some filters needs to be used to filter out the Job key which you need, let me know if you need any help there. 

select DISTINCT(full_key), title, description from build join build_definition bd on build.build_id = bd.build_id where build_type = 'JOB' and requirement_set IS NOT NULL

 2. For each one of the job keys you've retrieved, perform a POST call to the API endpoint to add the requirement for the "OS" capability to match "Linux". rest/api/latest/config/job/JOB_KEY/requirement. For example,

curl -H 'Content-Type: application/json' -u ADMIN:PASSWORD -X POST 'BAMBOO_URL/rest/api/latest/config/job/JOB_KEY/requirement' --data-raw '{"key":"OS","matchType":"EQUALS","matchValue":"Linux"}'
  • Please replace ADMIN, PASSWORD, BAMBOO_URL accordingly.
  • For JOB_KEY, you can create a script that iterates over the list of job keys you've extracted from the database, replaces JOB_KEY in the API call, and performs the POST call for each key. This will add the requirement to each job key.
  • You can also change the --data-raw content according to the capabilities/requirements you want. The example shared adds a requirement to the job where the "OS" capability must match "Linux", which would make the job run on remote agents that you have set "OS" as "Linux" only.
  • We'd suggest having a system administrator create a script that repeats the API call for all your job keys.

Let me know if this helps!

Regards,

Shashank Kumar

*please don't forget to Accept the answer if your query was answered**

Wouter
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 18, 2024

Thank you for the information, that's what I was looking for.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events