Compare commits

...

6 Commits

Author SHA1 Message Date
abel
712b91ccb3 feat(makefile): add module build targets and helper scripts
Split module image build into build-modules-sdk and
build-modules-images; build-modules
now depends on both. Factor container engine detection and version
parsing into
scripts/container-env.sh and scripts/pyproject-version.sh respectively.
Add Makefile
variables for SDK/module paths and image naming, update help output, and
simplify
clean target to remove common caches and .pyc files.
2026-03-10 12:50:16 +01:00
abel
3d394ddbab 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.
2026-03-10 12:33:33 +01:00
abel
854f1e5631 build(fuzzforge-modules): parameterize module dockerfile base image
replace hardcoded localhost/fuzzforge-modules-sdk:0.1.0 with a
configurable
ARG BASE_IMAGE and use FROM ${BASE_IMAGE}. default ARG is
fuzzforge-modules-sdk:0.0.1. updated Dockerfiles: cargo-fuzzer,
crash-analyzer, fuzzforge-module-template, harness-tester,
rust-analyzer.
2026-03-09 17:00:18 +01:00
abel
251e6b860d chore(git): ignore build artifacts
Add **/build/ pattern and a descriptive comment to .gitignore to
exclude build directories from version control.
2026-03-09 16:59:45 +01:00
abel
1f3ffa8881 build(makefile): improve build-modules
Build the fuzzforge-modules-sdk wheel and image and derive
SDK_VERSION from pyproject.toml to use as the base image for other
module builds (passed via --build-arg BASE_IMAGE). Set BASE_IMG_PREFIX
to "localhost/" when using Podman so local images are referenced
correctly. Streamline module loop to skip the SDK dir, require a
Dockerfile, preserve existing "fuzzforge-*" names, and consistently
tag images as fuzzforge-<name>:<version>
2026-03-09 16:59:31 +01:00
AFredefon
c6e9557541 Merge pull request #41 from FuzzingLabs/cleanup/remove-dead-code
refactor: remove dead code from OSS
2026-02-18 01:39:40 +01:00
9 changed files with 85 additions and 37 deletions

3
.gitignore vendored
View File

@@ -8,5 +8,8 @@
.vscode .vscode
__pycache__ __pycache__
# Build artifacts
**/build/
# Podman/Docker container storage artifacts # Podman/Docker container storage artifacts
~/.fuzzforge/ ~/.fuzzforge/

View File

@@ -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 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 # Default target
help: help:
@echo "FuzzForge OSS Development Commands" @echo "FuzzForge OSS Development Commands"
@@ -13,6 +20,8 @@ help:
@echo " make typecheck - Type check with mypy" @echo " make typecheck - Type check with mypy"
@echo " make test - Run all tests" @echo " make test - Run all tests"
@echo " make build-modules - Build all module container images" @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 " make clean - Clean build artifacts"
@echo "" @echo ""
@@ -64,40 +73,40 @@ test:
fi \ fi \
done 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 # Uses Docker by default, or Podman if FUZZFORGE_ENGINE=podman
build-modules: build-modules: build-modules-sdk build-modules-images
@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
@echo "" @echo ""
@echo "✓ All modules built successfully!" @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 build artifacts
clean: clean:
find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true @for dir in __pycache__ .pytest_cache .mypy_cache .ruff_cache "*.egg-info"; do \
find . -type d -name ".pytest_cache" -exec rm -rf {} + 2>/dev/null || true find . -type d -name "$$dir" -exec rm -rf {} + 2>/dev/null || true; \
find . -type d -name ".mypy_cache" -exec rm -rf {} + 2>/dev/null || true done
find . -type d -name ".ruff_cache" -exec rm -rf {} + 2>/dev/null || true @find . -type f -name "*.pyc" -delete 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

View File

@@ -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 # Module metadata is now read from pyproject.toml [tool.fuzzforge.module] section

View File

@@ -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 # Module metadata is now read from pyproject.toml [tool.fuzzforge.module] section

View File

@@ -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 # Module metadata is now read from pyproject.toml [tool.fuzzforge.module] section
# See MODULE_METADATA.md for documentation on configuring metadata # See MODULE_METADATA.md for documentation on configuring metadata

View File

@@ -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 # Module metadata is now read from pyproject.toml [tool.fuzzforge.module] section

View File

@@ -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 # Module metadata is now read from pyproject.toml [tool.fuzzforge.module] section

19
scripts/container-env.sh Executable file
View 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
View 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}}"