util

package
v0.0.0-...-aada4bf Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CacheConfigEnvName = "_EXPERIMENTAL_DAGGER_CACHE_CONFIG"
	GPUSupportEnvName  = "_EXPERIMENTAL_DAGGER_GPU_SUPPORT"
)
View Source
const (
	EngineContainerName = "dagger-engine.dev"
)

Variables

View Source
var DefaultDevEngineOpts = DevEngineOpts{
	EntrypointArgs: map[string]string{
		"network-name": "dagger-dev",
		"network-cidr": "10.88.0.0/16",
	},
	ConfigEntries: map[string]string{
		"grpc":                 `address=["unix:///var/run/buildkit/buildkitd.sock", "tcp://0.0.0.0:1234"]`,
		`registry."docker.io"`: `mirrors = ["mirror.gcr.io"]`,
	},
}

Functions

func CIDevEngineContainer

func CIDevEngineContainer(ctx context.Context, c *dagger.Client, opts ...DevEngineOpts) (*dagger.Container, error)

func CIDevEngineContainerAndEndpoint

func CIDevEngineContainerAndEndpoint(ctx context.Context, c *dagger.Client, opts ...DevEngineOpts) (*dagger.Service, string, error)

func CodegenBinary

func CodegenBinary(c *dagger.Client) *dagger.File

CodegenBinary returns a binary for generating the Go and TypeScript SDKs.

func DaggerBinary

func DaggerBinary(c *dagger.Client, version string) *dagger.File

DaggerBinary returns a compiled dagger binary

func DevEngineContainer

func DevEngineContainer(ctx context.Context, c *dagger.Client, arches []string, version string, opts ...DevEngineOpts) ([]*dagger.Container, error)

DevEngineContainer returns a container that runs a dev engine

func DevEngineContainerWithGPUSupport

func DevEngineContainerWithGPUSupport(ctx context.Context, c *dagger.Client, arches []string, version string, opts ...DevEngineOpts) ([]*dagger.Container, error)

DevEngineContainerWithGPUSUpport returns a container that runs a dev engine

func DevelDaggerBinary

func DevelDaggerBinary(ctx context.Context, c *dagger.Client) (*dagger.File, error)

DevelDaggerBinary returns a compiled dagger binary with the devel version

func GetHostEnv

func GetHostEnv(name string) string

GetHostEnv is like os.Getenv but ensures that the env var is set.

func GoBase

func GoBase(c *dagger.Client) *dagger.Container

GoBase is a standardized base image for running Go, cache optimized for the layout of this repository

NOTE: this function is a shared util ONLY because it's used both by the Engine and the Go SDK. Other languages shouldn't have a common helper.

func HostDaggerBinary

func HostDaggerBinary(c *dagger.Client, version string) *dagger.File

HostDaggerBinary returns a dagger binary compiled to target the host's OS+arch

func HostDockerDir

func HostDockerDir(c *dagger.Client) *dagger.Directory

HostDockerCredentials returns the host's ~/.docker dir if it exists, otherwise just an empty dir

func HostSecretVar

func HostSecretVar(c *dagger.Client, name string) dagger.WithContainerFunc

HostSecretVar is a chainable util for setting a secret env var from the host in a container.

func HostVar

func HostVar(c *dagger.Client, name string) dagger.WithContainerFunc

HostVar is a chainable util for setting an env var from the host in a container.

func LintGeneratedCode

func LintGeneratedCode(target string, fn func() error, files ...string) error

LintGeneratedCode ensures the generated code is up to date.

1) Read currently generated code 2) Generate again 3) Compare 4) Restore original generated code.

func PlatformDaggerBinary

func PlatformDaggerBinary(c *dagger.Client, goos, goarch, goarm string, version string) *dagger.File

func Repository

func Repository(c *dagger.Client) *dagger.Directory

Repository with common set of exclude filters to speed up upload

func RepositoryGoCodeOnly

func RepositoryGoCodeOnly(c *dagger.Client) *dagger.Directory

RepositoryGoCodeOnly is Repository, filtered to only contain Go code.

NOTE: this function is a shared util ONLY because it's used both by the Engine and the Go SDK. Other languages shouldn't have a common helper.

func ShellCmd

func ShellCmd(cmd string) dagger.WithContainerFunc

func ShellCmds

func ShellCmds(cmds ...string) dagger.WithContainerFunc

Types

type DevEngineOpts

type DevEngineOpts struct {
	EntrypointArgs map[string]string
	ConfigEntries  map[string]string
	Name           string
}

DevEngineOpts are options for the dev engine

type VersionInfo

type VersionInfo struct {
	Tag      string
	Commit   string
	TreeHash string
}

func DevelVersionInfo

func DevelVersionInfo(ctx context.Context, c *dagger.Client) (*VersionInfo, error)

func (VersionInfo) EngineVersion

func (info VersionInfo) EngineVersion() string

Jump to

Keyboard shortcuts

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