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

CLI Unification: audit-log, completion, connector, connector-catalog, environment, feedback, ksql, prompt, schema-registry, shell, update, version #931

Merged
merged 53 commits into from
Jul 29, 2021

Conversation

brianstrauch
Copy link
Member

Checklist

  1. [CRUCIAL] Is the change for CP or CCloud functionalities that are already live in prod?

    • yes: ok
    • no: DO NOT MERGE until the required functionalites are live in prod
  2. Did you add/update any commands that accept secrets as args/flags?

What

Unify several trivial commands. These commands don't have any overlapping flags or subcommands between cloud on on-prem.

  • Swap out cliName for cfg in branch statements. We use cfg.IsCloud() or cfg.IsOnPrem() to change functionality.
  • Use pversion.CLIName in place of cliName in strings.

Test & Review

Minor changes to golden files.

Open questions / Follow ups

prompt looks like it works fine for confluent. Let's re-enable it on master?

brianstrauch and others added 30 commits July 1, 2021 19:04
* unify config command

* unified config file, IsCloud and IsOnPrem

* consolidate ccloud hostnames var

* finish config unification and test

* add golden files

* check for test url second

* add back missing return

* support all cpdev platforms

* trim trailing slash from platform names, and use contains

* revert trim trailing slash

* fix error
@brianstrauch brianstrauch requested a review from a team as a code owner July 21, 2021 16:59
@brianstrauch brianstrauch changed the title CLI Unification: audit-log, completion, ksql, prompt, and version CLI Unification: audit-log, completion, feedback, ksql, prompt, version Jul 21, 2021
@brianstrauch brianstrauch changed the title CLI Unification: audit-log, completion, feedback, ksql, prompt, version CLI Unification: audit-log, completion, connector, connector-catalog, environment, feedback, ksql, prompt, version Jul 21, 2021
@brianstrauch brianstrauch changed the title CLI Unification: audit-log, completion, connector, connector-catalog, environment, feedback, ksql, prompt, version CLI Unification: audit-log, completion, connector, connector-catalog, environment, feedback, ksql, prompt, schema-registry, version Jul 22, 2021
@brianstrauch brianstrauch changed the title CLI Unification: audit-log, completion, connector, connector-catalog, environment, feedback, ksql, prompt, schema-registry, version CLI Unification: audit-log, completion, connector, connector-catalog, environment, feedback, ksql, prompt, schema-registry, shell, version Jul 22, 2021
@brianstrauch brianstrauch changed the title CLI Unification: audit-log, completion, connector, connector-catalog, environment, feedback, ksql, prompt, schema-registry, shell, version CLI Unification: audit-log, completion, connector, connector-catalog, environment, feedback, ksql, prompt, schema-registry, shell, update, version Jul 22, 2021
Copy link
Contributor

@DABH DABH left a comment

Choose a reason for hiding this comment

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

LGTM up to a few small questions!

defaultFormat := `({{color "blue" "ccloud"}}|{{color "red" "%E"}}:{{color "cyan" "%K"}})`
if cliName == "confluent" {
defaultFormat := `({{color "blue" "confluent"}}|{{color "red" "%E"}}:{{color "cyan" "%K"}})`
if cfg.IsOnPrem() {
Copy link
Contributor

Choose a reason for hiding this comment

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

How will bash completion instructions work now -- do we need to update those? We used to require e.g. "save ccloud completions to [something like] ~/ccloud-completions.sh" or "save confluent ones to ~/confluent-completions.sh". Is there going to be a filename conflict now? Or, another problem, are we going to only generate one file that (1) only works for the logged-out set of commands or (2) only works for one env but not the other or (3) completes for all commands even when only logged in to cloud or on prem?

Copy link
Member Author

Choose a reason for hiding this comment

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

This comment scared me- I thought I was going to have to write my own completion script generator or something... Luckily, completion "just works" in the unified CLI!

Our completion instructions (and reminder to re-run the completion command on update) seem to be CLI-agnostic too.

cliCmd := pcmd.NewAuthenticatedStateFlagCommand(
&cobra.Command{
Use: "cluster",
Short: "Manage Schema Registry cluster.",
Short: "Manage Schema Registry clusters.",
Copy link
Contributor

Choose a reason for hiding this comment

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

Was this singular for a reason? iirc there was something like, each customer can only have one SR cluster, or only one SR cluster per environment? Can you check on that before we change this?

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm... this looked like a typo, since the on-prem description uses the plural and it's grammar isn't right... Maybe this should be:

Suggested change
Short: "Manage Schema Registry clusters.",
Short: "Manage a Schema Registry cluster.",

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't know -- that is why I'm asking if you could check whether it's still the case that customers basically only have one SR cluster, or not. E.g. maybe this should be "Manage the Schema Registry cluster for the current environment."

Copy link
Member Author

Choose a reason for hiding this comment

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

My bad... after some investigation it looks like each environment has at most one schema registry cluster. I'll change this to "Manage the Schema Registry cluster for the current environment." as suggested.

Copy link
Member Author

Choose a reason for hiding this comment

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

This was too long, so I kept the short description as is and added a long description.

@brianstrauch brianstrauch merged commit 313d27b into main Jul 29, 2021
@brianstrauch brianstrauch deleted the unify-misc branch July 29, 2021 03:04
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