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

Your Points Tracker
Challenges
Leaderboard
  • 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
Recognition
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?
Kudos
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

How to pass a base64 encoded variable to the SFTP Deploy Pipeline

I'm trying to follow the guide to manage multiple repository ssh keys . I've added my ssh as a secure variable, encoded in base64. But how do I decode it to pass it into the pipe's variables (parameters)?

 

script:
  - pipe: atlassian/sftp-deploy:0.4.1
    variables:
      SSH_KEY: $MY_SSH_KEY_B64  //<- How do I decode it before passing it??
      ...

 

 

2 answers

1 accepted

0 votes
Answer accepted

Ok, just for the record, I managed to solve my problem. I don't know exactly what the problem was, but it all worked when I encoded the key using this online tool rather than using `base64 -w 0 < my_ssh_key`.

Hi @raschidjfr ,

you should only provide encoded SSH_KEY as a variable and pipe will decode it to the ~/.ssh/pipelines_id automatically.


Cheers,
Alex

Thanks for your answer @Oleksandr Kyrdan . Sorry, I didn't fully get  you... should I pass it encoded or decoded? I tried saving it encoded as the tutorial states but then I'm getting "invalid format" error:

Load key "/root/.ssh/pipelines_id": invalid format
✖ Deployment failed.

 

Maybe there's something wrong with the key format but I've been using it without problem from my terminal. You know, my key file looks something like this:

-----BEGIN RSA PRIVATE KEY-----  // line break here
MIIEpAIBAAKCAQEA1fgwkzccOpKpb4Ln6wIaCVFWgnRX+vANU/s5E3K8boCYQ8FU // line break here
XVrfupIjyPudSgs1RJvMp13PPkLfq+O92bWHQaAkm0b4+xKts8BHsGt8S7FgQjTe // line break here

...

Z57q0odcy76rGBq2iiqH2YU9P4sDdqLj/r1ZRl+FURwhHk9ATaFx+w== // line break here
-----END RSA PRIVATE KEY----- // line break here
// There's a last line break here

 

So I encoded it with base64 -w 0 < my_ssh_key:

LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQ0KTUlJRXBB(...)klWQVRFIEtFWS0tLS0tDQo=

 

And then the I get the "invalid format" error when running the pipline. Any thoughts?

Hi @raschidjfr ,

yep, encoded SSH_KEY as a variable according to the readme

# LINUX

$ base64 -w 0 < my_ssh_key

All your steps look good.

Try to check twice start and end of the encoded key before copying it, to prevent copying additional symbols.

Like raschidjfr likes this

Suggest an answer

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

Bitbucket Pipelines Runners is now in open beta

We are excited to announce the open beta program for self-hosted runners. Bitbucket Pipelines Runners is available to everyone. Please try it and let us know your feedback. If you have any issue...

634 views 15 9
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