Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,300,290
Community Members
 
Community Events
165
Community Groups

Enable/ disable jobs in stage dynamically?

Is there a way to enable or disable job dynamically in runtime in Bamboo just like conditional tasks?

3 answers

One of the dirty solutions I am thinking is to create a wrapper build plan that would read the parameters/variables and based on the variables (e.g enableJob1, enableJob2... enableJob3 - these would be true or false), do followings:

1) create java spec in run time

2) push the spec and create (or update) the plan itself 

3) run the updated plan 

Not sure I am overthinking or is there any other good way to solve this.

Yes, I understand Plan within Plan to tackle it. Your purpose would be solved but this solution would not be a good practice to follow.

@Suvradip Paul ,

Thank you for the reply. I am using Bamboo 7.2.3 deployed in a local vm. Unfortunately the link you have shared is not what I am looking for. 

Let me try to explain it more. I have a bamboo plan that has a number of jobs within a stage and each job has a number of tasks. The reason to have a number of jobs is to run them in parallel when required. Based on our need, we manually enable / disable the jobs before we execute the plan. 

I want to move away from this behaviour and provide conditional execution of jobs. My thought was to use java spec and do one of the following:

i) either populate job (.Stage.jobs(job1, job2, ... jobN)

or

ii) enable/disable job (job1.enable(false), job2.enable(true).. and so on)

I am almost reaching to a conclusion that this is not possible as I cannot read variable outside task.

Not sure if there is another way to do it. I dont want to use conditional tasks as this will require to run stage even if i have to skip all the tasks (assuming i wanted to disable the sage).

Hope this makes it clear.

-Pawan

Hi @Pawan Shrestha ,

Thanks for posting this in community.

I am not sure which version you are using, but I think this would solve your query (i.e. stopping an active job build) - https://confluence.atlassian.com/bamboo/stopping-an-active-build-289276913.html

Please  accept the answer if it solves your query else  please respond an allow others to share input.

Stay safe and healthy.

Cheers

Suvradip

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bamboo

Bamboo Data Center on Kubernetes

Hi, If you are running self-managed environments and looking to adopt modern infrastructure, Bamboo Data Center can now be deployed in a Kubernetes cluster. By leveraging Kubernetes, you can easily...

967 views 3 8
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you