Missed Team ’24? Catch up on announcements here.

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

How to change build variables in a deployment project

Sergio Walter Ruz October 29, 2019

Having some trouble working out how to get a deployment project to change the plan's variables depending on the type of build.

So if deploying to say Test or Prod I would want to change the build plan's variables accordingly as this will affect the artifact produced.

1 answer

0 votes
Daniel Santos
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 31, 2019

Hi @Sergio Walter Ruz

If I understood you correctly, you are trying to overwrite the value of an existing plan variable with a different value for each of your deployment environments, is that correct?

I just tested in Bamboo 6.10.2 and I was able to do this by declaring a variable with exact same name as the one available when the plan build was run. This allowed me to give it a different value.

To do this you need to navigate to the environment configuration and access the variables button.

Is that what you need or am I missing something?

Sergio Walter Ruz October 31, 2019

Thanks Daniel

I will try that. It sounds like what I needed. I thought that the variables you declare for a deployment where only for after the plan was already built and for use only during deployment. 

Regards

Sergio

Daniel Santos
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 31, 2019

Wait, I think I didn't understand you correctly and we have some ambiguity to eliminate.

What I understood was:

Plan A has a variable A with value X
Deployment environment test wants to have the variable A with value Y
Deployment environment prod wants to have the variable with value Z

This is the normal flow.

From your last comment I got confused:

I thought that the variables you declare for a deployment where only for after the plan was already built and for use only during deployment. 

It looks like that you are triggering a plan from a deployment and want to change the plan variables. Can you confirm that?

Sergio Walter Ruz October 31, 2019

Hi Daniel.

Yes that is correct.

I was hoping to only have one Build plan with it's own variables that get replaced depending on what type of build you are doing, say a test or production build.

So if I was to trigger a test deployment it would be using a test build and a production deployment it would use a production build. This means the artifacts produced by each build would be different. They would also be using a different Git branch. The test build would use the develop branch and the production build the master branch.

Daniel Santos
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 5, 2019

Hi @Sergio Walter Ruz

I think it was not clear since the beginning that you were trying to use different branches in the same deployment project.

A deployment plan is associated with only one plan and just one branch can be configured at each time. In other words, you can deploy from multiple branches, but you will need to manually change the deployment configuration every time you need it to build for a different branch.

My answer is still valid about the variables. You can rewrite them on each environment, but you can't configure each environment to build using a different plan branch (git branch).

We have the following feature request that seems to be aligned with your inquiry.

What you can do instead is creating a new deployment project. One would have the dev environment and the other a production environment. Each will be configured for its respective branch. Would it be a viable solution for you?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events