Skip to content

feat: refactor deployment config #6347

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

Merged
merged 89 commits into from
Mar 7, 2023
Merged

feat: refactor deployment config #6347

merged 89 commits into from
Mar 7, 2023

Conversation

ammario
Copy link
Member

@ammario ammario commented Feb 25, 2023

This PR introduces a new bigcli package and refactors coder server to use it instead of cobra/viper. It enables non-janky long-help formatting, doc generation, and YAML support. As a follow-up, I will convert the rest of the coder CLI to use bigcli. After a month or two of stability, we can open source bigcli, probably replacing the defunct coder/cli.

The line of codes should be around net zero, but the new code will be much easier to understand, maintain, and extend.

Breaking changes:

  • Removed long-deprecated Experimental flag

TODO

  • Support Git Auth
  • Manually confirm that environment variable and flag names match old implementation

Follow-on issues:

High-priority-cleanup

  • Generate CLI docs again
  • Convert the rest of the CLI to bigcli
  • Refactor rest of cli/server_test.go to use "clitest.Start" for better cleanup and error reporting
  • Regenerate golden files

Other

  • Document / Validate YAML works
  • Send back telemetry for each server option, plus how they're set. This makes it easier to make / communicate breaking changes.
  • Document how Support Links work in the YAML
  • Generate all Deployment setting pages and navigation from Options array

Copy link
Member

@mafredri mafredri left a comment

Choose a reason for hiding this comment

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

I haven't taken a look at the actual CLI output, but so far this seems like an improvement over what we have. I'd like to see the re-introduction of golden files (for the server command) so that visual changes are always verified.

It looks like a few things are still missing for this to be mergeable, so just leaving comments for now.

PS. I'm not sold on the name, what makes it big? 😆.

return strings.Join(names, " ")
}

// FullName returns usage of the command, preceded
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// FullName returns usage of the command, preceded
// FullUsage returns usage of the command, preceded


// FullName returns usage of the command, preceded
// by the usage of its parents.
func (c *Command) FullUsage() string {
Copy link
Member

Choose a reason for hiding this comment

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

When do we need to show parent command usage in addition to current command usage?

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 do so in the help template, perhaps not validly.

type OptionSet []Option

// Add adds the given Options to the OptionSet.
func (s *OptionSet) Add(opts ...Option) {
Copy link
Member

Choose a reason for hiding this comment

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

Consider updating function signature, since this is a set, we should do some verification/erroring here. Alternatively we may consider renaming, whichever makes more sense.


// ParseEnv parses the given environment variables into the OptionSet.
func (s *OptionSet) ParseEnv(globalPrefix string, environ []string) error {
var merr *multierror.Error
Copy link
Member

Choose a reason for hiding this comment

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

Should we consider using errors.Join instead? (I see we have one or two other uses of multierr currently, but we could nip that in the bud unless they give us something we need.

@ammario
Copy link
Member Author

ammario commented Mar 6, 2023

PS. I'm not sold on the name, what makes it big? 😆.

Struggled to find a good name, but big because it's meant to support bigger CLIs lol. If we think it's not very clear, I'm also down to use a more "cute" name like serpent (following on the cobra/viper snake theme).

I'd like to see the re-introduction of golden files (for the server command) so that visual changes are always verified.

I added this as a high priority follow-up.

@ammario ammario requested a review from kylecarbs March 6, 2023 19:19
@ammario ammario mentioned this pull request Mar 7, 2023
18 tasks
Copy link
Member

@kylecarbs kylecarbs left a comment

Choose a reason for hiding this comment

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

Some manual stuff testing:

image
^See the lack of space between running and Coder

image
^It says "Git Authentication Providers" randomly

image
^It's worth manually checking if this is still working by default. I know the value was false before, but somehow internally I think it was actually true.

image
This is in the deployment settings.

@ammario ammario merged commit 3b73321 into main Mar 7, 2023
@ammario ammario deleted the bigcli branch March 7, 2023 21:10
@github-actions github-actions bot locked and limited conversation to collaborators Mar 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants