buildpack

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2021 License: Apache-2.0 Imports: 19 Imported by: 6

Documentation

Index

Constants

View Source
const EnvBuildpackDir = "CNB_BUILDPACK_DIR"

Variables

This section is empty.

Functions

func DecodeLayerMetadataFile

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

func EncodeLayerMetadataFile

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

func WriteTOML

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

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, 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 {
	BOM         []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 EncoderDecoder

type EncoderDecoder interface {
	IsSupported(buildpackAPI string) bool
	Encode(file *os.File, lmf layertypes.LayerMetadataFile) error
	Decode(path string) (layertypes.LayerMetadataFile, string, error)
}

type Error

type Error struct {
	RootError error
	Type      ErrorType
}

func NewLifecycleError

func NewLifecycleError(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 (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 LayerType added in v0.13.0

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

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

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