debian-atomic/justfile
2025-08-15 12:20:46 -07:00

261 lines
9.5 KiB
Makefile

# Debian Atomic Justfile
# 1:1 parallel to Fedora Atomic for Debian
# Based on workstation-ostree-config patterns
# Default recipe - show available commands
default:
@echo "Debian Atomic Build System"
@echo "=========================="
@echo ""
@echo "Available recipes:"
@echo " compose-base - Compose base OSTree image"
@echo " compose-variants - Compose all variants"
@echo " compose-legacy - Compose classic OSTree commits"
@echo " compose-image - Compose OCI container images"
@echo " build-iso - Build bootable ISO images"
@echo " sync-comps - Sync with Debian package groups"
@echo " test-variant - Test a specific variant"
@echo " clean - Clean build artifacts"
@echo " deploy - Deploy to container registry"
@echo ""
@echo "Examples:"
@echo " just compose-variants"
@echo " just compose-legacy variant=bosom"
@echo " just build-iso variant=euclase"
@echo " just test-variant variant=apex"
# Variables
variant := "base"
output_dir := "/tmp/particle-os"
registry := "ghcr.io/particle-os"
compose_type := "legacy" # legacy or image
# Compose base OSTree image (Debian 13 Trixie Stable)
compose-base:
@echo "Composing Debian Atomic Base (Trixie Stable)..."
@mkdir -p {{output_dir}}/base
cd variants/base && \
podman build -t debian-atomic-base:latest . && \
echo "Base image (Trixie) composed successfully"
# Compose base OSTree image (Debian 14 Forky Testing)
compose-base-forky:
@echo "Composing Debian Atomic Base (Forky Testing)..."
@mkdir -p {{output_dir}}/base-forky
cd variants/base-forky && \
podman build -t debian-atomic-base-forky:latest . && \
echo "Base image (Forky) composed successfully"
# Compose all variants
compose-variants: compose-base
@echo "Composing all Debian Atomic variants..."
@mkdir -p {{output_dir}}/variants
for variant_dir in variants/*/; do \
if [ -f "$$variant_dir/Containerfile" ]; then \
variant_name=$$(basename "$$variant_dir"); \
echo "Composing $$variant_name..."; \
cd "$$variant_dir" && \
podman build -t debian-atomic-$$variant_name:latest . && \
cd ../..; \
fi; \
done
@echo "All variants composed successfully"
# Compose classic OSTree commits (Fedora legacy style)
compose-legacy variant:
@echo "Composing {{variant}} variant (legacy OSTree)..."
@mkdir -p {{output_dir}}/{{variant}}
if [ -d "variants/{{variant}}" ]; then \
cd variants/{{variant}} && \
podman build -t debian-atomic-{{variant}}:latest . && \
echo "{{variant}} variant composed successfully"; \
else \
echo "Variant {{variant}} not found"; \
exit 1; \
fi
# Compose OCI container images (Fedora image style)
compose-image variant:
@echo "Composing {{variant}} variant (OCI container)..."
@mkdir -p {{output_dir}}/{{variant}}
if [ -d "variants/{{variant}}" ]; then \
cd variants/{{variant}} && \
podman build -t debian-atomic-{{variant}}:latest . && \
echo "{{variant}} OCI image composed successfully"; \
else \
echo "Variant {{variant}} not found"; \
exit 1; \
fi
# Build bootable ISO images
build-iso variant output_path:
@echo "Building bootable ISO for {{variant}} variant..."
@mkdir -p {{output_path}}
if [ -d "variants/{{variant}}" ]; then \
./scripts/bootc-image-builder.sh \
-o {{output_path}} \
debian-atomic-{{variant}}:latest; \
echo "ISO built successfully at {{output_path}}"; \
else \
echo "Variant {{variant}} not found"; \
exit 1; \
fi
# Sync with Debian package groups (Fedora comps-sync equivalent)
sync-comps tasks_file:
@echo "Syncing with Debian package groups..."
if [ -f "{{tasks_file}}" ]; then \
python3 scripts/comps-sync.py {{tasks_file}}; \
echo "Package groups synced successfully"; \
else \
echo "Tasks file {{tasks_file}} not found"; \
exit 1; \
fi
# Sync and save package groups
sync-comps-save tasks_file:
@echo "Syncing and saving Debian package groups..."
if [ -f "{{tasks_file}}" ]; then \
python3 scripts/comps-sync.py --save {{tasks_file}}; \
echo "Package groups synced and saved successfully"; \
else \
echo "Tasks file {{tasks_file}} not found"; \
exit 1; \
fi
# Test a specific variant
test-variant variant:
@echo "Testing {{variant}} variant..."
@mkdir -p {{output_dir}}/test
if [ -d "variants/{{variant}}" ]; then \
cd variants/{{variant}} && \
podman build -t debian-atomic-{{variant}}:test . && \
echo "{{variant}} variant test build successful"; \
cd ../..; \
else \
echo "Variant {{variant}} not found"; \
exit 1; \
fi
# Test all variants
test-all-variants: compose-variants
@echo "Testing all variants..."
for variant_dir in variants/*/; do \
if [ -f "$$variant_dir/Containerfile" ]; then \
variant_name=$$(basename "$$variant_dir"); \
echo "Testing $$variant_name..."; \
just test-variant variant=$$variant_name; \
fi; \
done
@echo "All variants tested successfully"
# Clean build artifacts
clean:
@echo "Cleaning build artifacts..."
podman rmi -f debian-atomic-base:latest 2>/dev/null || true
for variant_dir in variants/*/; do \
if [ -d "$$variant_dir" ]; then \
variant_name=$$(basename "$$variant_dir"); \
podman rmi -f debian-atomic-$$variant_name:latest 2>/dev/null || true; \
fi; \
done
rm -rf {{output_dir}}
@echo "Cleanup completed"
# Deploy to container registry
deploy registry_url:
@echo "Deploying to registry {{registry_url}}..."
podman tag debian-atomic-base:latest {{registry_url}}/base:latest
podman push {{registry_url}}/base:latest
for variant_dir in variants/*/; do \
if [ -d "$$variant_dir" ]; then \
variant_name=$$(basename "$$variant_dir"); \
echo "Deploying $$variant_name..."; \
podman tag debian-atomic-$$variant_name:latest {{registry_url}}/$$variant_name:latest; \
podman push {{registry_url}}/$$variant_name:latest; \
fi; \
done
@echo "Deployment completed"
# Deploy specific variant
deploy-variant variant registry_url:
@echo "Deploying {{variant}} variant to {{registry_url}}..."
if [ -d "variants/{{variant}}" ]; then \
podman tag debian-atomic-{{variant}}:latest {{registry_url}}/{{variant}}:latest; \
podman push {{registry_url}}/{{variant}}:latest; \
echo "{{variant}} variant deployed successfully"; \
else \
echo "Variant {{variant}} not found"; \
exit 1; \
fi
# Build and deploy in one command
build-deploy variant registry_url:
@echo "Building and deploying {{variant}} variant..."
just compose-legacy variant={{variant}}
just deploy-variant variant={{variant}} registry={{registry_url}}
# Validate variant configuration
validate variant:
@echo "Validating {{variant}} variant configuration..."
if [ -d "variants/{{variant}}" ]; then \
if [ -f "variants/{{variant}}/Containerfile" ]; then \
echo "✓ Containerfile found"; \
else \
echo "✗ Containerfile missing"; \
exit 1; \
fi; \
if [ -f "variants/{{variant}}/README.md" ]; then \
echo "✓ README.md found"; \
else \
echo "⚠ README.md missing"; \
fi; \
echo "{{variant}} variant validation completed"; \
else \
echo "Variant {{variant}} not found"; \
exit 1; \
fi
# Validate all variants
validate-all:
@echo "Validating all variants..."
for variant_dir in variants/*/; do \
if [ -d "$$variant_dir" ]; then \
variant_name=$$(basename "$$variant_dir"); \
echo "Validating $$variant_name..."; \
just validate variant=$$variant_name; \
fi; \
done
@echo "All variants validated successfully"
# Show variant status
status:
@echo "Debian Atomic Variant Status"
@echo "============================"
@echo "Base image:"
@bash -c 'if podman images | grep -q "debian-atomic-base"; then echo " ✓ Built"; else echo " ✗ Not built"; fi'
@echo ""
@echo "Variants:"
@bash -c 'ls variants/ 2>/dev/null | while read variant; do if podman images | grep -q "debian-atomic-$$variant"; then echo " $$variant: ✓ Built"; else echo " $$variant: ✗ Not built"; fi; done'
# Help recipe
help:
@echo "Debian Atomic Build System Help"
@echo "==============================="
@echo ""
@echo "This justfile provides Fedora Atomic 1:1 parallel build recipes for Debian Atomic."
@echo ""
@echo "Key Concepts:"
@echo " - compose-legacy: Build classic OSTree commits (like Fedora's default)"
@echo " - compose-image: Build OCI container images (Fedora's new approach)"
@echo " - sync-comps: Sync with Debian package groups (Fedora comps-sync equivalent)"
@echo " - build-iso: Create bootable ISO images using bootc-image-builder"
@echo ""
@echo "Workflow:"
@echo " 1. just compose-base # Build base image"
@echo " 2. just compose-variants # Build all variants"
@echo " 3. just build-iso variant=workstation output=/tmp/output # Create bootable ISO"
@echo " 4. just deploy ghcr.io/debian-atomic # Deploy to registry"
@echo ""
@echo "For more information, see the Debian Atomic documentation."