dist

package
v0.34.0-rc2 Latest Latest
Warning

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

Go to latest
Published: May 24, 2024 License: Apache-2.0 Imports: 12 Imported by: 3

Documentation

Overview

Package dist is responsible for cataloging all data types in relation to distributing Cloud Native Buildpack components.

Index

Constants

View Source
const (
	BuildpackLayersLabel   = "io.buildpacks.buildpack.layers"
	ExtensionLayersLabel   = "io.buildpacks.extension.layers"
	ExtensionMetadataLabel = "io.buildpacks.extension.metadata"
	DefaultTargetOSLinux   = "linux"
	DefaultTargetOSWindows = "windows"
	DefaultTargetArch      = "amd64"
)
View Source
const AssumedBuildpackAPIVersion = "0.1"
View Source
const BuildpacksDir = "/cnb/buildpacks"
View Source
const ExtensionsDir = "/cnb/extensions"

Variables

This section is empty.

Functions

func AddToLayersMD added in v0.28.0

func AddToLayersMD(layerMD ModuleLayers, descriptor Descriptor, diffID string)

func GetLabel

func GetLabel(labeled Labeled, label string, obj interface{}) (ok bool, err error)

func LayerDiffID

func LayerDiffID(layerTarPath string) (v1.Hash, error)

func SetLabel

func SetLabel(labelable Labelable, label string, data interface{}) error

Types

type BuildpackDescriptor

type BuildpackDescriptor struct {
	WithAPI          *api.Version `toml:"api"`
	WithInfo         ModuleInfo   `toml:"buildpack"`
	WithStacks       []Stack      `toml:"stacks,omitempty"`
	WithTargets      []Target     `toml:"targets,omitempty"`
	WithOrder        Order        `toml:"order"`
	WithWindowsBuild bool
	WithLinuxBuild   bool
}

func (*BuildpackDescriptor) API

func (b *BuildpackDescriptor) API() *api.Version

func (*BuildpackDescriptor) EnsureStackSupport

func (b *BuildpackDescriptor) EnsureStackSupport(stackID string, providedMixins []string, validateRunStageMixins bool) error

func (*BuildpackDescriptor) EnsureTargetSupport added in v0.30.0

func (b *BuildpackDescriptor) EnsureTargetSupport(givenOS, givenArch, givenDistroName, givenDistroVersion string) error

func (*BuildpackDescriptor) EscapedID

func (b *BuildpackDescriptor) EscapedID() string

func (*BuildpackDescriptor) Info

func (b *BuildpackDescriptor) Info() ModuleInfo

func (*BuildpackDescriptor) Kind added in v0.28.0

func (b *BuildpackDescriptor) Kind() string

func (*BuildpackDescriptor) Order

func (b *BuildpackDescriptor) Order() Order

func (*BuildpackDescriptor) Stacks

func (b *BuildpackDescriptor) Stacks() []Stack

func (*BuildpackDescriptor) Targets added in v0.30.0

func (b *BuildpackDescriptor) Targets() []Target

type BuildpackURI

type BuildpackURI struct {
	URI string `toml:"uri"`
}

type Descriptor added in v0.28.0

type Descriptor interface {
	API() *api.Version
	Info() ModuleInfo
	Order() Order
	Stacks() []Stack
	Targets() []Target
}

type Distribution added in v0.30.0

type Distribution struct {
	Name    string `json:"name,omitempty" toml:"name,omitempty"`
	Version string `json:"version,omitempty" toml:"version,omitempty"`
}

type ExtensionDescriptor added in v0.28.0

type ExtensionDescriptor struct {
	WithAPI  *api.Version `toml:"api"`
	WithInfo ModuleInfo   `toml:"extension"`
}

func (*ExtensionDescriptor) API added in v0.28.0

func (e *ExtensionDescriptor) API() *api.Version

func (*ExtensionDescriptor) EnsureStackSupport added in v0.28.0

func (e *ExtensionDescriptor) EnsureStackSupport(_ string, _ []string, _ bool) error

func (*ExtensionDescriptor) EnsureTargetSupport added in v0.30.0

func (e *ExtensionDescriptor) EnsureTargetSupport(_, _, _, _ string) error

func (*ExtensionDescriptor) EscapedID added in v0.28.0

func (e *ExtensionDescriptor) EscapedID() string

func (*ExtensionDescriptor) Info added in v0.28.0

func (e *ExtensionDescriptor) Info() ModuleInfo

func (*ExtensionDescriptor) Kind added in v0.28.0

func (e *ExtensionDescriptor) Kind() string

func (*ExtensionDescriptor) Order added in v0.28.0

func (e *ExtensionDescriptor) Order() Order

func (*ExtensionDescriptor) Stacks added in v0.28.0

func (e *ExtensionDescriptor) Stacks() []Stack

func (*ExtensionDescriptor) Targets added in v0.30.0

func (e *ExtensionDescriptor) Targets() []Target

type ImageOrURI

type ImageOrURI struct {
	BuildpackURI
	ImageRef
}

func (*ImageOrURI) DisplayString

func (c *ImageOrURI) DisplayString() string

type ImageRef

type ImageRef struct {
	ImageName string `toml:"image"`
}

type Labelable

type Labelable interface {
	SetLabel(name string, value string) error
}

type Labeled

type Labeled interface {
	Label(name string) (value string, err error)
}

type License

type License struct {
	Type string `toml:"type"`
	URI  string `toml:"uri"`
}

type ModuleInfo added in v0.28.0

type ModuleInfo struct {
	ID          string    `toml:"id,omitempty" json:"id,omitempty" yaml:"id,omitempty"`
	Name        string    `toml:"name,omitempty" json:"name,omitempty" yaml:"name,omitempty"`
	Version     string    `toml:"version,omitempty" json:"version,omitempty" yaml:"version,omitempty"`
	Description string    `toml:"description,omitempty" json:"description,omitempty" yaml:"description,omitempty"`
	Homepage    string    `toml:"homepage,omitempty" json:"homepage,omitempty" yaml:"homepage,omitempty"`
	Keywords    []string  `toml:"keywords,omitempty" json:"keywords,omitempty" yaml:"keywords,omitempty"`
	Licenses    []License `toml:"licenses,omitempty" json:"licenses,omitempty" yaml:"licenses,omitempty"`
}

func (ModuleInfo) FullName added in v0.28.0

func (b ModuleInfo) FullName() string

func (ModuleInfo) FullNameWithVersion added in v0.28.0

func (b ModuleInfo) FullNameWithVersion() (string, error)

func (ModuleInfo) Match added in v0.28.0

func (b ModuleInfo) Match(o ModuleInfo) bool

Match compares two buildpacks by ID and Version

func (ModuleInfo) String added in v0.28.0

func (b ModuleInfo) String() string

Satisfy stringer

type ModuleLayerInfo added in v0.28.0

type ModuleLayerInfo struct {
	API         *api.Version `json:"api"`
	Stacks      []Stack      `json:"stacks,omitempty"`
	Targets     []Target     `json:"targets,omitempty"`
	Order       Order        `json:"order,omitempty"`
	LayerDiffID string       `json:"layerDiffID"`
	Homepage    string       `json:"homepage,omitempty"`
	Name        string       `json:"name,omitempty"`
}

type ModuleLayers added in v0.28.0

type ModuleLayers map[string]map[string]ModuleLayerInfo

func (ModuleLayers) Get added in v0.28.0

func (b ModuleLayers) Get(id, version string) (ModuleLayerInfo, bool)

type ModuleRef added in v0.28.0

type ModuleRef struct {
	ModuleInfo `yaml:"buildpackinfo,inline"`
	Optional   bool `toml:"optional,omitempty" json:"optional,omitempty" yaml:"optional,omitempty"`
}

type Order

type Order []OrderEntry

type OrderEntry

type OrderEntry struct {
	Group []ModuleRef `toml:"group" json:"group"`
}

type Platform

type Platform struct {
	OS string `toml:"os"`
}

type Stack

type Stack struct {
	ID     string   `json:"id" toml:"id"`
	Mixins []string `json:"mixins,omitempty" toml:"mixins,omitempty"`
}

type Target added in v0.30.0

type Target struct {
	OS            string         `json:"os" toml:"os"`
	Arch          string         `json:"arch" toml:"arch"`
	ArchVariant   string         `json:"variant,omitempty" toml:"variant,omitempty"`
	Distributions []Distribution `json:"distros,omitempty" toml:"distros,omitempty"`
}

func ExpandTargetsDistributions added in v0.34.0

func ExpandTargetsDistributions(targets ...Target) []Target

ExpandTargetsDistributions expands each provided target (with multiple distribution versions) to multiple targets (each with a single distribution version). For example, given an array with ONE target with the format:

[
  {OS:"linux", Distributions: []dist.Distribution{{Name: "ubuntu", Version: "18.01"},{Name: "ubuntu", Version: "21.01"}}}
]

it returns an array with TWO targets each with the format:

[
 {OS:"linux",Distributions: []dist.Distribution{{Name: "ubuntu", Version: "18.01"}}},
 {OS:"linux",Distributions: []dist.Distribution{{Name: "ubuntu", Version: "21.01"}}}
]

func (*Target) ValuesAsPlatform added in v0.34.0

func (t *Target) ValuesAsPlatform() string

func (*Target) ValuesAsSlice added in v0.34.0

func (t *Target) ValuesAsSlice() []string

ValuesAsSlice converts the internal representation of a target (os, arch, variant, etc.) into a string slice, where each value included in the final array must be not empty.

Jump to

Keyboard shortcuts

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