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(cli): add cloud secrets update command #4804

Merged
merged 15 commits into from Sep 26, 2023
Merged

Conversation

shumailxyz
Copy link
Contributor

@shumailxyz shumailxyz commented Jul 11, 2023

What this PR does / why we need it:
Adds a new command to update secrets in cloud.

garden cloud secrets update

Which issue(s) this PR fixes:
Fixes #3079

Special notes for your reviewer:

  • Added a flag upsert to perform upsert and create missing secrets while updating existing secrets.
  • Added a flag update-by-id to update secrets by id.
  • As there can be multiple secrets with same name across different env/users, added flags scope-to-env and scope-to-user-id to perform scoped filtering.
  • An error is thrown if update is performed by name and after applying all filters, multiple secrets with same name are found.
  • Added some unit tests however integration tests are missing for this new command as well as other secrets commands. Would be added separately for all the secrets operations together.

@shumailxyz shumailxyz force-pushed the feat-update-secret-cmd branch 2 times, most recently from 633eafa to a1636e9 Compare July 13, 2023 13:28
@shumailxyz shumailxyz requested review from eysi09 and a team July 13, 2023 13:28
@shumailxyz shumailxyz marked this pull request as ready for review July 13, 2023 13:29
Copy link
Contributor

@Orzelius Orzelius left a comment

Choose a reason for hiding this comment

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

I think the documentation should also mention that secrets will be created if they don't exist.

If you want to make the creation of secrets default behavior the command should be upsert not update. If you want to keep it update I think that the creation of new secrets should be behind a flag, something like --upsert.

Although we decided that we won't be testing this e2e with cloud I still think this code should be split into smaller testable parts and unit tests should be written to ensure quality and make future developments easier.

core/src/cloud/api.ts Outdated Show resolved Hide resolved
@shumailxyz shumailxyz requested review from a team and Orzelius July 18, 2023 15:37
@shumailxyz shumailxyz removed the request for review from Orzelius August 29, 2023 13:40
@shumailxyz shumailxyz requested review from Orzelius and removed request for Orzelius September 21, 2023 14:35
Copy link
Collaborator

@eysi09 eysi09 left a comment

Choose a reason for hiding this comment

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

Great work!

Left a few comments but overall looks good.

core/src/commands/cloud/secrets/secrets-update.ts Outdated Show resolved Hide resolved
core/src/commands/cloud/secrets/secrets-update.ts Outdated Show resolved Hide resolved
core/src/commands/cloud/secrets/secrets-update.ts Outdated Show resolved Hide resolved
core/src/commands/cloud/secrets/secrets-update.ts Outdated Show resolved Hide resolved
Copy link
Collaborator

@eysi09 eysi09 left a comment

Choose a reason for hiding this comment

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

Thanks for addressing the PR comments. Looks good to me!

@shumailxyz shumailxyz added this pull request to the merge queue Sep 25, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Sep 25, 2023
@shumailxyz shumailxyz added this pull request to the merge queue Sep 25, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Sep 25, 2023
@shumailxyz shumailxyz added this pull request to the merge queue Sep 26, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Sep 26, 2023
@shumailxyz shumailxyz added this pull request to the merge queue Sep 26, 2023
@shumailxyz shumailxyz removed this pull request from the merge queue due to a manual request Sep 26, 2023
@shumailxyz shumailxyz added this pull request to the merge queue Sep 26, 2023
Merged via the queue into main with commit 8b8fc00 Sep 26, 2023
42 checks passed
@shumailxyz shumailxyz deleted the feat-update-secret-cmd branch September 26, 2023 14:05
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.

[FEATURE]: Ability to perform UPSERT garden secrets
3 participants