[#68] Fix version linter.
Some checks failed
Formatters / Run fmt (pull_request) Successful in 25s
Pre-commit hooks / Pre-commit (pull_request) Failing after 35s
DCO action / DCO (pull_request) Successful in 40s

Signed-off-by: Ori Bruk <o.bruk@yadro.com>
This commit is contained in:
Ori Bruk 2024-10-23 12:34:42 +03:00
parent 68eee8bfbc
commit ad87868ce2
3 changed files with 11 additions and 27 deletions

View file

@ -22,9 +22,9 @@ repos:
entry: make fmt
language: system
pass_filenames: false
- id: make-version
name: Run make version
entry: make version
- id: make-vsn
name: Run make vsn
entry: make vsn
language: system
pass_filenames: false
- id: make-compatibility

View file

@ -1,6 +1,6 @@
# Changelog
## [3.0] - 2024-10-08 - Oryukdo (오륙도, 五六島)
## [3.0] - 2024-10-08 - Potanin Glacier
### Added
- Version compatibility information

View file

@ -3,7 +3,7 @@ SHELL=bash
include help.mk
.PHONY: doc fmt version compatibility pre-commit unpre-commit pre-commit-run
.PHONY: doc fmt vsn compatibility pre-commit unpre-commit pre-commit-run
# Regenerate documentation for proto files:
doc:
@ -23,28 +23,12 @@ fmt:
done
# Run version update check
version:
@version=$$(wget -qO- "https://git.frostfs.info/TrueCloudLab/frostfs-api/raw/branch/master/version.json"); \
if [ -z "$$version" ]; 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
vsn:
@diff=$$(git diff-index master version.json); \
if [[ -z "$$diff" ]]; then \
echo "⇒ You need to update the api version in the version.json file"; \
exit 1;\
fi
# Run compatibility information check
compatibility: