compiler

package
v0.0.0-...-a644469 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: GPL-3.0 Imports: 31 Imported by: 1

Documentation

Index

Constants

View Source
const BuildFile = "build.yaml"
View Source
const CollectionFile = "collection.yaml"
View Source
const DefinitionFile = "definition.yaml"

Variables

This section is empty.

Functions

func BackendArgs

func BackendArgs(r []string) func(cfg *types.CompilerOptions) error

func Concurrency

func Concurrency(i int) func(cfg *types.CompilerOptions) error

func EnableGenerateFinalImages

func EnableGenerateFinalImages(cfg *types.CompilerOptions) error

func EnablePushFinalImages

func EnablePushFinalImages(cfg *types.CompilerOptions) error

func ForcePushFinalImages

func ForcePushFinalImages(cfg *types.CompilerOptions) error

func KeepImg

func KeepImg(b bool) func(cfg *types.CompilerOptions) error

func LoadArtifactFromYaml

func LoadArtifactFromYaml(spec *types.LuetCompilationSpec) (*artifact.PackageArtifact, error)

func NoDeps

func NoDeps(b bool) func(cfg *types.CompilerOptions) error

func OnlyDeps

func OnlyDeps(b bool) func(cfg *types.CompilerOptions) error

func OnlyTarget

func OnlyTarget(b bool) func(cfg *types.CompilerOptions) error

func PullFirst

func PullFirst(b bool) func(cfg *types.CompilerOptions) error

func PushImages

func PushImages(b bool) func(cfg *types.CompilerOptions) error

func Rebuild

func Rebuild(b bool) func(cfg *types.CompilerOptions) error

func Wait

func Wait(b bool) func(cfg *types.CompilerOptions) error

func WithBackendType

func WithBackendType(r string) func(cfg *types.CompilerOptions) error

func WithBuildValues

func WithBuildValues(r []string) func(cfg *types.CompilerOptions) error

func WithCompressionType

func WithCompressionType(t types.CompressionImplementation) func(cfg *types.CompilerOptions) error

func WithContext

func WithContext(c types.Context) func(cfg *types.CompilerOptions) error

func WithFinalRepository

func WithFinalRepository(r string) func(cfg *types.CompilerOptions) error

WithFinalRepository Sets the final repository where to push images of built artifacts

func WithOptions

func WithOptions(opt *types.CompilerOptions) func(cfg *types.CompilerOptions) error

func WithPullRepositories

func WithPullRepositories(r []string) func(cfg *types.CompilerOptions) error

func WithPushRepository

func WithPushRepository(r string) func(cfg *types.CompilerOptions) error

WithPushRepository Sets the image reference where to push cache images

func WithRuntimeDatabase

func WithRuntimeDatabase(db types.PackageDatabase) func(cfg *types.CompilerOptions) error

func WithSolverOptions

func WithSolverOptions(c types.LuetSolverOptions) func(cfg *types.CompilerOptions) error

func WithTemplateFolder

func WithTemplateFolder(r []string) func(cfg *types.CompilerOptions) error

Types

type ArtifactIndex

type ArtifactIndex []*artifact.PackageArtifact

func (ArtifactIndex) CleanPath

func (i ArtifactIndex) CleanPath() ArtifactIndex

type BuildTree

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

func (*BuildTree) AllInLevel

func (bt *BuildTree) AllInLevel(l int) []string

func (*BuildTree) AllLevels

func (bt *BuildTree) AllLevels() []int

func (*BuildTree) Increase

func (bt *BuildTree) Increase(s string)

func (*BuildTree) JSON

func (bt *BuildTree) JSON() (string, error)

func (*BuildTree) Level

func (bt *BuildTree) Level(s string) int

func (*BuildTree) Order

func (bt *BuildTree) Order(compilationTree map[string]map[string]interface{})

func (*BuildTree) Reset

func (bt *BuildTree) Reset(s string)

type CompilerBackend

type CompilerBackend interface {
	BuildImage(backend.Options) error
	ExportImage(backend.Options) error
	LoadImage(string) error
	RemoveImage(backend.Options) error
	ImageDefinitionToTar(backend.Options) error

	CopyImage(string, string) error
	DownloadImage(opts backend.Options) error

	Push(opts backend.Options) error
	ImageAvailable(string) bool

	ImageReference(img1 string, ondisk bool) (v1.Image, error)
	ImageExists(string) bool
}

func NewBackend

func NewBackend(ctx types.Context, s string) (CompilerBackend, error)

type ImageHashTree

type ImageHashTree struct {
	Database      types.PackageDatabase
	SolverOptions types.LuetSolverOptions
}

ImageHashTree is holding the Database and the options to resolve PackageImageHashTrees for a given specfile It is responsible of returning a concrete result which identifies a Package in a HashTree

func NewHashTree

func NewHashTree(db types.PackageDatabase) *ImageHashTree

func (*ImageHashTree) Query

Query takes a compiler and a compilation spec and returns a PackageImageHashTree tied to it. PackageImageHashTree contains all the informations to resolve the spec build images in order to reproducibly re-build images from packages

type LuetCompiler

type LuetCompiler struct {
	//*tree.CompilerRecipe
	Backend  CompilerBackend
	Database types.PackageDatabase
	Options  types.CompilerOptions
}

func CompilerFinalImages

func CompilerFinalImages(cs *LuetCompiler) (*LuetCompiler, error)

func NewCompiler

func NewCompiler(p ...types.CompilerOption) *LuetCompiler

func NewLuetCompiler

func NewLuetCompiler(backend CompilerBackend, db types.PackageDatabase, compilerOpts ...types.CompilerOption) *LuetCompiler

func (*LuetCompiler) BuildTree

func (cs *LuetCompiler) BuildTree(compilerSpecs types.LuetCompilationspecs) (*BuildTree, error)

BuildTree returns a BuildTree which represent the order in which specs should be compiled. It places specs into levels, and each level can be built in parallel. The root nodes starting from the top. A BuildTree can be marshaled into JSON or walked like:

for _, l := range bt.AllLevels() {
	fmt.Println(strings.Join(bt.AllInLevel(l), " "))
}

func (*LuetCompiler) Compile

func (cs *LuetCompiler) Compile(keepPermissions bool, p *types.LuetCompilationSpec) (*artifact.PackageArtifact, error)

Compile is a non-parallel version of CompileParallel. It builds the compilation specs and generates an artifact

func (*LuetCompiler) CompileParallel

func (cs *LuetCompiler) CompileParallel(keepPermissions bool, ps *types.LuetCompilationspecs) ([]*artifact.PackageArtifact, []error)

CompileParallel compiles the supplied compilationspecs in parallel to note, no specific heuristic is implemented, and the specs are run in parallel as they are.

func (*LuetCompiler) CompileWithReverseDeps

func (cs *LuetCompiler) CompileWithReverseDeps(keepPermissions bool, ps *types.LuetCompilationspecs) ([]*artifact.PackageArtifact, []error)

CompileWithReverseDeps compiles the supplied compilationspecs and their reverse dependencies

func (*LuetCompiler) ComputeDepTree

func (*LuetCompiler) ComputeMinimumCompilableSet

func (cs *LuetCompiler) ComputeMinimumCompilableSet(p ...*types.LuetCompilationSpec) ([]*types.LuetCompilationSpec, error)

ComputeMinimumCompilableSet strips specs that are eventually compiled by leafs

func (*LuetCompiler) FromDatabase

func (cs *LuetCompiler) FromDatabase(db types.PackageDatabase, minimum bool, dst string) ([]*types.LuetCompilationSpec, error)

FromDatabase returns all the available compilation specs from a database. If the minimum flag is returned it will be computed a minimal subset that will guarantees that all packages are built ( if not targeting a single package explictly )

func (*LuetCompiler) FromPackage

func (cs *LuetCompiler) FromPackage(p *types.Package) (*types.LuetCompilationSpec, error)

FromPackage returns a compilation spec from a package definition

func (*LuetCompiler) GetBackend

func (cs *LuetCompiler) GetBackend() CompilerBackend

GetBackend returns the current compilation backend

func (*LuetCompiler) SetBackend

func (cs *LuetCompiler) SetBackend(b CompilerBackend)

SetBackend sets the compilation backend

type PackageImageHashTree

type PackageImageHashTree struct {
	Target       *types.PackageAssert
	Dependencies types.PackagesAssertions
	Solution     types.PackagesAssertions

	SourceHash       string
	BuilderImageHash string
	// contains filtered or unexported fields
}

PackageImageHashTree represent the Package into a given image hash tree The hash tree is constructed by a set of images representing the package during its build stage. A Hash is assigned to each image from the package fingerprint, plus the SAT solver assertion result (which is hashed as well) and the specfile signatures. This guarantees that each image of the build stage is unique and can be identified later on.

func (*PackageImageHashTree) DependencyBuildImage

func (ht *PackageImageHashTree) DependencyBuildImage(p *types.Package) (string, error)

func (*PackageImageHashTree) String

func (ht *PackageImageHashTree) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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