Documentation
¶
Index ¶
- Constants
- func AddImageConfigLabels(imageConfig []byte, labels map[string]string) ([]byte, error)
- func DisplayProgress(ctx context.Context, eg *errgroup.Group, buildChannel chan *client.SolveStatus, ...)
- func ExtractOSReleaseFromState(ctx context.Context, c gwclient.Client, state *llb.State) ([]byte, error)
- func ForwardProgressWithPrefix(ctx context.Context, src <-chan *client.SolveStatus, ...)
- func GetDefaultLinuxPlatform() ispec.Platform
- func GetRepoNameWithDigest(patchedImageName, imageDigest string) string
- func MergeImageRuntimeConfig(baseConfig, suppliedConfig []byte) ([]byte, error)
- func ResolvePatchedImageName(imageRef reference.Named, explicitTag, suffix string) (imageName, patchTag string, err error)
- func ResolvePatchedTag(imageRef reference.Named, explicitTag, suffix string) (string, error)
- func SetupBuildkitConfigAndManager(ctx context.Context, c gwclient.Client, image string, platform *ispec.Platform, ...) (*buildkit.Config, pkgmgr.PackageManager, error)
- func SetupBuildkitConfigAndManagerWithOptions(ctx context.Context, c gwclient.Client, image string, platform *ispec.Platform, ...) (*buildkit.Config, pkgmgr.PackageManager, error)
- func StateFileExists(ctx context.Context, c gwclient.Client, state *llb.State, ...) (bool, error)
- func StatePathExists(ctx context.Context, c gwclient.Client, state *llb.State, ...) (bool, error)
- func TryExtractOSReleaseFromState(ctx context.Context, c gwclient.Client, state *llb.State) ([]byte, bool, error)
- type OSInfo
Constants ¶
const (
LINUX = "linux"
)
Variables ¶
This section is empty.
Functions ¶
func AddImageConfigLabels ¶
AddImageConfigLabels returns imageConfig with labels merged into its OCI config. The input is left unchanged, and manager-provided values take precedence when a label already exists.
func DisplayProgress ¶
func DisplayProgress(ctx context.Context, eg *errgroup.Group, buildChannel chan *client.SolveStatus, progress progressui.DisplayMode)
DisplayProgress starts a goroutine to display build progress. This encapsulates the common pattern used in both generate and patch commands. Uses BuildKit's progressui; debug logging forces plain output so step logs stay readable.
func ExtractOSReleaseFromState ¶
func ExtractOSReleaseFromState(ctx context.Context, c gwclient.Client, state *llb.State) ([]byte, error)
ExtractOSReleaseFromState reads /etc/os-release after enforcing the same 1 MiB input limit used by Chisel release inference. The bounded BuildKit helper stats before allocating and uses ranged reads for the file contents.
func ForwardProgressWithPrefix ¶
func ForwardProgressWithPrefix(ctx context.Context, src <-chan *client.SolveStatus, dst chan<- *client.SolveStatus, prefix string)
ForwardProgressWithPrefix forwards progress from src to dst, prefixing vertex names with the given prefix. This allows multiplexing multiple build progress streams into a single display.
func GetDefaultLinuxPlatform ¶
GetDefaultLinuxPlatform returns a normalized Linux platform, defaulting to Linux if not already Linux.
func GetRepoNameWithDigest ¶
GetRepoNameWithDigest extracts repo name with digest from image name and digest. e.g. "docker.io/library/nginx:1.21.6-patched" -> "nginx@sha256:...".
func MergeImageRuntimeConfig ¶
MergeImageRuntimeConfig preserves base layer metadata while replacing the runtime config object with the one from the supplied image being repatched.
func ResolvePatchedImageName ¶
func ResolvePatchedImageName(imageRef reference.Named, explicitTag, suffix string) (imageName, patchTag string, err error)
ResolvePatchedImageName merges with suffix rules or uses the explicitTag entirely, returning the final patched image name and tag.
func ResolvePatchedTag ¶
ResolvePatchedTag merges explicit tag & suffix rules, returning the final patched tag.
func SetupBuildkitConfigAndManager ¶
func SetupBuildkitConfigAndManager( ctx context.Context, c gwclient.Client, image string, platform *ispec.Platform, workingFolder string, osInfo *OSInfo, ) (*buildkit.Config, pkgmgr.PackageManager, error)
SetupBuildkitConfigAndManager initializes buildkit config and package manager. This combines the common pattern used in both generate and patch commands.
func SetupBuildkitConfigAndManagerWithOptions ¶
func SetupBuildkitConfigAndManagerWithOptions( ctx context.Context, c gwclient.Client, image string, platform *ispec.Platform, workingFolder string, osInfo *OSInfo, managerOptions pkgmgr.PackageManagerOptions, ) (*buildkit.Config, pkgmgr.PackageManager, error)
SetupBuildkitConfigAndManagerWithOptions initializes BuildKit config and a package manager with optional manager-specific settings.
func StateFileExists ¶
func StateFileExists(ctx context.Context, c gwclient.Client, state *llb.State, platform *ispec.Platform, path string) (bool, error)
StateFileExists reports whether path is a regular file in state without reading its contents or executing any binary from the target image. A missing path is not an error; a path with another type is rejected as malformed.
func StatePathExists ¶
func StatePathExists(ctx context.Context, c gwclient.Client, state *llb.State, platform *ispec.Platform, path string) (bool, error)
StatePathExists reports whether path exists in state without executing any binary from the target image. A missing path is not an error; solve and stat failures that are not NotFound are returned to the caller.
func TryExtractOSReleaseFromState ¶
func TryExtractOSReleaseFromState(ctx context.Context, c gwclient.Client, state *llb.State) ([]byte, bool, error)
TryExtractOSReleaseFromState reads /etc/os-release when present. A genuinely missing file is reported as exists=false; solve, stat, size, and read failures remain errors so callers cannot silently skip OS-dependent safety checks.