crossbuild

package
v0.0.0-...-0453c99 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// EnvironmentDownloadBaseURL is the base url to download environment image.
	EnvironmentDownloadBaseURL = "storage.googleapis.com/nanos-build-envs"

	// EnvironmentImageFileExtension is extension for environment image file.
	EnvironmentImageFileExtension = ".qcow2"

	// EnvironmentUsername is username for regular account.
	EnvironmentUsername = "user"

	// EnvironmentUserPassword is password for regular account.
	EnvironmentUserPassword = "user"

	// EnvironmentRootPassword is password for admin account.
	EnvironmentRootPassword = "root"
)

Variables

View Source
var (
	// ErrMsgEnvironmentInitFailed occurs if environment initialization failed.
	ErrMsgEnvironmentInitFailed = "Failed to initialize crossbuild environment"

	// CrossBuildHomeDirPath is the crossbuild home directory.
	CrossBuildHomeDirPath = filepath.Join(lepton.GetOpsHome(), "crossbuild")

	// SupportedEnvironmentsFileName is name of the file that list supported environments.
	SupportedEnvironmentsFileName = "environments.json"

	// EnvironmentImageDirPath is the directory that keeps environment images.
	EnvironmentImageDirPath = filepath.Join(CrossBuildHomeDirPath, "images")
)

Functions

This section is empty.

Types

type Environment

type Environment struct {
	ID        string `json:"id"`
	Name      string `json:"name"`
	Version   string `json:"version"`
	IsDefault bool   `json:"is_default"`
	SSHPort   int    `json:"-"`
	PID       int    `json:"-"`
}

Environment is a virtualized crossbuild operating system.

func DefaultEnvironment

func DefaultEnvironment() (*Environment, error)

DefaultEnvironment returns default environment.

func (*Environment) Boot

func (env *Environment) Boot() error

Boot starts environment VM.

func (*Environment) GetFiles

func (env *Environment) GetFiles(c *types.Config, hostPath string) error

GetFiles copies image files from VM to local directory.

func (*Environment) Install

func (env *Environment) Install() error

Install pulls environment image from remote storage.

func (*Environment) IsInstalled

func (env *Environment) IsInstalled() bool

IsInstalled returns whether the environment is installed.

func (*Environment) IsReady

func (env *Environment) IsReady() bool

IsReady returns true if communication with environment VM can be established.

func (*Environment) NewCommand

func (env *Environment) NewCommand(command string, args ...interface{}) *EnvironmentCommand

NewCommand creates new command to be executed via SSH.

func (*Environment) NewCommandf

func (env *Environment) NewCommandf(format string, args ...interface{}) *EnvironmentCommand

NewCommandf creates new formatted command to be executed via SSH.

func (*Environment) NewEmptyCommand

func (env *Environment) NewEmptyCommand() *EnvironmentCommand

NewEmptyCommand creates an empty command.

func (*Environment) RunCommands

func (env *Environment) RunCommands(cmdFile string) error

RunCommands runs a sequence of commands in the VM.

func (*Environment) Shutdown

func (env *Environment) Shutdown() error

Shutdown stops the environment VM, if running.

func (*Environment) Uninstall

func (env *Environment) Uninstall() error

Uninstall uninstalls the environment from the system.

type EnvironmentCommand

type EnvironmentCommand struct {
	SuppressOutput bool
	CommandLines   []string
	Username       string
	Password       string
	Port           int
	OutputBuffer   bytes.Buffer
	ErrorBuffer    bytes.Buffer
	// contains filtered or unexported fields
}

EnvironmentCommand is one or more command lines to be executed.

func (*EnvironmentCommand) AsAdmin

func (cmd *EnvironmentCommand) AsAdmin() *EnvironmentCommand

AsAdmin modifies the command to use admin account.

func (*EnvironmentCommand) Execute

func (cmd *EnvironmentCommand) Execute() error

Execute executes command in VM as regular user, or as admin if asAdmin is true.

func (*EnvironmentCommand) StdError

func (cmd *EnvironmentCommand) StdError() string

StdError returns the string written to the standard error stream by a command.

func (*EnvironmentCommand) StdOutput

func (cmd *EnvironmentCommand) StdOutput() string

StdOutput returns the string written to the standard output stream by a command.

func (*EnvironmentCommand) Then

func (cmd *EnvironmentCommand) Then(command string, args ...interface{}) *EnvironmentCommand

Then appends command line to the set of commands.

Jump to

Keyboard shortcuts

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