[#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 entry: make fmt
language: system language: system
pass_filenames: false pass_filenames: false
- id: make-version - id: make-vsn
name: Run make version name: Run make vsn
entry: make version entry: make vsn
language: system language: system
pass_filenames: false pass_filenames: false
- id: make-compatibility - id: make-compatibility

View file

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

View file

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