feat: add resource collector for Forgejo runners

Add Go application that collects CPU and RAM metrics from /proc filesystem:
- Parse /proc/[pid]/stat for CPU usage (user/system time)
- Parse /proc/[pid]/status for memory usage (RSS, VmSize, etc.)
- Aggregate metrics across all processes
- Output via structured logging (JSON/text)
- Continuous collection with configurable interval

Designed for monitoring pipeline runner resource utilization to enable
dynamic runner sizing.
This commit is contained in:
Manuel Ganter 2026-02-04 14:13:24 +01:00
commit 219d26959f
No known key found for this signature in database
14 changed files with 1252 additions and 0 deletions

28
scripts/hooks/pre-commit Executable file
View file

@ -0,0 +1,28 @@
#!/bin/bash
# ABOUTME: Pre-commit hook that runs formatting and linting checks.
# ABOUTME: Install with `make install-hooks`.
set -e
echo "Running pre-commit checks..."
# Run go fmt and check if there are any changes
echo "Checking formatting..."
UNFORMATTED=$(gofmt -l .)
if [ -n "$UNFORMATTED" ]; then
echo "Error: The following files are not formatted:"
echo "$UNFORMATTED"
echo ""
echo "Run 'make fmt' to format them."
exit 1
fi
# Run linter
echo "Running linter..."
make lint
# Check for secrets with gitleaks
echo "Checking for secrets..."
make gitleaks
echo "Pre-commit checks passed!"