Starter license job limit reached before 10 jobs
Asked by Antoine Imbeau:

Within my team we use Bamboo (version 6.4.1) with the starter license. We currently only have two plan:

* The first plan has 1 stage (Default stage) containing one job that has two tasks (Source code checkout and Script). This plan is only building against one branch (master).
* The second plan has 1 stage (Default stage), one job and two tasks as well (Source code checkout and Script). This second plan currently builds against 7 branches including master.

If I am not mistaken, this amounts to a total of 8 jobs in total. Now when I attempt to add a job to a plan branch or to a plan (or even create a new plan), I get this message: "You have reached the job limit allowed by your Bamboo license (10 jobs allowed)."

I am trying to understand what are the 2 extra "hidden" jobs that prevent me from creating two more. Does a plan itself sort of count as a job? Could anyone enlighten me?

Also, I suppose the only way to remove that limitation is to upgrade to the 880$ license (1 Remote Agent, Unlimited Local Agents)?

Thanks in advance!


Answers:
author: robhit
body: Hi Antoine,

I was not quite sure how many jobs you have configured in your bamboo. So I have created one SQL to check the number of Bamboo jobs from the database to confirm the license restrictions.

You could use the same to check:

```
SELECT 
 A.PROJECT_KEY,
 A.TITLE AS 'PROJECT_TITLE',
 B.TITLE AS 'PLAN_OR_BRANCH_TITLE',
 CASE
 WHEN B.BUILD_TYPE = 'CHAIN' THEN 'MASTER_PLAN'
 WHEN B.BUILD_TYPE = 'CHAIN_BRANCH' THEN 'BRANCH_PLAN'
 END AS 'MASTER_OR_BRANCH_PLAN',
 B.FULL_KEY AS 'PLAN_FULL_KEY',
 D.NAME AS 'STAGE_NAME',
 C.FULL_KEY AS 'JOB_FULL_KEY',
 C.TITLE AS 'JOB_NAME'
FROM
 PROJECT A
 LEFT JOIN
 build B ON B.PROJECT_ID = A.PROJECT_ID
 LEFT JOIN
 BUILD C ON SUBSTRING_INDEX(C.FULL_KEY, '-', 2) = B.FULL_KEY
 LEFT JOIN
 CHAIN_STAGE D ON C.STAGE_ID = D.STAGE_ID
WHERE
 B.BUILD_TYPE IN ('CHAIN' , 'CHAIN_BRANCH')
 AND C.BUILD_TYPE IN ('JOB')
ORDER BY A.PROJECT_KEY , B.FULL_KEY , d.LIST_POSITION;
```

Note: The above SQL is tested with Bamboo version 6.5.0 with MySQL Code Compatibility.

Thanks,

Robhit

comments: author: Antoine Imbeau
body: Hi Robhit,

Thank you very much for your reply! I am using Postgresql so I'm encountering some issues when trying to run the query. I tried bringing some modifications to fit Postgresql syntax but it does not seem to work yet. I will update when I get there.

Thanks again!

Antoine


author: robhit
body: Hi Antoine,

So I tried making it in Postgres and this is how it looks like:

```
SELECT 
A.PROJECT_KEY,
A.TITLE AS PROJECT_TITLE,
B.TITLE AS PLAN_OR_BRANCH_TITLE,
CASE
WHEN B.BUILD_TYPE = 'CHAIN' THEN 'MASTER_PLAN'
WHEN B.BUILD_TYPE = 'CHAIN_BRANCH' THEN 'BRANCH_PLAN'
END AS MASTER_OR_BRANCH_PLAN,
B.FULL_KEY AS PLAN_FULL_KEY,
D.NAME AS STAGE_NAME,
C.FULL_KEY AS JOB_FULL_KEY,
C.TITLE AS JOB_NAME
FROM
PROJECT A
LEFT JOIN
build B ON B.PROJECT_ID = A.PROJECT_ID
LEFT JOIN
BUILD C ON split_part(C.FULL_KEY, '-', 1) || '-' || split_part(C.FULL_KEY, '-', 2) = B.FULL_KEY
LEFT JOIN
CHAIN_STAGE D ON C.STAGE_ID = D.STAGE_ID
WHERE
B.BUILD_TYPE IN ('CHAIN' , 'CHAIN_BRANCH')
AND C.BUILD_TYPE IN ('JOB')
ORDER BY A.PROJECT_KEY , B.FULL_KEY , d.LIST_POSITION;
```

Pardon me for bad coding. I know very little of Postgres and couldn't find a good replacement of the function "substring_index".

See if it works!

Thanks,

Robhit


author: Antoine Imbeau
body: Hi Robhit,

Thanks for the translated query! It works perfectly well!

It does indeed show that there are 10 jobs configured, which means the license restriction is working fine. The problem that your query allows me to highlight is that there are two "duplicates". So let's say that for Plan 1, I have one job configured on one plan branch (master), and for Plan 2 I have 7 (one for master and six for other branches), I have a total of 8 jobs. Now what seems to be happening is that for both plans, there is also the "MASTER_PLAN" that counts as a job as well and that is created by default. With these two additional "MASTER_PLAN", it seems I am reaching my 10 jobs cap. Is there a way to avoid having these default "MASTER_PLANS"?

Thanks again for your help!

Antoine


author: robhit
body: Hi Antoine,

I think there is some confusion in the concepts of Bamboo Jobs or plan configurations as a whole.

Let me explain when we configure a plan in Bamboo we add stages, jobs, tasks to it. These configurations apply to the entire plan which includes the master + child branches of the same plan (This I believe is the concept of Continuous Integration, to ensure that your child/feature/bug-fixes branches run exactly the same as the Master Branch).

So to answer your question on how to avoid the "MASTER_PLANS" is no it is not possible.

Hope it makes sense.

Thanks,

Robhit


author: Antoine Imbeau
body: Hi Robhit,

Thanks for your quick reply! I understand the part where child branches inherit the configuration of the master branch, which makes sense.

The thing I'm having more trouble wrapping my head around is that Bamboo counts two jobs when I explicitly created only one. When I created Plan 1, this plan was originally empty. I then configured it adding one job to the Default Stage with two tasks. At this point, I was expecting to have 1/10 jobs used. But in fact I have 2/10 since the "MASTER_PLAN" seems to be implicitly counted as a job. So if I understand correctly, every plan counts as 1 job, and then the N configured jobs within the plan count as N\*B where B is the number of plan branches within that plan?

I'm sorry if I am picky on the details. I'm just trying to figure out how Bamboo counts towards the job cap.

In any case, two jobs is not that much and we will soon need more. Is there a way to increase the job limit other than upgrading the license to the "1 Remote Agent Unlimited Local Agents" License?

Thanks again for your time!

Antoine


author: robhit
body: Hi [@Antoine Imbeau](/t5/user/viewprofilepage/user-id/1325395),

The use of the [Plan Branches](https://confluence.atlassian.com/display/BAMBOO/Using+plan+branches) has a multiplicative effect on the number of jobs configured, and therefore an effect on the 10 jobs cap. For example, a plan with two jobs that are building against a total of three branches (the plan's original branch, plus two additional branches) will contribute 6 jobs toward the limit.

There is no way to increase the number of jobs if not upgrading the license.

Thanks,

Robhit


author: Antoine Imbeau
body: Sounds good! Thank you for your help Robhit!


author: Chris Hoskins
body: Robhit, a couple of very minor errors that cause an error in your query. The query should be:

**SELECT** A.PROJECT_KEY,  
A.TITLE **AS** 'PROJECT_TITLE',  
B.TITLE **AS** 'PLAN_OR_BRANCH_TITLE',  
**CASE** **WHEN** B.BUILD_TYPE = 'CHAIN' **THEN** 'MASTER_PLAN'  
**WHEN** B.BUILD_TYPE = 'CHAIN_BRANCH' **THEN** 'BRANCH_PLAN'  
**END** **AS** 'MASTER_OR_BRANCH_PLAN',  
B.FULL_KEY **AS** 'PLAN_FULL_KEY',  
D.NAME **AS** 'STAGE_NAME',  
C.FULL_KEY **AS** 'JOB_FULL_KEY',  
C.TITLE **AS** 'JOB_NAME'  
**FROM** **PROJECT** A  
**LEFT** **JOIN** **BUILD** B **ON** B.PROJECT_ID = A.PROJECT_ID  
**LEFT** **JOIN** **BUILD** C **ON** SUBSTRING_INDEX(C.FULL_KEY, '-', 2) = B.FULL_KEY  
**LEFT** **JOIN** CHAIN_STAGE D **ON** C.STAGE_ID = D.STAGE_ID  
WHERE  
B.BUILD_TYPE **IN** ('CHAIN' , 'CHAIN_BRANCH')  
**AND** C.BUILD_TYPE **IN** ('JOB')  
**ORDER** **BY** A.PROJECT_KEY , B.FULL_KEY , D.LIST_POSITION;