Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: updates snaplet to ensure COPYCAT_SECRET #4

Merged
merged 1 commit into from
Aug 10, 2023

Conversation

Gowiem
Copy link
Member

@Gowiem Gowiem commented Aug 10, 2023

Info

  • Updates snaplet:capture to ensure we have the COPYCAT_SECRET env var set before running that task. This is required as it is the encryption seed for copycat usage within Snaplet.
  • Updates our snaplet vars so they incorporate the SNAPSHOT_ENV var and fixes support for overriding their values.
  • Introduces the .env.taskit-secrets file which is used to store local secrets in a taskit repository that should not be checked into git. This is added to our gitignore script + the dotenv items of our Taskfile.dist.yaml so we now have a pattern for sharing secrets easily with taskit.

References

  • This is in conjunction with our work in another PR that will be up shortly and will be linked below.

@Gowiem Gowiem self-assigned this Aug 10, 2023
Copy link

@kevcube kevcube left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm but not 100% sure about taskfile syntax

also wondering what is the COPYCAT_SECRET needed for?? Doesn't copycat just generate fake email/other PII? I hope they don't have an API that you have to pay to request bogus@bogus.com

Edit: I should read PR descriptions instead of just files changed

Comment on lines +18 to +21
# Load our project specific variables from .env.taskit + .env.taskit-secrets
dotenv:
- .env.taskit
- .env.taskit-secrets
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is taskit/snaplet typically run? Can we pass these in a way other than .env files?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering for 12-factor purposes, but it looks like taskfile is the one handling the .env import rather than us, so any 12-factor concerns are left on their plate, which I'm cool with

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're typically running snaplet tasks in our client infra project where these files are either present or in the case of the taskit-secrets file it can be created easily if needed. If these files don't exist, task / taskit works as normal. They're purely optional and supplementary which works nicely if we are using taskit in a project that doesn't use the snaplet:* tasks.

internal: true
cmds:
- |
if [[ -z "{{.COPYCAT_SECRET}}" ]]; then
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this {{.name}} syntax is how you reference env variables in taskfile?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Gowiem
Copy link
Member Author

Gowiem commented Aug 10, 2023

also wondering what is the COPYCAT_SECRET needed for?? Doesn't copycat just generate fake email/other PII? I hope they don't have an API that you have to pay to request bogus@bogus.com

Copycat is a small open source project from the folks at Snaplet: https://github.com/snaplet/copycat. Without setting that env var, you get a message from snaplet on each capture run like this: https://share.cleanshot.com/lRy4J0nY. More info here: https://github.com/snaplet/copycat#working-with-pii-personal-identifiable-information

This work to ensure that env var is set is so that we just quiet down that warning AND provide a means by which we can easily pass secrets to taskit going forward. I could see this new pattern evolving in the future where we passing a SOPS file and taskit is responsible for pulling all the secrets from that SOPS file given that the invoker has access to the key to decrypt. But that is a possible future if we need to build this out further, for now this is a fast path towards done and leaves us open to using it elsewhere.

@Gowiem
Copy link
Member Author

Gowiem commented Aug 10, 2023

Edit: I should read PR descriptions instead of just files changed

@kevcube you know I love a good PR description ❤️

1 similar comment
@Gowiem
Copy link
Member Author

Gowiem commented Aug 10, 2023

Edit: I should read PR descriptions instead of just files changed

@kevcube you know I love a good PR description ❤️

@Gowiem Gowiem merged commit 3b565f8 into main Aug 10, 2023
1 check passed
@Gowiem Gowiem deleted the feature/snaplet-updates branch August 10, 2023 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants