We have our environments named using the same terms as our branches so our bitbucket-pipelines.yml should be as simple as:
image: python:3.7
pipelines:
default:
- step:
name: deploy to $BITBUCKET_BRANCH
deployment: $BITBUCKET_BRANCH
script:
- deploy.py $BITBUCKET_BRANCH
When validating this yml, however, it appears that it's not possible to use a variable to define the 'deployment' environment as 'Environment names can use letters, spaces, numbers, underscores or hyphens'.
Is there a way to use an environment variable to define the deployment environment as per the example above?
I see you are new here, welcome!
Answering your question:
Is there a way to use an environment variable to define the deployment environment as per the example above?
No, you cannot use variables for that field as you already discovered. There is a check to cover only the three valid values which are: test, staging, and production. The parser does not allow variables there. You will need to declare each of the values separately.
For more details on our deployment feature, please visit Bitbucket Deployments.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.