builder

package
v0.0.0-...-08e834d Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

README

Builder

In a shell: "a toolkit for developing buildkitd clients".

This is evidently built on top of https://github.com/moby/buildkit and reuses code from buildctl.

Example

package main

import (
	"context"
	"bytes"

	"go.codecomet.dev/core/log"
	"go.codecomet.dev/alkali/builder/builder"
	"go.codecomet.dev/alkali/builder/commands"
)

func main() {
	// A protobuf message (eg: a marshalled llb.State)
	var proto *bytes.Buffer

    // Corresponding local filesystem keys/path
	var locals map[string]string
    // eg: locals["key"] = "local path"

    bo := builder.NewOperation("socket_path")
	bo.Ingest(proto, locals)

	_, err := commands.Run(context.Background(), bo)
	if err != nil {
		log.Error().Err(err).Msg("failed to run pipeline")
	}
}

Caveats

Current design is work in progress, specifically the BuildOperation top-level struct. Run and Export clearly belong to a notion of one operation, while the rest belongs to a controller. Furthermore, Secrets (inside Options) is also run-dependent.

About init

Unfortunately, buildkit does:

  • use environment variables as the only mean to customize certain things (eg: BUILDKIT_COLORS)
  • also buildkit is setting these from the environment inside an init() function

This makes it impossible to override them, unless we manipulate these env variables before the init() function is called. Given go import ordering...

Documentation

Index

Constants

View Source
const (
	SolBase03  = "0,43,54"
	SolBase02  = "7,54,66"
	SolBase01  = "88,110,117"
	SolBase00  = "101,123,131"
	SolBase0   = "131,148,150"
	SolBase1   = "147,161,161"
	SolBase2   = "238,232,213"
	SolBase3   = "253,246,227"
	SolYellow  = "181,137,0"
	SolOrange  = "203,75,22"
	SolRed     = "220,50,47"
	SolMagenta = "211,54,130"
	SolViolet  = "108,113,196"
	SolBlue    = "38,139,210"
	SolCyan    = "42,161,152"
	SolGreen   = "133,153,0"
)
View Source
const DefaultConnectionTimeout = 10 * time.Second

Variables

View Source
var (
	SolBodyText             string //nolint:gochecknoglobals
	SolEmphasize            string //nolint:gochecknoglobals
	SolComments             string //nolint:gochecknoglobals
	SolBackgroundHighlights string //nolint:gochecknoglobals
	SolBackground           string //nolint:gochecknoglobals
	SolError                string //nolint:gochecknoglobals
	SolWarning              string //nolint:gochecknoglobals
	SolInfo                 string //nolint:gochecknoglobals
	SolDebug                string //nolint:gochecknoglobals
)

Functions

func Colors

func Colors() string

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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