Andrew Newdigate activity https://gitlab.com/andrewn 2026-02-07T12:17:59Z tag:gitlab.com,2026-02-07:5078504604 Andrew Newdigate opened merge request !5: feat: Add k3d cluster driver support at GitLab.com / GitLab Infrastructure Team / sandbox / caproni-cli-poc 2026-02-07T12:17:59Z andrewn Andrew Newdigate andrew@gitlab.com

Add k3d as a second cluster driver alongside Colima, enabling developers to use lightweight Kubernetes clusters via k3d instead of full VM-based solutions.

Refactor cluster configuration to support driver-specific settings using JSON schema oneOf validation. Each driver now has its own configuration section:

  • Colima: memory and cores settings under colima: key
  • k3d: agents, servers, and image settings under k3d: key
  • Mock: no configuration required

Replace cluster.Status boolean fields (Running, Ready) with a State enum (StateStopped, StateStarting, StateNotReady, StateReady) to better represent cluster lifecycle. Remove driver-agnostic Memory/Cores fields from Status since these are now driver-specific.

Add separate integration tests for both drivers using build tags:

  • colima_integration_test for Colima-specific tests
  • k3d_integration_test for k3d-specific tests

This allows developers to run integration tests only for the cluster driver they have installed, via new mise tasks: test:integration:colima and test:integration:k3d.

Technical changes:

  • Add internal/cluster/k3d package with full cluster.Manager implementation
  • Update schema to use oneOf for driver-specific validation
  • Add K3dConfig, refactor ColimaConfig into nested structures
  • Add State enum to replace Status.Running and Status.Ready bools
  • Update all drivers to set appropriate State values
  • Add k3d integration tests for start, stop, status, destroy commands
  • Rename existing integration tests from *_integration_test.go to *_colima_integration_test.go
tag:gitlab.com,2026-02-07:5078504552 Andrew Newdigate pushed new project branch k3d at GitLab.com / GitLab Infrastructure Team / sandbox / caproni-cli-poc 2026-02-07T12:17:57Z andrewn Andrew Newdigate andrew@gitlab.com

Andrew Newdigate (dd137ea1) at 07 Feb 12:17

feat: Add k3d cluster driver support

tag:gitlab.com,2026-02-07:5078389322 Andrew Newdigate deleted project branch start at GitLab.com / GitLab Infrastructure Team / sandbox / caproni-cli-poc 2026-02-07T10:10:27Z andrewn Andrew Newdigate andrew@gitlab.com

Andrew Newdigate (faae1554) at 07 Feb 10:10

tag:gitlab.com,2026-02-07:5078389262 Andrew Newdigate pushed to project branch main at GitLab.com / GitLab Infrastructure Team / sandbox / caproni-cli-poc 2026-02-07T10:10:22Z andrewn Andrew Newdigate andrew@gitlab.com

Andrew Newdigate (1415170a) at 07 Feb 10:10

Merge branch 'start' into 'main'

... and 10 more commits

tag:gitlab.com,2026-02-07:5078389259 Andrew Newdigate accepted merge request !4: Cluster Operations at GitLab.com / GitLab Infrastructure Team / sandbox / caproni-cli-poc 2026-02-07T10:10:22Z andrewn Andrew Newdigate andrew@gitlab.com

Overview

This MR implements a complete cluster management system for Caproni with the Colima driver, comprehensive command suite (start, stop, status, destroy), and full test infrastructure including a mock driver for testing.

Key Features

Cluster Management System

  • Pluggable driver architecture with thread-safe registry pattern
  • Colima driver implementation with full lifecycle support (start, stop, status, destroy)
  • Self-registration pattern allowing drivers to register via init() functions
  • Profile support enabling multiple isolated cluster instances via ProfileName configuration

Command Suite

Implemented four core commands for cluster lifecycle management:

  • start - Start cluster and deploy GitLab
  • stop - Stop the cluster and edit mode services
  • status - Display cluster and service status
  • destroy - Completely remove cluster and all data

All commands:

  • Use the cluster registry pattern for driver selection
  • Support context propagation for cancellation
  • Include comprehensive unit and integration tests

Process Execution Infrastructure

  • executil package using go-cmd/cmd for better control and streaming
  • Real-time output logging with configurable log levels via slog
  • Context-aware cancellation for long-running processes
  • Duration tracking for all command executions
  • Structured error handling with static error types

Colima Driver Features

  • JSON-based status parsing using colima list --json for reliability
  • Memory format conversion (bytes to GiB)
  • Kubernetes version extraction
  • Profile existence detection for stopped clusters
  • Idempotent operations (safe to call multiple times)

Configuration Enhancements

  • ProfileName field in GlobalConfig (default: "caproni")
  • JSON schema updated to support both "colima" and "mock" drivers
  • Configuration validation with detailed error messages

Testing Infrastructure

Mock Driver

Created a mock cluster driver for testing:

  • Thread-safe multi-profile state management with sync.RWMutex
  • Error injection for testing error paths (StartError, StopError, etc.)
  • Call counting for verification (StartCallCount, StatusCallCount, etc.)
  • State inspection via GetState() for test assertions
  • Direct state setup via SetClusterState() for test scenarios
  • Idempotent operations matching real driver behavior

Test Organization

  • Integration test separation using build tags (//go:build integration)
  • Fast unit tests run in ~0.4 seconds with -short flag
  • Integration tests require actual Colima installation
  • Mock tests for all commands using unique profile names for isolation
  • TestMain setup for driver registration per package
  • Parallel test execution fully supported

Test Tasks

Added mise tasks for convenient test running:

  • mise run test:short - Unit tests only (no Colima required)
  • mise run test:integration - Integration tests (requires Colima)
  • mise run test - All tests

Documentation

  • Updated README.md with test documentation and running instructions
  • Simple Helm chart example configuration for getting started
  • Inline code documentation throughout

Technical Details

Error Message Standards

All error messages follow GitLab Go Guide conventions:

  • Use gerund form: "loading configuration" not "failed to load configuration"
  • Wrap with context: fmt.Errorf("loading configuration: %w", err)
  • No "failed", "error", or "didn't" in messages

Process Execution Pattern

result := executil.RunWithOptions(ctx, "colima", []string{"start"}, &executil.Options{
    LogLevel:       slog.LevelInfo,
    StderrLogLevel: slog.LevelWarn,
})

Benefits:

  • Real-time output streaming
  • Separate stdout/stderr handling
  • Context cancellation support
  • Automatic duration logging

Registry Pattern

func init() {
    cluster.RegisterDriver("colima", func(profileName string) cluster.Manager {
        return NewDriver(profileName)
    })
}

Benefits:

  • Clean separation of concerns
  • Easy to add new drivers
  • Thread-safe registration
  • Compile-time driver selection

Configuration Example

cluster:
  driver: colima
  memory: 8GiB
  cores: 4

repositories:
  gitlab:
    repository: https://gitlab.com/gitlab-org/gitlab.git
    directory: ./gitlab/
    type: app
    app:
      kubernetes_type: deployment

Future Work

  • Additional cluster drivers (kind, minikube, etc.)
  • Helm chart deployment implementation
  • Edit mode service management
  • Repository cloning and management
tag:gitlab.com,2026-02-07:5078384276 Andrew Newdigate pushed to project branch start at GitLab.com / GitLab Infrastructure Team / sandbox / caproni-cli-poc 2026-02-07T10:04:35Z andrewn Andrew Newdigate andrew@gitlab.com

Andrew Newdigate (faae1554) at 07 Feb 10:04

Fix tparallel linter: move t.Parallel() before short check

tag:gitlab.com,2026-02-07:5078379245 Andrew Newdigate pushed to project branch start at GitLab.com / GitLab Infrastructure Team / sandbox / caproni-cli-poc 2026-02-07T10:00:28Z andrewn Andrew Newdigate andrew@gitlab.com

Andrew Newdigate (57db6a8b) at 07 Feb 10:00

Add ProfileName configuration and mock driver support

tag:gitlab.com,2026-02-07:5078210502 Andrew Newdigate pushed to project branch start at GitLab.com / GitLab Infrastructure Team / sandbox / caproni-cli-poc 2026-02-07T07:02:36Z andrewn Andrew Newdigate andrew@gitlab.com

Andrew Newdigate (8769edb0) at 07 Feb 07:02

Update Colima driver to use list command and add ReadStdout utility

tag:gitlab.com,2026-02-06:5077295268 Andrew Newdigate pushed to project branch start at GitLab.com / GitLab Infrastructure Team / sandbox / caproni-cli-poc 2026-02-06T20:23:17Z andrewn Andrew Newdigate andrew@gitlab.com

Andrew Newdigate (bd7f142e) at 06 Feb 20:23

Fix error messages to comply with GitLab Go Guide

tag:gitlab.com,2026-02-06:5077229529 Andrew Newdigate pushed to project branch start at GitLab.com / GitLab Infrastructure Team / sandbox / caproni-cli-poc 2026-02-06T19:56:59Z andrewn Andrew Newdigate andrew@gitlab.com

Andrew Newdigate (432989e7) at 06 Feb 19:56

Add Destroy method to cluster driver and destroy command

tag:gitlab.com,2026-02-06:5077183290 Andrew Newdigate pushed to project branch start at GitLab.com / GitLab Infrastructure Team / sandbox / caproni-cli-poc 2026-02-06T19:39:55Z andrewn Andrew Newdigate andrew@gitlab.com

Andrew Newdigate (428232aa) at 06 Feb 19:39

Update Colima Status method to use JSON output

... and 2 more commits

tag:gitlab.com,2026-02-06:5076374297 Andrew Newdigate pushed to project branch start at GitLab.com / GitLab Infrastructure Team / sandbox / caproni-cli-poc 2026-02-06T15:20:00Z andrewn Andrew Newdigate andrew@gitlab.com

Andrew Newdigate (33fb4bb4) at 06 Feb 15:20

Update golangci-lint config to use wsl_v5 instead of deprecated wsl

tag:gitlab.com,2026-02-06:5076327809 Andrew Newdigate pushed to project branch start at GitLab.com / GitLab Infrastructure Team / sandbox / caproni-cli-poc 2026-02-06T15:07:59Z andrewn Andrew Newdigate andrew@gitlab.com

Andrew Newdigate (2d0be57e) at 06 Feb 15:07

Add cluster management with registry pattern and Colima driver

... and 2 more commits

tag:gitlab.com,2026-02-06:5076273398 Andrew Newdigate deleted project branch config-parser at GitLab.com / GitLab Infrastructure Team / sandbox / caproni-cli-poc 2026-02-06T14:55:23Z andrewn Andrew Newdigate andrew@gitlab.com

Andrew Newdigate (a02daef8) at 06 Feb 14:55

tag:gitlab.com,2026-02-06:5076272863 Andrew Newdigate pushed to project branch main at GitLab.com / GitLab Infrastructure Team / sandbox / caproni-cli-poc 2026-02-06T14:55:15Z andrewn Andrew Newdigate andrew@gitlab.com

Andrew Newdigate (c12aeadc) at 06 Feb 14:55

Merge branch 'config-parser' into 'main'

... and 2 more commits

tag:gitlab.com,2026-02-06:5076272859 Andrew Newdigate accepted merge request !3: Add configuration parsing for caproni.yaml at GitLab.com / GitLab Infrastructure Team / sandbox / caproni-cli-poc 2026-02-06T14:55:15Z andrewn Andrew Newdigate andrew@gitlab.com

Implements schema-driven configuration parsing with JSON schema validation. Configuration is loaded and validated lazily on first use with thread-safe caching for subsequent calls.

Key features:

  • Full type hierarchy matching config.schema.json
  • Lazy schema compilation with sync.Once for thread safety
  • Proper error handling (no silent failures)
  • Embedded schema using go:embed (no external dependencies)
  • Helper methods for common operations
tag:gitlab.com,2026-02-06:5076175984 Andrew Newdigate pushed to project branch config-parser at GitLab.com / GitLab Infrastructure Team / sandbox / caproni-cli-poc 2026-02-06T14:32:01Z andrewn Andrew Newdigate andrew@gitlab.com

Andrew Newdigate (a02daef8) at 06 Feb 14:32

Fix error messages to comply with Go style guide

tag:gitlab.com,2026-02-06:5076082952 Andrew Newdigate opened merge request !4: Cluster Operations at GitLab.com / GitLab Infrastructure Team / sandbox / caproni-cli-poc 2026-02-06T14:10:27Z andrewn Andrew Newdigate andrew@gitlab.com

Overview

This MR implements a complete cluster management system for Caproni with the Colima driver, comprehensive command suite (start, stop, status, destroy), and full test infrastructure including a mock driver for testing.

Key Features

Cluster Management System

  • Pluggable driver architecture with thread-safe registry pattern
  • Colima driver implementation with full lifecycle support (start, stop, status, destroy)
  • Self-registration pattern allowing drivers to register via init() functions
  • Profile support enabling multiple isolated cluster instances via ProfileName configuration

Command Suite

Implemented four core commands for cluster lifecycle management:

  • start - Start cluster and deploy GitLab
  • stop - Stop the cluster and edit mode services
  • status - Display cluster and service status
  • destroy - Completely remove cluster and all data

All commands:

  • Use the cluster registry pattern for driver selection
  • Support context propagation for cancellation
  • Include comprehensive unit and integration tests

Process Execution Infrastructure

  • executil package using go-cmd/cmd for better control and streaming
  • Real-time output logging with configurable log levels via slog
  • Context-aware cancellation for long-running processes
  • Duration tracking for all command executions
  • Structured error handling with static error types

Colima Driver Features

  • JSON-based status parsing using colima list --json for reliability
  • Memory format conversion (bytes to GiB)
  • Kubernetes version extraction
  • Profile existence detection for stopped clusters
  • Idempotent operations (safe to call multiple times)

Configuration Enhancements

  • ProfileName field in GlobalConfig (default: "caproni")
  • JSON schema updated to support both "colima" and "mock" drivers
  • Configuration validation with detailed error messages

Testing Infrastructure

Mock Driver

Created a mock cluster driver for testing:

  • Thread-safe multi-profile state management with sync.RWMutex
  • Error injection for testing error paths (StartError, StopError, etc.)
  • Call counting for verification (StartCallCount, StatusCallCount, etc.)
  • State inspection via GetState() for test assertions
  • Direct state setup via SetClusterState() for test scenarios
  • Idempotent operations matching real driver behavior

Test Organization

  • Integration test separation using build tags (//go:build integration)
  • Fast unit tests run in ~0.4 seconds with -short flag
  • Integration tests require actual Colima installation
  • Mock tests for all commands using unique profile names for isolation
  • TestMain setup for driver registration per package
  • Parallel test execution fully supported

Test Tasks

Added mise tasks for convenient test running:

  • mise run test:short - Unit tests only (no Colima required)
  • mise run test:integration - Integration tests (requires Colima)
  • mise run test - All tests

Documentation

  • Updated README.md with test documentation and running instructions
  • Simple Helm chart example configuration for getting started
  • Inline code documentation throughout

Technical Details

Error Message Standards

All error messages follow GitLab Go Guide conventions:

  • Use gerund form: "loading configuration" not "failed to load configuration"
  • Wrap with context: fmt.Errorf("loading configuration: %w", err)
  • No "failed", "error", or "didn't" in messages

Process Execution Pattern

result := executil.RunWithOptions(ctx, "colima", []string{"start"}, &executil.Options{
    LogLevel:       slog.LevelInfo,
    StderrLogLevel: slog.LevelWarn,
})

Benefits:

  • Real-time output streaming
  • Separate stdout/stderr handling
  • Context cancellation support
  • Automatic duration logging

Registry Pattern

func init() {
    cluster.RegisterDriver("colima", func(profileName string) cluster.Manager {
        return NewDriver(profileName)
    })
}

Benefits:

  • Clean separation of concerns
  • Easy to add new drivers
  • Thread-safe registration
  • Compile-time driver selection

Configuration Example

cluster:
  driver: colima
  memory: 8GiB
  cores: 4

repositories:
  gitlab:
    repository: https://gitlab.com/gitlab-org/gitlab.git
    directory: ./gitlab/
    type: app
    app:
      kubernetes_type: deployment

Future Work

  • Additional cluster drivers (kind, minikube, etc.)
  • Helm chart deployment implementation
  • Edit mode service management
  • Repository cloning and management
tag:gitlab.com,2026-02-06:5076082631 Andrew Newdigate pushed new project branch start at GitLab.com / GitLab Infrastructure Team / sandbox / caproni-cli-poc 2026-02-06T14:10:23Z andrewn Andrew Newdigate andrew@gitlab.com

Andrew Newdigate (b5981943) at 06 Feb 14:10

Add cluster management with registry pattern and Colima driver

... and 1 more commit

tag:gitlab.com,2026-02-06:5075827764 Andrew Newdigate opened merge request !3: Add configuration parsing for caproni.yaml at GitLab.com / GitLab Infrastructure Team / sandbox / caproni-cli-poc 2026-02-06T13:07:59Z andrewn Andrew Newdigate andrew@gitlab.com

Implements schema-driven configuration parsing with JSON schema validation. Configuration is loaded and validated lazily on first use with thread-safe caching for subsequent calls.

Key features:

  • Full type hierarchy matching config.schema.json
  • Lazy schema compilation with sync.Once for thread safety
  • Proper error handling (no silent failures)
  • Embedded schema using go:embed (no external dependencies)
  • Helper methods for common operations