mirror of
https://github.com/FuzzingLabs/fuzzforge_ai.git
synced 2026-03-13 09:05:59 +00:00
build(makefile): fix build-modules version parsing and image tag
Use grep -m1 with '^version\s*=' and improved sed to extract and trim package versions. Default to 0.0.1 when no version is found. Introduce SDK_IMG so BASE_IMG_PREFIX is applied to the SDK image tag and use it as the --build-arg BASE_IMAGE for module builds. Skip the SDK directory and the module template directory when iterating modules.
This commit is contained in:
15
Makefile
15
Makefile
@@ -83,22 +83,25 @@ build-modules:
|
||||
BASE_IMG_PREFIX=""; \
|
||||
fi; \
|
||||
SDK_DIR="fuzzforge-modules/fuzzforge-modules-sdk/"; \
|
||||
SDK_VERSION=$$(grep 'version' "$${SDK_DIR}pyproject.toml" 2>/dev/null | head -1 | sed 's/version = //;s/"//g' || echo "0.0.1"); \
|
||||
SDK_VERSION=$$(grep -m1 '^version\s*=' "$${SDK_DIR}pyproject.toml" 2>/dev/null | sed 's/^version\s*=\s*//;s/"//g;s/\s*$$//' ); \
|
||||
[ -n "$$SDK_VERSION" ] || SDK_VERSION="0.0.1"; \
|
||||
echo "Building wheels for fuzzforge-modules-sdk..."; \
|
||||
(cd "$$SDK_DIR" && uv build --wheel --out-dir .wheels) || exit 1; \
|
||||
echo "Building fuzzforge-modules-sdk:$$SDK_VERSION..."; \
|
||||
$$CONTAINER_CMD build -t "fuzzforge-modules-sdk:$$SDK_VERSION" "$$SDK_DIR" || exit 1; \
|
||||
SDK_IMG="$${BASE_IMG_PREFIX}fuzzforge-modules-sdk:$$SDK_VERSION"; \
|
||||
echo "Building $$SDK_IMG..."; \
|
||||
$$CONTAINER_CMD build -t "$$SDK_IMG" "$$SDK_DIR" || exit 1; \
|
||||
for module in fuzzforge-modules/*/; do \
|
||||
[ "$$module" = "$$SDK_DIR" ] || [ ! -f "$$module/Dockerfile" ] && continue; \
|
||||
if [ "$$module" = "$$SDK_DIR" ] || [ "$$module" = "fuzzforge-modules/fuzzforge-module-template/" ] || [ ! -f "$$module/Dockerfile" ]; then continue; fi; \
|
||||
name=$$(basename $$module); \
|
||||
version=$$(grep 'version' "$$module/pyproject.toml" 2>/dev/null | head -1 | sed 's/version = //;s/"//g'); \
|
||||
version=$$(grep -m1 '^version\s*=' "$$module/pyproject.toml" 2>/dev/null | sed 's/^version\s*=\s*//;s/"//g;s/\s*$$//'); \
|
||||
[ -n "$$version" ] || version="0.0.1"; \
|
||||
case $$name in \
|
||||
fuzzforge-*) tag="$$name:$$version" ;; \
|
||||
*) tag="fuzzforge-$$name:$$version" ;; \
|
||||
esac; \
|
||||
echo "Building $$tag..."; \
|
||||
$$CONTAINER_CMD build \
|
||||
--build-arg BASE_IMAGE="$${BASE_IMG_PREFIX}fuzzforge-modules-sdk:$$SDK_VERSION" \
|
||||
--build-arg BASE_IMAGE="$$SDK_IMG" \
|
||||
-t "$$tag" "$$module" || exit 1; \
|
||||
done
|
||||
@echo ""
|
||||
|
||||
Reference in New Issue
Block a user