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: 

Use an environment variable to set the deployment environment

Matthew Elwell
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!
April 30, 2019

We have our environments named using the same terms as our branches so our bitbucket-pipelines.yml should be as simple as: 

 

image: python:3.7

pipelines:
default:
- step:
name: deploy to $BITBUCKET_BRANCH
deployment: $BITBUCKET_BRANCH
script:
- deploy.py $BITBUCKET_BRANCH

 

When validating this yml, however, it appears that it's not possible to use a variable to define the 'deployment' environment as 'Environment names can use letters, spaces, numbers, underscores or hyphens'. 

 

Is there a way to use an environment variable to define the deployment environment as per the example above? 

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Answer accepted
Daniel Santos
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 9, 2019

Hi @Matthew Elwell

I see you are new here, welcome!

Answering your question:

Is there a way to use an environment variable to define the deployment environment as per the example above? 

No, you cannot use variables for that field as you already discovered. There is a check to cover only the three valid values which are: teststaging, and production. The parser does not allow variables there. You will need to declare each of the values separately.

For more details on our deployment feature, please visit Bitbucket Deployments.

TAGS
AUG Leaders

Atlassian Community Events