Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

BitBucket Pipelines - Need help for right usage of Environment Variables Edited

Hello,

i have added Environment-Variables on Account Level and on the Repository Level. One Command of my pipeline is this:

 
- curl -X PUT -d 'data={"keys":{"android":{"id":"$PHONEGAP_ANDROID_CERT_ID","key_pw":"$PHONEGAP_ANDROID_KEY_PASSWORD","keystore_pw":"$PHONEGAP_ANDROID_KEYSTORE_PASSWORD"},"ios":{"id":"$PHONEGAP_IOS_CERT_ID","password":"$PHONEGAP_IOS_CERT_PASSWORD"}}}' https://build.phonegap.com/api/v1/apps/$PHONEGAP_APP_ID?auth_token=$PHONEGAP_AUTH_TOKEN

As you can see there are multiple environment variables that should be injected to the JSON payload. But unfortunately this isn't working for me. What i am doing wrong?

Response from the PhoneGap Build Server after this request was sent:

{"error":"android key $PHONEGAP_ANDROID_CERT_ID not found (maybe wrong platform?)"}

This is the also first parameter from the Payload which hints that there is a general problem in this command with resolving the variables.

2 answers

1 accepted

2 votes
Answer accepted

I found the solution by my own. It was a general thing with handling variables in a shell script.

 - curl -X PUT -d 'data={"keys":{"android":{"id":"'$PHONEGAP_ANDROID_CERT_ID'","key_pw":"'$PHONEGAP_ANDROID_KEY_PASSWORD'","keystore_pw":"'$PHONEGAP_ANDROID_KEYSTORE_PASSWORD'"},"ios":{"id":"'$PHONEGAP_IOS_CERT_ID'","password":"'$PHONEGAP_IOS_CERT_PASSWORD'"}}}' https://build.phonegap.com/api/v1/apps/${PHONEGAP_APP_ID}?auth_token=${PHONEGAP_AUTH_TOKEN}

  

Good catch, I was also searching how to use the variables for a curl command

Be mindful: because this is YAML you can't have spaces after ':' characters or the YAML parser will choke. Watch for the error message: Bad indentation of a sequence entry

Any News ? :( 

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket

Powering DevOps with Bitbucket Server & Data Center

Hi everyone, The Cloud team recently announced 12 new DevOps features that help developers ship better code, faster   ! While we’re all excited about the new improvements to Bitbucket ...

1,826 views 0 7
Read article

Community Events

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

Events near you