Documentation
¶
Overview ¶
Package libbuildpack contains types and functions for implementing a Buildpack V3 compliant buildpack.
Index ¶
- func DefaultStack(logger Logger) (string, error)
- type Application
- type Build
- type BuildImages
- type BuildPlan
- type BuildPlanDependency
- type BuildPlanDependencyMetadata
- type Buildpack
- type BuildpackInfo
- type BuildpackMetadata
- type BuildpackStack
- type Cache
- type CacheLayer
- type Detect
- type EnvironmentVariable
- type EnvironmentVariables
- type Launch
- type LaunchLayer
- type LaunchMetadata
- type Logger
- type Platform
- type Process
- type Processes
- type RunImages
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultStack ¶
DefaultStack creates a new instance of Stack, extracting the name from the PACK_STACK_ID environment variable.
Types ¶
type Application ¶
type Application struct {
// Root is the path to the root directory of the application.
Root string
// Logger is used to write debug and info to the console.
Logger Logger
}
Application represents the application being processed by buildpacks.
func DefaultApplication ¶
func DefaultApplication(logger Logger) (Application, error)
DefaultApplication creates a new instance of Application, extracting the Root path from the working directory.
func NewApplication ¶
func NewApplication(root string, logger Logger) Application
NewApplication creates a new instance of Application, configuring the Root path.
func (Application) String ¶
func (a Application) String() string
String makes Application satisfy the Stringer interface.
type Build ¶
type Build struct {
// Application is the application being processed by the buildpack.
Application Application
// Buildpack represents the metadata associated with a buildpack.
Buildpack Buildpack
// BuildPlan represents dependencies contributed by previous builds.
BuildPlan BuildPlan
// Cache represents the cache layers contributed by a buildpack.
Cache Cache
// Launch represents the launch layers contributed by a buildpack.
Launch Launch
// Logger is used to write debug and info to the console.
Logger Logger
// Platform represents components contributed by the platform to the buildpack.
Platform Platform
// Stack is the stack currently available to the application.
Stack string
}
Build represents all of the components available to a buildpack at build time.
func DefaultBuild ¶
DefaultBuild creates a new instance of Build using default values.
func (Build) Failure ¶
Failure signals an unsuccessful build by exiting with a specified positive status code. This should be the final function called in building.
type BuildImages ¶
type BuildImages string
BuildImages is the build image source for a particular stack id.
type BuildPlan ¶
type BuildPlan map[string]BuildPlanDependency
BuildPlan represents the dependencies contributed by a build.
func DefaultBuildPlan ¶
DefaultBuildPlan creates a new instance of BuildPlan, extracting the contents from stdin.
func NewBuildPlan ¶
NewBuildPlan creates a new instance of BuildPlan from a specified io.Reader. Returns an error if the contents of the Reader are not valid TOML.
type BuildPlanDependency ¶
type BuildPlanDependency struct {
// Provider is the optional ID of the buildpack that will provide the dependency.
Provider string `toml:"provider"`
// Version is the optional dependency version.
Version string `toml:"version"`
// Metadata is additional metadata attached to the dependency.
Metadata BuildPlanDependencyMetadata `toml:"metadata"`
}
BuildPlanDependency represents a dependency in a build.
func (BuildPlanDependency) String ¶
func (d BuildPlanDependency) String() string
String makes BuildPlanDependency satisfy the Stringer interface.
type BuildPlanDependencyMetadata ¶
type BuildPlanDependencyMetadata map[string]interface{}
BuildPlanDependencyMetadata is additional metadata attached to a dependency.
type Buildpack ¶
type Buildpack struct {
// Info is information about the buildpack.
Info BuildpackInfo `toml:"buildpack"`
// Stacks is the collection of stacks that the buildpack supports.
Stacks []BuildpackStack `toml:"stacks"`
// Metadata is the additional metadata included in the buildpack.
Metadata BuildpackMetadata `toml:"metadata"`
// Logger is used to write debug and info to the console.
Logger Logger
}
Buildpack represents the metadata associated with a buildpack.
func DefaultBuildpack ¶
DefaultBuildpack creates a new instance of Buildpack extracting the contents of the buildpack.toml file in the root of the buildpack.
func NewBuildpack ¶
NewBuildpack creates a new instance of Buildpack from a specified io.Reader. Returns an error if the contents of the reader are not valid TOML.
type BuildpackInfo ¶
type BuildpackInfo struct {
// ID is the globally unique identifier of the buildpack.
ID string `toml:"id"`
// Name is the human readable name of the buildpack.
Name string `toml:"name"`
// Version is the semver-compliant version of the buildpack.
Version string `toml:"version"`
}
BuildpackInfo is information about the buildpack.
func (BuildpackInfo) String ¶
func (b BuildpackInfo) String() string
String makes BuildpackInfo satisfy the Stringer interface.
type BuildpackMetadata ¶
type BuildpackMetadata map[string]interface{}
BuildpackMetadata is additional metadata included in the buildpack
type BuildpackStack ¶
type BuildpackStack struct {
// ID is the globally unique identifier of the stack.
ID string `toml:"id"`
// BuildImages are the suggested sources for stacks if the platform is unaware of the stack id.
BuildImages []BuildImages `toml:"build-images"`
// RunImages are the suggested sources for stacks if the platform is unaware of the stack id.
RunImages []RunImages `toml:"run-images"`
}
BuildpackStack represents metadata about the stacks associated with the buildpack.
func (BuildpackStack) String ¶
func (b BuildpackStack) String() string
String makes BuildpackStack satisfy the Stringer interface.
type Cache ¶
type Cache struct {
// Root is the path to the root directory for the caches.
Root string
// Logger is used to write debug and info to the console.
Logger Logger
}
Cache represents cache layers for an application.
func DefaultCache ¶
DefaultCache creates a new instance of Cache, extracting the Root path from os.Args[2].
func (Cache) Layer ¶
func (c Cache) Layer(name string) CacheLayer
Layer creates a CacheLayer with a specified name.
type CacheLayer ¶
type CacheLayer struct {
// Root is the path to the root directory for the cache layer.
Root string
// Logger is used to write debug and info to the console.
Logger Logger
}
CacheLayer represents a cache layer for an application.
func (CacheLayer) AppendEnv ¶
func (c CacheLayer) AppendEnv(name string, format string, args ...interface{}) error
AppendEnv 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 (CacheLayer) AppendPathEnv ¶
func (c CacheLayer) AppendPathEnv(name string, format string, args ...interface{}) error
AppendPathEnv appends the value of this environment variable to any previous declarations of the value using the OS path delimiter.
func (CacheLayer) OverrideEnv ¶
func (c CacheLayer) OverrideEnv(name string, format string, args ...interface{}) error
Override overrides any existing value for an environment variable with this value.
func (CacheLayer) String ¶
func (c CacheLayer) String() string
String makes CacheLayer satisfy the Stringer interface.
type Detect ¶
type Detect struct {
// Application is the application being processed by the buildpack.
Application Application
// Buildpack represents the metadata associated with a buildpack.
Buildpack Buildpack
// BuildPlan represents dependencies contributed by previous builds.
BuildPlan BuildPlan
// Logger is used to write debug and info to the console.
Logger Logger
// Stack is the stack currently available to the application.
Stack string
}
Detect represents all of the components available to a buildpack at detect time.
func DefaultDetect ¶
DefaultDetect creates a new instance of Detect using default values.
func (Detect) Error ¶
Error signals an error during detection by exiting with a specified non-zero, non-100 status code. This should the final function called in detection.
func (Detect) Fail ¶
func (d Detect) Fail()
Fail signals an unsuccessful detection by exiting with a 100 status code. This should be the final function called in detection.
type EnvironmentVariable ¶
type EnvironmentVariable struct {
// Name is the name of the environment variable
Name string
// contains filtered or unexported fields
}
EnvironmentVariable represents an environment variable provided by the platform.
func (EnvironmentVariable) Set ¶
func (e EnvironmentVariable) Set() error
Set sets the environment variable content in the current process environment.
func (EnvironmentVariable) String ¶
func (e EnvironmentVariable) String() string
String makes EnvironmentVariable satisfy the Stringer interface.
type EnvironmentVariables ¶
type EnvironmentVariables []EnvironmentVariable
EnvironmentVariables is a collection of EnvironmentVariable instances.
func (EnvironmentVariables) SetAll ¶
func (e EnvironmentVariables) SetAll() error
SetAll sets all of the environment variable content in the current process environment.
type Launch ¶
type Launch struct {
// Root is the path to the root directory for the layers.
Root string
// Logger is used to write debug and info to the console.
Logger Logger
}
Launch represents launch layers for an application.
func DefaultLaunch ¶
DefaultLaunch creates a new instance of Launch, extracting the Root path from os.Args[3].
func (Launch) Layer ¶
func (l Launch) Layer(name string) LaunchLayer
Layer creates a LaunchLayer with a specified name.
func (Launch) WriteMetadata ¶
func (l Launch) WriteMetadata(metadata LaunchMetadata) error
WriteMetadata writes Launch metadata to the filesystem.
type LaunchLayer ¶
type LaunchLayer struct {
// Root is the path to the root directory for the launch layer.
Root string
// Logger is used to write debug and info to the console.
Logger Logger
// contains filtered or unexported fields
}
LaunchLayer represents a launch layer for an application.
func (LaunchLayer) ReadMetadata ¶
func (l LaunchLayer) ReadMetadata(v interface{}) error
ReadMetadata reads arbitrary launch layer metadata from the filesystem.
func (LaunchLayer) String ¶
func (l LaunchLayer) String() string
String makes LaunchLayer satisfy the Stringer interface.
func (LaunchLayer) WriteMetadata ¶
func (l LaunchLayer) WriteMetadata(metadata interface{}) error
WriteMetadata writes arbitrary launch layer metadata to the filesystem.
func (LaunchLayer) WriteProfile ¶
func (l LaunchLayer) WriteProfile(file string, format string, args ...interface{}) error
WriteProfile writes a file to profile.d with this value.
type LaunchMetadata ¶
type LaunchMetadata struct {
// Processes is a collection of processes.
Processes Processes `toml:"processes"`
}
LaunchMetadata represents metadata about the Launch.
func (LaunchMetadata) String ¶
func (l LaunchMetadata) String() string
String makes LaunchMetadata satisfy the Stringer interface.
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger is a type that contains references to the console output for debug and info logging levels.
func NewLogger ¶
NewLogger creates a new instance of Logger, configuring the debug and info writers to use. If writer is nil, that logging level is disabled.
func (Logger) Debug ¶
Debug prints output to the configured debug writer, interpolating the format and any arguments and adding a newline at the end. If debug logging is not enabled, nothing is printed.
func (Logger) Info ¶
Info prints output to the configured info writer, interpolating the format and any arguments and adding a newline at the end. If info logging is not enabled, nothing is printed.
func (Logger) IsDebugEnabled ¶
IsDebugEnabled returns true if debug logging is enabled, false otherwise.
func (Logger) IsInfoEnabled ¶
IsInfoEnabled returns true if info logging is enabled, false otherwise.
type Platform ¶
type Platform struct {
// Root is the path to the root directory for the platform contributions.
Root string
// Envs is the collection of environment variables contributed by the platform.
Envs EnvironmentVariables
// Logger is used to write debug and info to the console.
Logger Logger
}
Platform represents the platform contributions for an application.
func DefaultPlatform ¶
DefaultPlatform creates a new instance of Platform, extracting the Root path from os.Args[1].
func NewPlatform ¶
NewPlatform creates a new instance of Platform, configuring the Root path.