buildpack

package
v0.14.1 Latest Latest
Warning

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

Go to latest
Published: May 27, 2022 License: Apache-2.0 Imports: 20 Imported by: 6

Documentation

Index

Constants

View Source
const (
	EnvLayersDir  = "CNB_LAYERS_DIR"
	EnvBpPlanPath = "CNB_BP_PLAN_PATH"
)
View Source
const (
	EnvBuildpackDir  = "CNB_BUILDPACK_DIR"
	EnvPlatformDir   = "CNB_PLATFORM_DIR"
	EnvBuildPlanPath = "CNB_BUILD_PLAN_PATH"
)

Variables

This section is empty.

Functions

func EncodeLayerMetadataFile

func EncodeLayerMetadataFile(lmf LayerMetadataFile, path, buildpackAPI string) error

func MadeCached added in v0.13.1

func MadeCached(l Layer) bool

func MadeLaunch added in v0.13.1

func MadeLaunch(l Layer) bool

func Malformed added in v0.13.1

func Malformed(l Layer) bool

Types

type BOMEntry

type BOMEntry struct {
	Require
	Buildpack GroupBuildpack `toml:"buildpack" json:"buildpack"`
}

func WithBuildpack

func WithBuildpack(bp GroupBuildpack, bom []BOMEntry) []BOMEntry

func (*BOMEntry) ConvertMetadataToVersion

func (bom *BOMEntry) ConvertMetadataToVersion()

type BOMFile added in v0.13.0

type BOMFile struct {
	BuildpackID string
	LayerName   string
	LayerType   LayerType
	Path        string
}

func (*BOMFile) Name added in v0.13.0

func (b *BOMFile) Name() (string, error)

Name() returns the destination filename for a given BOM file cdx files should be renamed to "sbom.cdx.json" spdx files should be renamed to "sbom.spdx.json" syft files should be renamed to "sbom.syft.json" If the BOM is neither cdx, spdx, nor syft, the 2nd return argument will return an error to indicate an unsupported format

type BOMValidator added in v0.13.0

type BOMValidator interface {
	ValidateBOM(GroupBuildpack, []BOMEntry) ([]BOMEntry, error)
}

func NewBOMValidator added in v0.13.0

func NewBOMValidator(bpAPI string, layersDir string, logger Logger) BOMValidator

type BuildConfig

type BuildConfig struct {
	AppDir      string
	PlatformDir string
	LayersDir   string
	Out         io.Writer
	Err         io.Writer
	Logger      Logger
}

type BuildEnv

type BuildEnv interface {
	AddRootDir(baseDir string) error
	AddEnvDir(envDir string, defaultAction env.ActionType) error
	WithPlatform(platformDir string) ([]string, error)
	List() []string
}

type BuildPlan

type BuildPlan struct {
	PlanSections
	Or planSectionsList `toml:"or"`
}

type BuildResult

type BuildResult struct {
	BuildBOM    []BOMEntry
	LaunchBOM   []BOMEntry
	BOMFiles    []BOMFile
	Labels      []Label
	MetRequires []string
	Processes   []launch.Process
	Slices      []layers.Slice
}

type BuildTOML

type BuildTOML struct {
	BOM   []BOMEntry `toml:"bom"`
	Unmet []Unmet    `toml:"unmet"`
}

type Buildpack

type Buildpack interface {
	Build(bpPlan Plan, config BuildConfig, bpEnv BuildEnv) (BuildResult, error)
	ConfigFile() *Descriptor
	Detect(config *DetectConfig, bpEnv BuildEnv) DetectRun
}

type Descriptor

type Descriptor struct {
	API       string `toml:"api"`
	Buildpack Info   `toml:"buildpack"`
	Order     Order  `toml:"order"`
	Dir       string `toml:"-"`
}

func (*Descriptor) Build

func (b *Descriptor) Build(bpPlan Plan, config BuildConfig, bpEnv BuildEnv) (BuildResult, error)

func (*Descriptor) ConfigFile

func (b *Descriptor) ConfigFile() *Descriptor

func (*Descriptor) Detect

func (b *Descriptor) Detect(config *DetectConfig, bpEnv BuildEnv) DetectRun

func (*Descriptor) IsMetaBuildpack

func (b *Descriptor) IsMetaBuildpack() bool

func (*Descriptor) String

func (b *Descriptor) String() string

type DetectConfig

type DetectConfig struct {
	AppDir      string
	PlatformDir string
	Logger      Logger
}

type DetectRun

type DetectRun struct {
	BuildPlan
	Output []byte `toml:"-"`
	Code   int    `toml:"-"`
	Err    error  `toml:"-"`
}

type DirBuildpackStore

type DirBuildpackStore struct {
	Dir string
}

func NewBuildpackStore

func NewBuildpackStore(dir string) (*DirBuildpackStore, error)

func (*DirBuildpackStore) Lookup

func (f *DirBuildpackStore) Lookup(bpID, bpVersion string) (Buildpack, error)

type Error

type Error struct {
	RootError error
	Type      ErrorType
}

func NewError added in v0.13.1

func NewError(cause error, errType ErrorType) *Error

func (*Error) Cause

func (le *Error) Cause() error

func (*Error) Error

func (le *Error) Error() string

type ErrorType

type ErrorType string
const ErrTypeBuildpack ErrorType = "ERR_BUILDPACK"
const ErrTypeFailedDetection ErrorType = "ERR_FAILED_DETECTION"

type Group

type Group struct {
	Group []GroupBuildpack `toml:"group"`
}

func ReadGroup added in v0.13.1

func ReadGroup(path string) (Group, error)

func (Group) Append

func (bg Group) Append(group ...Group) Group

type GroupBuildpack

type GroupBuildpack struct {
	API      string `toml:"api,omitempty" json:"-"`
	Homepage string `toml:"homepage,omitempty" json:"homepage,omitempty"`
	ID       string `toml:"id" json:"id"`
	Optional bool   `toml:"optional,omitempty" json:"optional,omitempty"`
	Version  string `toml:"version" json:"version"`
}

A GroupBuildpack represents a buildpack referenced in a buildpack.toml's [[order.group]]. It may be a regular buildpack, or a meta buildpack.

func (GroupBuildpack) NoAPI

func (bp GroupBuildpack) NoAPI() GroupBuildpack

func (GroupBuildpack) NoHomepage

func (bp GroupBuildpack) NoHomepage() GroupBuildpack

func (GroupBuildpack) NoOpt

func (bp GroupBuildpack) NoOpt() GroupBuildpack

func (GroupBuildpack) String

func (bp GroupBuildpack) String() string

type Info

type Info struct {
	ClearEnv bool     `toml:"clear-env,omitempty"`
	Homepage string   `toml:"homepage,omitempty"`
	ID       string   `toml:"id"`
	Name     string   `toml:"name"`
	Version  string   `toml:"version"`
	SBOM     []string `toml:"sbom-formats,omitempty" json:"sbom-formats,omitempty"`
}

type Label

type Label struct {
	Key   string `toml:"key"`
	Value string `toml:"value"`
}

type LaunchTOML

type LaunchTOML struct {
	BOM       []BOMEntry
	Labels    []Label
	Processes []launch.Process `toml:"processes"`
	Slices    []layers.Slice   `toml:"slices"`
}

type Layer added in v0.13.1

type Layer struct {
	// contains filtered or unexported fields
}

func (*Layer) HasLocalContents added in v0.13.1

func (l *Layer) HasLocalContents() bool

func (*Layer) Identifier added in v0.13.1

func (l *Layer) Identifier() string

func (*Layer) Name added in v0.13.1

func (l *Layer) Name() string

func (*Layer) Path added in v0.13.1

func (l *Layer) Path() string

func (*Layer) Read added in v0.13.1

func (l *Layer) Read() (LayerMetadata, error)

func (*Layer) Remove added in v0.13.1

func (l *Layer) Remove() error

func (*Layer) WriteMetadata added in v0.13.1

func (l *Layer) WriteMetadata(metadata LayerMetadataFile) error

func (*Layer) WriteSha added in v0.13.1

func (l *Layer) WriteSha(sha string) error

type LayerMetadata added in v0.13.1

type LayerMetadata struct {
	SHA string `json:"sha" toml:"sha"`
	LayerMetadataFile
}

type LayerMetadataFile added in v0.13.1

type LayerMetadataFile struct {
	Data   interface{} `json:"data" toml:"metadata"`
	Build  bool        `json:"build" toml:"build"`
	Launch bool        `json:"launch" toml:"launch"`
	Cache  bool        `json:"cache" toml:"cache"`
}

func DecodeLayerMetadataFile

func DecodeLayerMetadataFile(path, buildpackAPI string) (LayerMetadataFile, string, error)

type LayerType added in v0.13.0

type LayerType int
const (
	LayerTypeBuild LayerType = iota
	LayerTypeCache
	LayerTypeLaunch
)

type LayersDir added in v0.13.1

type LayersDir struct {
	Path string

	Buildpack GroupBuildpack
	Store     *StoreTOML
	// contains filtered or unexported fields
}

func ReadLayersDir added in v0.13.1

func ReadLayersDir(layersDir string, bp GroupBuildpack, logger Logger) (LayersDir, error)

func (*LayersDir) FindLayers added in v0.13.1

func (d *LayersDir) FindLayers(f func(layer Layer) bool) []Layer

func (*LayersDir) NewLayer added in v0.13.1

func (d *LayersDir) NewLayer(name, buildpackAPI string, logger Logger) *Layer

type LayersMetadata added in v0.13.1

type LayersMetadata struct {
	ID      string                   `json:"key" toml:"key"`
	Version string                   `json:"version" toml:"version"`
	Layers  map[string]LayerMetadata `json:"layers" toml:"layers"`
	Store   *StoreTOML               `json:"store,omitempty" toml:"store"`
}

type Logger

type Logger interface {
	Debug(msg string)
	Debugf(fmt string, v ...interface{})

	Info(msg string)
	Infof(fmt string, v ...interface{})

	Warn(msg string)
	Warnf(fmt string, v ...interface{})

	Error(msg string)
	Errorf(fmt string, v ...interface{})
}

type Order

type Order []Group

func ReadOrder added in v0.13.1

func ReadOrder(path string) (Order, error)

type Plan

type Plan struct {
	Entries []Require `toml:"entries"`
}

type PlanSections

type PlanSections struct {
	Requires []Require `toml:"requires"`
	Provides []Provide `toml:"provides"`
}

type Provide

type Provide struct {
	Name string `toml:"name"`
}

type Require

type Require struct {
	Name     string                 `toml:"name" json:"name"`
	Version  string                 `toml:"version,omitempty" json:"version,omitempty"`
	Metadata map[string]interface{} `toml:"metadata" json:"metadata"`
}

func (*Require) ConvertVersionToMetadata

func (r *Require) ConvertVersionToMetadata()

type StoreTOML

type StoreTOML struct {
	Data map[string]interface{} `json:"metadata" toml:"metadata"`
}

type Unmet

type Unmet struct {
	Name string `toml:"name"`
}

Directories

Path Synopsis
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