Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Confused by variables: where is it useful to set them?

Bob Rzadzki
Contributor
February 16, 2023

I'm sure I'm overlooking something, or working from a mistaken assumption -- basically I'm so baffled here, you can't say anything that will offend me for being too obvious.

In a specs-based deployment in particular, what is the point of variables? It appears to me they can only be defined in the repository, which means they can be set per-project or per-environment in code only.... And so they're a bit of a "syntactic sugar" over repeating a value throughout the file, but there's no way to, say, reuse the specs of a single environment in multiple environments by setting different variables.

This appears to be the case for projects created through the UI, too -- variables are set at the same level as the rest of the config (or higher) and so just don't seem useful to me. The entire config has to be duplicated to have a place to set values for those variables.

I get the purpose of globals. But at the project or plan level, how are they used?

5 answers

1 vote
Bob Rzadzki
Contributor
February 22, 2023

Thanks, Eduardo.

0 votes
Bob Rzadzki
Contributor
February 23, 2023

Feature suggestion:

In its present form, this is a neat feature but of limited usefulness -- at least in the way my team uses Bamboo, and maybe that's a limitation of perspective. I can say it would be HUGELY helpful to be able to reuse a spec with different variables per project or plan.

The way I see this working:

  • We create a build or deploy spec with variables in it.
  • Bamboo scans the spec and makes it available in a "specs library".
  • We can pick a plan from the library, populate all its non-global variables, and see what changes it would make to projects/plans/environments before saying "go".
0 votes
Bob Rzadzki
Contributor
February 23, 2023

I do not see an Accept button, Eduardo -- I believe because we're in a Discussion forum here.

0 votes
Eduardo Alvarenga
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 22, 2023

No worries Bob. Make sure to Accept the answer if it was useful.

0 votes
Eduardo Alvarenga
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 16, 2023

Hello @Bob Rzadzki

If you are using YAML Specs, you can certainly make use of YAML Aliases and Anchors to avoid code repetition. That can also be achieved in Java Specs format by using regular Java code, avoiding unnecessary code.

Project and Plan level variables are used on their specific levels and will Override their upper levels when declared. A Plan-variable will always take preference over a Project-variable and Global-variable, and a Project-variable will always be considered over a Global-variable.

Sincerely,

Eduardo Alvarenga
Atlassian Support APAC

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

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events