Skip to content

Spike: Verify Butane Go library embedding #18

Description

@castrojo

Description

Before implementing issue #11 (Ignition config generation), verify that github.com/coreos/butane can be used as an embedded Go library to compile Butane YAML → Ignition JSON.

Why This Is a Spike

The Butane project's Go embedding API is not well-documented. There's a risk it's CLI-only or has an unstable internal API. We need to confirm this BEFORE issue #11 begins.

Acceptance Criteria

  • Write a 20-line test in internal/ignition/butane_spike_test.go
  • Test compiles minimal Butane YAML (Flatcar variant) to Ignition JSON
  • Confirm the correct import path (likely github.com/coreos/butane/config or github.com/coreos/butane/config/common)
  • Confirm the correct Flatcar variant string and spec version
  • Document findings in a comment on this issue

Fallback

If Butane cannot be cleanly used as a Go library:

  • Plan B: Shell out to the butane binary via Runner (requires butane in PATH or embedded)
  • Plan C: Generate Ignition JSON directly (skip Butane layer — more work, less validation)

Spike Output

func TestButaneSpike_CompilesFlatcar(t *testing.T) {
    butaneYAML := []byte(`
variant: flatcar
version: 1.1.0
storage:
  disks:
    - device: /dev/disk/by-id/test
      wipe_table: true
`)
    // Attempt compilation via Butane Go API
    ignJSON, err := /* butane compile call */
    require.NoError(t, err)
    assert.Contains(t, string(ignJSON), `"ignition"`)
}

Notes

Pin Butane spec version. For Flatcar variant, the current spec is likely 1.1.0 or 1.2.0. Check https://coreos.github.io/butane/config-flatcar-v1_1/ for the latest.

Metadata

Metadata

Assignees

No one assigned

    Labels

    1-triageNew work awaiting human triage.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions