From dc361be9e3ffa737a445503a5fd5479fda7ee086 Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Sat, 20 Aug 2022 03:06:01 +0200 Subject: [PATCH] docs(cosmovisor): updates docs about path name (#12921) ## Description Follow-up of #12918 - Add documentation for normalized upgrade name path. - Update goreleaser as version is got at build. --- ### 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... - [ ] 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 - [ ] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/main/CONTRIBUTING.md#pr-targeting)) - [ ] 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) - [ ] added a changelog entry to `CHANGELOG.md` - [ ] included comments for [documenting Go code](https://blog.golang.org/godoc) - [ ] updated the relevant documentation or specification - [ ] 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) --- cosmovisor/.goreleaser.yml | 6 ++---- cosmovisor/CHANGELOG.md | 6 +----- cosmovisor/README.md | 20 +++++++++---------- cosmovisor/RELEASE_NOTES.md | 1 - cosmovisor/scanner.go | 3 +++ cosmovisor/scanner_test.go | 7 ++++--- .../{f2-good.json => f2-normalized-name.json} | 0 7 files changed, 20 insertions(+), 23 deletions(-) rename cosmovisor/testdata/upgrade-files/{f2-good.json => f2-normalized-name.json} (100%) diff --git a/cosmovisor/.goreleaser.yml b/cosmovisor/.goreleaser.yml index c2b7a3331c..547c4bfafc 100644 --- a/cosmovisor/.goreleaser.yml +++ b/cosmovisor/.goreleaser.yml @@ -10,8 +10,6 @@ before: builds: - main: ./cmd/cosmovisor - ldflags: - - -X 'github.com/cosmos/cosmos-sdk/cosmovisor/cmd/cosmovisor/cmd.Version={{ replace .Version "cosmovisor/" "" }}' goos: - linux - windows @@ -36,5 +34,5 @@ changelog: sort: asc filters: exclude: - - '^docs:' - - '^test:' + - "^docs:" + - "^test:" diff --git a/cosmovisor/CHANGELOG.md b/cosmovisor/CHANGELOG.md index ddcb744ed7..c58e814dec 100644 --- a/cosmovisor/CHANGELOG.md +++ b/cosmovisor/CHANGELOG.md @@ -35,13 +35,9 @@ Ref: https://keepachangelog.com/en/1.0.0/ # Changelog ## [Unreleased] - -## v1.2.1 2022-08-15 - -* [\12918](https://github.com/cosmos/cosmos-sdk/pull/12918) Fix failure when installing cosmovisor via `go install`. +* [\12921](https://github.com/cosmos/cosmos-sdk/pull/12918) Add documentation about expected plan path name. * [\12918](https://github.com/cosmos/cosmos-sdk/pull/12918) Automatically set version using module version. -* [\12918](https://github.com/cosmos/cosmos-sdk/pull/12918) Fix plan path case sensitivity issue. ## v1.2.0 2022-07-26 diff --git a/cosmovisor/README.md b/cosmovisor/README.md index 76614f9160..f9f0ddb788 100644 --- a/cosmovisor/README.md +++ b/cosmovisor/README.md @@ -6,17 +6,17 @@ * [Design](#design) * [Contributing](#contributing) * [Setup](#setup) - * [Installation](#installation) - * [Command Line Arguments And Environment Variables](#command-line-arguments-and-environment-variables) - * [Folder Layout](#folder-layout) + * [Installation](#installation) + * [Command Line Arguments And Environment Variables](#command-line-arguments-and-environment-variables) + * [Folder Layout](#folder-layout) * [Usage](#usage) - * [Initialization](#initialization) - * [Detecting Upgrades](#detecting-upgrades) - * [Auto-Download](#auto-download) + * [Initialization](#initialization) + * [Detecting Upgrades](#detecting-upgrades) + * [Auto-Download](#auto-download) * [Example: SimApp Upgrade](#example-simapp-upgrade) - * [Chain Setup](#chain-setup) - * [Prepare Cosmovisor and Start the Chain](#prepare-cosmovisor-and-start-the-chain) - * [Update App](#update-app) + * [Chain Setup](#chain-setup) + * [Prepare Cosmovisor and Start the Chain](#prepare-cosmovisor-and-start-the-chain) + * [Update App](#update-app) ## Design @@ -115,7 +115,7 @@ All arguments passed to `cosmovisor run` will be passed to the application binar └── upgrade-info.json ``` -The `cosmovisor/` directory incudes a subdirectory for each version of the application (i.e. `genesis` or `upgrades/`). Within each subdirectory is the application binary (i.e. `bin/$DAEMON_NAME`) and any additional auxiliary files associated with each binary. `current` is a symbolic link to the currently active directory (i.e. `genesis` or `upgrades/`). The `name` variable in `upgrades/` is the URI-encoded name of the upgrade as specified in the upgrade module plan. +The `cosmovisor/` directory incudes a subdirectory for each version of the application (i.e. `genesis` or `upgrades/`). Within each subdirectory is the application binary (i.e. `bin/$DAEMON_NAME`) and any additional auxiliary files associated with each binary. `current` is a symbolic link to the currently active directory (i.e. `genesis` or `upgrades/`). The `name` variable in `upgrades/` is the lowercased URI-encoded name of the upgrade as specified in the upgrade module plan. Note that the upgrade name path are normalized to be lowercased: for instance, `MyUpgrade` is normalized to `myupgrade`, and its path is `upgrades/myupgrade`. Please note that `$DAEMON_HOME/cosmovisor` only stores the *application binaries*. The `cosmovisor` binary itself can be stored in any typical location (e.g. `/usr/local/bin`). The application will continue to store its data in the default data directory (e.g. `$HOME/.gaiad`) or the data directory specified with the `--home` flag. `$DAEMON_HOME` is independent of the data directory and can be set to any location. If you set `$DAEMON_HOME` to the same directory as the data directory, you will end up with a configuation like the following: diff --git a/cosmovisor/RELEASE_NOTES.md b/cosmovisor/RELEASE_NOTES.md index c5614e2219..0dfc925401 100644 --- a/cosmovisor/RELEASE_NOTES.md +++ b/cosmovisor/RELEASE_NOTES.md @@ -3,7 +3,6 @@ ### Bug Fixes * Fix failure when installing cosmovisor via `go install`. -* Fix plan path case sensitivity issue. ### Changelog diff --git a/cosmovisor/scanner.go b/cosmovisor/scanner.go index 14bc316301..f5fc3be741 100644 --- a/cosmovisor/scanner.go +++ b/cosmovisor/scanner.go @@ -158,5 +158,8 @@ func parseUpgradeInfoFile(filename string) (upgradetypes.Plan, error) { return upgradetypes.Plan{}, fmt.Errorf("invalid upgrade-info.json content; name and height must be not empty; got: %v", ui) } + // normalize name to prevent operator error in upgrade name case sensitivity errors. + ui.Name = strings.ToLower(ui.Name) + return ui, err } diff --git a/cosmovisor/scanner_test.go b/cosmovisor/scanner_test.go index f98d5707ac..a58ebc1a9b 100644 --- a/cosmovisor/scanner_test.go +++ b/cosmovisor/scanner_test.go @@ -21,8 +21,8 @@ func TestParseUpgradeInfoFile(t *testing.T) { expectErr: false, }, { - filename: "f2-good.json", - expectUpgrade: upgradetypes.Plan{Name: "Upgrade2", Info: "some info", Height: 125}, + filename: "f2-normalized-name.json", + expectUpgrade: upgradetypes.Plan{Name: "upgrade2", Info: "some info", Height: 125}, expectErr: false, }, { @@ -59,7 +59,8 @@ func TestParseUpgradeInfoFile(t *testing.T) { filename: "unknown.json", expectUpgrade: upgradetypes.Plan{}, expectErr: true, - }} + }, + } for i := range cases { tc := cases[i] diff --git a/cosmovisor/testdata/upgrade-files/f2-good.json b/cosmovisor/testdata/upgrade-files/f2-normalized-name.json similarity index 100% rename from cosmovisor/testdata/upgrade-files/f2-good.json rename to cosmovisor/testdata/upgrade-files/f2-normalized-name.json