types

package
v4.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const OCIConfigJSON = "oci-config"

Variables

This section is empty.

Functions

func UpdateDefinitionRaw

func UpdateDefinitionRaw(defs *[]Definition)

Types

type Bundle

type Bundle struct {
	JSONObjects map[string][]byte `json:"jsonObjects"`
	Recipe      Definition        `json:"rawDeffile"`
	Opts        Options           `json:"opts"`

	RootfsPath string `json:"rootfsPath"` // where actual fs to chroot will appear
	TmpDir     string `json:"tmpPath"`    // where temp files required during build will appear
	// contains filtered or unexported fields
}

Bundle is the temporary environment used during the image building process.

func NewBundle

func NewBundle(parentPath, tempDir string) (b *Bundle, err error)

NewBundle creates a Bundle environment.

func NewEncryptedBundle

func NewEncryptedBundle(parentPath, tempDir string, keyInfo *cryptkey.KeyInfo) (b *Bundle, err error)

NewEncryptedBundle creates an Encrypted Bundle environment.

func (*Bundle) Remove

func (b *Bundle) Remove() error

Remove cleans up any bundle files.

func (*Bundle) RunSection

func (b *Bundle) RunSection(s string) bool

RunSection iterates through the sections specified in a bundle and returns true if the given string, s, is a section of the definition that should be executed during the build process.

type Data

type Data struct {
	Files   []Files `json:"files"`
	Scripts `json:"buildScripts"`
}

Data contains any scripts, metadata, etc... that the Builder may need to know only at build time to build the image.

type Definition

type Definition struct {
	Header     map[string]string `json:"header"`
	ImageData  `json:"imageData"`
	BuildData  Data              `json:"buildData"`
	CustomData map[string]string `json:"customData"`

	// Raw contains the raw definition file content that is applied when this
	// Definition is built. For multi-stage builds parsed with parser.All(),
	// this is the content of a single build stage. Otherwise, it will be equal
	// to FullRaw.
	Raw []byte `json:"raw"`

	// FullRaw contains the raw data for the entire definition file.
	FullRaw []byte `json:"fullraw"`

	// SCIF app sections must be processed in order from the definition file,
	// so we need to record the order of the items as they are parsed from the
	// file into unordered maps.
	AppOrder []string `json:"appOrder"`
}

Definition describes how to build an image.

func NewDefinitionFromJSON

func NewDefinitionFromJSON(r io.Reader) (d Definition, err error)

NewDefinitionFromJSON creates a new Definition using the supplied JSON.

func NewDefinitionFromURI

func NewDefinitionFromURI(uri string) (d Definition, err error)

NewDefinitionFromURI crafts a new Definition given a URI.

func (*Definition) WriteRaw

func (d *Definition) WriteRaw(w io.Writer) error

WriteRaw writes the contents of definition d to w.

type FileTransport

type FileTransport struct {
	Src string `json:"source"`
	Dst string `json:"destination"`
}

FileTransport holds source and destination information of files to copy into the container.

func (FileTransport) SourcePath

func (ft FileTransport) SourcePath() (string, error)

SourcePath returns the source path in the format as specified by the io/fs package.

type Files

type Files struct {
	Args  string          `json:"args"`
	Files []FileTransport `json:"files"`
}

Files describes a %files section of a definition.

func (Files) Stage

func (f Files) Stage() string

Stage returns the build stage referenced by the files section f, or "" if no stage is referenced.

type ImageData

type ImageData struct {
	Metadata     []byte            `json:"metadata"`
	Labels       map[string]string `json:"labels"`
	ImageScripts `json:"imageScripts"`
}

ImageData contains any scripts, metadata, etc... that needs to be present in some form in the final built image.

type ImageScripts

type ImageScripts struct {
	Help        Script `json:"help"`
	Environment Script `json:"environment"`
	Runscript   Script `json:"runScript"`
	Test        Script `json:"test"`
	Startscript Script `json:"startScript"`
}

ImageScripts contains scripts that are used after build time.

type Options

type Options struct {
	// Sections are the parts of the definition to run during the build.
	Sections []string `json:"sections"`
	// TmpDir specifies a non-standard temporary location to perform a build.
	TmpDir string
	// LibraryURL contains URL to library where base images can be pulled.
	LibraryURL string `json:"libraryURL"`
	// LibraryAuthToken contains authentication token to access specified library.
	LibraryAuthToken string `json:"libraryAuthToken"`
	// KeyServerOpts contains options for keyserver used for SIF fingerprint verification in builds.
	KeyServerOpts []scskeyclient.Option
	// If non-nil, provides credentials to be used when authenticating to OCI registries.
	OCIAuthConfig *authn.AuthConfig
	// If non-nil, provides credentials to be used when authenticating to OCI registries.
	// Deprecated: Use OCIAuthConfig, which takes precedence if both are set.
	DockerAuthConfig *ocitypes.DockerAuthConfig
	// Custom docker Daemon host
	DockerDaemonHost string
	// EncryptionKeyInfo specifies the key used for filesystem
	// encryption if applicable.
	// A nil value indicates encryption should not occur.
	EncryptionKeyInfo *cryptkey.KeyInfo
	// ImgCache stores a pointer to the image cache to use.
	ImgCache *cache.Handle
	// NoTest indicates if build should skip running the test script.
	NoTest bool `json:"noTest"`
	// Force automatically deletes an existing container at build destination while performing build.
	Force bool `json:"force"`
	// Update detects and builds using an existing sandbox container at build destination.
	Update bool `json:"update"`
	// NoHTTPS instructs builder not to use secure connection.
	NoHTTPS bool `json:"noHTTPS"`
	// NoCleanUp allows a user to prevent a bundle from being cleaned up after a failed build.
	// useful for debugging.
	NoCleanUp bool `json:"noCleanUp"`
	// NoCache when true, will not use any cache, or make cache.
	NoCache bool
	// FixPerms controls if we will ensure owner rwX on container content
	// to preserve <=3.4 behavior.
	// TODO: Deprecate in 3.6, remove in 3.8
	FixPerms bool
	// To warn when the above is needed, we need to know if the target of this
	// bundle will be a sandbox
	SandboxTarget bool
	// Which Platform to use when retrieving images for the build
	Platform ggcrv1.Platform
	// Authentication file for registry credentials
	DockerAuthFile string
}

Options defines build time behavior to be executed on the bundle.

type Script

type Script struct {
	Args   string `json:"args"`
	Script string `json:"script"`
}

Script describes any script section of a definition.

type Scripts

type Scripts struct {
	Pre       Script `json:"pre"`
	Setup     Script `json:"setup"`
	Post      Script `json:"post"`
	Test      Script `json:"test"`
	Arguments Script `json:"arguments"`
}

Scripts defines scripts that are used at build time.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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