Nice way to have secrets in LastPass locally but in GitHub Secrets in CI? #1877
pedantic-git
started this conversation in
General
Replies: 2 comments
|
My current workaround is to have a script #!/usr/bin/env ruby
# This is a crude attempt to work around https://github.com/basecamp/kamal/issues/1867
# If the lpass command doesn't exist, it pulls anything that looks like an env var
# off the end of ARGV and returns a hash that looks like it
require "json"
require "open3"
require "shellwords"
# https://stackoverflow.com/a/42533209
def command?(name) = [name, *ENV['PATH'].split(File::PATH_SEPARATOR).map {|p| File.join(p, name)}].find {|f| File.executable?(f)}
if command? "lpass"
Open3.capture2("kamal", *ARGV).first
else
ARGV.grep(/\A[A-Z_]+\Z/).to_h { [ it, ENV[it] ] }.to_json
end.then { puts Shellwords.escape it } |
0 replies
|
I'd like to add a mechanism to cut out the secrets files entirely and just specify the secret information directly in the deploy.yml files. Then we could use ERB in there to decide where to load the secrets from based on the location. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I've been trying for the last few hours to do a nice convention-over-configuration implementation of the following scenario:
kamal deployin GitHub Actions, the secrets are pulled from the environment (as they are stored in GitHub Secrets)kamal secrets.I understand I could do this in a number of ways:
kamal secrets fetchand then calling that from within.kamal/secrets.envinstead of LastPass and runningdotenv kamal deploywhen running locally.kamal/secretsthat checks for the existence of thelpasscommand on every lineNone of these feel very clean or convention-over-configuration to me. Does anyone have an alternative implementation?
Some wishlist changes to Kamal's behaviour that would be nice, if no standard nice way is availalbe:
.kamal/secretsis absent - that way I can have my CI merely delete the.kamal/secretsfile before runningkamal deployand everything would work.secretsfile based on the presence of theCIenvironment variable, for example.secretsfile? Still quite ugly.All reactions