During release access variable value from different environment

Our release has two environments- test and production. During test we backup the production DB over the test DB. The DB name is a variable and has a different value for test / production.

I’d like to express something like “restore #{DbName.production} over #{DbName}”.

I realize I could have two variables TestDbName and ProductionDbName. Is there is a simpler option?

Thanks!

Hi Joseph,

Thanks for getting in touch,

Based on the information provided in your query, you can achieve this by including multiple values for the existing variable of DatabaseName and then provide environment scoping for each of these values based on the associated environment. The result of this will be that depending on environment that’s being deployed to, the variable will resolve to each value respectively.

To assist with visualising this, I’ve included a screenshot below;

If I’ve misunderstood your query in any way, or if you require further assistance/clarification, please let me know :slight_smile:

I hope this helps!

It’s probably not something you will encounter issues with in this example, though I’ve included a link to our documentation regarding Variable Specificity that helps explain how variables are prioritized.

Kind Regards,

Reece

1 Like

I think i’ll end up doing something like -

Test Production
DbName TestDb ProdDb
ProductionDbName ProdDb NA

because a number of other variables rely on DbName.

Then the backup test db step will be the only step that references ProductionDbName.

Thanks

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.