Using JSON in pipeline YAML script

As part of my deployment pipeline, I'm trying to notify Sentry via a webhook of the latest release number. This should be very simple to achieve using curl, but it doesn't seem to work properly...

Here is a simplified version of my YAML:

pipelines:
tags:
v[0-9]*:
- step:
script:
- echo $BITBUCKET_TAG
- "curl $SENTRY_WEBHOOK -X POST -H 'Content-Type: application/json' -d '{\"version\":\"$BITBUCKET_TAG\"}'"

 ...where SENTRY_WEBHOOK is an environmental variable with the URL of the webhook.

Note that the curl script has to be surrounded by double quotes in YAML, as it contains colons which would otherwise break it.

The echo command displays the tag, so I know that is being passed through OK to the pipeline. However, the curl command only partially works:

The webhook URL is successfully substituted, so it gets sent through to my Sentry account, but the tag is not substituted, so the actual JSON that is posted to Sentry is:

{ "version":"$BITBUCKET_TAG" }

Is this a bug, or is it me just getting my YAML syntax wrong?

0 answers

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jun 12, 2018 in Bitbucket

Do you use any Atlassian products for your personal projects?

After spinning my wheels trying to get organized enough to write a book for National Novel Writing Month (NaNoWriMo) I took my affinity for Atlassian products from my work life and decided to tr...

22,740 views 26 12
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you