app

package
v0.2.0-alpha.11 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2022 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CommandBootstrap = &cli.Command{
	Name:  "bootstrap",
	Usage: "Bootstrap the envd installation including shell autocompletion and buildkit image download",
	Flags: []cli.Flag{
		&cli.BoolFlag{
			Name:    "buildkit",
			Usage:   "Download the image and bootstrap buildkit",
			Aliases: []string{"b"},
			Value:   true,
		},
		&cli.BoolFlag{
			Name:  "with-autocomplete",
			Usage: "Add envd autocompletions",
			Value: true,
		},
		&cli.StringFlag{
			Name:    "dockerhub-mirror",
			Usage:   "Dockerhub mirror to use",
			Aliases: []string{"m"},
		},
		&cli.StringSliceFlag{
			Name:    "ssh-keypair",
			Usage:   fmt.Sprintf("Manually specify ssh key pair as `publicKey,privateKey`. Envd will generate a keypair at %s and %s if not specified", sshconfig.GetPublicKey(), sshconfig.GetPrivateKey()),
			Aliases: []string{"k"},
		},
	},

	Action: bootstrap,
}
View Source
var CommandBuild = &cli.Command{
	Name:    "build",
	Aliases: []string{"b"},
	Usage:   "Build the envd environment",
	Description: `
To build an image using build.envd:
	$ envd build
To build and push the image to a registry:
	$ envd build --output type=image,name=docker.io/username/image,push=true
`,
	Flags: []cli.Flag{
		&cli.StringFlag{
			Name:        "tag",
			Usage:       "Name and optionally a tag in the 'name:tag' format",
			Aliases:     []string{"t"},
			DefaultText: "PROJECT:dev",
		},
		&cli.PathFlag{
			Name:    "from",
			Usage:   "Function to execute, format `file:func`",
			Aliases: []string{"f"},
			Value:   "build.envd:build",
		},
		&cli.PathFlag{
			Name:    "path",
			Usage:   "Path to the directory containing the build.envd",
			Aliases: []string{"p"},
			Value:   ".",
		},
		&cli.PathFlag{
			Name:    "public-key",
			Usage:   "Path to the public key",
			Aliases: []string{"pubk"},
			Value:   sshconfig.GetPublicKey(),
			Hidden:  true,
		},
		&cli.StringFlag{
			Name:    "output",
			Usage:   "Output destination (e.g. type=tar,dest=path,push=true)",
			Aliases: []string{"o"},
		},
		&cli.BoolFlag{
			Name:  "force",
			Usage: "Force rebuild the image",
			Value: false,
		},

		&cli.StringFlag{
			Name:    "export-cache",
			Usage:   "Export the cache (e.g. type=registry,ref=<image>)",
			Aliases: []string{"ec"},
		},
		&cli.StringFlag{
			Name:    "import-cache",
			Usage:   "Import the cache (e.g. type=registry,ref=<image>)",
			Aliases: []string{"ic"},
		},
	},
	Action: build,
}
View Source
var CommandContext = &cli.Command{
	Name:  "context",
	Usage: "Manage envd contexts",
	Subcommands: []*cli.Command{
		CommandContextCreate,
		CommandContextList,
		CommandContextRemove,
		CommandContextUse,
	},
}
View Source
var CommandContextCreate = &cli.Command{
	Name:  "create",
	Usage: "Create envd context",
	Flags: []cli.Flag{
		&cli.StringFlag{
			Name:     "name",
			Usage:    "Name of the context",
			Value:    "",
			Required: true,
		},
		&cli.StringFlag{
			Name:  "builder",
			Usage: "Builder to use (docker-container, kube-pod, tcp)",
			Value: string(types.BuilderTypeDocker),
		},
		&cli.StringFlag{
			Name:  "builder-socket",
			Usage: "Builder socket",
			Value: "envd_buildkitd",
		},
		&cli.BoolFlag{
			Name:  "use",
			Usage: "Use the context",
		},
	},
	Action: contextCreate,
}
View Source
var CommandContextList = &cli.Command{
	Name:   "ls",
	Usage:  "List envd contexts",
	Action: contextList,
}
View Source
var CommandContextRemove = &cli.Command{
	Name:  "rm",
	Usage: "Remove envd context",
	Flags: []cli.Flag{
		&cli.StringFlag{
			Name:     "name",
			Usage:    "Name of the context",
			Value:    "",
			Required: true,
		},
	},
	Action: contextRemove,
}
View Source
var CommandContextUse = &cli.Command{
	Name:  "use",
	Usage: "Use the specified envd context",
	Flags: []cli.Flag{
		&cli.StringFlag{
			Name:     "name",
			Usage:    "Name of the context",
			Value:    "",
			Required: true,
		},
	},
	Action: contextUse,
}
View Source
var CommandDescribeEnvironment = &cli.Command{
	Name:    "describe",
	Aliases: []string{"d"},
	Usage:   "Show details about environments, including dependencies",
	Flags: []cli.Flag{
		&cli.StringFlag{
			Name:    "env",
			Usage:   "Specify the envd environment to use",
			Aliases: []string{"e"},
		},
		&cli.PathFlag{
			Name:    "private-key",
			Usage:   "Path to the private key",
			Aliases: []string{"k"},
			Value:   sshconfig.GetPrivateKey(),
		},
	},
	Action: getEnvironmentDependency,
}
View Source
var CommandDescribeImage = &cli.Command{
	Name:    "describe",
	Aliases: []string{"d"},
	Usage:   "Show details about image, including dependencies",
	Flags: []cli.Flag{
		&cli.StringFlag{
			Name:    "image",
			Usage:   "Specify the image to use",
			Aliases: []string{"i"},
		},
	},
	Action: getImageDependency,
}
View Source
var CommandDestroy = &cli.Command{
	Name:    "destroy",
	Aliases: []string{"d"},
	Usage:   "Destroy the envd environment",
	Flags: []cli.Flag{
		&cli.PathFlag{
			Name:        "path",
			Usage:       "Path to the directory containing the build.envd",
			Aliases:     []string{"p"},
			DefaultText: "current directory",
		},
		&cli.PathFlag{
			Name:    "name",
			Usage:   "Name of the environment or container ID",
			Aliases: []string{"n"},
		},
	},

	Action: destroy,
}
View Source
var CommandEnvironment = &cli.Command{
	Name:    "envs",
	Aliases: []string{"env", "e"},
	Usage:   "Manage envd environments",

	Subcommands: []*cli.Command{
		CommandDescribeEnvironment,
		CommandListEnv,
	},
}
View Source
var CommandImage = &cli.Command{
	Name:    "images",
	Aliases: []string{"image", "i"},
	Usage:   "Manage envd images",

	Subcommands: []*cli.Command{
		CommandDescribeImage,
		CommandListImage,
	},
}
View Source
var CommandInit = &cli.Command{
	Name:    "init",
	Aliases: []string{"i"},
	Usage:   "Initializes the current directory with the build.envd file",
	Flags: []cli.Flag{
		&cli.StringFlag{
			Name:     "lang",
			Usage:    "language usage. Support Python, R",
			Aliases:  []string{"l"},
			Required: true,
		},
	},
	Action: initCommand,
}
View Source
var CommandListEnv = &cli.Command{
	Name:    "list",
	Aliases: []string{"ls", "l"},
	Usage:   "List envd environments",
	Action:  getEnvironment,
}
View Source
var CommandListImage = &cli.Command{
	Name:    "list",
	Aliases: []string{"ls", "l"},
	Usage:   "List envd images",
	Action:  getImage,
}
View Source
var CommandPause = &cli.Command{
	Name:    "pause",
	Aliases: []string{"p"},
	Usage:   "Pause the envd environment",
	Flags: []cli.Flag{
		&cli.StringFlag{
			Name:    "env",
			Usage:   "Environment name",
			Aliases: []string{"e"},
		},
	},

	Action: pause,
}
View Source
var CommandPrune = &cli.Command{
	Name:  "prune",
	Usage: "Clean up the build cache",
	Flags: []cli.Flag{
		&cli.DurationFlag{
			Name:  "keep-duration",
			Usage: "Keep data newer than this limit",
		},
		&cli.Float64Flag{
			Name:  "keep-storage",
			Usage: "Keep data below this limit (in MB)",
		},
		&cli.StringSliceFlag{
			Name:   "filter, f",
			Usage:  "Filter records",
			Hidden: true,
		},
		&cli.BoolFlag{
			Name:  "all",
			Usage: "Include internal caches (oh-my-zsh, vscode extensions and other envd caches)",
		},
		&cli.BoolFlag{
			Name:  "verbose, v",
			Usage: "Verbose output",
		},
	},

	Action: prune,
}
View Source
var CommandResume = &cli.Command{
	Name:    "resume",
	Aliases: []string{"r"},
	Usage:   "Resume the envd environment",
	Flags: []cli.Flag{
		&cli.StringFlag{
			Name:    "env",
			Usage:   "Environment name",
			Aliases: []string{"e"},
		},
	},

	Action: resume,
}
View Source
var CommandUp = &cli.Command{
	Name:    "up",
	Aliases: []string{"u"},
	Usage:   "Build and run the envd environment",
	Flags: []cli.Flag{
		&cli.StringFlag{
			Name:        "tag",
			Usage:       "Name and optionally a tag in the 'name:tag' format",
			Aliases:     []string{"t"},
			DefaultText: "PROJECT:dev",
		},
		&cli.PathFlag{
			Name:    "path",
			Usage:   "Path to the directory containing the build.envd",
			Aliases: []string{"p"},
			Value:   ".",
		},
		&cli.StringSliceFlag{
			Name:    "volume",
			Usage:   "Mount host directory into container",
			Aliases: []string{"v"},
		},
		&cli.PathFlag{
			Name:    "from",
			Usage:   "Function to execute, format `file:func`",
			Aliases: []string{"f"},
			Value:   "build.envd:build",
		},
		&cli.PathFlag{
			Name:    "private-key",
			Usage:   "Path to the private key",
			Aliases: []string{"k"},
			Value:   sshconfig.GetPrivateKey(),
			Hidden:  true,
		},
		&cli.PathFlag{
			Name:    "public-key",
			Usage:   "Path to the public key",
			Aliases: []string{"pubk"},
			Value:   sshconfig.GetPublicKey(),
			Hidden:  true,
		},
		&cli.DurationFlag{
			Name:  "timeout",
			Usage: "Timeout of container creation",
			Value: time.Second * 30,
		},
		&cli.BoolFlag{
			Name:  "detach",
			Usage: "Detach from the container",
			Value: false,
		},
		&cli.BoolFlag{
			Name:  "no-gpu",
			Usage: "Launch the CPU container",
			Value: false,
		},
		&cli.BoolFlag{
			Name:  "force",
			Usage: "Force rebuild and run the container although the previous container is running",
			Value: false,
		},

		&cli.StringFlag{
			Name:    "export-cache",
			Usage:   "Export the cache (e.g. type=registry,ref=<image>)",
			Aliases: []string{"ec"},
		},
		&cli.StringFlag{
			Name:    "import-cache",
			Usage:   "Import the cache (e.g. type=registry,ref=<image>)",
			Aliases: []string{"ic"},
		},
	},

	Action: up,
}
View Source
var CommandVersion = &cli.Command{
	Name:    "version",
	Aliases: []string{"v"},
	Usage:   "Print envd version information",
	Action:  printVersion,
	Flags: []cli.Flag{
		&cli.BoolFlag{
			Name:    "short",
			Usage:   "Only print the version number",
			Value:   false,
			Aliases: []string{"s"},
		},
		&cli.BoolFlag{
			Name:    "detail",
			Usage:   "Print details about the envd environment",
			Value:   false,
			Aliases: []string{"d"},
		},
	},
}

Functions

This section is empty.

Types

type EnvdApp

type EnvdApp struct {
	cli.App
}

func New

func New() EnvdApp

Jump to

Keyboard shortcuts

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