You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
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.