I have a use case like below
- we have a release branch
- Defined steps for build and deploy to destination from release branch in bitbucket-pipelines.yml
- Defined 3 different Destination as testing, staging and production
Question is, can we run pipeline against different destination but using the same release branch commit and same steps of build and deployment.
Hi @Midhun Mohan and welcome to the community.
When you say that you defined 3 different destinations as testing, staging and production, I assume that you defined them as deployment environments from Repository settings > Deployments?
If so, you can define different variables for each deployment environment from this page.
Based on the description of your use case, you could configure the bitbucket-pipelines.yml file as follows:
pipelines:
branches:
release:
- step:
name: Build
script:
- <command 1>
- <command 2>
- step:
name: Deploy to testing
deployment: testing
script:
- <command to deploy>
- step:
name: Deploy to staging
deployment: staging
script:
- <command to deploy>
- step:
name: Deploy to production
deployment: production
script:
- <command to deploy>
With a yml file like above, each push to the release branch will trigger the Build step, and then the deployment steps to the 3 different environments.
I'm not sure if your question is about something different. In case I have misunderstood what you are asking, please feel free to clarify so I can better help you.
Kind regards,
Theodora
Thanks for the response,
The mentioned steps, we already tried and its working.
The scenario here is bit different, means we have a build script, only those environment related variables has to be changed for each deployment(to dev , staging etc). So, if there is any way without updating yml each time for a new environment( say staging-2) we can run the pipeline. Only effort will be configuring the new environment under deployments.
Just to be simple, we need to check with you that can we select a deployment from a dropdown when running a pipeline so that the variables will be used from that.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Midhun Mohan,
Thank you for your reply and the clarification.
If you want to add and use a new environment under Deployments, then this needs to be added in the bitbucket-pipelines.yml file as well, with the keyword deployment for the relevant step.
Pipelines builds run based on the content of the bitbucket-pipelines.yml file and at the moment the deployment environment needs to be stated explicitly in the bitbucket-pipelines.yml file for the relevant step.
I'm afraid that it is not possible to have a deployment step where you can choose the environment from a dropdown.
Kind regards,
Theodora
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
ya got to know that few days before, thanks for the confirmation.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Theodora Boudale You know you can't do that, right? You can only define a particular deployment environment ONCE per pipeline.
As per BB customer support
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Brigitte!
You can only define a particular deployment environment ONCE per pipeline.
None of my replies here mention the opposite, the topic discussed in this question is different.
Kind regards,
Theodora
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.