Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
205 changes: 0 additions & 205 deletions docs/docs/reference/images/labels.md

This file was deleted.

4 changes: 0 additions & 4 deletions docs/docs/reference/images/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,3 @@ For complete image specifications, see the Dockerfiles in the repository:
- [Base Dockerfile](https://github.com/GilmanLab/headjack/blob/master/images/base/Dockerfile)
- [Systemd Dockerfile](https://github.com/GilmanLab/headjack/blob/master/images/systemd/Dockerfile)
- [Docker-in-Docker Dockerfile](https://github.com/GilmanLab/headjack/blob/master/images/dind/Dockerfile)

## See Also

- [OCI Labels](labels.md) - Labels for custom image configuration
1 change: 0 additions & 1 deletion docs/sidebars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ const sidebars: SidebarsConfig = {
},
items: [
'reference/images/overview',
'reference/images/labels',
],
},
],
Expand Down
12 changes: 0 additions & 12 deletions images/systemd/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,5 @@ STOPSIGNAL SIGRTMIN+3
# Volume for cgroups (required for systemd)
VOLUME ["/sys/fs/cgroup"]

# =============================================================================
# Headjack Runtime Configuration Labels
# =============================================================================

# These labels inform Headjack how to run the image:
# - io.headjack.init: Command to run as PID 1 (overrides "sleep infinity" default)
# - io.headjack.podman.flags: Space-separated key=value pairs for Podman flags
# - io.headjack.docker.flags: Space-separated key=value pairs for Docker flags
LABEL io.headjack.init="/lib/systemd/systemd"
LABEL io.headjack.podman.flags="systemd=always"
LABEL io.headjack.docker.flags="privileged=true cgroupns=host volume=/sys/fs/cgroup:/sys/fs/cgroup:rw"

# systemd as init system
CMD ["/lib/systemd/systemd"]
8 changes: 2 additions & 6 deletions internal/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
"github.com/jmgilman/headjack/internal/git"
"github.com/jmgilman/headjack/internal/instance"
"github.com/jmgilman/headjack/internal/multiplexer"
"github.com/jmgilman/headjack/internal/registry"
)

// baseDeps lists the external binaries that must always be available.
Expand Down Expand Up @@ -176,19 +175,16 @@ func initManager() error {
// Use tmux as the terminal multiplexer
mux := multiplexer.NewTmux(executor)

// Create registry client for fetching image metadata
regClient := registry.NewClient(registry.ClientConfig{})

// Map runtime name to RuntimeType
runtimeType := runtimeNameToType(runtimeName)

// Parse config flags for merging with image label flags
// Parse config flags
configFlags, err := getConfigFlags()
if err != nil {
return err
}

mgr = instance.NewManager(store, runtime, opener, mux, regClient, instance.ManagerConfig{
mgr = instance.NewManager(store, runtime, opener, mux, instance.ManagerConfig{
WorktreesDir: worktreesDir,
LogsDir: logsDir,
RuntimeType: runtimeType,
Expand Down
56 changes: 0 additions & 56 deletions internal/flags/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"errors"
"fmt"
"sort"
"strings"
)

// Flags represents runtime flags as a key-value map.
Expand Down Expand Up @@ -55,61 +54,6 @@ func FromConfig(cfg map[string]any) (Flags, error) {
return result, nil
}

// FromLabel parses a space-separated string of key=value pairs into Flags.
// Format: "key1=value1 key2=value2 boolkey=true barekey"
//
// Rules:
// - "key=value" → string value
// - "key=true" or "key=false" → bool value
// - "key" (bare, no =) → bool true
// - Repeated keys become []string (e.g., "vol=/a vol=/b" → {"vol": ["/a", "/b"]})
// - Values containing = are handled correctly (splits on first = only)
func FromLabel(label string) (Flags, error) {
result := make(Flags)
if label == "" {
return result, nil
}

for _, part := range strings.Fields(label) {
key, value, hasEquals := strings.Cut(part, "=")
if key == "" {
continue // Skip empty keys
}

if !hasEquals {
// Bare key treated as boolean true (e.g., "privileged")
result[key] = true
continue
}

// Check for boolean string values
switch strings.ToLower(value) {
case "true":
result[key] = true
continue
case "false":
result[key] = false
continue
}

// Handle repeated keys by converting to array
if existing, ok := result[key]; ok {
switch e := existing.(type) {
case string:
result[key] = []string{e, value}
case []string:
result[key] = append(e, value)
default:
// Overwrite non-string values (e.g., bool) with the new string
result[key] = value
}
} else {
result[key] = value
}
}
return result, nil
}

// Merge combines two Flags maps with override taking precedence.
// Keys in override replace keys in base.
func Merge(base, override Flags) Flags {
Expand Down
Loading
Loading