Documentation ¶
Index ¶
- Constants
- func BuildpacksFromOCILayoutBlob(blob Blob) (mainBP BuildModule, dependencies []BuildModule, err error)
- func ConfigFromOCILayoutBlob(blob Blob) (config v1.ImageConfig, err error)
- func HasDockerLocator(locator string) bool
- func IsOCILayoutBlob(blob blob2.Blob) (bool, error)
- func NewDownloader(logger Logger, imageFetcher ImageFetcher, downloader Downloader, ...) *buildpackDownloader
- func ParseIDLocator(locator string) (id string, version string)
- func ParsePackageLocator(locator string) (imageName string)
- func ParseRegistryID(registryID string) (namespace string, name string, version string, err error)
- func Set(exclude []string) map[string]struct{}
- func ToLayerTar(dest string, module BuildModule) (string, error)
- type Blob
- type BuildModule
- func ExtensionsFromOCILayoutBlob(blob Blob) (mainExt BuildModule, err error)
- func FromBlob(descriptor Descriptor, blob Blob) BuildModule
- func FromBuildpackRootBlob(blob Blob, layerWriterFactory archive.TarWriterFactory) (BuildModule, error)
- func FromExtensionRootBlob(blob Blob, layerWriterFactory archive.TarWriterFactory) (BuildModule, error)
- type BuildModuleWriter
- type Descriptor
- type DownloadOptions
- type Downloader
- type ImageFactory
- type ImageFetcher
- type LocatorType
- type Logger
- type ManagedCollection
- func (f *ManagedCollection) AddModules(main BuildModule, deps ...BuildModule)
- func (f *ManagedCollection) AllModules() []BuildModule
- func (f *ManagedCollection) ExplodedModules() []BuildModule
- func (f *ManagedCollection) FlattenedModules() [][]BuildModule
- func (f *ManagedCollection) ShouldFlatten(module BuildModule) bool
- type Metadata
- type ModuleTar
- type Package
- type PackageBuilder
- func (b *PackageBuilder) AddDependencies(main BuildModule, dependencies []BuildModule)
- func (b *PackageBuilder) AddDependency(buildpack BuildModule)
- func (b *PackageBuilder) AllModules() []BuildModule
- func (b *PackageBuilder) FlattenedModules() [][]BuildModule
- func (b *PackageBuilder) SaveAsFile(path, imageOS string, labels map[string]string) error
- func (b *PackageBuilder) SaveAsImage(repoName string, publish bool, imageOS string, labels map[string]string) (imgutil.Image, error)
- func (b *PackageBuilder) SetBuildpack(buildpack BuildModule)
- func (b *PackageBuilder) SetExtension(extension BuildModule)
- func (b *PackageBuilder) ShouldFlatten(module BuildModule) bool
- type PackageBuilderOption
- type RegistryResolver
- type WorkableImage
Constants ¶
const ( KindBuildpack = "buildpack" KindExtension = "extension" )
const ( FlattenMaxDepth = -1 FlattenNone = 0 )
const MetadataLabel = "io.buildpacks.buildpackage.metadata"
TODO: Move to dist
Variables ¶
This section is empty.
Functions ¶
func BuildpacksFromOCILayoutBlob ¶
func BuildpacksFromOCILayoutBlob(blob Blob) (mainBP BuildModule, dependencies []BuildModule, err error)
BuildpacksFromOCILayoutBlob constructs buildpacks from a blob in OCI layout format.
func ConfigFromOCILayoutBlob ¶
func ConfigFromOCILayoutBlob(blob Blob) (config v1.ImageConfig, err error)
func HasDockerLocator ¶
func IsOCILayoutBlob ¶
IsOCILayoutBlob checks whether a blob is in OCI layout format.
func NewDownloader ¶
func NewDownloader(logger Logger, imageFetcher ImageFetcher, downloader Downloader, registryResolver RegistryResolver) *buildpackDownloader
func ParseIDLocator ¶
ParseIDLocator parses a buildpack locator in the following formats into its ID and version.
- <id>[@<version>]
- urn:cnb:builder:<id>[@<version>]
- urn:cnb:registry:<id>[@<version>]
- from=builder:<id>[@<version>] (deprecated)
If version is omitted, the version returned will be empty. Any "from=builder:" or "urn:cnb" prefix will be ignored.
func ParsePackageLocator ¶
ParsePackageLocator parses a locator (in format `[docker://][<host>/]<path>[:<tag>⏐@<digest>]`) to image name (`[<host>/]<path>[:<tag>⏐@<digest>]`)
func ParseRegistryID ¶
ParseRegistryID parses a registry id (ie. `<namespace>/<name>@<version>`) into namespace, name and version components.
Supported formats:
- <ns>/<name>[@<version>]
- urn:cnb:registry:<ns>/<name>[@<version>]
func ToLayerTar ¶
func ToLayerTar(dest string, module BuildModule) (string, error)
Types ¶
type Blob ¶
type Blob interface { // Open returns a io.ReadCloser for the contents of the Blob in tar format. Open() (io.ReadCloser, error) }
type BuildModule ¶ added in v0.28.0
type BuildModule interface { // Open returns a reader to a tar with contents structured as per the distribution spec // (currently '/cnb/buildpacks/{ID}/{version}/*', all entries with a zeroed-out // timestamp and root UID/GID). Open() (io.ReadCloser, error) Descriptor() Descriptor }
func ExtensionsFromOCILayoutBlob ¶ added in v0.28.0
func ExtensionsFromOCILayoutBlob(blob Blob) (mainExt BuildModule, err error)
ExtensionsFromOCILayoutBlob constructs extensions from a blob in OCI layout format.
func FromBlob ¶
func FromBlob(descriptor Descriptor, blob Blob) BuildModule
FromBlob constructs a buildpack or extension from a blob. It is assumed that the buildpack contents are structured as per the distribution spec (currently '/cnb/buildpacks/{ID}/{version}/*' or '/cnb/extensions/{ID}/{version}/*').
func FromBuildpackRootBlob ¶ added in v0.28.0
func FromBuildpackRootBlob(blob Blob, layerWriterFactory archive.TarWriterFactory) (BuildModule, error)
FromBuildpackRootBlob constructs a buildpack from a blob. It is assumed that the buildpack contents reside at the root of the blob. The constructed buildpack contents will be structured as per the distribution spec (currently a tar with contents under '/cnb/buildpacks/{ID}/{version}/*').
func FromExtensionRootBlob ¶ added in v0.28.0
func FromExtensionRootBlob(blob Blob, layerWriterFactory archive.TarWriterFactory) (BuildModule, error)
FromExtensionRootBlob constructs an extension from a blob. It is assumed that the extension contents reside at the root of the blob. The constructed extension contents will be structured as per the distribution spec (currently a tar with contents under '/cnb/extensions/{ID}/{version}/*').
type BuildModuleWriter ¶ added in v0.30.0
type BuildModuleWriter struct {
// contains filtered or unexported fields
}
func NewBuildModuleWriter ¶ added in v0.30.0
func NewBuildModuleWriter(logger logging.Logger, factory archive.TarWriterFactory) *BuildModuleWriter
NewBuildModuleWriter creates a BuildModule writer
func (*BuildModuleWriter) NToLayerTar ¶ added in v0.30.0
func (b *BuildModuleWriter) NToLayerTar(tarPath, filename string, modules []BuildModule, exclude map[string]struct{}) (string, []BuildModule, error)
NToLayerTar creates a tar file containing the all the Buildpacks given, but excluding the ones which FullName() is in the exclude list. It returns the path to the tar file, the list of Buildpacks that were excluded, and any error
type Descriptor ¶ added in v0.28.0
type Descriptor interface { API() *api.Version EnsureStackSupport(stackID string, providedMixins []string, validateRunStageMixins bool) error EnsureTargetSupport(os, arch, distroName, distroVersion string) error EscapedID() string Info() dist.ModuleInfo Kind() string Order() dist.Order Stacks() []dist.Stack Targets() []dist.Target }
type DownloadOptions ¶
type DownloadOptions struct { // Buildpack registry name. Defines where all registry buildpacks will be pulled from. RegistryName string // The base directory to use to resolve relative assets RelativeBaseDir string // The OS of the builder image ImageOS string // The OS/Architecture to download Platform string // Deprecated: the older alternative to buildpack URI ImageName string // The kind of module to download (valid values: "buildpack", "extension"). Defaults to "buildpack". ModuleKind string Daemon bool PullPolicy image.PullPolicy }
type Downloader ¶
type ImageFactory ¶
type ImageFetcher ¶
type LocatorType ¶
type LocatorType int
const ( InvalidLocator LocatorType = iota FromBuilderLocator URILocator IDLocator PackageLocator RegistryLocator )
func GetLocatorType ¶
func GetLocatorType(locator string, relativeBaseDir string, buildpacksFromBuilder []dist.ModuleInfo) (LocatorType, error)
GetLocatorType determines which type of locator is designated by the given input. If a type cannot be determined, `INVALID_LOCATOR` will be returned. If an error is encountered, it will be returned.
func (LocatorType) String ¶
func (l LocatorType) String() string
type ManagedCollection ¶ added in v0.30.0
type ManagedCollection struct {
// contains filtered or unexported fields
}
func NewModuleManager ¶ added in v0.30.0
func NewModuleManager(flatten bool, maxDepth int) *ManagedCollection
func (*ManagedCollection) AddModules ¶ added in v0.30.0
func (f *ManagedCollection) AddModules(main BuildModule, deps ...BuildModule)
AddModules determines whether the explodedModules must be added as flattened or not. It uses flatten and maxDepth configuration given during initialization of the manager.
func (*ManagedCollection) AllModules ¶ added in v0.30.0
func (f *ManagedCollection) AllModules() []BuildModule
AllModules returns all explodedModules handle by the manager
func (*ManagedCollection) ExplodedModules ¶ added in v0.30.0
func (f *ManagedCollection) ExplodedModules() []BuildModule
ExplodedModules returns all modules that will be added to the output artifact as a single layer containing a single module.
func (*ManagedCollection) FlattenedModules ¶ added in v0.30.0
func (f *ManagedCollection) FlattenedModules() [][]BuildModule
FlattenedModules returns all modules that will be added to the output artifact as a single layer containing multiple modules.
func (*ManagedCollection) ShouldFlatten ¶ added in v0.30.0
func (f *ManagedCollection) ShouldFlatten(module BuildModule) bool
ShouldFlatten returns true if the given module is flattened.
type Metadata ¶
type Metadata struct { dist.ModuleInfo Stacks []dist.Stack `toml:"stacks" json:"stacks"` }
type ModuleTar ¶ added in v0.30.0
type ModuleTar interface { Info() dist.ModuleInfo Path() string }
func ToNLayerTar ¶ added in v0.30.0
func ToNLayerTar(dest string, module BuildModule) ([]ModuleTar, error)
type PackageBuilder ¶
type PackageBuilder struct {
// contains filtered or unexported fields
}
func NewBuilder ¶
func NewBuilder(imageFactory ImageFactory, ops ...PackageBuilderOption) *PackageBuilder
TODO: Rename to PackageBuilder
func (*PackageBuilder) AddDependencies ¶ added in v0.30.0
func (b *PackageBuilder) AddDependencies(main BuildModule, dependencies []BuildModule)
func (*PackageBuilder) AddDependency ¶
func (b *PackageBuilder) AddDependency(buildpack BuildModule)
func (*PackageBuilder) AllModules ¶ added in v0.30.0
func (b *PackageBuilder) AllModules() []BuildModule
func (*PackageBuilder) FlattenedModules ¶ added in v0.30.0
func (b *PackageBuilder) FlattenedModules() [][]BuildModule
func (*PackageBuilder) SaveAsFile ¶
func (b *PackageBuilder) SaveAsFile(path, imageOS string, labels map[string]string) error
func (*PackageBuilder) SaveAsImage ¶
func (*PackageBuilder) SetBuildpack ¶
func (b *PackageBuilder) SetBuildpack(buildpack BuildModule)
func (*PackageBuilder) SetExtension ¶ added in v0.30.0
func (b *PackageBuilder) SetExtension(extension BuildModule)
func (*PackageBuilder) ShouldFlatten ¶ added in v0.30.0
func (b *PackageBuilder) ShouldFlatten(module BuildModule) bool
type PackageBuilderOption ¶ added in v0.30.0
type PackageBuilderOption func(*options) error
func WithFlatten ¶ added in v0.30.0
func WithFlatten(depth int, exclude []string) PackageBuilderOption
func WithLayerWriterFactory ¶ added in v0.30.0
func WithLayerWriterFactory(factory archive.TarWriterFactory) PackageBuilderOption
func WithLogger ¶ added in v0.30.0
func WithLogger(logger logging.Logger) PackageBuilderOption