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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Conditional task replacement issue Edited

I have a strange scenario I am struggling to figure out. 

I have two sequential conditional tasks on a build plan.  The condition is on a Bitbucket variable coming in to the build called bamboo.repository.pr.key

The first step I check if it exists, if it does the command runs with the variable being substituted with the actual key from Bitbucket and the command runs fine.

The second step I check if it does not exist and I run a build on the base branch using a different variable.

Interesting once the variable is substituted in the first step, the second conditional does not find it and therefore also runs instead of being skipped.

This is the log where you can see it being odd, the condition all of a sudden says that variable does not exist.

simple  11-Mar-2021 14:40:21    All conditions for task 'Sonar Scan PR' were met. Conditions: Variable bamboo.repository.pr.key exists

command 11-Mar-2021 14:40:21    Substituting variable: ${bamboo.repository.pr.key} with 19

command 11-Mar-2021 14:40:21    Substituting variable: ${bamboo.repository.pr.sourceBranch} with feature/SonarBuildTest

command 11-Mar-2021 14:40:21    Substituting variable: ${bamboo.repository.pr.targetBranch} with dev

***<logs cut here>***

simple  11-Mar-2021 14:41:16    All conditions for task 'Sonar Scan Branch' were met. Conditions: Variable bamboo.repository.pr.key not exists

command 11-Mar-2021 14:41:16    Substituting variable: ${bamboo.repository.git.branch} with feature/SonarBuildTest

 

Does the variable only become available to the job if it is referenced in the argument?  That is the only thing I can think of apart from it being a bug (or something I am overlooking of course)

Any help would be appreciated! :)

Thanks

1 answer

1 accepted

1 vote
Answer accepted

Don't use "bamboo." prefix and see how it goes

Many thanks Alexey that worked.  

Suggest an answer

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

Bamboo 7.2 is here!

I'm happy to announce that Bamboo 7.2 has been released and it’s overflowing with awesome new features. This will be the last major Server release before the launch of Bamboo DC. Bamboo logs We...

852 views 8 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