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?? ...
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.