builder

package
v0.36.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2024 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvUID = "CNB_USER_ID"
	EnvGID = "CNB_GROUP_ID"

	ModuleOnBuilderMessage = `%s %s already exists on builder and will be overwritten
  - existing diffID: %s
  - new diffID: %s`

	ModulePreviouslyDefinedMessage = `%s %s was previously defined with different contents and will be overwritten
  - previous diffID: %s
  - using diffID: %s`
)
View Source
const (
	DefaultLifecycleVersion    = "0.20.3"
	DefaultBuildpackAPIVersion = "0.2"
)

A snapshot of the latest tested lifecycle version values

View Source
const (
	OrderLabel           = "io.buildpacks.buildpack.order"
	OrderExtensionsLabel = "io.buildpacks.buildpack.order-extensions"
)

Variables

View Source
var KnownBuilders = []KnownBuilder{
	{
		Vendor:             "Google",
		Image:              "gcr.io/buildpacks/builder:google-22",
		DefaultDescription: "Ubuntu 22.04 base image with buildpacks for .NET, Dart, Go, Java, Node.js, PHP, Python, and Ruby",
		Suggested:          true,
		Trusted:            true,
	},
	{
		Vendor:             "Heroku",
		Image:              "heroku/builder:24",
		DefaultDescription: "Ubuntu 24.04 AMD64+ARM64 base image with buildpacks for Go, Java, Node.js, PHP, Python, Ruby & Scala.",
		Suggested:          true,
		Trusted:            true,
	},
	{
		Vendor:             "Heroku",
		Image:              "heroku/builder:22",
		DefaultDescription: "Ubuntu 22.04 AMD64 base image with buildpacks for Go, Java, Node.js, PHP, Python, Ruby & Scala.",
		Suggested:          false,
		Trusted:            true,
	},
	{
		Vendor:             "Heroku",
		Image:              "heroku/builder:20",
		DefaultDescription: "Ubuntu 20.04 AMD64 base image with buildpacks for Go, Java, Node.js, PHP, Python, Ruby & Scala.",
		Suggested:          false,
		Trusted:            true,
	},
	{
		Vendor:             "Paketo Buildpacks",
		Image:              "paketobuildpacks/builder-jammy-base",
		DefaultDescription: "Small base image with buildpacks for Java, Node.js, Golang, .NET Core, Python & Ruby",
		Suggested:          true,
		Trusted:            true,
	},
	{
		Vendor:             "Paketo Buildpacks",
		Image:              "paketobuildpacks/builder-jammy-full",
		DefaultDescription: "Larger base image with buildpacks for Java, Node.js, Golang, .NET Core, Python, Ruby, & PHP",
		Suggested:          true,
		Trusted:            true,
	},
	{
		Vendor:             "Paketo Buildpacks",
		Image:              "paketobuildpacks/builder-jammy-tiny",
		DefaultDescription: "Tiny base image (jammy build image, distroless run image) with buildpacks for Golang & Java",
		Suggested:          true,
		Trusted:            true,
	},
	{
		Vendor:             "Paketo Buildpacks",
		Image:              "paketobuildpacks/builder-jammy-buildpackless-static",
		DefaultDescription: "Static base image (jammy build image, distroless run image) suitable for static binaries like Go or Rust",
		Suggested:          true,
		Trusted:            true,
	},
}

Functions

func IsKnownTrustedBuilder added in v0.35.0

func IsKnownTrustedBuilder(builderName string) bool

func IsTrustedBuilder added in v0.36.0

func IsTrustedBuilder(cfg config.Config, builderName string) (bool, error)

func SupportedLinuxArchitecture added in v0.34.0

func SupportedLinuxArchitecture(arch string) bool

SupportedLinuxArchitecture returns true for each binary architecture available at https://github.com/buildpacks/lifecycle/releases/

Types

type APISet added in v0.13.0

type APISet []*api.Version

func (APISet) AsStrings added in v0.13.0

func (a APISet) AsStrings() []string

func (APISet) Earliest added in v0.13.0

func (a APISet) Earliest() *api.Version

func (APISet) Latest added in v0.13.0

func (a APISet) Latest() *api.Version

type APIVersions added in v0.13.0

type APIVersions struct {
	Deprecated APISet `toml:"deprecated" json:"deprecated" yaml:"deprecated"`
	Supported  APISet `toml:"supported" json:"supported" yaml:"supported"`
}

APIVersions describes the supported API versions

type Blob

type Blob interface {
	Open() (io.ReadCloser, error)
}

Blob is an interface to wrap opening blobs

type Builder

type Builder struct {
	StackID string
	// contains filtered or unexported fields
}

Builder represents a pack builder, used to build images

func FromImage

func FromImage(img imgutil.Image) (*Builder, error)

FromImage constructs a builder from a builder image

func New

func New(baseImage imgutil.Image, name string, ops ...BuilderOption) (*Builder, error)

New constructs a new builder from a base image

func (*Builder) AddBuildpack

func (b *Builder) AddBuildpack(bp buildpack.BuildModule)

AddBuildpack adds a buildpack to the builder

func (*Builder) AddBuildpacks added in v0.30.0

func (b *Builder) AddBuildpacks(main buildpack.BuildModule, dependencies []buildpack.BuildModule)

func (*Builder) AddExtension added in v0.28.0

func (b *Builder) AddExtension(bp buildpack.BuildModule)

AddExtension adds an extension to the builder

func (*Builder) AllModules added in v0.30.0

func (b *Builder) AllModules(kind string) []buildpack.BuildModule

func (*Builder) BaseImageName added in v0.23.0

func (b *Builder) BaseImageName() string

BaseImageName returns the name of the builder base image

func (*Builder) Buildpacks

func (b *Builder) Buildpacks() []dist.ModuleInfo

Buildpacks returns the buildpack list

func (*Builder) CreatedBy

func (b *Builder) CreatedBy() CreatorMetadata

CreatedBy returns metadata around the creation of the builder

func (*Builder) DefaultRunImage added in v0.30.0

func (b *Builder) DefaultRunImage() RunImageMetadata

DefaultRunImage returns the default run image metadata

func (*Builder) Description

func (b *Builder) Description() string

Description returns the builder description

func (*Builder) Extensions added in v0.28.0

func (b *Builder) Extensions() []dist.ModuleInfo

Extensions returns the extensions list

func (*Builder) FlattenedModules added in v0.30.0

func (b *Builder) FlattenedModules(kind string) [][]buildpack.BuildModule

func (*Builder) GID

func (b *Builder) GID() int

GID returns the GID of the builder

func (*Builder) Image

func (b *Builder) Image() imgutil.Image

Image returns the base image

func (*Builder) LifecycleDescriptor

func (b *Builder) LifecycleDescriptor() LifecycleDescriptor

LifecycleDescriptor returns the LifecycleDescriptor

func (*Builder) Mixins

func (b *Builder) Mixins() []string

Mixins returns the mixins of the builder

func (*Builder) Name

func (b *Builder) Name() string

Name returns the name of the builder

func (*Builder) Order

func (b *Builder) Order() dist.Order

Order returns the order

func (*Builder) OrderExtensions added in v0.28.0

func (b *Builder) OrderExtensions() dist.Order

OrderExtensions returns the order for extensions

func (*Builder) RunImages added in v0.30.0

func (b *Builder) RunImages() []RunImageMetadata

RunImages returns all run image metadata

func (*Builder) Save

func (b *Builder) Save(logger logging.Logger, creatorMetadata CreatorMetadata) error

Save saves the builder

func (*Builder) SetBuildConfigEnv added in v0.32.0

func (b *Builder) SetBuildConfigEnv(env map[string]string)

SetBuildConfigEnv sets an environment variable to a value that will take action on platform environment variables basedon filename suffix

func (*Builder) SetDescription

func (b *Builder) SetDescription(description string)

SetDescription sets the description of the builder

func (*Builder) SetEnv

func (b *Builder) SetEnv(env map[string]string)

SetEnv sets an environment variable to a value

func (*Builder) SetLifecycle

func (b *Builder) SetLifecycle(lifecycle Lifecycle)

SetLifecycle sets the lifecycle of the builder

func (*Builder) SetOrder

func (b *Builder) SetOrder(order dist.Order)

SetOrder sets the order of the builder

func (*Builder) SetOrderExtensions added in v0.28.0

func (b *Builder) SetOrderExtensions(order dist.Order)

SetOrderExtensions sets the order of the builder

func (*Builder) SetRunImage added in v0.30.0

func (b *Builder) SetRunImage(runConfig builder.RunConfig)

SetRunImage sets the run image of the builder

func (*Builder) SetStack

func (b *Builder) SetStack(stackConfig builder.StackConfig)

SetStack sets the stack of the builder

func (*Builder) SetValidateMixins added in v0.30.0

func (b *Builder) SetValidateMixins(to bool)

SetValidateMixins if true instructs the builder to validate mixins

func (*Builder) ShouldFlatten added in v0.30.0

func (b *Builder) ShouldFlatten(module buildpack.BuildModule) bool

func (*Builder) Stack

func (b *Builder) Stack() StackMetadata

Stack returns the stack metadata

func (*Builder) UID

func (b *Builder) UID() int

UID returns the UID of the builder

type BuilderOption added in v0.30.0

type BuilderOption func(*options) error

func WithFlattened added in v0.33.0

func WithFlattened(modules buildpack.FlattenModuleInfos) BuilderOption

func WithLabels added in v0.33.0

func WithLabels(labels map[string]string) BuilderOption

func WithRunImage added in v0.34.0

func WithRunImage(name string) BuilderOption

func WithoutSave added in v0.35.0

func WithoutSave() BuilderOption

type CreatorMetadata

type CreatorMetadata struct {
	Name    string `json:"name" yaml:"name"`
	Version string `json:"version" yaml:"version"`
}

type DetectionCalculator added in v0.15.0

type DetectionCalculator interface {
	Order(topOrder dist.Order, layers dist.ModuleLayers, depth int) (pubbldr.DetectionOrder, error)
}

type DetectionOrderCalculator added in v0.15.0

type DetectionOrderCalculator struct{}

func NewDetectionOrderCalculator added in v0.15.0

func NewDetectionOrderCalculator() *DetectionOrderCalculator

func (*DetectionOrderCalculator) Order added in v0.15.0

func (c *DetectionOrderCalculator) Order(
	order dist.Order,
	layers dist.ModuleLayers,
	maxDepth int,
) (pubbldr.DetectionOrder, error)

type ImageFetcher added in v0.15.0

type ImageFetcher interface {
	// Fetch fetches an image by resolving it both remotely and locally depending on provided parameters.
	// If daemon is true, it will look return a `local.Image`. Pull, applicable only when daemon is true, will
	// attempt to pull a remote image first.
	Fetch(ctx context.Context, name string, options image.FetchOptions) (imgutil.Image, error)

	// CheckReadAccess verifies if an image is accessible with read permissions
	// When FetchOptions.Daemon is true and the image doesn't exist in the daemon,
	// the behavior is dictated by the pull policy, which can have the following behavior
	//   - PullNever: returns false
	//   - PullAlways Or PullIfNotPresent: it will check read access for the remote image.
	// When FetchOptions.Daemon is false it will check read access for the remote image.
	CheckReadAccess(repo string, options image.FetchOptions) bool
}

type ImageFetcherWrapper added in v0.15.0

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

func NewImageFetcherWrapper added in v0.15.0

func NewImageFetcherWrapper(fetcher ImageFetcher) *ImageFetcherWrapper

func (*ImageFetcherWrapper) CheckReadAccessValidator added in v0.34.0

func (w *ImageFetcherWrapper) CheckReadAccessValidator(repo string, options image.FetchOptions) bool

func (*ImageFetcherWrapper) Fetch added in v0.15.0

func (w *ImageFetcherWrapper) Fetch(
	ctx context.Context,
	name string,
	options image.FetchOptions,
) (Inspectable, error)

type Info added in v0.15.0

type Info struct {
	Description     string
	StackID         string
	Mixins          []string
	RunImages       []pubbldr.RunImageConfig
	Buildpacks      []dist.ModuleInfo
	Order           pubbldr.DetectionOrder
	BuildpackLayers dist.ModuleLayers
	Lifecycle       LifecycleDescriptor
	CreatedBy       CreatorMetadata
	Extensions      []dist.ModuleInfo
	OrderExtensions pubbldr.DetectionOrder
}

type Inspectable added in v0.15.0

type Inspectable interface {
	Label(name string) (string, error)
}

type InspectableFetcher added in v0.15.0

type InspectableFetcher interface {
	Fetch(ctx context.Context, name string, options image.FetchOptions) (Inspectable, error)
}

type Inspector added in v0.15.0

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

func NewInspector added in v0.15.0

func NewInspector(fetcher InspectableFetcher, factory LabelManagerFactory, calculator DetectionCalculator) *Inspector

func (*Inspector) Inspect added in v0.15.0

func (i *Inspector) Inspect(name string, daemon bool, orderDetectionDepth int) (Info, error)

type KnownBuilder added in v0.33.2

type KnownBuilder struct {
	Vendor             string
	Image              string
	DefaultDescription string
	Suggested          bool
	Trusted            bool
}

type LabelInspector added in v0.15.0

type LabelInspector interface {
	Metadata() (Metadata, error)
	StackID() (string, error)
	Mixins() ([]string, error)
	Order() (dist.Order, error)
	BuildpackLayers() (dist.ModuleLayers, error)
	OrderExtensions() (dist.Order, error)
}

type LabelManager added in v0.15.0

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

func NewLabelManager added in v0.15.0

func NewLabelManager(inspectable Inspectable) *LabelManager

func (*LabelManager) BuildpackLayers added in v0.15.0

func (m *LabelManager) BuildpackLayers() (dist.ModuleLayers, error)

func (*LabelManager) Metadata added in v0.15.0

func (m *LabelManager) Metadata() (Metadata, error)

func (*LabelManager) Mixins added in v0.15.0

func (m *LabelManager) Mixins() ([]string, error)

func (*LabelManager) Order added in v0.15.0

func (m *LabelManager) Order() (dist.Order, error)

func (*LabelManager) OrderExtensions added in v0.29.0

func (m *LabelManager) OrderExtensions() (dist.Order, error)

func (*LabelManager) StackID added in v0.15.0

func (m *LabelManager) StackID() (string, error)

type LabelManagerFactory added in v0.15.0

type LabelManagerFactory interface {
	BuilderLabelManager(inspectable Inspectable) LabelInspector
}

type LabelManagerProvider added in v0.15.0

type LabelManagerProvider struct{}

func NewLabelManagerProvider added in v0.15.0

func NewLabelManagerProvider() *LabelManagerProvider

func (*LabelManagerProvider) BuilderLabelManager added in v0.15.0

func (p *LabelManagerProvider) BuilderLabelManager(inspectable Inspectable) LabelInspector

type Lifecycle

type Lifecycle interface {
	Blob
	Descriptor() LifecycleDescriptor
}

Lifecycle is an implementation of the CNB Lifecycle spec

func NewLifecycle

func NewLifecycle(blob Blob) (Lifecycle, error)

NewLifecycle creates a Lifecycle from a Blob

type LifecycleAPI

type LifecycleAPI struct {
	BuildpackVersion *api.Version `toml:"buildpack" json:"buildpack"`
	PlatformVersion  *api.Version `toml:"platform" json:"platform"`
}

LifecycleAPI describes which API versions the lifecycle satisfies

type LifecycleAPIs added in v0.13.0

type LifecycleAPIs struct {
	Buildpack APIVersions `toml:"buildpack" json:"buildpack"`
	Platform  APIVersions `toml:"platform" json:"platform"`
}

LifecycleAPIs describes the supported API versions per specification

type LifecycleDescriptor

type LifecycleDescriptor struct {
	Info LifecycleInfo `toml:"lifecycle"`
	// Deprecated: Use `LifecycleAPIs` instead
	API  LifecycleAPI  `toml:"api"`
	APIs LifecycleAPIs `toml:"apis"`
}

LifecycleDescriptor contains information described in the lifecycle.toml

func CompatDescriptor added in v0.13.0

func CompatDescriptor(descriptor LifecycleDescriptor) LifecycleDescriptor

CompatDescriptor provides compatibility by mapping new fields to old and vice-versa

func ParseDescriptor added in v0.13.0

func ParseDescriptor(contents string) (LifecycleDescriptor, error)

ParseDescriptor parses LifecycleDescriptor from toml formatted string.

type LifecycleInfo

type LifecycleInfo struct {
	Version *Version `toml:"version" json:"version" yaml:"version"`
}

LifecycleInfo contains information about the lifecycle

type LifecycleMetadata

type LifecycleMetadata struct {
	LifecycleInfo
	// Deprecated: use APIs instead
	API  LifecycleAPI  `json:"api"`
	APIs LifecycleAPIs `json:"apis"`
}

type Metadata

type Metadata struct {
	Description string             `json:"description"`
	Buildpacks  []dist.ModuleInfo  `json:"buildpacks"`
	Extensions  []dist.ModuleInfo  `json:"extensions"`
	Stack       StackMetadata      `json:"stack"`
	Lifecycle   LifecycleMetadata  `json:"lifecycle"`
	CreatedBy   CreatorMetadata    `json:"createdBy"`
	RunImages   []RunImageMetadata `json:"images"`
}

type RunImageMetadata

type RunImageMetadata struct {
	Image   string   `json:"image" toml:"image"`
	Mirrors []string `json:"mirrors" toml:"mirrors"`
}

type RunImages added in v0.30.0

type RunImages struct {
	Images []RunImageMetadata `json:"images" toml:"images"`
}

type StackMetadata

type StackMetadata struct {
	RunImage RunImageMetadata `json:"runImage" toml:"run-image"`
}

type Version

type Version struct {
	semver.Version
}

Version is an extension to semver.Version to make it marshalable.

func VersionMustParse

func VersionMustParse(v string) *Version

VersionMustParse parses a string into a Version

func (*Version) Equal added in v0.10.0

func (v *Version) Equal(other *Version) bool

Equal compares two Versions

func (*Version) MarshalText

func (v *Version) MarshalText() ([]byte, error)

MarshalText makes Version satisfy the encoding.TextMarshaler interface.

func (*Version) String

func (v *Version) String() string

String returns the string value of the Version

func (*Version) UnmarshalText

func (v *Version) UnmarshalText(text []byte) error

UnmarshalText makes Version satisfy the encoding.TextUnmarshaler interface.

Directories

Path Synopsis
Package testmocks is a generated GoMock package.
Package testmocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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