Documentation
¶
Index ¶
- Constants
- func DecodeLaunchTOML(launchPath string, bpAPI string, launchTOML *LaunchTOML) error
- func EncodeLayerMetadataFile(lmf LayerMetadataFile, path, buildpackAPI string) error
- func MadeCached(l Layer) bool
- func MadeLaunch(l Layer) bool
- func Malformed(l Layer) bool
- func ValidateBuildDockerfile(dockerfile string, logger log.Logger) error
- func ValidateRunDockerfile(dInfo *DockerfileInfo, logger log.Logger) error
- type BOMEntry
- type BOMFile
- type BOMValidator
- type BaseInfo
- type BpDescriptor
- type BpInfo
- type BuildEnv
- type BuildExecutor
- type BuildInputs
- type BuildOutputs
- type BuildPlan
- type BuildTOML
- type DefaultBuildExecutor
- type DefaultDetectExecutor
- type DefaultGenerateExecutor
- type Descriptor
- type DetectExecutor
- type DetectInputs
- type DetectOutputs
- type DockerfileInfo
- type Error
- type ErrorType
- type ExtDescriptor
- type ExtInfo
- type ExtendArg
- type ExtendBuildConfig
- type ExtendConfig
- type GenerateExecutor
- type GenerateInputs
- type GenerateOutputs
- type Group
- type GroupElement
- func (e GroupElement) Equals(o GroupElement) bool
- func (e GroupElement) IsExtensionsOrder() bool
- func (e GroupElement) Kind() string
- func (e GroupElement) NoAPI() GroupElement
- func (e GroupElement) NoExtension() GroupElement
- func (e GroupElement) NoHomepage() GroupElement
- func (e GroupElement) NoOpt() GroupElement
- func (e GroupElement) String() string
- func (e GroupElement) WithAPI(version string) GroupElement
- func (e GroupElement) WithHomepage(address string) GroupElement
- type Label
- type LaunchTOML
- type Layer
- func (l *Layer) HasLocalContents() bool
- func (l *Layer) Identifier() string
- func (l *Layer) Name() string
- func (l *Layer) Path() string
- func (l *Layer) Read() (LayerMetadata, error)
- func (l *Layer) Remove() error
- func (l *Layer) WriteMetadata(metadata LayerMetadataFile) error
- func (l *Layer) WriteSha(sha string) error
- type LayerMetadata
- type LayerMetadataFile
- type LayerType
- type LayersDir
- type LayersMetadata
- type OSDistro
- type Order
- type Plan
- type PlanSections
- type ProcessEntry
- type Provide
- type Require
- type StackMetadata
- type StoreTOML
- type TargetMetadata
- type Unmet
Constants ¶
const ( MediaTypeCycloneDX = "application/vnd.cyclonedx+json" MediaTypeSPDX = "application/spdx+json" MediaTypeSyft = "application/vnd.syft+json" ExtensionCycloneDX = "sbom.cdx.json" ExtensionSPDX = "sbom.spdx.json" ExtensionSyft = "sbom.syft.json" )
const ( // EnvBpPlanPath is the absolute path of the filtered build plan, containing relevant Buildpack Plan entries from detection EnvBpPlanPath = "CNB_BP_PLAN_PATH" // EnvLayersDir is the absolute path of the buildpack layers directory (read-write); a different copy is provided for each buildpack; // contents may be saved to either or both of: the final output image or the cache EnvLayersDir = "CNB_LAYERS_DIR" )
const ( KindBuildpack = "Buildpack" KindExtension = "Extension" )
const ( // EnvBuildPlanPath is the absolute path of the build plan; a different copy is provided for each buildpack EnvBuildPlanPath = "CNB_BUILD_PLAN_PATH" // EnvBuildpackDir is the absolute path of the buildpack root directory (read-only) EnvBuildpackDir = "CNB_BUILDPACK_DIR" // EnvExtensionDir is the absolute path of the extension root directory (read-only) EnvExtensionDir = "CNB_EXTENSION_DIR" // EnvPlatformDir is the absolute path of the platform directory (read-only); a single copy is provided for all buildpacks EnvPlatformDir = "CNB_PLATFORM_DIR" )
const ( DockerfileKindBuild = "build" DockerfileKindRun = "run" )
const ( // EnvOutputDir is the absolute path of the extension output directory (read-write); a different copy is provided for each extension; // contents are copied to the generator's <generated> directory EnvOutputDir = "CNB_OUTPUT_DIR" )
Variables ¶
This section is empty.
Functions ¶
func DecodeLaunchTOML ¶ added in v0.15.0
func DecodeLaunchTOML(launchPath string, bpAPI string, launchTOML *LaunchTOML) error
DecodeLaunchTOML reads a launch.toml file
func EncodeLayerMetadataFile ¶
func EncodeLayerMetadataFile(lmf LayerMetadataFile, path, buildpackAPI string) error
func MadeCached ¶ added in v0.13.1
func MadeLaunch ¶ added in v0.13.1
func ValidateBuildDockerfile ¶ added in v0.17.0
func ValidateRunDockerfile ¶ added in v0.17.0
func ValidateRunDockerfile(dInfo *DockerfileInfo, logger log.Logger) error
Types ¶
type BOMEntry ¶
type BOMEntry struct { Require Buildpack GroupElement `toml:"buildpack" json:"buildpack"` }
func WithBuildpack ¶
func WithBuildpack(bp GroupElement, bom []BOMEntry) []BOMEntry
type BOMFile ¶ added in v0.13.0
func (*BOMFile) Name ¶ added in v0.13.0
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(GroupElement, []BOMEntry) ([]BOMEntry, error)
}
func NewBOMValidator ¶ added in v0.13.0
func NewBOMValidator(_ string, layersDir string, logger log.Logger) BOMValidator
NewBOMValidator returns a validator for the legacy unstructured BOM.
type BaseInfo ¶ added in v0.15.0
type BaseInfo struct { ClearEnv bool `toml:"clear-env,omitempty"` Homepage string `toml:"homepage,omitempty"` ID string `toml:"id"` Name string `toml:"name"` Version string `toml:"version"` }
BaseInfo is information shared by both buildpacks and extensions. For buildpacks it winds up under the toml `buildpack` key along with SBOM info, but extensions have no SBOMs.
type BpDescriptor ¶ added in v0.15.0
type BpDescriptor struct { WithAPI string `toml:"api"` Buildpack BpInfo `toml:"buildpack"` Order Order `toml:"order"` WithRootDir string `toml:"-"` Targets []TargetMetadata `toml:"targets"` Stacks []StackMetadata `toml:"stacks"` // just for backwards compat so we can check if it's the bionic stack, which we translate to a target }
func ReadBpDescriptor ¶ added in v0.15.0
func ReadBpDescriptor(path string) (*BpDescriptor, error)
func (*BpDescriptor) API ¶ added in v0.15.0
func (d *BpDescriptor) API() string
func (*BpDescriptor) ClearEnv ¶ added in v0.15.0
func (d *BpDescriptor) ClearEnv() bool
func (*BpDescriptor) Homepage ¶ added in v0.15.0
func (d *BpDescriptor) Homepage() string
func (*BpDescriptor) RootDir ¶ added in v0.15.0
func (d *BpDescriptor) RootDir() string
func (*BpDescriptor) String ¶ added in v0.15.0
func (d *BpDescriptor) String() string
func (*BpDescriptor) TargetsList ¶ added in v0.17.0
func (d *BpDescriptor) TargetsList() []TargetMetadata
type BuildExecutor ¶ added in v0.15.0
type BuildExecutor interface {
Build(d BpDescriptor, inputs BuildInputs, logger log.Logger) (BuildOutputs, error)
}
BuildExecutor executes a single buildpack's `./bin/build` binary, providing inputs as defined in the Buildpack Interface Specification, and processing outputs for the platform.
type BuildInputs ¶ added in v0.15.0
type BuildOutputs ¶ added in v0.15.0
type BuildPlan ¶
type BuildPlan struct { PlanSections Or planSectionsList `toml:"or"` }
type DefaultBuildExecutor ¶ added in v0.15.0
type DefaultBuildExecutor struct{}
func (*DefaultBuildExecutor) Build ¶ added in v0.15.0
func (e *DefaultBuildExecutor) Build(d BpDescriptor, inputs BuildInputs, logger log.Logger) (BuildOutputs, error)
type DefaultDetectExecutor ¶ added in v0.15.0
type DefaultDetectExecutor struct{}
func (*DefaultDetectExecutor) Detect ¶ added in v0.15.0
func (e *DefaultDetectExecutor) Detect(d Descriptor, inputs DetectInputs, logger log.Logger) DetectOutputs
type DefaultGenerateExecutor ¶ added in v0.15.0
type DefaultGenerateExecutor struct{}
func (*DefaultGenerateExecutor) Generate ¶ added in v0.15.0
func (e *DefaultGenerateExecutor) Generate(d ExtDescriptor, inputs GenerateInputs, logger log.Logger) (GenerateOutputs, error)
type Descriptor ¶
type Descriptor interface { API() string Homepage() string TargetsList() []TargetMetadata }
Descriptor exposes information contained in a buildpack.toml or extension.toml that is generic to buildpacks and/or image extensions.
type DetectExecutor ¶ added in v0.15.0
type DetectExecutor interface {
Detect(d Descriptor, inputs DetectInputs, logger log.Logger) DetectOutputs
}
DetectExecutor executes a single buildpack or image extension's `./bin/detect` binary, providing inputs as defined in the Buildpack Interface Specification, and processing outputs for the platform. For image extensions (where `./bin/detect` is optional), pre-populated outputs are processed here.
type DetectInputs ¶ added in v0.15.0
type DetectOutputs ¶ added in v0.15.0
type DockerfileInfo ¶ added in v0.15.0
type DockerfileInfo struct { ExtensionID string Kind string Path string // WithBase if populated indicates that the Dockerfile switches the image base to the provided value. // If WithBase is empty, Extend should be true, otherwise there is nothing for the Dockerfile to do. // However if WithBase is populated, Extend may be true or false. WithBase string // Extend if true indicates that the Dockerfile contains image modifications // and if false indicates that the Dockerfile only switches the image base. // If Extend is false, WithBase should be non-empty, otherwise there is nothing for the Dockerfile to do. // However if Extend is true, WithBase may be empty or non-empty. Extend bool Ignore bool }
type ErrorType ¶
type ErrorType string
const ErrTypeBuildpack ErrorType = "ERR_BUILDPACK"
const ErrTypeFailedDetection ErrorType = "ERR_FAILED_DETECTION"
type ExtDescriptor ¶ added in v0.15.0
type ExtDescriptor struct { WithAPI string `toml:"api"` Extension ExtInfo `toml:"extension"` WithRootDir string `toml:"-"` Targets []TargetMetadata `toml:"targets"` }
func ReadExtDescriptor ¶ added in v0.15.0
func ReadExtDescriptor(path string) (*ExtDescriptor, error)
func (*ExtDescriptor) API ¶ added in v0.15.0
func (d *ExtDescriptor) API() string
func (*ExtDescriptor) ClearEnv ¶ added in v0.15.0
func (d *ExtDescriptor) ClearEnv() bool
func (*ExtDescriptor) Homepage ¶ added in v0.15.0
func (d *ExtDescriptor) Homepage() string
func (*ExtDescriptor) RootDir ¶ added in v0.15.0
func (d *ExtDescriptor) RootDir() string
func (*ExtDescriptor) String ¶ added in v0.15.0
func (d *ExtDescriptor) String() string
func (*ExtDescriptor) TargetsList ¶ added in v0.17.0
func (d *ExtDescriptor) TargetsList() []TargetMetadata
type ExtendBuildConfig ¶ added in v0.15.0
type ExtendBuildConfig struct {
Args []ExtendArg `toml:"args"`
}
type ExtendConfig ¶ added in v0.15.0
type ExtendConfig struct {
Build ExtendBuildConfig `toml:"build"`
}
type GenerateExecutor ¶ added in v0.15.0
type GenerateExecutor interface {
Generate(d ExtDescriptor, inputs GenerateInputs, logger log.Logger) (GenerateOutputs, error)
}
GenerateExecutor executes a single image extension's `./bin/generate` binary, providing inputs as defined in the Buildpack Interface Specification, and processing outputs for the platform. Pre-populated outputs for image extensions that are missing `./bin/generate` are processed here.
type GenerateInputs ¶ added in v0.15.0
type GenerateOutputs ¶ added in v0.15.0
type GenerateOutputs struct { Dockerfiles []DockerfileInfo Contexts []extend.ContextInfo MetRequires []string }
type Group ¶
type Group struct { Group []GroupElement `toml:"group"` GroupExtensions []GroupElement `toml:"group-extensions,omitempty" json:"group-extensions,omitempty"` }
func (Group) HasExtensions ¶ added in v0.15.0
type GroupElement ¶ added in v0.15.0
type GroupElement struct { // ID specifies the ID of the buildpack or extension. ID string `toml:"id" json:"id"` // Version specifies the version of the buildpack or extension. Version string `toml:"version" json:"version"` // API specifies the Buildpack API that the buildpack or extension implements. API string `toml:"api,omitempty" json:"-"` // Homepage specifies the homepage of the buildpack or extension. Homepage string `toml:"homepage,omitempty" json:"homepage,omitempty"` // Extension specifies whether the group element is a buildpack or an extension. Extension bool `toml:"extension,omitempty" json:"-"` // Optional specifies that the buildpack or extension is optional. Extensions are always optional. Optional bool `toml:"optional,omitempty" json:"optional,omitempty"` // OrderExtensions holds the order for extensions during the detect phase. OrderExtensions Order `toml:"-" json:"-"` }
A GroupElement represents a buildpack referenced in a buildpack.toml's [[order.group]] OR a buildpack or extension in order.toml OR a buildpack or extension in group.toml.
func (GroupElement) Equals ¶ added in v0.15.0
func (e GroupElement) Equals(o GroupElement) bool
func (GroupElement) IsExtensionsOrder ¶ added in v0.15.0
func (e GroupElement) IsExtensionsOrder() bool
func (GroupElement) Kind ¶ added in v0.15.0
func (e GroupElement) Kind() string
func (GroupElement) NoAPI ¶ added in v0.15.0
func (e GroupElement) NoAPI() GroupElement
func (GroupElement) NoExtension ¶ added in v0.15.0
func (e GroupElement) NoExtension() GroupElement
func (GroupElement) NoHomepage ¶ added in v0.15.0
func (e GroupElement) NoHomepage() GroupElement
func (GroupElement) NoOpt ¶ added in v0.15.0
func (e GroupElement) NoOpt() GroupElement
func (GroupElement) String ¶ added in v0.15.0
func (e GroupElement) String() string
func (GroupElement) WithAPI ¶ added in v0.15.0
func (e GroupElement) WithAPI(version string) GroupElement
func (GroupElement) WithHomepage ¶ added in v0.15.0
func (e GroupElement) WithHomepage(address string) GroupElement
type LaunchTOML ¶
type LaunchTOML struct { BOM []BOMEntry Labels []Label Processes []ProcessEntry `toml:"processes"` Slices []layers.Slice `toml:"slices"` }
func (LaunchTOML) ToLaunchProcessesForBuildpack ¶ added in v0.15.0
func (lt LaunchTOML) ToLaunchProcessesForBuildpack(bpID string) []launch.Process
converts launch.toml processes to launch.Processes
type Layer ¶ added in v0.13.1
type Layer struct {
// contains filtered or unexported fields
}
func (*Layer) HasLocalContents ¶ added in v0.13.1
func (*Layer) Identifier ¶ added in v0.13.1
func (*Layer) Read ¶ added in v0.13.1
func (l *Layer) Read() (LayerMetadata, error)
func (*Layer) WriteMetadata ¶ added in v0.13.1
func (l *Layer) WriteMetadata(metadata LayerMetadataFile) 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 ¶
type LayersDir ¶ added in v0.13.1
type LayersDir struct { Path string Buildpack GroupElement Store *StoreTOML // contains filtered or unexported fields }
func ReadLayersDir ¶ added in v0.13.1
func (*LayersDir) FindLayers ¶ added in v0.13.1
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 OSDistro ¶ added in v0.17.0
type OSDistro struct { Name string `json:"name" toml:"name"` Version string `json:"version" toml:"version"` }
OSDistro is an OS distribution that a buildpack or extension can support.
type PlanSections ¶
type ProcessEntry ¶ added in v0.15.0
type ProcessEntry struct { Type string `toml:"type" json:"type"` Command []string `toml:"-"` // ignored RawCommandValue toml.Primitive `toml:"command" json:"command"` Args []string `toml:"args" json:"args"` Direct *bool `toml:"direct" json:"direct"` Default bool `toml:"default,omitempty" json:"default,omitempty"` WorkingDirectory string `toml:"working-dir,omitempty" json:"working-dir,omitempty"` }
func (*ProcessEntry) ToLaunchProcess ¶ added in v0.15.0
func (p *ProcessEntry) ToLaunchProcess(bpID string) launch.Process
ToLaunchProcess converts a buildpack.ProcessEntry to a launch.Process
type StackMetadata ¶ added in v0.17.0
type StackMetadata struct {
ID string `toml:"id"`
}
type StoreTOML ¶
type StoreTOML struct {
Data map[string]interface{} `json:"metadata" toml:"metadata"`
}
type TargetMetadata ¶ added in v0.17.0
type TargetMetadata struct { OS string `json:"os" toml:"os"` Arch string `json:"arch" toml:"arch"` ArchVariant string `json:"arch-variant,omitempty" toml:"arch-variant"` Distros []OSDistro `json:"distros,omitempty" toml:"distros"` }
func (*TargetMetadata) String ¶ added in v0.17.0
func (t *TargetMetadata) String() string