Skip to content

Nice way to have secrets in LastPass locally but in GitHub Secrets in CI? #1867

Description

@pedantic-git

I've been trying for the last few hours to do a nice convention-over-configuration implementation of the following scenario:

  1. When running kamal deploy in GitHub Actions, the secrets are pulled from the environment (as they are stored in GitHub Secrets)
  2. When running it on my local machine, they're pulled from LastPass using kamal secrets.

I understand I could do this in a number of ways:

  • Writing a script that returns the same format as kamal secrets fetch and then calling that from within .kamal/secrets
  • Using .env instead of LastPass and running dotenv kamal deploy when running locally
  • Some sort of monstrosity within .kamal/secrets that checks for the existence of the lpass command on every line

None 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:

  • If Kamal just used the environment for all secrets if .kamal/secrets is absent - that way I can have my CI merely delete the .kamal/secrets file before running kamal deploy and everything would work.
  • A way to select a different secrets file based on the presence of the CI environment variable, for example.
  • Erb in the secrets file? Still quite ugly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions