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

How to catch and substitute variable value if the variable has not yet been initialized?

Hello,

when executing deployment project environment(deployment), my task is using two variables:

  • ${bamboo.deploy.release.previous}
  • ${bamboo.deploy.release}

When I am trying to deploy for the first time in this environment variable ${bamboo.deploy.release.previous} is not yet initialized because there is no previous version in this environment.

How do I catch this in Bamboo specs so I can substitute it with another value and get my tasks executed?

The error that I am getting is:

 -PdiffFrom=${bamboo.deploy.release.previous}: bad substitution

 

Thanks in advance,

Gregor 

1 answer

1 accepted

0 votes
Answer accepted

Actually I found the solution myself when rereading the documentation https://confluence.atlassian.com/bamboo0610/variables-for-deployment-environments-980469289.html 

"...Variables later in the following list override the previous ones in case of repeating names..."

What I did was that I created a variable with the same name and set it to an empty string and added it to the environment:

Variable from = new Variable("bamboo.deploy.release.previous", "");

If bamboo does not create this variable because there are no deployments made to the environment, it is an empty string. If bamboo creates the variable it gets overridden by the release string that is currently deployed on the said environment.

Sorry if this question was a bit premature, but maybe somebody will find use in it.

Best regards,

Gregor

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...

534 views 6 7
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