-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Client] [Tooling] refactor: CLI (#806)
## Description <!-- reviewpad:summarize:start --> ### Summary generated by Reviewpad on 13 Jun 23 12:53 UTC This pull request includes various updates across the codebase, including changes to CLI flags, import statements, and default values. It also involves refactoring code to use shared helper functions, removing unused code, and improving error handling. Some variables have been renamed to be more descriptive. The specific changes include modifications to files such as `validator.go`, `cluster-manager.yaml`, `cli-client.yaml`, `utils.go`, and `runtime_defaults.go`. For example, the `RPC_HOST` variable has been replaced with `POCKET_REMOTE_CLI_URL`. A new `helper` package has been added, and a new `flags` package contains several CLI flags. Code has also been updated to use `flags.RemoteCLIURL` instead of `remoteCLIURL`. Some constants have been renamed to include `Hostname`, and there are updates to endpoint hostnames for some validators. <!-- reviewpad:summarize:end --> ## Issue Dependants: - #730 ## Type of change Please mark the relevant option(s): - [ ] New feature, functionality or library - [ ] Bug fix - [x] Code health or cleanup - [ ] Major breaking change - [ ] Documentation - [ ] Other <!-- add details here if it a different type of change --> ## List of changes - Exported `rootCmd` to support cross-package usage (i.e. subcommands w/ own pkgs) - Refactored common CLI code - Moved & refactored `PersistentPreRunE()` helper - Moved & exported `busCLICtxKey` - Exported `GetValueFromCLIContext()` and `SetValueInCLIContext()` - Moved `setupAndStartP2PModule` - Moved `setupCurrentHeightProvider` - Moved `setupPeerstoreProvider` - Refactored CLI flags to own package for cross-package use - Replaced RPC_HOST with POCKET_REMOTE_CLI_URL where appropriate - Added `remote-cli-url` flag to cluster manager & refactor - Added support for overriding of `remote-cli-url` flag with env var - Append "Hostname" to validator endpoint hostname constants - Promoted string literal to `RandomValidatorEndpointK8SHostname` constant - Improved e2e tests error messaging - Simplify e2e debug command calls - Improve error handling in client CLI ## Testing - [ ] `make develop_test`; if any code changes were made - [ ] `make test_e2e` on [k8s LocalNet](https://github.com/pokt-network/pocket/blob/main/build/localnet/README.md); if any code changes were made - [ ] `e2e-devnet-test` passes tests on [DevNet](https://pocketnetwork.notion.site/How-to-DevNet-ff1598f27efe44c09f34e2aa0051f0dd); if any code was changed - [x] [Docker Compose LocalNet](https://github.com/pokt-network/pocket/blob/main/docs/development/README.md); if any major functionality was changed or introduced - [x] [k8s LocalNet](https://github.com/pokt-network/pocket/blob/main/build/localnet/README.md); if any infrastructure or configuration changes were made ## Required Checklist - [x] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have added, or updated, [`godoc` format comments](https://go.dev/blog/godoc) on touched members (see: [tip.golang.org/doc/comment](https://tip.golang.org/doc/comment)) - [x] I have tested my changes using the available tooling - [x] I have updated the corresponding CHANGELOG ### If Applicable Checklist - [ ] I have updated the corresponding README(s); local and/or global - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] I have added, or updated, [mermaid.js](https://mermaid-js.github.io) diagrams in the corresponding README(s) - [ ] I have added, or updated, documentation and [mermaid.js](https://mermaid-js.github.io) diagrams in `shared/docs/*` if I updated `shared/*`README(s)
- Loading branch information
1 parent
9cb0ee9
commit 12f9f49
Showing
30 changed files
with
344 additions
and
232 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package flags | ||
|
||
var ( | ||
// RemoveCLIURL is the URL of the remote RPC node which the CLI will interact with. | ||
// Formatted as <protocol>://<host>:<port> (uses RPC Port). | ||
// (see: --help the root command for more info). | ||
RemoteCLIURL string | ||
|
||
// DataDir a path to store pocket related data (keybase etc.). | ||
// (see: --help the root command for more info). | ||
DataDir string | ||
|
||
// ConfigPath is the path to the node config file. | ||
// (see: --help the root command for more info). | ||
ConfigPath string | ||
|
||
// If true skips the interactive prompts wherever possible (useful for scripting & automation) | ||
// (see: --help the root command for more info). | ||
NonInteractive bool | ||
|
||
// Show verbose output | ||
// (see: --help the root command for more info). | ||
Verbose bool | ||
) |
Oops, something went wrong.