lifecycle

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2019 License: Apache-2.0 Imports: 20 Imported by: 0

README

Lifecycle

Build Status GoDoc

A reference implementation of Buildpack API v3.

Commands

Build
  • detector - chooses buildpacks (via /bin/detect)
  • analyzer - restores launch layer metadata from the previous build
  • builder - executes buildpacks (via /bin/build)
  • exporter - remotely patches images with new layers (via rebase & append)
  • launcher - invokes choice of process
Develop
  • detector - chooses buildpacks (via /bin/detect)
  • developer - executes buildpacks (via /bin/develop)
  • launcher - invokes choice of process
Cache
  • retriever - restores cache
  • cacher - updates cache

Notes

Cache implementations (retriever and cacher) are intended to be interchangable and platform-specific. A platform may choose not to deduplicate cache layers.

Documentation

Index

Constants

View Source
const (
	CodeDetectPass = iota
	CodeDetectError
	CodeDetectFail = 100
)
View Source
const (
	MetadataLabel      = "io.buildpacks.lifecycle.metadata"
	CacheMetadataLabel = "io.buildpacks.lifecycle.cache.metadata"
)

Variables

View Source
var POSIXBuildEnv = map[string][]string{
	"bin": {
		"PATH",
	},
	"lib": {
		"LD_LIBRARY_PATH",
		"LIBRARY_PATH",
	},
	"include": {
		"CPATH",
		"C_INCLUDE_PATH",
		"CPLUS_INCLUDE_PATH",
		"OBJC_INCLUDE_PATH",
	},
	"pkgconfig": {
		"PKG_CONFIG_PATH",
	},
}
View Source
var POSIXLaunchEnv = map[string][]string{
	"bin": {"PATH"},
	"lib": {"LD_LIBRARY_PATH"},
}

Functions

func SetupCredHelpers

func SetupCredHelpers(refs ...string) error

func WriteTOML

func WriteTOML(path string, data interface{}) error

Types

type Analyzer

type Analyzer struct {
	Buildpacks []*Buildpack
	AppDir     string
	LayersDir  string
	In         []byte
	Out, Err   *log.Logger
	UID        int
	GID        int
}

func (*Analyzer) Analyze

func (a *Analyzer) Analyze(image image.Image) error

type AppImageMetadata

type AppImageMetadata struct {
	App        AppMetadata         `json:"app"`
	Config     ConfigMetadata      `json:"config"`
	Launcher   LauncherMetadata    `json:"launcher"`
	Buildpacks []BuildpackMetadata `json:"buildpacks"`
	RunImage   RunImageMetadata    `json:"runImage"`
	Stack      StackMetadata       `json:"stack"`
}

type AppMetadata

type AppMetadata struct {
	SHA string `json:"sha"`
}

type BuildEnv

type BuildEnv interface {
	AddRootDir(baseDir string) error
	AddEnvDir(envDir string) error
	List() []string
}

type BuildMetadata

type BuildMetadata struct {
	Processes  []Process `toml:"processes"`
	Buildpacks []string  `toml:"buildpacks"`
	BOM        Plan      `toml:"bom"`
}

type Builder

type Builder struct {
	PlatformDir string
	LayersDir   string
	AppDir      string
	Env         BuildEnv
	Buildpacks  []*Buildpack
	Plan        Plan
	Out, Err    io.Writer
}

func (*Builder) Build

func (b *Builder) Build() (*BuildMetadata, error)

type Buildpack

type Buildpack struct {
	ID       string `toml:"id"`
	Version  string `toml:"version"`
	Optional bool   `toml:"optional,omitempty"`
	Name     string `toml:"-"`
	Dir      string `toml:"-"`
}

func (*Buildpack) Detect

func (bp *Buildpack) Detect(c *DetectConfig, in io.Reader, out io.Writer) int

func (*Buildpack) EscapedID

func (bp *Buildpack) EscapedID() string

type BuildpackGroup

type BuildpackGroup struct {
	Buildpacks []*Buildpack `toml:"buildpacks"`
}

func (*BuildpackGroup) Detect

func (bg *BuildpackGroup) Detect(c *DetectConfig) (plan []byte, group *BuildpackGroup, ok bool)

func (*BuildpackGroup) Write

func (g *BuildpackGroup) Write(path string) error

type BuildpackMap

type BuildpackMap map[string]*Buildpack

func NewBuildpackMap

func NewBuildpackMap(dir string) (BuildpackMap, error)

func (BuildpackMap) ReadGroup

func (m BuildpackMap) ReadGroup(path string) (*BuildpackGroup, error)

func (BuildpackMap) ReadOrder

func (m BuildpackMap) ReadOrder(orderPath string) (BuildpackOrder, error)

type BuildpackMetadata

type BuildpackMetadata struct {
	ID      string                   `json:"key"`
	Version string                   `json:"version"`
	Layers  map[string]LayerMetadata `json:"layers"`
}

type BuildpackOrder

type BuildpackOrder []BuildpackGroup

func (BuildpackOrder) Detect

func (bo BuildpackOrder) Detect(c *DetectConfig) (plan []byte, group *BuildpackGroup)

type CacheImageMetadata

type CacheImageMetadata struct {
	Buildpacks []BuildpackMetadata `json:"buildpacks"`
}

type Cacher

type Cacher struct {
	ArtifactsDir string
	Buildpacks   []*Buildpack
	Out, Err     *log.Logger
	UID, GID     int
}

func (*Cacher) Cache

func (c *Cacher) Cache(layersDir string, oldCacheImage, newCacheImage image.Image) error

type ConfigMetadata

type ConfigMetadata struct {
	SHA string `json:"sha"`
}

type DetectConfig

type DetectConfig struct {
	AppDir      string
	PlatformDir string
	Out, Err    *log.Logger
}

type Env

type Env struct {
	Getenv  func(key string) string
	Setenv  func(key, value string) error
	Environ func() []string
	Map     map[string][]string
}

func (*Env) AddEnvDir

func (p *Env) AddEnvDir(envDir string) error

func (*Env) AddRootDir

func (p *Env) AddRootDir(baseDir string) error

func (*Env) List

func (p *Env) List() []string

type Exporter

type Exporter struct {
	Buildpacks   []*Buildpack
	ArtifactsDir string
	In           []byte
	Out, Err     *log.Logger
	UID, GID     int
}

func (*Exporter) Export

func (e *Exporter) Export(layersDir, appDir string, runImage, origImage image.Image, launcher string, stack StackMetadata) error

type LaunchTOML

type LaunchTOML struct {
	Processes []Process `toml:"processes"`
}

type Launcher

type Launcher struct {
	DefaultProcessType string
	LayersDir          string
	AppDir             string
	Processes          []Process
	Buildpacks         []string
	Env                BuildEnv
	Exec               func(argv0 string, argv []string, envv []string) error
}

func (*Launcher) Launch

func (l *Launcher) Launch(executable, startCommand string) error

type LauncherMetadata

type LauncherMetadata struct {
	SHA string `json:"sha"`
}

type LayerMetadata

type LayerMetadata struct {
	SHA    string      `json:"sha" toml:"-"`
	Data   interface{} `json:"data" toml:"metadata"`
	Build  bool        `json:"build" toml:"build"`
	Launch bool        `json:"launch" toml:"launch"`
	Cache  bool        `json:"cache" toml:"cache"`
}

type Plan

type Plan map[string]map[string]interface{}

type Process

type Process struct {
	Type    string `toml:"type"`
	Command string `toml:"command"`
}

type Restorer

type Restorer struct {
	LayersDir  string
	Buildpacks []*Buildpack
	Out, Err   *log.Logger
	UID        int
	GID        int
}

func (*Restorer) Restore

func (r *Restorer) Restore(cacheImage image.Image) error

type RunImageMetadata

type RunImageMetadata struct {
	TopLayer string `json:"topLayer"`
	SHA      string `json:"sha"`
}

type StackMetadata

type StackMetadata struct {
	RunImage StackRunImageMetadata `toml:"run-image" json:"runImage"`
}

type StackRunImageMetadata

type StackRunImageMetadata struct {
	Image   string   `toml:"image" json:"image"`
	Mirrors []string `toml:"mirrors" json:"mirrors,omitempty"`
}

Directories

Path Synopsis
cmd
analyzer command
builder command
cacher command
detector command
exporter command
launcher command
restorer command
Package testmock is a generated GoMock package.
Package testmock is a generated GoMock package.

Jump to

Keyboard shortcuts

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