Hi,
I would like to combine "deployment: Dev" or "deployment: Test" together with variables for my custom pipeline.
The purpose is that I want to trigger the deployment of a specific release version either to our Dev environment or Test environment.
Therefore I need a variable "releaseVersion" and also the ability to define different environments by using the "deployment: Dev" or "deployment: Test".
In fact I would like to combine:
https://support.atlassian.com/bitbucket-cloud/docs/configure-bitbucket-pipelinesyml/#deployment
and
https://support.atlassian.com/bitbucket-cloud/docs/configure-bitbucket-pipelinesyml/#variables
Both can be used within a custom pipeline but somehow not in combination.
Following is currently working:
pipelines:
custom:
deploy-dev-reset:
- step:
<<: *deploy-reset
deployment: Dev
- step: *reset-dev-elastic-search
deploy-test-reset:
- step:
<<: *deploy-reset
deployment: Test
But if I try to add variables to the custom pipline it is not working anymore:
pipelines:
custom:
deploy-dev-reset:
- variables:
- name: releaseVersion
name: Deploy Dev Env
- step:
<<: *deploy-reset
deployment: Dev
- step: *reset-dev-elastic-search
deploy-test-reset:
- variables:
- name: releaseVersion
name: Deploy Test Env
- step:
<<: *deploy-reset
deployment: Test
I could solve this issue. In general it is possible to combine "deployment" and "variables" within a custom pipeline.
Example:
pipelines:
custom:
deploy-dev-reset:
- variables:
- name: releaseVersion
default: "snapshot"
- step:
<<: *deploy-reset
deployment: Dev
- step: *reset-dev-elastic-search
deploy-test-reset:
- variables:
- name: releaseVersion
default: "0.1.0"
- step:
<<: *deploy-reset
deployment: Test
The actual root cause of the issue was something else. It was just an "echo" which contained a ":"
Example (which causes an error):
- echo "Re-install everything using image tag: $releaseVersion"
to use ":" within a script it needs to be escaped by using a ">"
- >
echo "Re-install everything using image tag: $releaseVersion"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.