Help us shape the future of Go! Take the 2026 Go Developer Survey

fold

package
v0.29.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 17, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package fold merges assembled Strata environments into portable artifacts.

Two modes:

  • MergeToLayer: merge N squashfs layers into a single squashfs layer (Linux only).
  • EjectToDir: materialize the merged overlay into a plain directory tree (all platforms).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EjectToDir

func EjectToDir(ctx context.Context, lf *spec.LockFile, layerPaths []overlay.LayerPath, cfg EjectConfig) error

EjectToDir materializes all layers in lf into a plain directory tree at cfg.OutputDir. It does not require Strata at runtime after this operation.

Output layout:

<OutputDir>/root/           — merged filesystem tree
<OutputDir>/env.sh          — bash snippet: PATH, LD_LIBRARY_PATH
<OutputDir>/environment     — systemd EnvironmentFile format
<OutputDir>/lock.yaml       — copy of the source lockfile
<OutputDir>/README          — usage instructions

layerPaths must already be fetched and verified (e.g. via fetchLayersToCache).

func MergeToLayer

func MergeToLayer(ctx context.Context, lf *spec.LockFile, layerPaths []overlay.LayerPath, cfg MergeConfig) (*spec.LayerManifest, error)

MergeToLayer mounts the N layers in lf via OverlayFS, stages the merged tree into a new squashfs layer, signs it, and pushes it to cfg.Registry.

layerPaths must already be fetched and verified (e.g. via fetchLayersToCache).

This function is Linux-only because it relies on squashfs creation via mksquashfs and OverlayFS mounting.

Types

type EjectConfig

type EjectConfig struct {
	// OutputDir is the destination directory. It must not already exist
	// (or must be empty). Required.
	OutputDir string

	// CacheDir is the directory where layer .sqfs files are cached.
	// Defaults to the system cache dir if empty.
	CacheDir string
}

EjectConfig controls EjectToDir behavior.

type MergeConfig

type MergeConfig struct {
	// Name is the name of the merged layer (required).
	Name string

	// Version is the version of the merged layer (required).
	Version string

	// ABI is the C runtime ABI identifier (e.g. "linux-gnu-2.34").
	// Defaults to the ABI of the first layer in the lockfile.
	ABI string

	// Arch is the target architecture (e.g. "x86_64", "arm64").
	// Defaults to the Arch of the first layer in the lockfile.
	Arch string

	// Provides declares capabilities the merged layer exports.
	Provides []spec.Capability

	// Requires declares capability requirements of the merged layer.
	Requires []spec.Requirement

	// KeyRef is the cosign key reference (file path or KMS URI).
	// Empty means skip signing.
	KeyRef string

	// NoSign disables signing even if KeyRef is set.
	NoSign bool

	// Registry is the destination registry client. Required unless DryRun.
	Registry build.PushRegistry

	// DryRun prints the plan without executing.
	DryRun bool
}

MergeConfig controls MergeToLayer behavior.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL