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

0.13: [Bug]: Creating Extra Cloud Secrets from Files fails #6048

Closed
vvagaytsev opened this issue May 15, 2024 · 0 comments · Fixed by #6099
Closed

0.13: [Bug]: Creating Extra Cloud Secrets from Files fails #6048

vvagaytsev opened this issue May 15, 2024 · 0 comments · Fixed by #6099

Comments

@vvagaytsev
Copy link
Collaborator

Garden Bonsai (0.13) Bug

Bulk secrets creation from files fails on duplicate secrets.

Assume there is an .env file with some new secrets added. Attempt to create the secrets from that file fails if at least one of the secrets defined in the file already exists.

Current Behavior

  • Bulk secrets creation fails when at least one of the secrets in the batch already exist.
  • The error message for single secret failure is confusing and not too informative.

Expected behavior

  • Bulk secrets creation from file should skip already existing secrets and create only the new ones.
  • The error message for single secret failure should hide the underlying HTTP error code and be more user-friendly.

Reproducible example

Create some new secrets in ~/repo-secrets.env file and add them with garden cloud secrets create --from-file ~/repo-secrets.env.

Add some new entries to ~/repo-secrets.env file and rerun the secrets creation command. It will fail with the error:

> garden cloud secrets create --from-file ~/repo-secrets.env

Create secrets 🔒 
 
ℹ garden                    → Initializing...
ℹ garden-cloud              → Connecting project...
✔ garden-cloud              → Ready
ℹ garden                    → Running in environment dev.true-customer-danieltaylor
ℹ secrets-command           → Creating secrets...
ℹ secrets-command           → Creating secrets... → 1/10
Encountered an unexpected Garden error. This is likely a bug 🍂
 
You can help by reporting this on GitHub: https://github.com/garden-io/garden/issues/new?labels=bug,crash&template=CRASH.md&title=Crash%3A%20Response%20code%20409%20(Conflict)
 
Please attach the following information to the bug report after making sure that the error message does not contain sensitive information:
 
HTTPError: Response code 409 (Conflict)
    at Request.<anonymous> (file:///Users/danieltaylor/Library/Application%20Support/io.garden.garden/1715246255-NGojvKX.r/rollup/garden.mjs:226907:42)
    at Object.onceWrapper (node:events:634:26)
    at Request.emit (node:events:531:35)
    at Request.emit (node:domain:488:12)
    at Request._onResponseBase (file:///Users/danieltaylor/Library/Application%20Support/io.garden.garden/1715246255-NGojvKX.r/rollup/garden.mjs:226411:22)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Request._onResponse (file:///Users/danieltaylor/Library/Application%20Support/io.garden.garden/1715246255-NGojvKX.r/rollup/garden.mjs:226453:13)

Workaround

Use garden secrets update command with --upsert flag:

garden cloud secrets update --upsert --from-file ~/repo-secrets.env

Suggested solution(s)

  • Skip already existing secrets while bulk secrets creation (from file).
  • Improve the error message for a single secrets creation via Garden CLI.

Additional context

Consider implementing --upsert (or --overwrite) flag for the garden secrets create command to overwrite the already existing secrets.

Your environment

  • OS:
  • How I'm running Kubernetes:

garden version 0.13.30

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant