forked from TrueCloudLab/frostfs-api
Compare commits
2 commits
ce37ce12d6
...
b0df4dfc4d
Author | SHA1 | Date | |
---|---|---|---|
|
b0df4dfc4d | ||
|
c3665fc29f |
1 changed files with 9 additions and 19 deletions
28
Makefile
28
Makefile
|
@ -1,8 +1,6 @@
|
|||
#!/usr/bin/make -f
|
||||
SHELL=bash
|
||||
|
||||
VERSION_CHECK_BRANCH ?=$(shell git describe --tags --match "version-check*" 2>/dev/null || echo "remotes/origin/master")
|
||||
|
||||
include help.mk
|
||||
|
||||
.PHONY: doc fmt check-version compatibility pre-commit unpre-commit pre-commit-run
|
||||
|
@ -26,8 +24,8 @@ fmt:
|
|||
|
||||
# Run version update check in version.json file
|
||||
check-version:
|
||||
@protoChanges=$$(git diff --name-only $(VERSION_CHECK_BRANCH) | grep '**/*.proto'); \
|
||||
version=$$(git show $(VERSION_CHECK_BRANCH):version.json); \
|
||||
@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; \
|
||||
|
@ -38,32 +36,24 @@ check-version:
|
|||
if [ "$$masterMilestone" -eq "$$milestone" -a "$$masterPatch" -eq "$$patch" ]; then \
|
||||
echo "⇒ You need to update the api version in the version.json file"; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
if [ "$$masterMilestone" -gt "$$milestone" ]; then \
|
||||
elif [ "$$masterMilestone" -gt "$$milestone" ]; then \
|
||||
echo "⇒ The milestone cannot be decrement in the version.json file"; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
if [ "$$masterMilestone" -eq "$$milestone" -a "$$masterPatch" -gt "$$patch" ]; then \
|
||||
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; \
|
||||
fi; \
|
||||
if [ "$$masterMilestone" -lt "$$milestone" -a "$$patch" -ne 0 ]; then \
|
||||
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.
|
||||
# Description of logic:
|
||||
# 1. Determine the current API version from the version.json file;
|
||||
# 2. Find all JSON files with compatibility descriptions in the compatibility package;
|
||||
# 3. For each such file, we define all the described rpc methods;
|
||||
# 4. For each rpc method in each compatibility file, we check that the updated version information is present.
|
||||
# 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 compatibility/*.json`; do \
|
||||
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; \
|
||||
|
|
Loading…
Add table
Reference in a new issue