I am setting up Circle CI for the first time. As part of my build process I need to generate SSH keys for a package I am using (https://github.com/lexik/LexikJWTAuthenticationBundle/blob/master/Resources/doc/index.md#installation)
But in order to do this I need to enter a passphrase, how can I do this in a command in Circle CI?
Do you actually need to do the generation of keys in the build, or could you do that outside of the build and present the same ones each time? If you can do the latter, then you can just store them in env vars in the UI.
Thank you for your reply, I tried your suggestion but it didn’t like the public key!
The first time I tried it I got this error:
#!/bin/sh -eo pipefail# Unable to parse YAML
# while scanning a simple key# in ‘string’, line 68, column 11:
# '-----BEGIN PUBLIC KEY-----# ^
# could not find expected ':'# in ‘string’, line 80, column 45:
# ... D8bdNZ+Vj+sN+L6L4QOy28CAwEAAQ=='# ^
# Warning: This configuration was auto-generated to show you the message above.# Don’t rerun this job. Rerunning will have no effect.
So I removed the last line of the public key: -----END PUBLIC KEY-----’ which makes the yaml valid, but now I get an error from LexikJWTAuthenticationBundle:
Unable to create a signed JWT from the given configuration.
I tried generating another key, but it ends with the same ==
Anyway around this?
I think there is a way in YAML to do multi-line values. Have a look at the Wikipedia article on YAML, I recall it is surprisingly detailed.
Failing that, store the key as a single line, use a magic character instead of line breaks, and then search-replace them with awk in the shell.
Thank you for your reply, you are right, it was a multiline format issue. This was very helpful in solving the issue:
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.