Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

BitBucket Pipelines - Need help for right usage of Environment Variables

ltbon2c24aa9zksr January 27, 2018

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
ltbon2c24aa9zksr January 29, 2018

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}

  

Bruno Alexandre February 21, 2018

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

R. Michael Rogers
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 7, 2020

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

0 votes
ltbon2c24aa9zksr January 29, 2018

Any News ? :( 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events