I have this same issue with my pipeline. The key is working with Gitlab without an issue so the key structure and other aspects are correct.
Here is my pipeline step
- name: Setup SSH
run: |
mkdir -p /home/runner/.ssh
echo "${{ secrets.EBKEY }}" | base64 --decode > /home/runner/.ssh/id_rsa
chmod 400 /home/runner/.ssh/id_rsa
eval "$(ssh-agent -s)"
ssh-add /home/runner/.ssh/id_rsa
echo "Host *\\n\\tStrictHostKeyChecking no\\n\\n" > /home/runner/.ssh/config
Here is the debug log:
type here##[debug]Evaluating condition for step: 'Setup SSH'
##[debug]Evaluating: success()
##[debug]Evaluating success:
##[debug]=> true
##[debug]Result: true
##[debug]Starting: Setup SSH
##[debug]Loading inputs
##[debug]Evaluating: format('mkdir -p /home/runner/.ssh
##[debug]echo "{0}" | base64 --decode > /home/runner/.ssh/id_rsa
##[debug]chmod 400 /home/runner/.ssh/id_rsa
##[debug]eval "$(ssh-agent -s)"
##[debug]ssh-add /home/runner/.ssh/id_rsa
##[debug]echo "Host *\\n\\tStrictHostKeyChecking no\\n\\n" > /home/runner/.ssh/config
##[debug]', secrets.EBKEY)
##[debug]Evaluating format:
##[debug]..Evaluating String:
##[debug]..=> 'mkdir -p /home/runner/.ssh
##[debug]echo "{0}" | base64 --decode > /home/runner/.ssh/id_rsa
##[debug]chmod 400 /home/runner/.ssh/id_rsa
##[debug]eval "$(ssh-agent -s)"
##[debug]ssh-add /home/runner/.ssh/id_rsa
##[debug]echo "Host *\\n\\tStrictHostKeyChecking no\\n\\n" > /home/runner/.ssh/config
##[debug]'
##[debug]..Evaluating Index:
##[debug]....Evaluating secrets:
##[debug]....=> Object
##[debug]....Evaluating String:
##[debug]....=> 'EBKEY'
##[debug]..=> null
##[debug]=> 'mkdir -p /home/runner/.ssh
##[debug]echo "" | base64 --decode > /home/runner/.ssh/id_rsa
##[debug]chmod 400 /home/runner/.ssh/id_rsa
##[debug]eval "$(ssh-agent -s)"
##[debug]ssh-add /home/runner/.ssh/id_rsa
##[debug]echo "Host *\\n\\tStrictHostKeyChecking no\\n\\n" > /home/runner/.ssh/config
##[debug]'
##[debug]Result: 'mkdir -p /home/runner/.ssh
##[debug]echo "" | base64 --decode > /home/runner/.ssh/id_rsa
##[debug]chmod 400 /home/runner/.ssh/id_rsa
##[debug]eval "$(ssh-agent -s)"
##[debug]ssh-add /home/runner/.ssh/id_rsa
##[debug]echo "Host *\\n\\tStrictHostKeyChecking no\\n\\n" > /home/runner/.ssh/config
##[debug]'
##[debug]Loading env
Run mkdir -p /home/runner/.ssh
##[debug]/usr/bin/bash -e /home/runner/work/_temp/5148b361-95c0-4434-bd47-153342516c5c.sh
Agent pid 1560
Error loading key "/home/runner/.ssh/id_rsa": error in libcrypto
Error: Process completed with exit code 1.
##[debug]Finishing: Setup SSH
As I can see when the pipeline runs it takes an empty string in the echo command. What could be the issue here?
I tried writing a pipeline for my NodeJS app to deploy to Elastic Beanstalk.