The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

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

Is it possible to set environment variables per pipeline step

Rutger Claes
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 16, 2018

To keep my pipeline tasks DRY I want to reuse my deployment task.  I now have something like:

- step:
<<: *DEPLOY_TEST
deployment: test
- step:
<<: *DEPLOY_STAGING
deployment: staging
trigger: manual

But the DEPLOY_STAGING and DEPLOY_TEST definitions only differ regarding the env on which to deploy.  Can I add something like:

- step:
<<: *DEPLOY
deployment: test
environment:
HOST: test-host

To further reuse code and have just one DEPLOY definition?

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Answer accepted
Philip Hodder
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 2, 2018

Hi Rutger,

We recently released support for defining Deployment Variables. This will allow you to configure variables that will be injected into the relevant Deployment Step. Which seems to be what you need here.

You can configure them in the Repository Settings -> Pipelines -> Deployments.

Thanks,

Phil

Liri Sokol
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 3, 2019

Too bad we are only restricted to three hardcoded deployments though

Like Ansgar Schürmann likes this
Philip Hodder
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 3, 2019

@Liri Sokol, we've started work on adding support for flexible environment configurations (i.e. more than 3 environments, named whatever you want). You can follow its progress here: https://bitbucket.org/site/master/issues/15362/enhance-deployments-to-support-flexible

Attila Szeremi
Contributor
April 7, 2021

Also it's not just deployment where different environment vars may be needed; e.g.  separate smoke test steps for an env that should be run after a deploy to that env

Like Maddie Jones likes this
Valentin Funk
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 20, 2022

This also doesn't work because you cannot have multiple steps that use deployment variables. 

Like # people like this
TAGS
AUG Leaders

Atlassian Community Events