[Solved] Unable to SSH into a remote machine using a private key

Unable to pass a private key to drone-ssh

I’ve been (unsuccessfully) trying to use the drone-ssh plugin with Drone 0.5.

I’ve taken the following steps:

# upload the key to drone as a secret
drone secret add <repo name> SSH_KEY @/<private key path>

# tried to upload with the image prefixed
drone secret add --image plugins/ssh <repo name> SSH_KEY @/<private key path>

In my .drone.yml file, I tried providing SSH_KEY in both a YAML property as well as an environment variable:

        image: plugins/ssh
        host: swarm.internal
        user: ubuntu
        port: 22
        key: ${SSH_KEY}
            - SSH_KEY=${SSH_KEY}
            - $(aws ecr get-login --region us-west-2)

When I run a build I get one of the following errors respectively:

Error: Failed to parse private key. ssh: no key found

Error: Failed to dial to server. ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain

UPDATE: Looks like there was some auth issue on my end. Please disregard this.

@nsamala How did you solve it. I’m facing the same issue.