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

Can I have a remote trigger only on the plan branches?

Vivien Jovet October 1, 2019

Hi,

 

Context:

I have configured a build plan for the branches (so not develop or master), the repository for the plan is pointing to the develop branch, and I setup plan branch management so that only branches on PR have a plan branch, the plan branches have a remote trigger (bitbucket cloud webhook).

 

Problem:

The plan branches are not triggered by the webhook, the response from Bamboo server is 400 with body "The plan [xxx - Branches] is not configured for remote triggering." 

If I add a remote trigger to the parent plan itself (in addition of the one for the plan branches) it will trigger a build for the develop branch when there is a commit pushed to it (and there is a separate plan for the develop branch).

 

Question:

How do I achieve this? Is there a workaround? Is it a bug?

 

ps: I'm using Bamboo specs to create the plans.

1 answer

1 accepted

0 votes
Answer accepted
Daniel Santos
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 3, 2019

Hi @Vivien Jovet

Yes, you need the remote trigger configured in the main plan, but you can disable that one and therefore it will not be triggered.

Please add your Remote trigger back and disable the main plan by going to:

  • Plan configuration >> Plan details  and uncheck the [ ]Plan enabled checkbox.

I hope that will give you the behavior you want.
I don't think this is a bug, but the way Bamboo was designed to work.

Please let me know the results you get.

Vivien Jovet October 3, 2019

Thanks for your answer, I will try that today.

Vivien Jovet October 3, 2019

It worked! Do I still need to set the trigger on the plan branches or set it to inherit the main plan trigger?

Vivien Jovet October 3, 2019

Actually it works but it's not practical using Bamboo Specs, if I disable the plan when uploading the spec Bamboo will discard it.

 

Report from the scan:

image1.png

 

And the plans generated:

image2.png

 

You can see it's missing the `Branches` plan.

 

We'd have to remember to disable the main plan manually every time we make changes via Bamboo Specs.

Daniel Santos
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 4, 2019

Hi @Vivien Jovet

I've opened a bug for this behavior, it seems incoherent to me and can confuse users:

I was thinking about your initial issue and it seems simpler just to publish this plan with a different main repository. Instead of using develop branch, is it possible for you to use one of the branches that should be built in this plan?

Vivien Jovet October 4, 2019

No I can't do that unless I leave a dead branch at all time. The `Branches` plan I've shown above is meant for feature and bugfix branches, so once they're merged into the develop branch, they are deleted.

 

Does Bamboo have a REST API endpoint to disable a plan? If it does I could add a behavior to the plan spec class so that if a plan is disabled, it set it enabled before to publish and make a request to disable it afterward. At least until BAM-20669 is resolved. 

Daniel Santos
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 7, 2019

Hi @Vivien Jovet

No I can't do that unless I leave a dead branch at all time. The `Branches` plan I've shown above is meant for feature and bugfix branches, so once they're merged into the develop branch, they are deleted.

Got it! Thank you for explaining it.

Does Bamboo have a REST API endpoint to disable a plan? If it does I could add a behavior to the plan spec class so that if a plan is disabled, it set it enabled before to publish and make a request to disable it afterward. At least until BAM-20669 is resolved. 

Yes, there is an API endpoint for that.

Enable a plan

curl -k -u <BAMBOO_ADMIN_USER>:<BAMBOO_PASSWORD> \
       -H "Content-type: application/json" \
       -X POST "<BAMBOO_URL>/rest/api/latest/plan/<FULL_PLAN_KEY>/enable"

Disable a plan

curl -k -u <BAMBOO_ADMIN_USER>:<BAMBOO_PASSWORD> \
        -H "Content-type: application/json" \
        -X DELETE "<BAMBOO_URL>/rest/api/latest/plan/<FULL_PLAN_KEY>/enable"

I hope that helps to temporarily solve the issue. =]

Vivien Jovet October 7, 2019

Those API endpoints work but I'm having trouble using it within the Bamboo Specs scanner which has a security manager preventing my code to work.

 

I'm getting:

Caused by: java.security.AccessControlException: access denied ("java.net.SocketPermission" "bamboo.xxx.com" "resolve")

 

Is there a way to change the settings of the security manager?

Daniel Santos
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 10, 2019

Hi @Vivien Jovet

I've contacted the development team got from them that this is a known security implication. It intends to save users from malicious code embedded in specs. Unfortunately, you will not be able to use the rest API that way.

I guess the best option we have now is to use a dummy branch as the main branch. That will let you this separation of plans that you need.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events