If I push to `branch-A`, I want to run tests using `branch-A` envs.
If I push to `branch-B`, I want to run tests using `branch-B` envs.
How can I do that without creating new `steps` just to change the environmental variable?
@alexwonguhuru, if you only need the variable variation for you deployments, you should be able to use Deployment Variables to do that. They'll let you define different values for the same key on different deployment steps.
We have documentation about it here: https://confluence.atlassian.com/bitbucket/variables-in-pipelines-794502608.html
An example bitbucket-pipelines.yml would be:
name: Deploy to Test
- echo $MY_ENV # Would print www.mysite.com/develop
name: Deploy to Staging
- echo $MY_ENV # Would print www.mysite.com/staging
name: Deploy to Production
- echo $MY_ENV # Would print www.mysite.com/production
The variables are configured in the Repository Settings -> Pipelines -> Deployments section, per environment.
Currently Pipelines only supports those 3 deployment environments. However, we are currently working on extending this to more environments. You can follow the progress of this feature here: https://bitbucket.org/site/master/issues/15362/enhance-deployments-to-support-flexible
Thank you Phil, this is exactly what I was looking for.
> Currently Pipelines only supports those 3 deployment environments. However, we are currently working on extending this to more environments.
I am looking forward to this because I have more than 3 deployment environments. I have watched it.
I am not on the Bitbucket Team, but I will try to help.
I know you'd like to avoid creating additional steps, but have you tried using mutliple, smaller steps so that you can re-use all of the parts that are common?
If this doesn't meet your needs, feel free to create an issue in the public issue tracker for Bitbucket: https://bitbucket.org/site/master/issues?status=new&status=open&component=Pipelines
I know that the team listen to Customer feedback to improve our products.
I hope that helps!
Thank you for the response. I tried dividing it into smaller steps as you suggested.
- Repository Env already has `MY_ENV=hello`
- step1: MY_ENV=world
- step2: echo $MY_ENV (result: `hello`)
Basically on a new step, whatever ENV I set in the previous step gets reset. I will create an issue in the public issue tracker.
Sorry not being clear.
My env is like the following
Depending on the branch I want to replace the key `MY_ENV` with a different value, not a different key.
If I deploy to `develop`, `MY_ENV` should be `www.mysite.com/develop`.
If I deploy to `staging`, `MY_ENV` should be `www.mysite.com/staging`
The `MY_ENV` is a process env inside my server files.
Hello Community, I’m Anton Genkin, a product manager on the Bitbucket Server and Data Center team and am excited to share that Bitbucket Server 7.0 is now available! It's a platform release, one th...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events