I followed the section titled "Use multiple SSH keys in your pipeline" on this page: https://confluence.atlassian.com/bitbucket/use-ssh-keys-in-bitbucket-pipelines-847452940.html
However, I notice it only sometimes works.
The image I use is: atlassian/default-image:2 and I follow exactly the steps outlined in the Wiki setting up the known_hosts, echoing the secured environment variable SSH key into the default ~/.ssh/id_rsa file
If I enabled `ssh -vv` for my ssh command and allow the default of ~/.ssh/id_rsa to be picked up I observe that this only works sometimes. In some cases, depending on the bitbucket repository and pipeline where it is used, it tries to use a different default id_rsa, for example from:
debug2: we did not send a packet, disable
method
debug1: Next authentication method: publickey
debug1:
Trying private key: /opt/atlassian/pipelines/agent/ssh/id_rsa
debug2: we sent a publickey packet, wait for reply
However, in a different run of exactly the same script in a different repo and pipeline (same base Docker image too), it returns this:debug2: we did not send a packet, disable method
debug1: Next authentication method: publickey
debug1: Trying private key: /root/.ssh/id_rsa
debug2: we sent a publickey packet, wait for reply
debug1: Authentication succeeded (publickey).
I am not passing `-i` to the `ssh` command since documentation states the default id_rsa file will be used, but now I feel that `-i` is required to ensure the correct id_rsa file is used.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.