When triggered, pipeline runs and return the following error,
$ ssh-add <(echo "$SSH_PRIVATE_KEY")
Enter passphrase for /dev/fd/63: ERROR: Job failed: exit code 1
my SSH_PRIVATE_KEY variable exist with a valid private key.
In my case, I had set the SSH_PRIVATE_KEY variable to "protected", so this worked when building from a protected branch. If your SSH_PRIVATE_KEY variable is Protected ensure your branch is also protected. Information on how to protect your gitlab branch
There's two possible options to achieve it.
First option: Use another SSH private key who didn't request to enter a passphrase.
Second option: Use a expect syntax to "interactively" enter passphrase when it required [1].
Don't think the second option is more secure than first one, because, on the shell file you need to store your passphrase without any encryption.
[1] https://unix.stackexchange.com/questions/288099/how-to-write-expect-in-shell
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With