v1alpha2

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: May 23, 2024 License: MPL-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package v1alpha2 contains type definitions for `pkg.yaml`.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dependencies

type Dependencies []Dependency

Dependencies is a list of Depency.

func (Dependencies) Validate

func (deps Dependencies) Validate() error

Validate dependencies.

type Dependency

type Dependency struct {
	Image    string `yaml:"image,omitempty"`
	Stage    string `yaml:"stage,omitempty"`
	From     string `yaml:"from,omitempty"`
	To       string `yaml:"to,omitempty"`
	Platform string `yaml:"platform,omitempty"`
	Runtime  bool   `yaml:"runtime,omitempty"`
}

Dependency on another image or stage.

func (*Dependency) Dest

func (d *Dependency) Dest() string

Dest returns copy destination (to base).

func (*Dependency) IsInternal

func (d *Dependency) IsInternal() bool

IsInternal checks whether dependency is internal to some stage.

func (*Dependency) Src

func (d *Dependency) Src() string

Src returns copy source (from dependency).

func (*Dependency) Validate

func (d *Dependency) Validate() error

Validate the dependency.

type Environment

type Environment map[string]string

Environment is a set of environment variables to be set in the step.

type Finalize

type Finalize struct {
	From string `yaml:"from,omitempty"`
	To   string `yaml:"to,omitempty"`
}

Finalize is a set of COPY instructions to finalize the build.

type Install

type Install []string

Install is a list of Alpine package names to install.

type Instruction

type Instruction string

Instruction is a single shell command.

func (Instruction) Script

func (ins Instruction) Script() string

Script formats Instruction for /bin/sh -c execution.

type Instructions

type Instructions []Instruction

Instructions is a list of shell commands.

type Pkg

type Pkg struct {
	Context      types.Variables `yaml:"-"`
	Name         string          `yaml:"name,omitempty"`
	Shell        Shell           `yaml:"shell,omitempty"`
	BaseDir      string          `yaml:"-"`
	FileName     string          `yaml:"-"`
	Install      Install         `yaml:"install,omitempty"`
	Dependencies Dependencies    `yaml:"dependencies,omitempty"`
	Steps        Steps           `yaml:"steps,omitempty"`
	Finalize     []Finalize      `yaml:"finalize,omitempty"`
	Variant      Variant         `yaml:"variant,omitempty"`
}

Pkg represents build instructions for a single package.

func NewPkg

func NewPkg(baseDir, fileName string, contents []byte, vars types.Variables) (*Pkg, error)

NewPkg loads Pkg structure from file.

func (*Pkg) Validate

func (p *Pkg) Validate() error

Validate the Pkg.

type Pkgfile

type Pkgfile struct {
	Vars   types.Variables   `yaml:"vars,omitempty"`
	Labels map[string]string `yaml:"labels,omitempty"`
	Format string            `yaml:"format"`
}

Pkgfile describes structure of 'Pkgfile'.

func NewPkgfile

func NewPkgfile(contents []byte) (*Pkgfile, error)

NewPkgfile loads Pkgfile from `[]byte` contents.

type Shell

type Shell string

Shell is a path to the shell used to execute Instructions.

func (Shell) Get

func (sh Shell) Get() string

Get returns current shell.

type Source

type Source struct {
	URL         string `yaml:"url,omitempty"`
	Destination string `yaml:"destination,omitempty"`
	SHA256      string `yaml:"sha256,omitempty"`
	SHA512      string `yaml:"sha512,omitempty"`
}

Source describe build source to be downloaded.

func (*Source) ToSHA512Sum

func (source *Source) ToSHA512Sum() []byte

ToSHA512Sum returns in format of line expected by 'sha512sum'.

func (*Source) Validate

func (source *Source) Validate() error

Validate source.

func (*Source) ValidateChecksums

func (source *Source) ValidateChecksums(ctx context.Context) (string, string, error)

ValidateChecksums downloads the source, validates checksums, and returns actual checksums and validation error, if any.

type Sources

type Sources []Source

Sources is a collection of Source.

func (Sources) Validate

func (sources Sources) Validate() error

Validate sources.

type Step

type Step struct {
	Env        Environment  `yaml:"env,omitempty"`
	CachePaths []string     `yaml:"cachePaths,omitempty"`
	TmpDir     string       `yaml:"-"`
	Sources    Sources      `yaml:"sources,omitempty"`
	Prepare    Instructions `yaml:"prepare,omitempty"`
	Build      Instructions `yaml:"build,omitempty"`
	Install    Instructions `yaml:"install,omitempty"`
	Test       Instructions `yaml:"test,omitempty"`
}

Step describes a single build step.

Steps are executed sequentially, each step runs in its own empty temporary directory.

func (*Step) Validate

func (step *Step) Validate() error

Validate the step.

type Steps

type Steps []Step

Steps is a collection of Step.

func (Steps) Validate

func (steps Steps) Validate() error

Validate steps.

type Variant

type Variant int

Variant is a kind of base build image.

const (
	// Alpine variant uses Alpine as base image for the build.
	Alpine Variant = iota
	// Scratch variant uses scratch image as base image for the build.
	Scratch
)

func (Variant) MarshalYAML

func (v Variant) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.Marshaller interface.

func (Variant) String

func (v Variant) String() string

func (*Variant) UnmarshalYAML

func (v *Variant) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements yaml.Unmarshaller interface.

Jump to

Keyboard shortcuts

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