layers

package
v0.19.3 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: Apache-2.0 Imports: 20 Imported by: 2

Documentation

Overview

Package layers provides a factory that can be used to construct layer tarballs from buildpack layer directories, extension layers, and other CNB filesystem constructs. The tarballs can be added as layers to any OCI image.

Index

Constants

View Source
const (
	AppLayerName            = "Application Layer"
	BuildpackLayerName      = "Layer: '%s', Created by buildpack: %s"
	ExtensionLayerName      = "Layer: '%s', Created by extension: %s"
	LauncherConfigLayerName = "Buildpacks Launcher Config"
	LauncherLayerName       = "Buildpacks Application Launcher"
	ProcessTypesLayerName   = "Buildpacks Process Types"
	SBOMLayerName           = "Software Bill-of-Materials"
	SliceLayerName          = "Application Slice: %d"
)

Variables

This section is empty.

Functions

func Extract added in v0.9.0

func Extract(r io.Reader, dest string) error

Extract extracts entries from r to the dest directory Contents of r should be an OCI layer. If dest is an empty string files with be extracted to `/` or `c:\` on unix and windows filesystems respectively.

Types

type Factory

type Factory struct {
	ArtifactsDir string // ArtifactsDir is the directory where layer files are written
	UID, GID     int    // UID and GID are used to normalize layer entries
	Logger       log.Logger
	Ctx          context.Context
	// contains filtered or unexported fields
}

func (*Factory) DirLayer

func (f *Factory) DirLayer(withID string, fromDir string, createdBy string) (layer Layer, err error)

DirLayer creates a layer from the given directory DirLayer will set the UID and GID of entries describing dir and its children (but not its parents)

to Factory.UID and Factory.GID

func (*Factory) LauncherLayer added in v0.9.0

func (f *Factory) LauncherLayer(path string) (layer Layer, err error)

LauncherLayer creates a Layer containing the launcher at path

func (*Factory) ProcessTypesLayer added in v0.9.0

func (f *Factory) ProcessTypesLayer(config launch.Metadata) (layer Layer, err error)

ProcessTypesLayer creates a Layer containing symlinks pointing to target where:

  • any parents of the symlink files will also be added to the layer
  • symlinks and their parent directories shall be root owned and world readable

func (*Factory) SliceLayers

func (f *Factory) SliceLayers(dir string, slices []Slice) ([]Layer, error)

SliceLayers divides dir into layers using slices using the following process: * Given n slices SliceLayers will return n+1 layers * The first n layers will contain files matched by the any Path in the nth Slice * The final layer will contain any files in dir that were not included in a previous layer Some layers may be empty

func (*Factory) TarLayer added in v0.19.0

func (f *Factory) TarLayer(withID string, fromTarPath string, createdBy string) (layer Layer, err error)

TarLayer creates a layer from the provided tar path. The provided tar may be compressed or uncompressed. TarLayer will return a layer with uncompressed data and zeroed out timestamps. FIXME: investigate if it's possible to set "no compression" in kaniko, then we can avoid decompressing layers

type Layer

type Layer struct {
	ID      string
	TarPath string
	Digest  string
	History v1.History
}

type Slice

type Slice struct {
	Paths []string `toml:"paths"`
}

Jump to

Keyboard shortcuts

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