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

PXP-477: [CLI] Develop the config secrets push command #81

Merged
merged 43 commits into from
Apr 7, 2023

Conversation

mfauzaan
Copy link
Member

@mfauzaan mfauzaan commented Mar 28, 2023

Summary

This PR adds a bunker secret edit command to the Wukong CLI, enabling users to update remote secrets via the command line interface after making changes to the local config files.

Example command usage: wukong-cli dev config push {path}

Multiple config changes:
Screenshot 2023-04-03 at 6 52 35 PM

Diff with the changes:
Screenshot 2023-04-05 at 2 41 14 PM

Ticket: PXP-477

What's Changed

Added

  • Added wukong dev config push command to search for config files with the vault tag in the provided path or current path.
  • Compare the local config files with the remote versions in Bunker and identify any changes made by the user.
  • Prompt the user with a selection option if multiple secrets are eligible for editing.
  • Display the differences between the local and remote secrets files before pushing changes, allowing users to confirm the modifications.
  • Update the remote version with the user's changes upon confirmation.

@mfauzaan mfauzaan self-assigned this Mar 28, 2023
@mfauzaan mfauzaan added the feature New feature label Mar 29, 2023
@jk-gan
Copy link
Contributor

jk-gan commented Mar 29, 2023

can you update the completions by running cargo build --release && ./generate-completions.sh?

Copy link
Contributor

@onimsha onimsha left a comment

Choose a reason for hiding this comment

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

From what I can see, this command allows to select an individual change in a secret file to apply the edit. This is similar to Git diff, however I'm wonder if we have actual case for this.

From the user's perspective, the diff merely for me to review the change, and I can either accept or deny it, plus an option to go back and making some edits. Selecting individual changes seems not practical IMHO.

Also, I don't see we're handling the case of multiple annotations. For example if there is an umbrella Elixir application, there can be more than 1 annotations, thus leading to multiple secret files . I just need the confirmation that we're not handling this case atm, to determine what would be the next step.

cc @jk-gan @mfauzaan

@jk-gan
Copy link
Contributor

jk-gan commented Mar 30, 2023

From what I can see, this command allows to select an individual change in a secret file to apply the edit. This is similar to Git diff, however I'm wonder if we have actual case for this.

From the user's perspective, the diff merely for me to review the change, and I can either accept or deny it, plus an option to go back and making some edits. Selecting individual changes seems not practical IMHO.

Also, I don't see we're handling the case of multiple annotations. For example if there is an umbrella Elixir application, there can be more than 1 annotations, thus leading to multiple secret files . I just need the confirmation that we're not handling this case atm, to determine what would be the next step.

cc @jk-gan @mfauzaan

I see, so the command is meant to be used with the annotation? The RFC I saw was saying "Pull the secret file from Bunker, make changes, and push new contents to update the Bunker". I think we misunderstood that.

@mfauzaan mfauzaan force-pushed the feat/secrets-edit-command branch from 2ad3b8a to 6a5a7ff Compare April 5, 2023 03:24
@mfauzaan mfauzaan changed the title PXP-477: [CLI] Develop the config secrets edit command PXP-477: [CLI] Develop the config secrets pull command Apr 6, 2023
@mfauzaan mfauzaan force-pushed the feat/secrets-edit-command branch from 12fff38 to b1d8f6a Compare April 6, 2023 04:54
@onimsha onimsha changed the title PXP-477: [CLI] Develop the config secrets pull command PXP-477: [CLI] Develop the config secrets push command Apr 6, 2023
@onimsha
Copy link
Contributor

onimsha commented Apr 6, 2023

For this error.

comparing local config vs remote config...
Error - No such file or directory (os error 2)

We should add a suggestion text to ask user maybe they will need to run the wukong dev config pull first.

@mfauzaan
Copy link
Member Author

mfauzaan commented Apr 6, 2023

For this error.

comparing local config vs remote config...
Error - No such file or directory (os error 2)

We should add a suggestion text to ask user maybe they will need to run the wukong dev config pull first.

Screenshot 2023-04-06 at 2 49 49 PM

@mfauzaan mfauzaan closed this Apr 6, 2023
@mfauzaan mfauzaan reopened this Apr 6, 2023
@sauron-droid
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: mfauzaan, onimsha

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@jk-gan
Copy link
Contributor

jk-gan commented Apr 7, 2023

I got Permission denied and I don't why

Screenshot 2023-04-07 at 4 11 53 PM

@onimsha
Copy link
Contributor

onimsha commented Apr 7, 2023

I got Permission denied and I don't why

Screenshot 2023-04-07 at 4 11 53 PM

Maybe don't have access to the Vault secret ? Can you access the secret using Bunker UI ?

jk-gan
jk-gan previously requested changes Apr 7, 2023
@mfauzaan mfauzaan dismissed jk-gan’s stale review April 7, 2023 10:05

since the possibility of this is small atm, we can address this in another PR later.

@mfauzaan mfauzaan merged commit c035225 into main Apr 7, 2023
@sauron-droid sauron-droid deleted the feat/secrets-edit-command branch April 7, 2023 10:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

4 participants