Skip to content

Commit c09eb82

Browse files
authored
docs: Add release process details and workflow (#353)
* docs: Add release process details and workflow * chore(docs): Extract detailed docs from README.md * chore: Update process w latest feedback; Remove chglog Makefile directive * chore: Apply go-mod manipulation recommendations to build process/docs * fix: repair link after document was relocated
1 parent 11d0ef1 commit c09eb82

File tree

4 files changed

+94
-53
lines changed

4 files changed

+94
-53
lines changed

Makefile

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ lint:
6666
.PHONY: visor
6767
visor:
6868
rm -f visor
69-
go build $(GOFLAGS) -o visor .
69+
go build $(GOFLAGS) -o visor -mod=readonly .
7070

7171
BINS+=visor
7272

@@ -84,10 +84,6 @@ dist-clean:
8484
git submodule deinit --all -f
8585
.PHONY: dist-clean
8686

87-
.PHONY: changelog
88-
changelog:
89-
go run github.com/git-chglog/git-chglog/cmd/git-chglog -o CHANGELOG.md
90-
9187
test-coverage:
9288
VISOR_TEST_DB="postgres://postgres:password@localhost:5432/postgres?sslmode=disable" go test -coverprofile=coverage.out ./...
9389
.PHONY: test-coverage

README.md

Lines changed: 3 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ A component of [**Sentinel**](https://github.com/filecoin-project/sentinel), a c
55

66
A **Visor** process collects _permanent_ Filecoin chain meterics from a [**Lotus**](https://github.com/filecoin-project/lotus/) daemon, and writes them to a [**TimescaleDB**](https://github.com/timescale/timescaledb) time-series and relational datastore.
77

8-
98
## Getting Started
109

1110
Clone the repo and build the dependencies:
@@ -113,61 +112,17 @@ or by specifying the following flags:
113112
--jaeger-sampler-type=const jaeger-sampler-param=1
114113
```
115114

116-
## Deployment
117-
118-
### Schema Migrations
119-
120-
The database schema is versioned and every change requires a migration script to be executed. See [storage/migrations/README.md](storage/migrations/README.md) for more information.
121-
122-
### Checking current schema version
123-
124-
The visor `migrate` subcommand compares the **database schema version** to the **latest schema version** and reports any differences.
125-
It also verifies that the **database schema** matches the requirements of the models used by visor. It is safe to run and will not alter the database.
126-
127-
Visor also verifies that the schema is compatible when the index or process subcommands are executed.
128-
129-
### Migrating schema to latest version
130-
131-
To migrate a database schema to the latest version, run:
132-
133-
visor migrate --latest
134-
135-
Visor will only migrate a schema if it determines that it has exclusive access to the database.
136-
137-
Visor can also be configured to automatically migrate the database when indexing or processing by passing the `--allow-schema-migration` flag.
138-
139-
### Reverting a schema migration
140-
141-
To revert to an earlier version, run:
142-
143-
visor migrate --to <version>
144-
145-
**WARNING: reverting a migration is very likely to lose data in tables and columns that are not present in the earlier version**
146-
147-
148115
## Versioning and Releases
149116

150117
Feature branches and master are designated as **unstable** which are internal-only development builds.
151118

152119
Periodically a build will be designated as **stable** and will be assigned a version number by tagging the repository
153120
using Semantic Versioning in the following format: `vMajor.Minor.Patch`.
154-
155-
### Release Process
156-
157-
Between releases we keep track of notable changes in CHANGELOG.md.
158-
159-
When we want to make a release we should update CHANGELOG.md to contain the release notes for the planned release in a section for
160-
the proposed release number. This update is the commit that will be tagged with as the actual release which ensures that each release
161-
contains a copy of it's own release notes.
162-
163-
We should also copy the release notes to the Github releases page, but CHANGELOG.md is the primary place to keep the release notes.
164-
165-
The release commit should be tagged with a signed tag:
166-
167-
git tag -s vx.x.x
168-
git push --tags
169121

122+
## Other Topics
170123

124+
- [Release Management](docs/release_management.md)
125+
- [Schema/Migration Management](docs/migrations.md)
171126

172127
## Code of Conduct
173128

docs/migrations.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Schema Migrations
2+
3+
The database schema is versioned and every change requires a migration script to be executed. See [../storage/migrations/README.md](../storage/migrations/README.md) for more information.
4+
5+
## Checking current schema version
6+
7+
The visor `migrate` subcommand compares the **database schema version** to the **latest schema version** and reports any differences.
8+
It also verifies that the **database schema** matches the requirements of the models used by visor. It is safe to run and will not alter the database.
9+
10+
Visor also verifies that the schema is compatible when the index or process subcommands are executed.
11+
12+
## Migrating schema to latest version
13+
14+
To migrate a database schema to the latest version, run:
15+
16+
visor migrate --latest
17+
18+
Visor will only migrate a schema if it determines that it has exclusive access to the database.
19+
20+
Visor can also be configured to automatically migrate the database when indexing or processing by passing the `--allow-schema-migration` flag.
21+
22+
## Reverting a schema migration
23+
24+
To revert to an earlier version, run:
25+
26+
visor migrate --to <version>
27+
28+
**WARNING: reverting a migration is very likely to lose data in tables and columns that are not present in the earlier version**
29+

docs/release_management.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Release Process
2+
3+
Between releases we keep track of notable changes in CHANGELOG.md.
4+
5+
When we want to make a release we should update CHANGELOG.md to contain the release notes for the planned release in a section for
6+
the proposed release number. This update is the commit that will be tagged with as the actual release which ensures that each release
7+
contains a copy of it's own release notes.
8+
9+
We should also copy the release notes to the Github releases page, but CHANGELOG.md is the primary place to keep the release notes.
10+
11+
The release commit should be tagged with an annotated and signed tag:
12+
13+
git tag -asm vx.x.x vx.x.x
14+
git push --tags
15+
16+
A non-prescriptive example of the release process might look like the following:
17+
18+
```sh
19+
git checkout master
20+
git pull # checkout/pull latest master
21+
git checkout -b vX.Y.Z(-rcN)-release # create release branch
22+
vi CHANGELOG.md # update CHANGELOG.md
23+
go mod tidy # ensure tidy go.mod for release
24+
make visor # validate build
25+
git add CHANGELOG.md go.mod go.sum
26+
git commit -m "chore(docs): Update CHANGELOG for vX.Y.Z(-rcN)"
27+
# commit CHANGELOG/go.mod updates
28+
git tag -asm vX.Y.Z-rcN vX.Y.Z(-rcN) # create signed/annotated tag
29+
git push --tags origin vX.Y.Z(-rcN)-release
30+
# push release branch and tags
31+
```
32+
33+
NOTE: `sentinel-visor` pull requests prefer to be squash-merged into `master`, however considering this workflow tags release candidate within the release branch which we want to easily resolve in the repository's history, it is preferred to not squash and instead merge the release branch into `master`.
34+
35+
36+
## Updating CHANGELOG.md
37+
38+
The format is a variant of [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) combined with categories from [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/). This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). The [github.com/git-chglog](https://github.com/git-chglog/git-chglog) utility assists us with maintaing CHANGELOG.md.
39+
40+
The sections within each release have a preferred order which prioritizes by largest-user-impact-first: `Feat > Refactor > Fix > {Area-specific or Custom Sections} > Chore`
41+
42+
Here is an example workflow of how CHANGELOG.md might be updated.
43+
44+
```sh
45+
# checkout master and pull latest changes
46+
git checkout master
47+
git pull
48+
49+
# output the CHANGELOG content for the next release (assuming next release is v0.5.0-rc1)
50+
go run github.com/git-chglog/git-chglog/cmd/git-chglog -o CHANGELOG_updates.md --next-tag v0.5.0-rc1
51+
52+
# reconcile CHANGELOG_updates.md into CHANGELOG.md applying the preferred section order
53+
vi CHANGELOG*.md
54+
rm CHANGELOG_updates.md
55+
56+
# commit changes
57+
git add CHANGELOG.md
58+
git commit -m 'chore(docs): Update CHANGELOG for v0.5.0-rc1'
59+
```
60+
61+
Here is an [example of how the diff might look](https://github.com/filecoin-project/sentinel-visor/pull/326/commits/9536df9e39991a3b78013d1d1b36fef94562556d).

0 commit comments

Comments
 (0)