Help us shape the future of Go! Take the 2026 Go Developer Survey

platform

package
v0.14.2 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2022 License: Apache-2.0 Imports: 13 Imported by: 12

Documentation

Index

Constants

View Source
const (
	DefaultAnalyzedFile = "analyzed.toml"
	DefaultGroupFile    = "group.toml"
)
View Source
const (
	BuildMetadataLabel   = "io.buildpacks.build.metadata"
	LayerMetadataLabel   = "io.buildpacks.lifecycle.metadata"
	ProjectMetadataLabel = "io.buildpacks.project.metadata"
	StackIDLabel         = "io.buildpacks.stack.id"
	MixinsLabel          = "io.buildpacks.stack.mixins"
)
View Source
const CodeFailed = 1

Variables

View Source
var (
	PlaceholderAnalyzedPath = filepath.Join("<layers>", DefaultAnalyzedFile)
	PlaceholderGroupPath    = filepath.Join("<layers>", DefaultGroupFile)
)

Functions

This section is empty.

Types

type AnalyzeInputs added in v0.14.1

type AnalyzeInputs struct {
	AdditionalTags   str.Slice // satisfies the `Value` interface required by the `flag` package
	AnalyzedPath     string
	CacheImageRef    string
	LaunchCacheDir   string
	LayersDir        string
	LegacyCacheDir   string
	LegacyGroupPath  string
	OutputImageRef   string
	PreviousImageRef string
	RunImageRef      string
	StackPath        string
	UID              int
	GID              int
	SkipLayers       bool
	UseDaemon        bool
}

AnalyzeInputs holds the values of command-line flags and args. Fields are the cumulative total of inputs across all supported platform APIs.

func (AnalyzeInputs) RegistryImages added in v0.14.1

func (a AnalyzeInputs) RegistryImages() []string

RegistryImages returns the inputs that are images in a registry.

type AnalyzedMetadata

type AnalyzedMetadata struct {
	PreviousImage *ImageIdentifier `toml:"image"`
	Metadata      LayersMetadata   `toml:"metadata"`
	RunImage      *ImageIdentifier `toml:"run-image,omitempty"`
}

type BuildMetadata

type BuildMetadata struct {
	BOM                         []buildpack.BOMEntry       `toml:"bom,omitempty" json:"bom"`
	Buildpacks                  []buildpack.GroupBuildpack `toml:"buildpacks" json:"buildpacks"`
	Labels                      []buildpack.Label          `toml:"labels" json:"-"`
	Launcher                    LauncherMetadata           `toml:"-" json:"launcher"`
	Processes                   []launch.Process           `toml:"processes" json:"processes"`
	Slices                      []layers.Slice             `toml:"slices" json:"-"`
	BuildpackDefaultProcessType string                     `toml:"buildpack-default-process-type,omitempty" json:"buildpack-default-process-type,omitempty"`
	PlatformAPI                 *api.Version               `toml:"-" json:"-"`
}

func (*BuildMetadata) MarshalJSON added in v0.14.0

func (md *BuildMetadata) MarshalJSON() ([]byte, error)

func (BuildMetadata) ToLaunchMD

func (md BuildMetadata) ToLaunchMD() launch.Metadata

type BuildPlan

type BuildPlan struct {
	Entries []BuildPlanEntry `toml:"entries"`
}

func (BuildPlan) Filter

func (p BuildPlan) Filter(metRequires []string) BuildPlan

TODO: ensure at least one claimed entry of each name is provided by the BP

func (BuildPlan) Find

func (p BuildPlan) Find(bpID string) buildpack.Plan

type BuildPlanEntry

type BuildPlanEntry struct {
	Providers []buildpack.GroupBuildpack `toml:"providers"`
	Requires  []buildpack.Require        `toml:"requires"`
}

func (BuildPlanEntry) NoOpt

func (be BuildPlanEntry) NoOpt() BuildPlanEntry

type BuildReport

type BuildReport struct {
	BOM []buildpack.BOMEntry `toml:"bom"`
}

type CacheMetadata

type CacheMetadata struct {
	BOM        LayerMetadata              `json:"sbom"`
	Buildpacks []buildpack.LayersMetadata `json:"buildpacks"`
}

func (*CacheMetadata) MetadataForBuildpack

func (cm *CacheMetadata) MetadataForBuildpack(id string) buildpack.LayersMetadata

type DefaultExiter added in v0.13.2

type DefaultExiter struct{}

func (*DefaultExiter) CodeFor added in v0.13.2

func (e *DefaultExiter) CodeFor(errType LifecycleExitError) int

type Exiter added in v0.13.2

type Exiter interface {
	CodeFor(errType LifecycleExitError) int
}

func NewExiter added in v0.14.1

func NewExiter(platformAPI string) Exiter

type ExportReport

type ExportReport struct {
	Build BuildReport `toml:"build,omitempty"`
	Image ImageReport `toml:"image"`
}

type GitMetadata

type GitMetadata struct {
	Repository string `json:"repository"`
	Commit     string `json:"commit"`
}

type ImageIdentifier

type ImageIdentifier struct {
	Reference string `toml:"reference"`
}

FIXME: fix key names to be accurate in the daemon case

type ImageReport

type ImageReport struct {
	Tags         []string `toml:"tags"`
	ImageID      string   `toml:"image-id,omitempty"`
	Digest       string   `toml:"digest,omitempty"`
	ManifestSize int64    `toml:"manifest-size,omitzero"`
}

type InputsResolver added in v0.14.1

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

InputsResolver resolves inputs for each of the lifecycle phases.

func NewInputsResolver added in v0.14.1

func NewInputsResolver(platformAPI *api.Version) *InputsResolver

NewInputsResolver accepts a platform API and returns a new InputsResolver.

func (*InputsResolver) ResolveAnalyze added in v0.14.1

func (r *InputsResolver) ResolveAnalyze(inputs AnalyzeInputs, logger Logger) (AnalyzeInputs, error)

ResolveAnalyze accepts an AnalyzeInputs and returns a new AnalyzeInputs with default values filled in, or an error if the provided inputs are not valid.

type LauncherMetadata

type LauncherMetadata struct {
	Version string         `json:"version"`
	Source  SourceMetadata `json:"source"`
}

type LayerMetadata

type LayerMetadata struct {
	SHA string `json:"sha" toml:"sha"`
}

type LayersMetadata

type LayersMetadata struct {
	App          []LayerMetadata            `json:"app" toml:"app"`
	BOM          *LayerMetadata             `json:"sbom,omitempty" toml:"sbom,omitempty"`
	Buildpacks   []buildpack.LayersMetadata `json:"buildpacks" toml:"buildpacks"`
	Config       LayerMetadata              `json:"config" toml:"config"`
	Launcher     LayerMetadata              `json:"launcher" toml:"launcher"`
	ProcessTypes LayerMetadata              `json:"process-types" toml:"process-types"`
	RunImage     RunImageMetadata           `json:"runImage" toml:"run-image"`
	Stack        StackMetadata              `json:"stack" toml:"stack"`
}

NOTE: This struct MUST be kept in sync with `LayersMetadataCompat`

func (*LayersMetadata) MetadataForBuildpack

func (m *LayersMetadata) MetadataForBuildpack(id string) buildpack.LayersMetadata

type LayersMetadataCompat

type LayersMetadataCompat struct {
	App          interface{}                `json:"app" toml:"app"`
	BOM          *LayerMetadata             `json:"sbom,omitempty" toml:"sbom,omitempty"`
	Buildpacks   []buildpack.LayersMetadata `json:"buildpacks" toml:"buildpacks"`
	Config       LayerMetadata              `json:"config" toml:"config"`
	Launcher     LayerMetadata              `json:"launcher" toml:"launcher"`
	ProcessTypes LayerMetadata              `json:"process-types" toml:"process-types"`
	RunImage     RunImageMetadata           `json:"runImage" toml:"run-image"`
	Stack        StackMetadata              `json:"stack" toml:"stack"`
}

NOTE: This struct MUST be kept in sync with `LayersMetadata`. It exists for situations where the `App` field type cannot be guaranteed, yet the original struct data must be maintained.

type LegacyExiter added in v0.13.2

type LegacyExiter struct{}

func (*LegacyExiter) CodeFor added in v0.13.2

func (e *LegacyExiter) CodeFor(errType LifecycleExitError) int

type LifecycleExitError added in v0.13.2

type LifecycleExitError int
const (
	FailedDetect           LifecycleExitError = iota
	FailedDetectWithErrors                    // no buildpacks detected
	DetectError                               // no buildpacks detected and at least one errored
	AnalyzeError                              // generic analyze error
	RestoreError                              // generic restore error
	FailedBuildWithErrors                     // buildpack error during /bin/build
	BuildError                                // generic build error
	ExportError                               // generic export error
	RebaseError                               // generic rebase error
)

type Logger added in v0.14.1

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 Platform

type Platform struct {
	*InputsResolver
	Exiter
	// contains filtered or unexported fields
}

Platform handles logic pertaining to inputs and outputs from a platform (lifecycle invoker)'s perspective.

func NewPlatform

func NewPlatform(apiStr string) *Platform

NewPlatform accepts a platform API and returns a new Platform.

func (*Platform) API

func (p *Platform) API() *api.Version

API returns the platform API.

type ProjectMetadata

type ProjectMetadata struct {
	Source *ProjectSource `toml:"source" json:"source,omitempty"`
}

type ProjectSource

type ProjectSource struct {
	Type     string                 `toml:"type" json:"type,omitempty"`
	Version  map[string]interface{} `toml:"version" json:"version,omitempty"`
	Metadata map[string]interface{} `toml:"metadata" json:"metadata,omitempty"`
}

type RunImageMetadata

type RunImageMetadata struct {
	TopLayer  string `json:"topLayer" toml:"top-layer"`
	Reference string `json:"reference" toml:"reference"`
}

type SourceMetadata

type SourceMetadata struct {
	Git GitMetadata `json:"git"`
}

type StackMetadata

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

func (*StackMetadata) BestRunImageMirror

func (sm *StackMetadata) BestRunImageMirror(registry string) (string, error)

type StackRunImageMetadata

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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