Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
badges earned

Your Points Tracker
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

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

Where to store API Key on bitbucket?

I am trying to set up a CI/CD process for Salesforce using Docker and SFDX. 

I got everything working except that I am not sure how to safely store the private key that SFDX uses to authenticate into salesforce.


Here's the command that I am using to authenticate:
sfdx force:auth:jwt:grant --clientid $CONSUMER_KEY --jwtkeyfile keys/server.key --username $SFDC_QA_USER --setdefaultdevhubusername --setalias testPipelines --instanceurl $SFDC_QA_URL


Where "CONSUMER_KEY" is a repository variable. 

However server.key is inside a "keys" folder in the branch itself.

I was wondering if there's something like "repository secret files" maybe? If not can I store an encrypted version of the server.key and have docker decrypt it and pass it to SFDX? I am really not sure how to approach this.

1 answer

0 votes
mwatson Atlassian Team Mar 18, 2019

Don't check the key into the repository - it will be in the history forever!

Instead, use the same approach we recommend for additional ssh keys.

See the section entitled Use multiple SSH keys in your pipeline in

@mwatson if you look at the command I posted the property --jwtkeyfile is mandatory and it requires that I specify a file afterwards for it to work. I don't see how adding a SSH key would overcome this. 

Is there really no way to store api key files in bitbucket?

mwatson Atlassian Team Mar 18, 2019

The docs section I linked shows how to store a key in a secure repository variable and then use a code fragment in your step to save it to a file and use it in your scripts. You can use the same approach for other keys, not just ssh keys.

e.g. if you take your key and run (on linux)

base64 -w 0 < keys/server.key

 then store the output in a secure repository variable called SERVER_KEY you can then do this in your step to get it onto your filesystem in your build:

- (umask  077 ; echo $SERVER_KEY | base64 --decode > keys/server.key)

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Marketplace Apps & Integrations

Staying organized with Jira: best practices for a better project management

Project managers know this problem: A “mountain of work” lays in front of you, and you don’t know how and where to tackle them. Different to-dos lie ahead, but just one task after the other can be ha...

237 views 2 1
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