Environment variables available from pipeline steps are listed here:
There doesn't seem to be a way to find out which deployment environment is set for this step at the moment (i.e. via fictional BITBUCKET_DEPLOYMENT variable). This is needed for deployment script to decide what to do, otherwise, steps can't be reused for different environments.
Am I missing something?
Currently there's no BITBUCKET_DEPLOYMENT type environment variable.
Is there any reason that you cannot hard code this inside you're step scripts, given that you already need to specify the environment name on the step?
name: Deploy to test
- export DEPLOYMENT_NAME=test
name: Deploy to staging
- export DEPLOYMENT_NAME=staging
Does that suit you, or did you have some different use cases?
You can also open a feature request for such an environment variable here: https://bitbucket.org/site/master/issues?status=new&status=open&component=Pipelines
Of course, I can hardcode the environment in the deployment script in addition to specifying it in step itself. My question was, however, how can I avoid precisely that.
There are several reasons as to why I would like to avoid it if at all possible.
An obvious way would be to find out which deployment environment is active by querying an environment variable, but very unfortunately you confirmed that it is not available.
I have created a new feature request as instructed:
I'm in need of accessing the name of the deployment environment inside the steps with reusable scripts.
Right now, I'm thinking to go ahead with explicitly mentioning/adding one more environment variable called 'BITBUCKET_DEPLOYMENT' under each deployment and repeating the deployment name itself there.
It would be nice to see this feature included as part of Bitbucket itself. thanks.
We’ve added the following default variables to Pipelines:
These are also documented with our other variables.
I still get an issue 'variable missing' although used deployment pipelines setting
This is my yaml
pipelines: branches: develop: - step: name: Build script: - zip -r myapp.zip * artifacts: - myapp.zip - step: name: Upload to S3 services: - docker script: - pipe: atlassian/aws-code-deploy:0.3.2 variables: BITBUCKET_DEPLOYMENT_ENVIRONMENT: 'staging' AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION S3_BUCKET: $S3_BUCKET COMMAND: 'upload' APPLICATION_NAME: $APPLICATION_NAME ZIP_FILE: 'myapp.zip'
Hi everyone, We are looking to learn more about development teams’ workflows and pain points, especially around DevOps, integrations, administration, scale, security, and the related challeng...
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