What I have done:
I have stored a .ssh/private-key (--- BEGIN...) into a repository variable with 'secured' marked. If it is a good idea I don't no.
Within a pipeline script I echoed such variable to a file like `echo ${VARIABLE} >~/.ssh/name`, chmod it to 600... btw: the file is 1675 bytes long, on bitbucket and local.
When I try to use `md5sum -b ~/.ssh/name` on such file the result is not the expected checksum, I have on my local system. I used different editors to create such variable, but the result is always the same.
But, the same procedure with the single line public key works as expected, the checksum is the same as on my local system and in pipeline script.
I'm working on Linux so line ending is always the byte 0x0a.
How can I see, the content is as expected?
Hi @Lars_langhans,
Pipelines does not currently support line breaks in environment variables. What we suggest is to base-64 encode the private key by running:
Linux
$ base64 -w 0 < my_ssh_key
Mac OS X
$ base64 < my_ssh_key
Then copy the base64-encoded private key from the terminal, and paste it as the value for a variable.
You can then create the private key file in your build with the following command
(umask 077 ; echo $MY_SSH_KEY | base64 --decode > ~/.ssh/id_rsa)
where MY_SSH_KEY replace with the name of your repository variable.
We have documentation about this here:
Kind regards,
Theodora
Thanks for the not documented feature, that carriage return 0x0a will replaced by 0x20 (space).
BTW: To see the full content of a file, I use 'od -x file', which works as expected.
Kind Regards
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.