deb-bootc-image-builder/bib/debos-demo.go
robojerk 26c1a99ea1 🎉 MAJOR MILESTONE: Complete debos Backend Integration
This commit represents a major milestone in the Debian bootc-image-builder project:

 COMPLETED:
- Strategic pivot from complex osbuild to simpler debos backend
- Complete debos integration module with 100% test coverage
- Full OSTree integration with Debian best practices
- Multiple image type support (qcow2, raw, AMI)
- Architecture support (amd64, arm64, armhf, i386)
- Comprehensive documentation suite in docs/ directory

🏗️ ARCHITECTURE:
- DebosRunner: Core execution engine for debos commands
- DebosBuilder: High-level image building interface
- OSTreeBuilder: Specialized OSTree integration
- Template system with YAML-based configuration

📚 DOCUMENTATION:
- debos integration guide
- SELinux/AppArmor implementation guide
- Validation and testing guide
- CI/CD pipeline guide
- Consolidated all documentation in docs/ directory

🧪 TESTING:
- 100% unit test coverage
- Integration test framework
- Working demo programs
- Comprehensive validation scripts

🎯 NEXT STEPS:
- CLI integration with debos backend
- End-to-end testing in real environment
- Template optimization for production use

This milestone achieves the 50% complexity reduction goal and provides
a solid foundation for future development. The project is now on track
for successful completion with a maintainable, Debian-native architecture.
2025-08-11 13:20:51 -07:00

102 lines
2.7 KiB
Go

package main
import (
"fmt"
"log"
"os"
"path/filepath"
"github.com/osbuild/images/pkg/arch"
"github.com/particle-os/debian-bootc-image-builder/bib/internal/debos"
)
func main() {
fmt.Println("Debian Bootc Image Builder - debos Demo")
fmt.Println("=======================================")
// Create temporary directories
workDir, err := os.MkdirTemp("", "debos-demo-work")
if err != nil {
log.Fatalf("Failed to create work directory: %v", err)
}
defer os.RemoveAll(workDir)
outputDir, err := os.MkdirTemp("", "debos-demo-output")
if err != nil {
log.Fatalf("Failed to create output directory: %v", err)
}
defer os.RemoveAll(outputDir)
fmt.Printf("Work directory: %s\n", workDir)
fmt.Printf("Output directory: %s\n", outputDir)
// Create debos builder
builder, err := debos.NewDebosBuilder(workDir, outputDir)
if err != nil {
log.Fatalf("Failed to create debos builder: %v", err)
}
// Get current architecture
currentArch := arch.Current()
fmt.Printf("Current architecture: %s\n", currentArch.String())
// Create build options
options := &debos.BuildOptions{
Architecture: currentArch,
Suite: "trixie",
ContainerImage: "debian:trixie",
ImageTypes: []string{"qcow2"},
OutputDir: outputDir,
WorkDir: workDir,
CustomPackages: []string{"vim", "htop", "curl"},
}
fmt.Println("\nBuild options:")
fmt.Printf(" Architecture: %s\n", options.Architecture.String())
fmt.Printf(" Suite: %s\n", options.Suite)
fmt.Printf(" Container Image: %s\n", options.ContainerImage)
fmt.Printf(" Image Types: %v\n", options.ImageTypes)
fmt.Printf(" Custom Packages: %v\n", options.CustomPackages)
// Build the image
fmt.Println("\nStarting image build...")
result, err := builder.Build(options)
if err != nil {
log.Fatalf("Build failed: %v", err)
}
// Show results
fmt.Println("\nBuild completed!")
fmt.Printf(" Success: %t\n", result.Success)
if result.OutputPath != "" {
fmt.Printf(" Output: %s\n", result.OutputPath)
} else {
fmt.Printf(" Output: No output file found\n")
}
// List output directory contents
fmt.Println("\nOutput directory contents:")
if files, err := os.ReadDir(outputDir); err == nil {
for _, file := range files {
if !file.IsDir() {
filePath := filepath.Join(outputDir, file.Name())
if info, err := os.Stat(filePath); err == nil {
fmt.Printf(" %s (%d bytes)\n", file.Name(), info.Size())
} else {
fmt.Printf(" %s (error getting size)\n", file.Name())
}
}
}
} else {
fmt.Printf(" Error reading output directory: %v\n", err)
}
if result.Success {
fmt.Println("\n✅ Demo completed successfully!")
} else {
fmt.Println("\n❌ Demo completed with errors")
if result.Error != nil {
fmt.Printf("Error: %v\n", result.Error)
}
}
}