Skip to content

Commit 8076144

Browse files
authored
refactor: make Cosmovisor use cobra (#11823)
## Description Closes: #11789 --- ### Author Checklist *All items are required. Please add a note to the item if the item is not applicable and please add links to any relevant follow up issues.* I have... - [x] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] added `!` to the type prefix if API or client breaking change - [x] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/main/CONTRIBUTING.md#pr-targeting)) - [x] provided a link to the relevant issue or specification - [ ] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/main/docs/building-modules) - [ ] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/main/CONTRIBUTING.md#testing) - [x] added a changelog entry to `CHANGELOG.md` - [x] included comments for [documenting Go code](https://blog.golang.org/godoc) - [ ] updated the relevant documentation or specification - [x] reviewed "Files changed" and left comments if necessary - [ ] confirmed all CI checks have passed ### Reviewers Checklist *All items are required. Please add a note if the item is not applicable and please add your handle next to the items reviewed if you only reviewed selected items.* I have... - [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] confirmed `!` in the type prefix if API or client breaking change - [ ] confirmed all author checklist items have been addressed - [ ] reviewed state machine logic - [ ] reviewed API design and naming - [ ] reviewed documentation is accurate - [ ] reviewed tests and test coverage - [ ] manually tested (if applicable)
1 parent c0f65e1 commit 8076144

File tree

18 files changed

+174
-430
lines changed

18 files changed

+174
-430
lines changed

cosmovisor/CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@ Ref: https://keepachangelog.com/en/1.0.0/
3737
## [Unreleased]
3838
<!-- NOTE: when creating a new release, update cosmovisor/cmd/cosmovisor/cmd/version.go:Version -->
3939

40-
* [\#11731](https://github.com/cosmos/cosmos-sdk/pull/11731) `cosmovisor version --json` returns the cosmovisor version and the result of `simd --output json --long` in one JSON object.
40+
### Features
41+
42+
* [\#11823](https://github.com/cosmos/cosmos-sdk/pull/11823) Refactor `cosmovisor` CLI to use `cobra`.
43+
* [\#11731](https://github.com/cosmos/cosmos-sdk/pull/11731) `cosmovisor version -o json` returns the cosmovisor version and the result of `simd --output json --long` in one JSON object.
4144

4245
## v1.1.0 2022-10-02
4346

cosmovisor/README.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ To install a previous version, you can specify the version. IMPORTANT: Chains th
3737
go install github.com/cosmos/cosmos-sdk/cosmovisor/cmd/cosmovisor@v0.1.0
3838
```
3939

40-
You can run `cosmovisor --version` to check the Cosmovisor version (works only with Cosmovisor >=1.0.0).
40+
You can run `cosmovisor version` to check the Cosmovisor version (works only with Cosmovisor >1.1.0).
4141

4242
You can also install from source by pulling the cosmos-sdk repository and switching to the correct version and building as follows:
4343

@@ -62,7 +62,7 @@ The first argument passed to `cosmovisor` is the action for `cosmovisor` to take
6262

6363
* `help`, `--help`, or `-h` - Output `cosmovisor` help information and check your `cosmovisor` configuration.
6464
* `run` - Run the configured binary using the rest of the provided arguments.
65-
* `version`, or `--version` - Output the `cosmovisor` version and also run the binary with the `version` argument.
65+
* `version` - Output the `cosmovisor` version and also run the binary with the `version` argument.
6666

6767
All arguments passed to `cosmovisor run` will be passed to the application binary (as a subprocess). `cosmovisor` will return `/dev/stdout` and `/dev/stderr` of the subprocess as its own. For this reason, `cosmovisor run` cannot accept any command-line arguments other than those available to the application binary.
6868

@@ -209,7 +209,6 @@ You can also use `sha512sum` if you would prefer to use longer hashes, or `md5su
209209

210210
The following instructions provide a demonstration of `cosmovisor` using the simulation application (`simapp`) shipped with the Cosmos SDK's source code. The following commands are to be run from within the `cosmos-sdk` repository.
211211

212-
213212
### Chain Setup
214213

215214
Let's create a new chain using the `v0.44` version of simapp (the Cosmos SDK demo app):
@@ -234,7 +233,7 @@ Set up app config:
234233
```
235234

236235
Initialize the node and overwrite any previous genesis file (never do this in a production environment):
237-
236+
238237
<!-- TODO: init does not read chain-id from config -->
239238

240239
```sh
@@ -289,17 +288,15 @@ cp ./build/simd $DAEMON_HOME/cosmovisor/genesis/bin
289288

290289
Now you can run cosmovisor with simapp v0.44:
291290

292-
293291
```sh
294292
cosmovisor run start
295293
```
296294

297-
298295
#### Update App
299296

300297
Update app to the latest version (e.g. v0.45).
301298

302-
Next, we can add a migration - which is defined using `x/upgrade` [upgrade plan](https://github.com/cosmos/cosmos-sdk/blob/main/docs/core/upgrade.md) (you may refer to a past version if you are using an older Cosmos SDK release). In a migration we can do any deterministic state change.
299+
Next, we can add a migration - which is defined using `x/upgrade` [upgrade plan](https://github.com/cosmos/cosmos-sdk/blob/main/docs/core/upgrade.md) (you may refer to a past version if you are using an older Cosmos SDK release). In a migration we can do any deterministic state change.
303300

304301
Build the new version `simd` binary:
305302

@@ -314,7 +311,6 @@ mkdir -p $DAEMON_HOME/cosmovisor/upgrades/test1/bin
314311
cp ./build/simd $DAEMON_HOME/cosmovisor/upgrades/test1/bin
315312
```
316313

317-
318314
Open a new terminal window and submit an upgrade proposal along with a deposit and a vote (these commands must be run within 20 seconds of each other):
319315

320316
```sh

cosmovisor/cmd/cosmovisor/cmd/help.go

Lines changed: 0 additions & 49 deletions
This file was deleted.

cosmovisor/cmd/cosmovisor/cmd/root.go

Lines changed: 0 additions & 44 deletions
This file was deleted.

cosmovisor/cmd/cosmovisor/cmd/run_test.go

Lines changed: 0 additions & 76 deletions
This file was deleted.

cosmovisor/cmd/cosmovisor/cmd/version.go

Lines changed: 0 additions & 88 deletions
This file was deleted.

0 commit comments

Comments
 (0)