Incorrect Usage: bad flag syntax when adding secret ssh key as a string

Hello,

I’m trying to use drone/cli (as a docker container) to add an SSH key as organization secret using:

docker run --rm -e DRONE_SERVER=<host> -e DRONE_TOKEN=<token> drone/cli:latest orgsecret add <org> <keyname> <private_ssh_key_single_line>

However, I’m receiving the following error: Incorrect Usage: bad flag syntax. This is due to the fact the key starts with -----BEGIN RSA PRIVATE KEY----- and I assume drone/cli complains about --. How can I overcome this issue? I tried quoting the values but still can’t make it work. Of course I could create a file with the key, share it within the container, then import it with @ syntax but I would like to avoid all those steps.

The recommended solution would be to use the @ syntax to load the file. If you want to pass the value as a command line parameter you will need to figure out the correct quoting. I am sure it is possible, but probably will require some trial and error.