mirror of
https://github.com/FuzzingLabs/fuzzforge_ai.git
synced 2026-03-13 16:36:06 +00:00
Compare commits
5 Commits
feature/hu
...
fix/module
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
712b91ccb3 | ||
|
|
3d394ddbab | ||
|
|
854f1e5631 | ||
|
|
251e6b860d | ||
|
|
1f3ffa8881 |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -8,5 +8,8 @@
|
||||
.vscode
|
||||
__pycache__
|
||||
|
||||
# Build artifacts
|
||||
**/build/
|
||||
|
||||
# Podman/Docker container storage artifacts
|
||||
~/.fuzzforge/
|
||||
|
||||
73
Makefile
73
Makefile
@@ -1,7 +1,14 @@
|
||||
.PHONY: help install sync format lint typecheck test build-modules clean
|
||||
.PHONY: help install sync format lint typecheck test build-modules build-modules-sdk build-modules-images clean
|
||||
|
||||
SHELL := /bin/bash
|
||||
|
||||
# Container image configuration
|
||||
SDK_DIR := fuzzforge-modules/fuzzforge-modules-sdk/
|
||||
MODULE_TEMPLATE := fuzzforge-modules/fuzzforge-module-template/
|
||||
SDK_VERSION := $(shell scripts/pyproject-version.sh $(SDK_DIR)pyproject.toml)
|
||||
BASE_IMG_PREFIX := $(if $(filter podman,$(FUZZFORGE_ENGINE)),localhost/,)
|
||||
SDK_IMG := $(BASE_IMG_PREFIX)fuzzforge-modules-sdk:$(SDK_VERSION)
|
||||
|
||||
# Default target
|
||||
help:
|
||||
@echo "FuzzForge OSS Development Commands"
|
||||
@@ -13,6 +20,8 @@ help:
|
||||
@echo " make typecheck - Type check with mypy"
|
||||
@echo " make test - Run all tests"
|
||||
@echo " make build-modules - Build all module container images"
|
||||
@echo " make build-modules-sdk - Build the SDK base image"
|
||||
@echo " make build-modules-images - Build all module images (requires SDK image)"
|
||||
@echo " make clean - Clean build artifacts"
|
||||
@echo ""
|
||||
|
||||
@@ -64,40 +73,40 @@ test:
|
||||
fi \
|
||||
done
|
||||
|
||||
# Build all module container images
|
||||
# Build all module container images (SDK first, then modules)
|
||||
# Uses Docker by default, or Podman if FUZZFORGE_ENGINE=podman
|
||||
build-modules:
|
||||
@echo "Building FuzzForge module images..."
|
||||
@if [ "$$FUZZFORGE_ENGINE" = "podman" ]; then \
|
||||
if [ -n "$$SNAP" ]; then \
|
||||
echo "Using Podman with isolated storage (Snap detected)"; \
|
||||
CONTAINER_CMD="podman --root ~/.fuzzforge/containers/storage --runroot ~/.fuzzforge/containers/run"; \
|
||||
else \
|
||||
echo "Using Podman"; \
|
||||
CONTAINER_CMD="podman"; \
|
||||
fi; \
|
||||
else \
|
||||
echo "Using Docker"; \
|
||||
CONTAINER_CMD="docker"; \
|
||||
fi; \
|
||||
for module in fuzzforge-modules/*/; do \
|
||||
if [ -f "$$module/Dockerfile" ] && \
|
||||
[ "$$module" != "fuzzforge-modules/fuzzforge-modules-sdk/" ] && \
|
||||
[ "$$module" != "fuzzforge-modules/fuzzforge-module-template/" ]; then \
|
||||
name=$$(basename $$module); \
|
||||
version=$$(grep 'version' "$$module/pyproject.toml" 2>/dev/null | head -1 | sed 's/.*"\(.*\\)".*/\\1/' || echo "0.1.0"); \
|
||||
echo "Building $$name:$$version..."; \
|
||||
$$CONTAINER_CMD build -t "fuzzforge-$$name:$$version" "$$module" || exit 1; \
|
||||
fi \
|
||||
done
|
||||
build-modules: build-modules-sdk build-modules-images
|
||||
@echo ""
|
||||
@echo "✓ All modules built successfully!"
|
||||
|
||||
# Build the SDK base image (also builds its Python wheel)
|
||||
build-modules-sdk:
|
||||
@source scripts/container-env.sh; \
|
||||
echo "Building wheels for fuzzforge-modules-sdk..."; \
|
||||
(cd "$(SDK_DIR)" && uv build --wheel --out-dir .wheels) || exit 1; \
|
||||
echo "Building $(SDK_IMG)..."; \
|
||||
$$CONTAINER_CMD build -t "$(SDK_IMG)" "$(SDK_DIR)" || exit 1
|
||||
|
||||
# Build all module images (requires SDK image to exist)
|
||||
build-modules-images:
|
||||
@source scripts/container-env.sh; \
|
||||
for module in fuzzforge-modules/*/; do \
|
||||
[ "$$module" = "$(SDK_DIR)" ] && continue; \
|
||||
[ "$$module" = "$(MODULE_TEMPLATE)" ] && continue; \
|
||||
[ -f "$$module/Dockerfile" ] || continue; \
|
||||
name=$$(basename "$$module"); \
|
||||
version=$$(scripts/pyproject-version.sh "$$module/pyproject.toml"); \
|
||||
case $$name in \
|
||||
fuzzforge-*) tag="$$name:$$version" ;; \
|
||||
*) tag="fuzzforge-$$name:$$version" ;; \
|
||||
esac; \
|
||||
echo "Building $$tag..."; \
|
||||
$$CONTAINER_CMD build --build-arg BASE_IMAGE="$(SDK_IMG)" -t "$$tag" "$$module" || exit 1; \
|
||||
done
|
||||
|
||||
# Clean build artifacts
|
||||
clean:
|
||||
find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true
|
||||
find . -type d -name ".pytest_cache" -exec rm -rf {} + 2>/dev/null || true
|
||||
find . -type d -name ".mypy_cache" -exec rm -rf {} + 2>/dev/null || true
|
||||
find . -type d -name ".ruff_cache" -exec rm -rf {} + 2>/dev/null || true
|
||||
find . -type d -name "*.egg-info" -exec rm -rf {} + 2>/dev/null || true
|
||||
find . -type f -name "*.pyc" -delete 2>/dev/null || true
|
||||
@for dir in __pycache__ .pytest_cache .mypy_cache .ruff_cache "*.egg-info"; do \
|
||||
find . -type d -name "$$dir" -exec rm -rf {} + 2>/dev/null || true; \
|
||||
done
|
||||
@find . -type f -name "*.pyc" -delete 2>/dev/null || true
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
FROM localhost/fuzzforge-modules-sdk:0.1.0
|
||||
ARG BASE_IMAGE=fuzzforge-modules-sdk:0.0.1
|
||||
FROM ${BASE_IMAGE}
|
||||
|
||||
# Module metadata is now read from pyproject.toml [tool.fuzzforge.module] section
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
FROM localhost/fuzzforge-modules-sdk:0.1.0
|
||||
ARG BASE_IMAGE=fuzzforge-modules-sdk:0.0.1
|
||||
FROM ${BASE_IMAGE}
|
||||
|
||||
# Module metadata is now read from pyproject.toml [tool.fuzzforge.module] section
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
FROM localhost/fuzzforge-modules-sdk:0.1.0
|
||||
ARG BASE_IMAGE=fuzzforge-modules-sdk:0.0.1
|
||||
FROM ${BASE_IMAGE}
|
||||
|
||||
# Module metadata is now read from pyproject.toml [tool.fuzzforge.module] section
|
||||
# See MODULE_METADATA.md for documentation on configuring metadata
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
FROM localhost/fuzzforge-modules-sdk:0.1.0
|
||||
ARG BASE_IMAGE=fuzzforge-modules-sdk:0.0.1
|
||||
FROM ${BASE_IMAGE}
|
||||
|
||||
# Module metadata is now read from pyproject.toml [tool.fuzzforge.module] section
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
FROM localhost/fuzzforge-modules-sdk:0.1.0
|
||||
ARG BASE_IMAGE=fuzzforge-modules-sdk:0.0.1
|
||||
FROM ${BASE_IMAGE}
|
||||
|
||||
# Module metadata is now read from pyproject.toml [tool.fuzzforge.module] section
|
||||
|
||||
|
||||
19
scripts/container-env.sh
Executable file
19
scripts/container-env.sh
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env bash
|
||||
# Resolve the container engine based on FUZZFORGE_ENGINE env var.
|
||||
# Usage: source scripts/container-env.sh
|
||||
# Exports: CONTAINER_CMD
|
||||
|
||||
if [ "${FUZZFORGE_ENGINE}" = "podman" ]; then
|
||||
if [ -n "${SNAP}" ]; then
|
||||
echo "Using Podman with isolated storage (Snap detected)"
|
||||
CONTAINER_CMD="podman --root ~/.fuzzforge/containers/storage --runroot ~/.fuzzforge/containers/run"
|
||||
else
|
||||
echo "Using Podman"
|
||||
CONTAINER_CMD="podman"
|
||||
fi
|
||||
else
|
||||
echo "Using Docker"
|
||||
CONTAINER_CMD="docker"
|
||||
fi
|
||||
|
||||
export CONTAINER_CMD
|
||||
12
scripts/pyproject-version.sh
Executable file
12
scripts/pyproject-version.sh
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
# Extract the version from a pyproject.toml file.
|
||||
# Usage: pyproject-version.sh <path/to/pyproject.toml> [default]
|
||||
# Prints the version string, or the default (0.0.1) if not found.
|
||||
|
||||
PYPROJECT="${1:?Usage: pyproject-version.sh <pyproject.toml> [default]}"
|
||||
DEFAULT="${2:-0.0.1}"
|
||||
|
||||
version=$(grep -m1 '^version\s*=' "${PYPROJECT}" 2>/dev/null \
|
||||
| sed 's/^version\s*=\s*//;s/"//g;s/\s*$//')
|
||||
|
||||
echo "${version:-${DEFAULT}}"
|
||||
Reference in New Issue
Block a user