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

How do I set the deployment environment based on the destination branch

Mach Dinh-Vu May 9, 2023

In this example, I know the destination environment from $BITBUCKET_BRANCH in my step set-deployment-environment. I set my environment variable $ENV_NAME, but deployment will not accept an environment variable as I believe this needs to be a string.

 

pull-requests:
release/*:
- step: *set-deployment-environment
- step:
<<: *ansible-build-deploy
name: Deploying to environment
deployment: $ENV_NAME

 

Can anyone suggest a solution?

1 answer

1 accepted

0 votes
Answer accepted
Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 11, 2023

Hello @Mach Dinh-Vu ,

Thank you for reaching out to Atlassian Community!

Unfortunately, it's currently not possible to define a dynamic environment in the YML file using environment variables. The deployment environment of the step needs to be a fixed static value that was previously created under the Deployments section of Repository Settings. We do have an open feature request to implement the ability for deployment environments to be configured dynamically/using env variable, which you can find below :

I would suggest you to add your vote there, since this helps both developers and product managers to understand the interest. Also, make sure you add yourself as a watcher in case you want to receive first-hand updates from that ticket. Please note that all features are implemented with this policy in mind.

Thank you, @Mach Dinh-Vu !

Patrik S

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events