tart

package
v0.0.0-...-756c5c5 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// EnvTartExecutorInternalBuildsDir is an internal environment variable
	// that does not use the "CUSTOM_ENV_" prefix, thus preventing the override
	// by the user.
	EnvTartExecutorInternalBuildsDir = "TART_EXECUTOR_INTERNAL_BUILDS_DIR"

	// EnvTartExecutorInternalCacheDir is an internal environment variable
	// that does not use the "CUSTOM_ENV_" prefix, thus preventing the override
	// by the user.
	EnvTartExecutorInternalCacheDir = "TART_EXECUTOR_INTERNAL_CACHE_DIR"
)

Variables

View Source
var (
	ErrTartNotFound = errors.New("tart command not found")
	ErrTartFailed   = errors.New("tart command returned non-zero exit code")
	ErrVMFailed     = errors.New("VM errored")
)
View Source
var ErrConfigFromEnvironmentFailed = errors.New("failed to load config from environment")

Functions

func TartExec

func TartExec(
	ctx context.Context,
	args ...string,
) (string, string, error)

func TartExecWithEnv

func TartExecWithEnv(
	ctx context.Context,
	env map[string]string,
	args ...string,
) (string, string, error)

Types

type Config

type Config struct {
	SSHUsername         string `env:"SSH_USERNAME" envDefault:"admin"`
	SSHPassword         string `env:"SSH_PASSWORD" envDefault:"admin"`
	SSHPort             uint16 `env:"SSH_PORT" envDefault:"22"`
	Softnet             bool   `env:"SOFTNET"`
	Headless            bool   `env:"HEADLESS"  envDefault:"true"`
	AlwaysPull          bool   `env:"ALWAYS_PULL"  envDefault:"true"`
	InsecurePull        bool   `env:"INSECURE_PULL"  envDefault:"false"`
	PullConcurrency     uint8  `env:"PULL_CONCURRENCY"`
	HostDir             bool   `env:"HOST_DIR"`
	Shell               string `env:"SHELL"`
	InstallGitlabRunner string `env:"INSTALL_GITLAB_RUNNER"`
	Timezone            string `env:"TIMEZONE"`
}

func NewConfigFromEnvironment

func NewConfigFromEnvironment() (Config, error)

type VM

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

func CreateNewVM

func CreateNewVM(
	ctx context.Context,
	gitLabEnv gitlab.Env,
	config Config,
	cpuOverride uint64,
	memoryOverride uint64,
) (*VM, error)

func ExistingVM

func ExistingVM(gitLabEnv gitlab.Env) *VM

func (*VM) Delete

func (vm *VM) Delete() error

func (*VM) IP

func (vm *VM) IP(ctx context.Context) (string, error)

func (*VM) MonitorTartRunOutput

func (vm *VM) MonitorTartRunOutput()

func (*VM) OpenSSH

func (vm *VM) OpenSSH(ctx context.Context, config Config) (*ssh.Client, error)

func (*VM) Start

func (vm *VM) Start(
	config Config,
	gitLabEnv *gitlab.Env,
	customDirectoryMounts []string,
	customDiskMounts []string,
) error

func (*VM) Stop

func (vm *VM) Stop() error

Jump to

Keyboard shortcuts

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