A modern, high-performance rewrite of the Glazier imaging system in Go.
The original Glazier is a powerful imaging tool written in Python. While robust, deploying Python applications in a pre-boot environment (WinPE) presents challenges:
- Dependency Hell: Managing Python runtime, pip packages, and native extensions.
- Size: Python + deps can be large.
- Performance: Startup time and memory footprint.
- Type Safety: Runtime errors that could be caught at compile time.
Glazier Go solves these problems:
- Single Static Binary:
glazier.exe(~15MB, no Python installation required). - Type Safety: Leveraging Go's strong typing for robust configuration parsing.
- Concurrency: Native Goroutines for parallel task execution.
- Clean Architecture: Decoupling the core logic from the Windows API wrappers.
- Actions:
- Files: Download (SHA256 verified), Copy, Unzip, Remove.
- Disk: Partition and format drives (
partition.disk). - System: Reboot, Shutdown (
system.power). - Registry: Set, Get, Delete keys/values.
- Software: Install packages via GooGet.
- BitLocker: Enable encryption.
- Domain: Join Active Directory.
- Resilience:
- Automatic Retries with exponential backoff for flaky actions (e.g., network downloads).
- Structured Logging (Google Deck) with Windows Event Log integration (graceful WinPE fallback).
- Configuration:
- YAML-based config engine.
- Modular Configs: Split large configs using
include. - Templates for dynamic variable substitution.
- Policy validation (OS version, Device Model).
We employ a Plugin-style Architecture to separate the "Business Logic" from the "System Actions":
-
Core Engine (
internal/config):- Handles YAML parsing, policy validation, and flow control.
- Pure Go logic, platform-agnostic, easily unit-tested.
-
Action Registry (
internal/actions):- A dynamic registry where actions like
bitlocker.enableordomain.joinare registered. - Ensures new capabilities can be added without modifying the core engine.
- A dynamic registry where actions like
- Go 1.21+
- Windows (for running the binary, though it builds on Linux/macOS)
go mod tidy
go build ./cmd/glazierGlazier expects a configuration root. By default, it looks for config.yaml or build.yaml (configurable).
# Validate config (Dry Run)
.\glazier.exe -validate -config_root_path ./examples/basic.yaml
# Run with local examples
.\glazier.exe -config_root_path ./examples/basic.yaml- Configuration Guide: Learn how to structure your YAML files (Retries, Error Handling).
- Action Reference: Full list of supported actions (
bitlocker,googet,partition.disk, etc.). - Templates: Dynamic variable substitution using Go templates.
- Manual Testing: How to verify the binary in a real environment.
- UI Layer: Optional simple UI for user prompts during imaging.
Apache 2.0 (Same as original Glazier)