How do I dynamically skip the execution of stage based on variable value?

Shriram Jaju August 3, 2023

I have bamboo plan with 2 stages. In first stage I check for a condition and set a injected variable. In second stage I have "Dynamic Tasks De-Activation" set to evaluate the value of the injected variable. When I run the build, in second stage even-though dynamic Condition evaluated to [true], the stage is not skipped and marked as fail.

I want to skip the stage if the dynamic condition is true. So basically I want to skip the whole build in case the condition is not met.

P.S. In case the dynamic condition is false, the second stage is executed as expected.

1 answer

1 accepted

2 votes
Answer accepted
Eduardo Alvarenga
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 3, 2023

Hello @Shriram Jaju

When adding the injected variable, have you selected the scope as "Result"? Result will pass the variable to the next Stages within the same Build and guarantee its availability.

Also, make sure you are evaluating the correct variable name on your conditional task as it should be something like:

${bamboo.namespace.variable_name}

The namespace is defined when creating the injected task.

Kind regards,

Eduardo Alvarenga
Atlassian Support APAC

--please don't forget to Accept the answer if the reply is helpful-- 

vikeshk November 16, 2023

Hi @Eduardo Alvarenga 
${bamboo.namespace.variable_name} doesn't seem to work.

${bamboo.inject.testvar} = true
${bamboo.inject.testvar} evaluates to null in Dynamic Tasks De-Activation" condition. When I echo ${bamboo.inject.testvar} in a build task it logs the correct value.

Please let me know if I am missing anything here. Thank you!

PS:  Bamboo version 8.2.5 build 80211 - 22 Jul 22

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events