Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ lint-services:
flake8 --toml-config core/pyproject.toml --black-config core/pyproject.toml examples;
# lint services
@for f in $(shell ls ${SERVICES_DIR}); do set -e; cd ${SERVICES_DIR}/$${f};poetry install --no-root --only dev; flake8 .; cd ../..; done
# lint versions
@./scripts/lint-versions.sh

test:
echo "Testing service ${service}"
Expand Down
37 changes: 37 additions & 0 deletions scripts/lint-versions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/bin/env bash

# Immediate exit on failure
set -e

echo ">> Linting SDK module versions..."

# Check all pyproject.toml files
for file in $(find . -print | sed 's|^./||' | grep -E "(^services/[^/]+/pyproject.toml$|^core/pyproject.toml$)"); do
# Extract the current version
dirpath=$(dirname "$file")
version=$(scripts/helper.sh "$dirpath")

# skip iaasalpha
case "$dirpath" in
"services/iaasalpha")
continue
;;
esac

# special handling for CDN (is in v2 by accident)
if [[ "$dirpath" == "services/cdn" ]]; then
if [[ ! "$version" =~ ^v[0-2]\.[0-9]+\.[0-9]+$ ]]; then
echo ">> $dirpath"
echo "The version '$version' is invalid."
exit 1
fi
continue
fi

# verify version
if [[ ! "$version" =~ ^v[0-1]\.[0-9]+\.[0-9]+$ ]]; then
echo ">> $dirpath"
echo "The version '$version' is invalid."
exit 1
fi
done