files

package
v0.17.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2023 License: Apache-2.0 Imports: 10 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeBuildMetadata

func DecodeBuildMetadata(path string, platformAPI *api.Version, buildmd *BuildMetadata) error

DecodeBuildMetadata reads a metadata.toml file

Types

type Analyzed

type Analyzed struct {
	// PreviousImage is the build image identifier, if the previous image exists.
	PreviousImage *ImageIdentifier `toml:"image,omitempty"`
	// BuildImage is the build image identifier.
	// It is recorded for use by the restorer in the case that image extensions are used
	// to extend the build image.
	BuildImage *ImageIdentifier `toml:"build-image,omitempty"`
	// LayersMetadata holds information about previously built layers.
	// It is used by the exporter to determine if any layers from the current build are unchanged,
	// to avoid re-uploading the same data to the export target,
	// and to provide information about previously-created layers to buildpacks.
	LayersMetadata LayersMetadata `toml:"metadata"`
	// RunImage holds information about the run image.
	// It is used to validate that buildpacks satisfy os/arch constraints,
	// and to provide information about the export target to buildpacks.
	RunImage *RunImage `toml:"run-image,omitempty"`
}

Analyzed is written by the analyzer as analyzed.toml to record information about: * the previous image (if it exists), * the run image, * the build image (if provided). The location of the file can be specified by providing `-analyzed <path>` to the lifecycle.

func ReadAnalyzed

func ReadAnalyzed(path string, logger log.Logger) (Analyzed, error)

func (Analyzed) PreviousImageRef

func (a Analyzed) PreviousImageRef() string

func (Analyzed) RunImageImage

func (a Analyzed) RunImageImage() string

func (Analyzed) RunImageRef

func (a Analyzed) RunImageRef() string

func (Analyzed) RunImageTarget

func (a Analyzed) RunImageTarget() TargetMetadata

type BuildMetadata

type BuildMetadata struct {
	// BOM (deprecated) holds the unstructured bill-of-materials.
	BOM []buildpack.BOMEntry `toml:"bom,omitempty" json:"bom"`
	// Buildpacks are the buildpacks used in the build.
	Buildpacks []buildpack.GroupElement `toml:"buildpacks" json:"buildpacks"`
	// Extensions are the image extensions used in the build.
	Extensions []buildpack.GroupElement `toml:"extensions,omitempty" json:"extensions,omitempty"`
	// Labels are labels provided by buildpacks.
	Labels []buildpack.Label `toml:"labels" json:"-"`
	// Launcher is metadata to describe the launcher.
	Launcher LauncherMetadata `toml:"-" json:"launcher"`
	// Processes are processes provided by buildpacks.
	Processes []launch.Process `toml:"processes" json:"processes"`
	// Slices are application slices provided by buildpacks,
	// used by the exporter to "slice" the application directory into distinct layers.
	Slices []layers.Slice `toml:"slices" json:"-"`
	// BuildpackDefaultProcessType is the buildpack-provided default process type.
	// It will be the default process type for the image unless overridden by the end user.
	BuildpackDefaultProcessType string `toml:"buildpack-default-process-type,omitempty" json:"buildpack-default-process-type,omitempty"`
	// PlatformAPI is the Platform API version used for the build.
	PlatformAPI *api.Version `toml:"-" json:"-"`
}

BuildMetadata is written by the builder as <layers>/config/metadata.toml to record information about the build. It is also serialized by the exporter as the `io.buildpacks.build.metadata` label on the output image.

func (*BuildMetadata) MarshalJSON

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

func (BuildMetadata) ToLaunchMD

func (m BuildMetadata) ToLaunchMD() launch.Metadata

type BuildPlanEntry

type BuildPlanEntry struct {
	Providers []buildpack.GroupElement `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 GitMetadata

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

type ImageIdentifier

type ImageIdentifier struct {
	Reference string `toml:"reference"` // FIXME: fix key name 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 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     RunImageForRebase          `json:"runImage" toml:"run-image"`
	Stack        *Stack                     `json:"stack,omitempty" toml:"stack,omitempty"`
}

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

func (*LayersMetadata) LayersMetadataFor

func (m *LayersMetadata) LayersMetadataFor(bpID 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     RunImageForRebase          `json:"runImage" toml:"run-image"`
	Stack        *Stack                     `json:"stack,omitempty" toml:"stack,omitempty"`
}

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 OSDistribution

type OSDistribution struct {
	Name    string `json:"name" toml:"name"`
	Version string `json:"version" toml:"version"`
}

type Plan

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

Plan is written by the detector as plan.toml to record the application dependencies requested by buildpacks, and the image extensions or buildpacks that provide them. A subset of the plan is presented to each image extension (during the `generate` phase) or buildpack (during the `build` phase) with the entries that the module is expected to provide. The location of the file can be specified by providing `-plan <path>` to the lifecycle.

func (Plan) Filter

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

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

func (Plan) Find

func (p Plan) Find(kind, id string) buildpack.Plan

type ProjectMetadata

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

ProjectMetadata is written as `project_metadata.toml` by the exporter to record information about the application source code. It is also serialized by the exporter as the `io.buildpacks.project.metadata` label on the output image. The location of the file can be specified by providing `-project-metadata <path>` to the lifecycle.

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 Report

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

Report is written by the exporter as report.toml to record information about the build. It is not included in the output image, but can be saved off by the platform before the build container exits. The location of the file can be specified by providing `-report <path>` to the lifecycle.

type Run

type Run struct {
	Images []RunImageForExport `json:"-" toml:"images"`
}

Run is provided by the platform as run.toml to record information about the run images that may be used during export. Data from the selected run image is serialized by the exporter as the `runImage` key in the `io.buildpacks.lifecycle.metadata` label on the output image for use during rebase. The location of the file can be specified by providing `-run <path>` to the lifecycle.

func ReadRun

func ReadRun(runPath string, logger log.Logger) (Run, error)

type RunImage

type RunImage struct {
	Reference string `toml:"reference"`
	// Image specifies the repository name for the image.
	// When exporting to a daemon, the restorer uses this field to pull the run image if needed for the extender;
	// it can't use reference because this may be a daemon image ID if analyzed.toml was last written by the analyzer.
	Image string `toml:"image,omitempty"`
	// Extend if true indicates that the run image should be extended by the extender.
	Extend         bool            `toml:"extend,omitempty"`
	TargetMetadata *TargetMetadata `json:"target,omitempty" toml:"target,omitempty"`
}

type RunImageForExport

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

func (*RunImageForExport) Contains

func (r *RunImageForExport) Contains(ref string) bool

Contains returns true if the provided reference matches either the primary image, or the image mirrors.

type RunImageForRebase

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

func (*RunImageForRebase) Contains

func (r *RunImageForRebase) Contains(ref string) bool

func (*RunImageForRebase) ToStack

func (r *RunImageForRebase) ToStack() Stack

type SourceMetadata

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

type Stack

type Stack struct {
	RunImage RunImageForExport `json:"runImage" toml:"run-image"`
}

Stack (deprecated as of Platform API 0.12) is provided by the platform as stack.toml to record information about the run images that may be used during export. It is also serialized by the exporter as the `stack` key in the `io.buildpacks.lifecycle.metadata` label on the output image for use during rebase. The location of the file can be specified by providing `-stack <path>` to the lifecycle.

func ReadStack

func ReadStack(stackPath string, logger log.Logger) (Stack, error)

type TargetMetadata

type TargetMetadata struct {
	ID          string `json:"id,omitempty" toml:"id,omitempty"`
	OS          string `json:"os" toml:"os"`
	Arch        string `json:"arch" toml:"arch"`
	ArchVariant string `json:"arch-variant,omitempty" toml:"arch-variant,omitempty"`

	Distribution *OSDistribution `json:"distribution,omitempty" toml:"distribution,omitempty"`
}

func (*TargetMetadata) String

func (t *TargetMetadata) String() string

Jump to

Keyboard shortcuts

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