apko

package
v0.1.18 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: Apache-2.0, MIT Imports: 6 Imported by: 0

Documentation

Overview

Package apko implements image.Composer by invoking the pinned apko binary.

New builds an adapter that shells out to `apko lock` and then `apko build` in the request working directory. The adapter performs no lockfile or layout reasoning of its own: configuration, repository, keyring, lock, SBOM, layout, reference, architectures, and annotations come from the request. Both invocations run with [exec.Cmd.Dir] set to request.Dir; every other path the child receives is request-relative.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Composer

type Composer struct {
	// contains filtered or unexported fields
}

Composer invokes the apko CLI to lock a configuration and write a multi-architecture OCI layout.

It implements image.Composer. It performs no lockfile or layout inspection of its own.

func New

func New(options Options) *Composer

New constructs a Composer from options.

Path resolution is deferred until Composer.Build so a missing binary is reported when composing, not at construction.

func (*Composer) Build

func (c *Composer) Build(ctx context.Context, request image.ComposeRequest) error

Build implements image.Composer.

It runs `apko lock` and then `apko build` as explicit argument slices through execx.Run, both with the child working directory set to request.Dir. Architecture flags follow image.ComposeRequest.Arches in order. Annotation flags follow image.ComposeRequest.Annotations in order. A nil context, a nil receiver, an empty required request field, an empty Arches slice, an empty architecture entry, or an annotation with an empty key is rejected before any process starts. A nonzero exit returns an error that names the apko subcommand, the exit code, and a bounded tail of stderr. Both invocations discard stdout.

type Options

type Options struct {
	// Path is the apko executable. An empty path resolves "apko" from
	// PATH with [exec.LookPath] when composing.
	Path string

	// Environ is the child process environment. A nil value inherits
	// [os.Environ]. The slice is used as-is and is never logged.
	Environ []string

	// Stderr receives apko diagnostics while the process runs. A nil
	// value discards them. A nonzero exit still captures a bounded tail
	// for the returned error.
	Stderr io.Writer
}

Options configures a Composer.

Directories

Path Synopsis
Package mocks contains Mockery-generated doubles for image.Composer.
Package mocks contains Mockery-generated doubles for image.Composer.

Jump to

Keyboard shortcuts

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