Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,457,020
Community Members
 
Community Events
176
Community Groups

will Repository Variables stored secured be destroy by echo?

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?

 

2 answers

1 accepted

1 vote
Answer accepted

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

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events