platutil

package
v0.8.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2024 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultPlatform returns the default platform object.
	DefaultPlatform = Platform{}
	// NativePlatform returns the native platform.
	NativePlatform = Platform{/* contains filtered or unexported fields */}
	// UserPlatform returns the user platform.
	UserPlatform = Platform{/* contains filtered or unexported fields */}
)

Functions

func GetNativePlatform

func GetNativePlatform(gwClient gwclient.Client) (specs.Platform, error)

GetNativePlatform returns the native platform for a given gwClient.

func GetNativePlatformViaBkClient

func GetNativePlatformViaBkClient(ctx context.Context, bkClient *client.Client) (specs.Platform, error)

GetNativePlatformViaBkClient returns the native platform for a given buildkit client.

func GetUserPlatform

func GetUserPlatform() specs.Platform

GetUserPlatform returns the user platform.

func IsPlatformDefined

func IsPlatformDefined(p Platform) bool

IsPlatformDefined returns true when the platform was explicitly set

Types

type Platform

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

Platform is a platform set to either the user's platform, the native platform where the build executes, or another specific platform.

func FromLLBPlatform

func FromLLBPlatform(p specs.Platform) Platform

FromLLBPlatform returns a platform from a containerd platform.

func (Platform) String

func (p Platform) String() string

String returns the string representation of the platform.

type Resolver

type Resolver struct {
	AllowNativeAndUser bool // this will be set via feature flag.
	// contains filtered or unexported fields
}

Resolver is a platform resolver.

func NewResolver

func NewResolver(nativePlatform specs.Platform) *Resolver

NewResolver returns a new platform resolver.

func (*Resolver) Current

func (r *Resolver) Current() Platform

Current returns the current platform.

func (*Resolver) Default

func (r *Resolver) Default() Platform

Default returns the default platform.

func (*Resolver) LLBNative

func (r *Resolver) LLBNative() specs.Platform

LLBNative returns the native platform.

func (*Resolver) LLBUser

func (r *Resolver) LLBUser() specs.Platform

LLBUser returns the user platform.

func (*Resolver) Materialize

func (r *Resolver) Materialize(in Platform) Platform

Materialize turns a platform into a concrete platform (resolves "user" / "native" / "") to an actual value.

func (*Resolver) Parse

func (r *Resolver) Parse(str string) (Platform, error)

Parse parses a given platform string. Empty string is a valid selection: it means "the default platform".

func (*Resolver) ParseAllowNativeAndUser

func (r *Resolver) ParseAllowNativeAndUser(str string) (Platform, error)

ParseAllowNativeAndUser parses a given platform string. Empty string is a valid selection: it means "the default platform". This variant forces allowing "native" and "user".

func (*Resolver) PlatformEquals

func (r *Resolver) PlatformEquals(p1, p2 Platform) bool

PlatformEquals compares two platforms if the equate to the same platform. A "native" platform can still equate to a "user" platform, if they materialize to the same platform.

func (*Resolver) Scratch

func (r *Resolver) Scratch() pllb.State

Scratch is the scratch state with the native platform readily set.

func (*Resolver) SubPlatform

func (r *Resolver) SubPlatform(in Platform) Platform

SubPlatform returns a platform that defaults to the current platform of the resolver (as opposed to the default platform of the resolver).

func (*Resolver) SubResolver

func (r *Resolver) SubResolver(newPlatform Platform) *Resolver

SubResolver returns a copy of this resolver, but with the current and default platform overriden.

func (*Resolver) ToLLBPlatform

func (r *Resolver) ToLLBPlatform(in Platform) specs.Platform

ToLLBPlatform returns the containerd platform.

func (*Resolver) UpdatePlatform

func (r *Resolver) UpdatePlatform(newPlatform Platform) Platform

UpdatePlatform set the current platform of this resolver and returns the effective platform set, resolving the default accordingly.

Jump to

Keyboard shortcuts

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