I am seeing a contradiction with Bitbucket pipelines and I think it's due to my misunderstanding
I want to create a pipeline for staging and a pipeline for production. The difference between these 2 pipelines is that each sets a different value for deployment
so I can make use of Pipeline deployment variables
Due to the natural flow of develop
merging into master
, I cannot keep a separate version of bitbucket-pipelines.yml
on each branch because the next merge of develop
-> master
will update the master
branch version of the pipeline
So it seems I need a single version of bitbucket-pipelines.yml
, that is OK only if it's possible to define the multiple environments within that file, which it seems to me at the moment that it cannot be the case
image: fkmy/atlassian-pipeline-awscli-node:latest
pipelines:
custom:
staging:
- step:
name: Staging Deployment
deployment: staging
services:
- docker
script:
- echo "Do something specific to ${ENVIRONMENT}
production:
- step:
name: Production Deployment
deployment: production
services:
- docker
script:
- echo "Do something specific to ${ENVIRONMENT}
In the above example, ${ENVIRONMENT} would be a variable set within Pipelines deployment variables
But the above pipeline doesn't get staging
or environment
recognised in the pipeline selection
I cannot use the branches
section because I don't want a deployment to happen to staging
or production
upon every commit to the repository
My overall goal is to be able to run a staging or a production deployment manually via the Run pipeline
button and being able to select an environment to deploy to
First of all your Deployments should have the above mentioned deployment groups like in the attached image(this can be found in Repository settings and the names can be different as per your needs). after that you have two ways to do this. either include Env variables in the pipelines or you include them here on the Deployments page, in both the cases the variables will be available to you regarding specific deployment groups. cleaner way is to add it to deployment groups.