forked from TrueCloudLab/frostfs-api
[#68] Ensure compatibility of different API versions with each other.
Update linters. Signed-off-by: Ori Bruk <o.bruk@yadro.com>
This commit is contained in:
parent
5bfbd249bc
commit
c3665fc29f
13 changed files with 218 additions and 12 deletions
|
@ -10,6 +10,8 @@ jobs:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
- name: Install deps
|
- name: Install deps
|
||||||
run: |
|
run: |
|
||||||
apt update
|
apt update
|
||||||
|
|
|
@ -22,3 +22,13 @@ repos:
|
||||||
entry: make fmt
|
entry: make fmt
|
||||||
language: system
|
language: system
|
||||||
pass_filenames: false
|
pass_filenames: false
|
||||||
|
- id: make-check-version
|
||||||
|
name: Run make check-version
|
||||||
|
entry: make check-version
|
||||||
|
language: system
|
||||||
|
pass_filenames: false
|
||||||
|
- id: make-compatibility
|
||||||
|
name: Run make compatibility
|
||||||
|
entry: make compatibility
|
||||||
|
language: system
|
||||||
|
pass_filenames: false
|
||||||
|
|
10
CHANGELOG.md
10
CHANGELOG.md
|
@ -1,5 +1,15 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## [3.0] - 2024-10-08 - Potanin Glacier
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- Version compatibility information
|
||||||
|
- Linter for checking version update
|
||||||
|
- Linter for checking json files for version compatibility
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- Versioning (semver like 2.14.0 to milestone with patch like 3.0)
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
|
@ -53,6 +53,13 @@ changes. Maybe you will find it convenient to name branch in the
|
||||||
$ git checkout -b feature/123-something_awesome
|
$ git checkout -b feature/123-something_awesome
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Maintain version compatibility
|
||||||
|
After your code changes, make sure
|
||||||
|
|
||||||
|
- Increment the milestone version or patch version in case of bug fixes [Version information](version.json).
|
||||||
|
- To add information about compatibility with previous versions of the api for the new code
|
||||||
|
[Compatibility files](compatibility).
|
||||||
|
|
||||||
### Test your changes
|
### Test your changes
|
||||||
After your code changes, make sure
|
After your code changes, make sure
|
||||||
|
|
||||||
|
|
43
Makefile
43
Makefile
|
@ -3,7 +3,7 @@ SHELL=bash
|
||||||
|
|
||||||
include help.mk
|
include help.mk
|
||||||
|
|
||||||
.PHONY: doc fmt pre-commit unpre-commit pre-commit-run
|
.PHONY: doc fmt check-version compatibility pre-commit unpre-commit pre-commit-run
|
||||||
|
|
||||||
# Regenerate documentation for proto files:
|
# Regenerate documentation for proto files:
|
||||||
doc:
|
doc:
|
||||||
|
@ -22,6 +22,47 @@ fmt:
|
||||||
clang-format -i $$f; \
|
clang-format -i $$f; \
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Run version update check in version.json file
|
||||||
|
check-version:
|
||||||
|
@protoChanges=$$(git diff --name-only remotes/origin/master | grep '**/*.proto'); \
|
||||||
|
version=$$(git show remotes/origin/master:version.json); \
|
||||||
|
if [ -z "$$version" ] || [ -z "$$protoChanges" ]; then \
|
||||||
|
exit; \
|
||||||
|
fi; \
|
||||||
|
masterMilestone=$$(jq -n --argjson data "$$version" '$$data.milestone'); \
|
||||||
|
masterPatch=$$(jq -n --argjson data "$$version" '$$data.patch'); \
|
||||||
|
milestone=$$(jq -r '.milestone' version.json); \
|
||||||
|
patch=$$(jq -r '.patch' version.json); \
|
||||||
|
if [ "$$masterMilestone" -eq "$$milestone" -a "$$masterPatch" -eq "$$patch" ]; then \
|
||||||
|
echo "⇒ You need to update the api version in the version.json file"; \
|
||||||
|
exit 1; \
|
||||||
|
elif [ "$$masterMilestone" -gt "$$milestone" ]; then \
|
||||||
|
echo "⇒ The milestone cannot be decrement in the version.json file"; \
|
||||||
|
exit 1; \
|
||||||
|
elif [ "$$masterMilestone" -eq "$$milestone" -a "$$masterPatch" -gt "$$patch" ]; then \
|
||||||
|
echo "⇒ The patch cannot be decrement without milestone increment in the version.json file"; \
|
||||||
|
exit 1; \
|
||||||
|
elif [ "$$masterMilestone" -lt "$$milestone" -a "$$patch" -ne 0 ]; then \
|
||||||
|
echo "⇒ The patch should be 0 after milestone increment in the version.json file"; \
|
||||||
|
exit 1; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Run a compatibility information check \
|
||||||
|
Checks that the files that describe compatibility in the compatibility package \
|
||||||
|
have the current version information added in the version.json file
|
||||||
|
compatibility:
|
||||||
|
@version=$$(jq -r '.milestone' version.json).$$(jq -r '.patch' version.json); \
|
||||||
|
conflicts=0; \
|
||||||
|
for f in `ls **/*.json`; do \
|
||||||
|
for rpc in $$(jq -r '.[] | to_entries | .[].key' $$f); do \
|
||||||
|
if $$(jq -r '.[].'$$rpc' | has("v'$$version'") | not' $$f); then \
|
||||||
|
echo "⇒ No compatibility information found for version" $$version "in file" $$f "for rpc" $$rpc; \
|
||||||
|
conflicts=$$(($conflicts+1)); \
|
||||||
|
fi \
|
||||||
|
done \
|
||||||
|
done; \
|
||||||
|
exit $$conflicts;
|
||||||
|
|
||||||
# Activate pre-commit hooks
|
# Activate pre-commit hooks
|
||||||
pre-commit:
|
pre-commit:
|
||||||
pre-commit install --hook-type pre-commit
|
pre-commit install --hook-type pre-commit
|
||||||
|
|
9
compatibility/accounting.json
Normal file
9
compatibility/accounting.json
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"compatibilityInfo": {
|
||||||
|
"Balance": {
|
||||||
|
"v3.0": {
|
||||||
|
"compatibility": "SUPPORTED"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
19
compatibility/apemanager.json
Normal file
19
compatibility/apemanager.json
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
{
|
||||||
|
"compatibilityInfo": {
|
||||||
|
"AddChain": {
|
||||||
|
"v3.0": {
|
||||||
|
"compatibility": "SUPPORTED"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"RemoveChain": {
|
||||||
|
"v3.0": {
|
||||||
|
"compatibility": "SUPPORTED"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ListChains": {
|
||||||
|
"v3.0": {
|
||||||
|
"compatibility": "SUPPORTED"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
24
compatibility/container.json
Normal file
24
compatibility/container.json
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
{
|
||||||
|
"compatibilityInfo": {
|
||||||
|
"Put": {
|
||||||
|
"v3.0": {
|
||||||
|
"compatibility": "SUPPORTED"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Delete": {
|
||||||
|
"v3.0": {
|
||||||
|
"compatibility": "SUPPORTED"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Get": {
|
||||||
|
"v3.0": {
|
||||||
|
"compatibility": "SUPPORTED"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"List": {
|
||||||
|
"v3.0": {
|
||||||
|
"compatibility": "SUPPORTED"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
19
compatibility/netmap.json
Normal file
19
compatibility/netmap.json
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
{
|
||||||
|
"compatibilityInfo": {
|
||||||
|
"LocalNodeInfo": {
|
||||||
|
"v3.0": {
|
||||||
|
"compatibility": "SUPPORTED"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"NetworkInfo": {
|
||||||
|
"v3.0": {
|
||||||
|
"compatibility": "SUPPORTED"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"NetmapSnapshot": {
|
||||||
|
"v3.0": {
|
||||||
|
"compatibility": "SUPPORTED"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
49
compatibility/object.json
Normal file
49
compatibility/object.json
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
{
|
||||||
|
"compatibilityInfo": {
|
||||||
|
"Get": {
|
||||||
|
"v3.0": {
|
||||||
|
"compatibility": "SUPPORTED"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Put": {
|
||||||
|
"v3.0": {
|
||||||
|
"compatibility": "SUPPORTED"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Delete": {
|
||||||
|
"v3.0": {
|
||||||
|
"compatibility": "SUPPORTED"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Head": {
|
||||||
|
"v3.0": {
|
||||||
|
"compatibility": "SUPPORTED"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Search": {
|
||||||
|
"v3.0": {
|
||||||
|
"compatibility": "SUPPORTED"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"GetRange": {
|
||||||
|
"v3.0": {
|
||||||
|
"compatibility": "SUPPORTED"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"GetRangeHash": {
|
||||||
|
"v3.0": {
|
||||||
|
"compatibility": "SUPPORTED"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"PutSingle": {
|
||||||
|
"v3.0": {
|
||||||
|
"compatibility": "SUPPORTED"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Patch": {
|
||||||
|
"v3.0": {
|
||||||
|
"compatibility": "SUPPORTED"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
9
compatibility/session.json
Normal file
9
compatibility/session.json
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"compatibilityInfo": {
|
||||||
|
"Create": {
|
||||||
|
"v3.0": {
|
||||||
|
"compatibility": "SUPPORTED"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,15 +3,17 @@
|
||||||
This documents outlines the frostfs-api release process and can be used as a TODO
|
This documents outlines the frostfs-api release process and can be used as a TODO
|
||||||
list for a new release.
|
list for a new release.
|
||||||
|
|
||||||
|
## Pre-release actions
|
||||||
|
|
||||||
|
Increment the milestone version or patch version in case of bug fixes.
|
||||||
|
To add information about compatibility with previous versions of the api for the new code.
|
||||||
|
This must be run:
|
||||||
|
* `make doc`
|
||||||
|
|
||||||
## Pre-release checks
|
## Pre-release checks
|
||||||
|
|
||||||
This should run successfully:
|
This should run successfully:
|
||||||
* `make lint`
|
* `make pre-commit-run`
|
||||||
|
|
||||||
## Pre-release actions
|
|
||||||
|
|
||||||
This must be run:
|
|
||||||
* `make doc`
|
|
||||||
|
|
||||||
## Writing CHANGELOG
|
## Writing CHANGELOG
|
||||||
|
|
||||||
|
@ -30,13 +32,13 @@ Release commit summary should follow the template:
|
||||||
`Release v<Version> - <Codename island> (<Hangeul>, <Hanja>)`, e.g.:
|
`Release v<Version> - <Codename island> (<Hangeul>, <Hanja>)`, e.g.:
|
||||||
|
|
||||||
```
|
```
|
||||||
Release v2.9.0 - Anmyeondo (안면도, 安眠島)
|
Release v3.0 - Anmyeondo (안면도, 安眠島)
|
||||||
```
|
```
|
||||||
|
|
||||||
## Tag the release
|
## Tag the release
|
||||||
|
|
||||||
Use `vX.Y.Z` tag following the semantic versioning standard. For pre-release
|
Use `vX.Y` tag (milestone version with patch). For pre-release
|
||||||
versions use `vX.Y.Z-rc.N` scheme.
|
versions use `vX.Y-rc.N` scheme.
|
||||||
|
|
||||||
## Push changes and release tag to Github
|
## Push changes and release tag to Github
|
||||||
|
|
||||||
|
@ -45,7 +47,7 @@ that releasing requires admin privileges for the project), both the `master`
|
||||||
branch update and tag must be pushed simultaneously like this:
|
branch update and tag must be pushed simultaneously like this:
|
||||||
|
|
||||||
```
|
```
|
||||||
$ git push origin master v2.7.0
|
$ git push origin master v2.7
|
||||||
```
|
```
|
||||||
|
|
||||||
## Make a proper Github release
|
## Make a proper Github release
|
||||||
|
@ -58,5 +60,5 @@ releases.
|
||||||
|
|
||||||
## Post-release actions
|
## Post-release actions
|
||||||
|
|
||||||
* Close corresponding X.Y.Z Github milestone
|
* Close corresponding X.Y Github milestone
|
||||||
* Make announcements in Matrix and Discord channels
|
* Make announcements in Matrix and Discord channels
|
||||||
|
|
5
version.json
Normal file
5
version.json
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"milestone": 3,
|
||||||
|
"patch": 0,
|
||||||
|
"date": "2024-10-08"
|
||||||
|
}
|
Loading…
Reference in a new issue