libcnb

package module
v1.30.4 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2024 License: Apache-2.0 Imports: 12 Imported by: 218

README

github.com/buildpacks/libcnb

Go Reference

libcnb is a Go language binding of the Cloud Native Buildpacks API. It is a non-opinionated implementation adding language constructs and convenience methods for working with the API.

For operations such as building an app, creating a builder or packaging a buildpack, you may use pack as a Go library.

Usage

Installation
go get github.com/buildpacks/libcnb
Docs

https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc

Tutorial

docs/tutorial.md

License

This library is released under version 2.0 of the Apache License.

Documentation

Index

Constants

View Source
const (
	// MinSupportedBPVersion indicates the minium supported version of the Buildpacks API
	MinSupportedBPVersion = "0.5"

	// MaxSupportedBPVersion indicates the maximum supported version of the Buildpacks API
	MaxSupportedBPVersion = "0.8"
)

Constants to track minimum and maximum supported Buildpack API versions

View Source
const (
	BOMFormatCycloneDXExtension = "cdx.json"
	BOMFormatSPDXExtension      = "spdx.json"
	BOMFormatSyftExtension      = "syft.json"
	BOMMediaTypeCycloneDX       = "application/vnd.cyclonedx+json"
	BOMMediaTypeSPDX            = "application/spdx+json"
	BOMMediaTypeSyft            = "application/vnd.syft+json"
	BOMUnknown                  = "unknown"
)
View Source
const (
	// BindingKind is the metadata key for a binding's kind.
	BindingKind = "kind"

	// BindingProvider is the key for a binding's provider.
	BindingProvider = "provider"

	// BindingType is the key for a binding's type.
	BindingType = "type"

	// EnvServiceBindings is the name of the environment variable that contains the path to service bindings directory.
	//
	// See the Service Binding Specification for Kubernetes for more details - https://k8s-service-bindings.github.io/spec/
	EnvServiceBindings = "SERVICE_BINDING_ROOT"

	// EnvVcapServices is the name of the environment variable that contains the bindings in cloudfoundry
	EnvVcapServices = "VCAP_SERVICES"

	// EnvCNBBindings is the name of the environment variable that contains the path to the CNB bindings directory.
	// See the CNB bindings extension spec for more details - https://github.com/buildpacks/spec/blob/main/extensions/bindings.md
	//
	// Deprecated: Use the Service Binding Specification for Kubernetes instead -
	// https://github.com/buildpacks/rfcs/blob/main/text/0055-deprecate-service-bindings.md.
	EnvCNBBindings = "CNB_BINDINGS"
)

Variables

This section is empty.

Functions

func Build

func Build(builder Builder, options ...Option)

Build is called by the main function of a buildpack, for build.

func Detect

func Detect(detector Detector, options ...Option)

Detect is called by the main function of a buildpack, for detection.

func Main added in v1.10.0

func Main(detector Detector, builder Builder, options ...Option)

Main is called by the main function of a buildpack, encapsulating both detection and build in the same binary.

func RunExecD added in v1.24.0

func RunExecD(execDMap map[string]ExecD, options ...Option)

RunExecD is called by the main function of a buildpack's execd binary, encompassing multiple execd executors in one binary.

Types

type Application added in v1.1.0

type Application struct {

	// Path is the path to the application.
	Path string
}

Application is the user contributed application to build.

type ApplicationPathFormatter

type ApplicationPathFormatter string

ApplicationPathFormatter is the formatter for an ApplicationPath.

func (ApplicationPathFormatter) String

func (a ApplicationPathFormatter) String() string

type BOM deprecated added in v1.19.0

type BOM struct {
	Entries []BOMEntry
}

BOM contains all Bill of Materials entries

Deprecated: as of Buildpack API 0.7, write to `layer.BOMPath()` instead

type BOMEntry deprecated added in v1.19.0

type BOMEntry struct {
	// Name represents the name of the entry.
	Name string `toml:"name"`

	// Metadata is the metadata of the entry.  Optional.
	Metadata map[string]interface{} `toml:"metadata,omitempty"`

	// Launch indicates whether the given entry is included in app image. If launch is true the entry
	// will be added to the app image Bill of Materials. Launch should be true if the entry describes
	// the contents of a launch layer or app layer.
	Launch bool `toml:"-"`

	// Build indicates whether the given entry is available at build time. If build is true the entry
	// will be added to the build Bill of Materials.
	Build bool `toml:"-"`
}

BOMEntry contains a bill of materials entry.

Deprecated: as of Buildpack API 0.7, BOM should use standard formats like CycloneDX going forward

type Binding

type Binding struct {

	// Name is the name of the binding
	Name string

	// Path is the path to the binding directory.
	Path string

	// Type is the type of the binding.
	Type string

	// Provider is the optional provider of the binding.
	Provider string

	// Secret is the secret of the binding.
	Secret map[string]string
}

Binding is a projection of metadata about an external entity to be bound to.

func NewBinding

func NewBinding(name string, path string, secret map[string]string) Binding

NewBinding creates a new Binding initialized with a secret.

func NewBindingFromPath

func NewBindingFromPath(path string) (Binding, error)

NewBindingFromPath creates a new binding from the files located at a path.

func (Binding) SecretFilePath added in v1.12.0

func (b Binding) SecretFilePath(name string) (string, bool)

SecretFilePath return the path to a secret file with the given name.

func (Binding) String

func (b Binding) String() string

type Bindings

type Bindings []Binding

Bindings is a collection of bindings keyed by their name.

func NewBindingsForBuild added in v1.22.0

func NewBindingsForBuild(platformDir string) (Bindings, error)

NewBindingsForBuild creates a new bindings from all the bindings at the path defined by $SERVICE_BINDING_ROOT or $CNB_BINDINGS if it does not exist. If neither is defined, bindings are read from <platform>/bindings, the default path defined in the CNB Binding extension specification.

func NewBindingsForLaunch added in v1.22.0

func NewBindingsForLaunch() (Bindings, error)

NewBindingsForLaunch creates a new bindings from all the bindings at the path defined by $SERVICE_BINDING_ROOT or $CNB_BINDINGS if it does not exist. If neither is defined, returns an empty collection of Bindings.

func NewBindingsFromEnvironment

func NewBindingsFromEnvironment() (Bindings, error)

NewBindingsFromEnvironment creates a new bindings from all the bindings at the path defined by $SERVICE_BINDING_ROOT or $CNB_BINDINGS if it does not exist. If neither is defined, returns an empty collection of Bindings. Note - This API is deprecated. Please use NewBindingsForLaunch instead.

func NewBindingsFromPath

func NewBindingsFromPath(path string) (Bindings, error)

NewBindingsFromPath creates a new instance from all the bindings at a given path.

func NewBindingsFromVcapServicesEnv added in v1.29.0

func NewBindingsFromVcapServicesEnv(content string) (Bindings, error)

NewBindingsFromVcapServicesEnv creates a new instance from all the bindings given from the VCAP_SERVICES.

type BuildContext

type BuildContext struct {

	// Application is application to build.
	Application Application

	// Buildpack is metadata about the buildpack, from buildpack.toml.
	Buildpack Buildpack

	// Layers is the layers available to the buildpack.
	Layers Layers

	// PersistentMetadata is metadata that is persisted even across cache cleaning.
	PersistentMetadata map[string]interface{}

	// Plan is the buildpack plan provided to the buildpack.
	Plan BuildpackPlan

	// Platform is the contents of the platform.
	Platform Platform

	// StackID is the ID of the stack.
	StackID string
}

BuildContext contains the inputs to build.

type BuildPlan

type BuildPlan struct {
	// Provides is the dependencies provided by the buildpack.
	Provides []BuildPlanProvide `toml:"provides,omitempty"`

	// Requires is the dependencies required by the buildpack.
	Requires []BuildPlanRequire `toml:"requires,omitempty"`
}

BuildPlan represents the provisions and requirements of a buildpack during detection.

type BuildPlanProvide

type BuildPlanProvide struct {
	// Name is the name of the dependency.
	Name string `toml:"name"`
}

BuildPlanProvide represents a dependency provided by a buildpack.

type BuildPlanRequire

type BuildPlanRequire struct {
	// Name is the name of the dependency.
	Name string `toml:"name"`

	// Metadata is the metadata for the dependency. Optional.
	Metadata map[string]interface{} `toml:"metadata,omitempty"`
}

BuildPlanRequire represents a dependency required by a buildpack.

type BuildPlans

type BuildPlans struct {
	// BuildPlan is the first build plan.
	BuildPlan

	// Or is the collection of other build plans.
	Or []BuildPlan `toml:"or,omitempty"`
}

BuildPlans represents a collection of build plans produced by a buildpack during detection.

type BuildResult

type BuildResult struct {
	// BOM contains entries to be appended to the app image Bill of Materials and/or build Bill of Materials.
	//
	// Deprecated: as of Buildpack API 0.7, write to `layer.BOMPath()` instead
	BOM *BOM

	// Labels are the image labels contributed by the buildpack.
	Labels []Label

	// Layers is the collection of LayerCreators contributed by the buildpack.
	Layers []LayerContributor

	// PersistentMetadata is metadata that is persisted even across cache cleaning.
	PersistentMetadata map[string]interface{}

	// Processes are the process types contributed by the buildpack.
	Processes []Process

	// Slices are the application slices contributed by the buildpack.
	Slices []Slice

	// Unmet contains buildpack plan entries that were not satisfied by the buildpack and therefore should be
	// passed to subsequent providers.
	Unmet []UnmetPlanEntry
}

BuildResult contains the results of detection.

func NewBuildResult added in v1.8.0

func NewBuildResult() BuildResult

NewBuildResult creates a new BuildResult instance, initializing empty fields.

func (BuildResult) String added in v1.4.1

func (b BuildResult) String() string

type BuildTOML added in v1.19.0

type BuildTOML struct {
	// BOM contains the build-time bill of materials.
	//
	// Deprecated: as of Buildpack API 0.7, write to `layer.BOMPath()` instead
	BOM []BOMEntry `toml:"bom"`

	// Unmet is a collection of buildpack plan entries that should be passed through to subsequent providers.
	Unmet []UnmetPlanEntry
}

BuildTOML represents the contents of build.toml.

type Builder added in v1.3.0

type Builder interface {

	// Build takes a context and returns a result, performing buildpack build behaviors.
	Build(context BuildContext) (BuildResult, error)
}

Builder describes an interface for types that can be used by the Build function.

type Buildpack

type Buildpack struct {
	// API is the api version expected by the buildpack.
	API string `toml:"api"`

	// Info is information about the buildpack.
	Info BuildpackInfo `toml:"buildpack"`

	// Path is the path to the buildpack.
	Path string `toml:"-"`

	// Stacks is the collection of stacks supported by the buildpack.
	Stacks []BuildpackStack `toml:"stacks"`

	// Metadata is arbitrary metadata attached to the buildpack.
	Metadata map[string]interface{} `toml:"metadata"`
}

Buildpack is the contents of the buildpack.toml file.

type BuildpackInfo

type BuildpackInfo struct {
	// ID is the ID of the buildpack.
	ID string `toml:"id"`

	// Name is the name of the buildpack.
	Name string `toml:"name"`

	// Version is the version of the buildpack.
	Version string `toml:"version"`

	// Homepage is the homepage of the buildpack.
	Homepage string `toml:"homepage"`

	// ClearEnvironment is whether the environment should be clear of user-configured environment variables.
	ClearEnvironment bool `toml:"clear-env"`

	// Description is a string describing the buildpack.
	Description string `toml:"description"`

	// Keywords is a list of words that are associated with the buildpack.
	Keywords []string `toml:"keywords"`

	// Licenses a list of buildpack licenses.
	Licenses []License `toml:"licenses"`

	// SBOM is the list of supported SBOM media types
	SBOMFormats []string `toml:"sbom-formats"`
}

BuildpackInfo is information about the buildpack.

type BuildpackOrder

type BuildpackOrder struct {
	// Groups is the collection of groups within the order.
	Groups []BuildpackOrderBuildpack `toml:"group"`
}

BuildpackOrder is an order definition in the buildpack.

type BuildpackOrderBuildpack

type BuildpackOrderBuildpack struct {
	// ID is the id of the buildpack.
	ID string `toml:"id"`

	// Version is the version of the buildpack.
	Version string `toml:"version"`

	// Optional is whether the buildpack is optional within the buildpack.
	Optional bool `toml:"optional"`
}

BuildpackOrderBuildpack is a buildpack within in a buildpack order group.

type BuildpackPathFormatter

type BuildpackPathFormatter string

BuildpackPathFormatter is the formatter for a BuildpackPath.

func (BuildpackPathFormatter) String

func (b BuildpackPathFormatter) String() string

type BuildpackPlan

type BuildpackPlan struct {

	// Entries represents all the buildpack plan entries.
	Entries []BuildpackPlanEntry `toml:"entries,omitempty"`
}

BuildpackPlan represents a buildpack plan.

type BuildpackPlanEntry

type BuildpackPlanEntry struct {
	// Name represents the name of the entry.
	Name string `toml:"name"`

	// Metadata is the metadata of the entry.  Optional.
	Metadata map[string]interface{} `toml:"metadata,omitempty"`
}

BuildpackPlanEntry represents an entry in the buildpack plan.

type BuildpackStack

type BuildpackStack struct {
	// ID is the id of the stack.
	ID string `toml:"id"`

	// Mixins is the collection of mixins associated with the stack.
	Mixins []string `toml:"mixins"`
}

BuildpackStack is a stack supported by the buildpack.

type Config

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

Config is an object that contains configurable properties for execution.

type DetectContext

type DetectContext struct {

	// Application is the application to build.
	Application Application

	// Buildpack is metadata about the buildpack, from buildpack.toml.
	Buildpack Buildpack

	// Platform is the contents of the platform.
	Platform Platform

	// StackID is the ID of the stack.
	StackID string
}

DetectContext contains the inputs to detection.

type DetectResult

type DetectResult struct {

	// Pass indicates whether detection has passed.
	Pass bool

	// Plans are the build plans contributed by the buildpack.
	Plans []BuildPlan
}

DetectResult contains the results of detection.

type Detector added in v1.3.0

type Detector interface {

	// Detect takes a context and returns a result, performing buildpack detect behaviors.
	Detect(context DetectContext) (DetectResult, error)
}

Detector describes an interface for types that can be used by the Detect function.

type Environment

type Environment map[string]string

Environment represents the file-based environment variable specification.

func (Environment) Append

func (e Environment) Append(name string, delimiter string, a ...interface{})

Append formats using the default formats for its operands and appends the value of this environment variable to any previous declarations of the value without any delimitation. Spaces are added between operands when neither is a string. If delimitation is important during concatenation, callers are required to add it.

func (Environment) Appendf added in v1.6.0

func (e Environment) Appendf(name string, delimiter string, format string, a ...interface{})

Appendf formats according to a format specifier and appends the value of this environment variable to any previous declarations of the value without any delimitation. If delimitation is important during concatenation, callers are required to add it.

func (Environment) Default

func (e Environment) Default(name string, a ...interface{})

Default formats using the default formats for its operands and sets a default for an environment variable with this value. Spaces are added between operands when neither is a string.

func (Environment) Defaultf added in v1.6.0

func (e Environment) Defaultf(name string, format string, a ...interface{})

Defaultf formats according to a format specifier and sets a default for an environment variable with this value.

func (Environment) Override

func (e Environment) Override(name string, a ...interface{})

Override formats using the default formats for its operands and overrides any existing value for an environment variable with this value. Spaces are added between operands when neither is a string.

func (Environment) Overridef added in v1.6.0

func (e Environment) Overridef(name string, format string, a ...interface{})

Overridef formats according to a format specifier and overrides any existing value for an environment variable with this value.

func (Environment) Prepend

func (e Environment) Prepend(name string, delimiter string, a ...interface{})

Prepend formats using the default formats for its operands and prepends the value of this environment variable to any previous declarations of the value without any delimitation. Spaces are added between operands when neither is a string. If delimitation is important during concatenation, callers are required to add it.

func (Environment) Prependf added in v1.6.0

func (e Environment) Prependf(name string, delimiter string, format string, a ...interface{})

Prependf formats using the default formats for its operands and prepends the value of this environment variable to any previous declarations of the value without any delimitation. If delimitation is important during concatenation, callers are required to add it.

func (Environment) ProcessAppend added in v1.14.0

func (e Environment) ProcessAppend(processType string, name string, delimiter string, a ...interface{})

ProcessAppend formats using the default formats for its operands and appends the value of this environment variable to any previous declarations of the value without any delimitation. Spaces are added between operands when neither is a string. If delimitation is important during concatenation, callers are required to add it.

func (Environment) ProcessAppendf added in v1.14.0

func (e Environment) ProcessAppendf(processType string, name string, delimiter string, format string, a ...interface{})

ProcessAppendf formats according to a format specifier and appends the value of this environment variable to any previous declarations of the value without any delimitation. If delimitation is important during concatenation, callers are required to add it.

func (Environment) ProcessDefault added in v1.14.0

func (e Environment) ProcessDefault(processType string, name string, a ...interface{})

ProcessDefault formats using the default formats for its operands and sets a default for an environment variable with this value. Spaces are added between operands when neither is a string.

func (Environment) ProcessDefaultf added in v1.14.0

func (e Environment) ProcessDefaultf(processType string, name string, format string, a ...interface{})

ProcessDefaultf formats according to a format specifier and sets a default for an environment variable with this value.

func (Environment) ProcessOverride added in v1.14.0

func (e Environment) ProcessOverride(processType string, name string, a ...interface{})

ProcessOverride formats using the default formats for its operands and overrides any existing value for an environment variable with this value. Spaces are added between operands when neither is a string.

func (Environment) ProcessOverridef added in v1.14.0

func (e Environment) ProcessOverridef(processType string, name string, format string, a ...interface{})

ProcessOverridef formats according to a format specifier and overrides any existing value for an environment variable with this value.

func (Environment) ProcessPrepend added in v1.14.0

func (e Environment) ProcessPrepend(processType string, name string, delimiter string, a ...interface{})

ProcessPrepend formats using the default formats for its operands and prepends the value of this environment variable to any previous declarations of the value without any delimitation. Spaces are added between operands when neither is a string. If delimitation is important during concatenation, callers are required to add it.

func (Environment) ProcessPrependf added in v1.14.0

func (e Environment) ProcessPrependf(processType string, name string, delimiter string, format string, a ...interface{})

ProcessPrependf formats using the default formats for its operands and prepends the value of this environment variable to any previous declarations of the value without any delimitation. If delimitation is important during concatenation, callers are required to add it.

type EnvironmentWriter

type EnvironmentWriter interface {

	// Write is called with the path to a directory where the environment variables should be serialized to and the
	// environment variables to serialize to that directory.
	Write(dir string, environment map[string]string) error
}

EnvironmentWriter is the interface implemented by a type that wants to serialize a map of environment variables to the file system.

type Exec added in v1.16.0

type Exec struct {
	// Path is the path to the exec.d directory.
	Path string
}

Exec represents the exec.d layer location

func (Exec) FilePath added in v1.16.0

func (e Exec) FilePath(name string) string

FilePath returns the fully qualified file path for a given name.

func (Exec) ProcessFilePath added in v1.16.0

func (e Exec) ProcessFilePath(processType string, name string) string

ProcessFilePath returns the fully qualified file path for a given name.

type ExecD added in v1.24.0

type ExecD interface {
	Execute() (map[string]string, error)
}

ExecD describes an interface for types that follow the Exec.d specification. It should return a map of environment variables and their values as output.

type ExecDWriter added in v1.24.0

type ExecDWriter interface {

	// Write is called with the map of environment value key value
	// pairs that will be written out
	Write(value map[string]string) error
}

ExecDWriter is the interface implemented by a type that wants to write exec.d output to file descriptor 3.

type ExitHandler

type ExitHandler interface {

	// Error is called when an error is encountered.
	Error(error)

	// Fail is called when a buildpack fails.
	Fail()

	// Pass is called when a buildpack passes.
	Pass()
}

ExitHandler is the interface implemented by a type that wants to handle exit behavior when a buildpack encounters an error.

type Label added in v1.9.0

type Label struct {

	// Key is the key of the label.
	Key string `toml:"key"`

	// Value is the value of the label.
	Value string `toml:"value"`
}

Label represents an image label.

type LaunchTOML added in v1.19.0

type LaunchTOML struct {

	// Labels is the collection of image labels contributed by the buildpack.
	Labels []Label `toml:"labels"`

	// Processes is the collection of process types contributed by the buildpack.
	Processes []Process `toml:"processes"`

	// Slices is the collection of slices contributed by the buildpack.
	Slices []Slice `toml:"slices"`

	// BOM is a collection of entries for the bill of materials.
	//
	// Deprecated: as of Buildpack API 0.7, write to `layer.BOMPath()` instead
	BOM []BOMEntry `toml:"bom"`
}

LaunchTOML represents the contents of launch.toml.

type Layer

type Layer struct {
	// LayerTypes indicates the type of layer
	LayerTypes `toml:"types"`

	// Metadata is the metadata associated with the layer.
	Metadata map[string]interface{} `toml:"metadata"`

	// Name is the name of the layer.
	Name string `toml:"-"`

	// Path is the filesystem location of the layer.
	Path string `toml:"-"`

	// BuildEnvironment are the environment variables set at build time.
	BuildEnvironment Environment `toml:"-"`

	// LaunchEnvironment are the environment variables set at launch time.
	LaunchEnvironment Environment `toml:"-"`

	// SharedEnvironment are the environment variables set at both build and launch times.
	SharedEnvironment Environment `toml:"-"`

	// Profile is the profile.d scripts set in the layer.
	Profile Profile `toml:"-"`

	// Exec is the exec.d executables set in the layer.
	Exec Exec `toml:"-"`
}

Layer represents a layer managed by the buildpack.

func (Layer) SBOMPath added in v1.25.0

func (l Layer) SBOMPath(bt SBOMFormat) string

type LayerContributor

type LayerContributor interface {
	// Contribute accepts a layer and transforms it, returning a layer.
	Contribute(layer Layer) (Layer, error)

	// Name is the name of the layer.
	Name() string
}

LayerContributor is an interface for types that create layers.

type LayerTypes added in v1.19.0

type LayerTypes struct {
	// Build indicates that a layer should be used for builds.
	Build bool `toml:"build"`

	// Cache indicates that a layer should be cached.
	Cache bool `toml:"cache"`

	// Launch indicates that a layer should be used for launch.
	Launch bool `toml:"launch"`
}

LayerTypes describes which types apply to a given layer. A layer may have any combination of Launch, Build, and Cache types.

type Layers

type Layers struct {
	// Path is the layers filesystem location.
	Path string
}

Layers represents the layers part of the specification.

func (Layers) BuildSBOMPath added in v1.25.0

func (l Layers) BuildSBOMPath(bt SBOMFormat) string

BOMBuildPath returns the full path to the build SBoM file for the buildpack

func (Layers) LaunchSBOMPath added in v1.25.0

func (l Layers) LaunchSBOMPath(bt SBOMFormat) string

BOMLaunchPath returns the full path to the launch SBoM file for the buildpack

func (*Layers) Layer

func (l *Layers) Layer(name string) (Layer, error)

Layer creates a new layer, loading metadata if it exists.

type License added in v1.20.0

type License struct {
	// Type is the identifier for the license.
	// It MAY use the SPDX 2.1 license expression, but is not limited to identifiers in the SPDX Licenses List.
	Type string `toml:"type"`

	// URI may be specified in lieu of or in addition to type to point to the license
	// if this buildpack is using a nonstandard license.
	URI string `toml:"uri"`
}

License contains information about a Software License governing the use or redistribution of a buildpack

type Option

type Option func(config Config) Config

Option is a function for configuring a Config instance.

func WithArguments

func WithArguments(arguments []string) Option

WithArguments creates an Option that sets a collection of arguments.

func WithBOMLabel added in v1.25.5

func WithBOMLabel(bomLabel bool) Option

WithBOMLabel creates an Option that enables/disables writing the BOM Label Deprecated: as of Buildpack API 0.7, to be removed in a future version

func WithEnvironmentWriter

func WithEnvironmentWriter(environmentWriter EnvironmentWriter) Option

WithEnvironmentWriter creates an Option that sets an EnvironmentWriter implementation.

func WithExecDWriter added in v1.24.0

func WithExecDWriter(execdWriter ExecDWriter) Option

WithExecDWriter creates an Option that sets a ExecDWriter implementation.

func WithExitHandler

func WithExitHandler(exitHandler ExitHandler) Option

WithExitHandler creates an Option that sets an ExitHandler implementation.

func WithTOMLWriter

func WithTOMLWriter(tomlWriter TOMLWriter) Option

WithTOMLWriter creates an Option that sets a TOMLWriter implementation.

type Platform

type Platform struct {

	// Bindings are the external bindings available to the application.
	Bindings Bindings

	// Environment is the environment exposed by the platform.
	Environment map[string]string

	// Path is the path to the platform.
	Path string
}

Platform is the contents of the platform directory.

type PlatformFormatter

type PlatformFormatter Platform

PlatformFormatter is the formatter for a Platform.

func (PlatformFormatter) String

func (p PlatformFormatter) String() string

type Process

type Process struct {

	// Type is the type of the process.
	Type string `toml:"type"`

	// Command is the command of the process.
	Command string `toml:"command"`

	// Arguments are arguments to the command.
	Arguments []string `toml:"args"`

	// Command is exec'd directly by the os (no profile.d scripts run)
	Direct bool `toml:"direct,omitempty"`

	// WorkingDirectory is a directory to execute the command in, removes the need to use a shell environment to CD into working directory
	WorkingDirectory string `toml:"working-dir,omitempty"`

	// Default can be set to true to indicate that the process
	// type being defined should be the default process type for the app image.
	Default bool `toml:"default,omitempty"`
}

Process represents metadata about a type of command that can be run.

type Profile

type Profile map[string]string

Profile is the collection of values to be written into profile.d

func (Profile) Add

func (p Profile) Add(name string, a ...interface{})

Add formats using the default formats for its operands and adds an entry for a .profile.d file. Spaces are added between operands when neither is a string.

func (Profile) Addf added in v1.6.0

func (p Profile) Addf(name string, format string, a ...interface{})

Addf formats according to a format specifier and adds an entry for a .profile.d file.

func (Profile) ProcessAdd added in v1.14.0

func (p Profile) ProcessAdd(processType string, name string, a ...interface{})

ProcessAdd formats using the default formats for its operands and adds an entry for a .profile.d file. Spaces are added between operands when neither is a string.

func (Profile) ProcessAddf added in v1.14.0

func (p Profile) ProcessAddf(processType string, name string, format string, a ...interface{})

ProcessAddf formats according to a format specifier and adds an entry for a .profile.d file.

type SBOMFormat added in v1.25.0

type SBOMFormat int

BOMFormat indicates the format of the SBOM entry

const (
	CycloneDXJSON SBOMFormat = iota
	SPDXJSON
	SyftJSON
	UnknownFormat
)

func SBOMFormatFromString added in v1.25.1

func SBOMFormatFromString(from string) (SBOMFormat, error)

func (SBOMFormat) MediaType added in v1.25.1

func (b SBOMFormat) MediaType() string

func (SBOMFormat) String added in v1.25.0

func (b SBOMFormat) String() string

type Slice

type Slice struct {

	// Paths are the contents of the slice.
	Paths []string `toml:"paths"`
}

Slice represents metadata about a slice.

type Store

type Store struct {

	// Metadata represents the persistent metadata.
	Metadata map[string]interface{} `toml:"metadata"`
}

Store represents the contents of store.toml

type TOMLWriter

type TOMLWriter interface {

	// Write is called with the path that a TOML file should be written to and the object to serialize to that file.
	Write(path string, value interface{}) error
}

TOMLWriter is the interface implemented by a type that wants to serialize an object to a TOML file.

type UnmetPlanEntry added in v1.19.0

type UnmetPlanEntry struct {
	// Name represents the name of the entry.
	Name string `toml:"name"`
}

UnmetPlanEntry denotes an unmet buildpack plan entry. When a buildpack returns an UnmetPlanEntry in the BuildResult, any BuildpackPlanEntry with a matching Name will be provided to subsequent providers.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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