cmd

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2020 License: Apache-2.0, MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BuildCommand = cli.Command{
	Name:  "build",
	Usage: "builds a test plan",
	Subcommands: cli.Commands{
		cli.Command{
			Name:    "composition",
			Aliases: []string{"c"},
			Usage:   "Builds a composition.",
			Action:  buildCompositionCmd,
			Flags: []cli.Flag{
				cli.StringFlag{
					Name:  "file, f",
					Usage: "path to a composition `FILE`",
				},
				cli.BoolFlag{
					Name:  "write-artifacts, w",
					Usage: "Writes the resulting build artifacts to the composition file.",
				},
			},
		},
		cli.Command{
			Name:      "single",
			Aliases:   []string{"s"},
			Usage:     "Builds a single group, passing in all necesssary input via CLI flags.",
			Action:    buildSingleCmd,
			ArgsUsage: "[<testplan>]",
			Flags: []cli.Flag{
				cli.StringFlag{
					Name:  "builder, b",
					Usage: "specifies the builder to use; values include: 'docker:go', 'exec:go'",
				},
				cli.StringSliceFlag{
					Name:  "dep, d",
					Usage: "set a dependency mapping",
				},
				cli.StringSliceFlag{
					Name:  "build-cfg",
					Usage: "set a build config parameter",
				},
			},
		},
	},
}
View Source
var CollectCommand = cli.Command{
	Name:      "collect",
	Usage:     "Produces a tgz file with the output from a certain run",
	Action:    collectCommand,
	ArgsUsage: "[run_id]",
	Flags: []cli.Flag{
		cli.StringFlag{
			Name:     "runner, r",
			Usage:    "specifies the runner to use; values include: 'local:exec', 'local:docker', 'cluster:k8s'",
			Required: true,
		},
		cli.StringFlag{
			Name:  "output, o",
			Usage: "specifies a named output for the tgz file",
		},
	},
}

CollectCommand is the specification of the `collect` command.

Commands collects all subcommands of the testground CLI.

View Source
var DaemonCommand = cli.Command{
	Name:   "daemon",
	Usage:  "start a long-running daemon process",
	Action: daemonCommand,
}

DaemonCommand is the specification of the `daemon` command.

View Source
var DescribeCommand = cli.Command{
	Name:      "describe",
	Usage:     "describes a test plan or test case",
	ArgsUsage: "[term], where " + daemon.TermExplanation,
	Action:    describeCommand,
}

DescribeCommand is the specification of the `list` command.

View Source
var ErrNotLinux = fmt.Errorf("the sidecar only supports linux, not %s", runtime.GOOS)
View Source
var Flags = []cli.Flag{
	cli.BoolFlag{
		Name:  "v",
		Usage: "verbose output (equivalent to DEBUG log level)",
	},
	cli.BoolFlag{
		Name:  "vv",
		Usage: "super verbose output (equivalent to DEBUG log level for now, it may accommodate TRACE in the future)",
	},
	cli.StringFlag{
		Name:  "endpoint",
		Usage: "set the daemon endpoint URI (overrides .env.toml)",
	},
}
View Source
var HealthcheckCommand = cli.Command{
	Name:   "healthcheck",
	Usage:  "checks, and optionally heals, the preconditions for the runner to be able to run properly",
	Action: healthcheckCommand,
	Flags: []cli.Flag{
		cli.BoolFlag{
			Name:  "fix",
			Usage: "should try to fix the preconditions",
		},
		cli.StringFlag{
			Name:     "runner",
			Usage:    "specifies the runner to use; values include: 'local:exec', 'local:docker', 'cluster:k8s'",
			Required: true,
		},
	},
}
View Source
var ListCommand = cli.Command{
	Name:   "list",
	Usage:  "list all test plans and test cases",
	Action: listCommand,
}

ListCommand is the specification of the `list` command.

View Source
var RunCommand = cli.Command{
	Name:  "run",
	Usage: "(Builds and) runs a test case. List test cases with the `list` command.",
	Subcommands: cli.Commands{
		cli.Command{
			Name:    "composition",
			Aliases: []string{"c"},
			Usage:   "(Builds and) runs a composition.",
			Action:  runCompositionCmd,
			Flags: []cli.Flag{
				cli.StringFlag{
					Name:  "file, f",
					Usage: "path to a composition `FILE`",
				},
				cli.BoolFlag{
					Name:  "write-artifacts, w",
					Usage: "Writes the resulting build artifacts to the composition file.",
				},
				cli.BoolFlag{
					Name:  "ignore-artifacts, i",
					Usage: "Ignores any build artifacts present in the composition file.",
				},
				cli.BoolFlag{
					Name:  "collect",
					Usage: "Collect assets at the end of the run phase.",
				},
				cli.StringFlag{
					Name:  "collect-file, o",
					Usage: "Destination for the assets if --collect is set",
				},
			},
		},
		cli.Command{
			Name:      "single",
			Aliases:   []string{"s"},
			Usage:     "(Builds and) runs a single group.",
			Action:    runSingleCmd,
			ArgsUsage: "[name]",
			Flags: append(
				BuildCommand.Subcommands[1].Flags,
				cli.StringFlag{
					Name:  "runner, r",
					Usage: "specifies the runner to use; values include: 'local:exec', 'local:docker', 'cluster:k8s'",
				},
				cli.StringFlag{
					Name:  "use-build, ub",
					Usage: "specifies the artifact to use (from a previous build)",
				},
				cli.UintFlag{
					Name:  "instances, i",
					Usage: "number of instances of the test case to run",
				},
				cli.StringSliceFlag{
					Name:  "run-cfg",
					Usage: "override runner configuration",
				},
				cli.StringSliceFlag{
					Name:  "test-param, p",
					Usage: "provide a test parameter",
				},
				cli.BoolFlag{
					Name:  "collect",
					Usage: "Collect assets at the end of the run phase.",
				},
				cli.StringFlag{
					Name:  "collect-file, o",
					Usage: "Destination for the assets if --collect is set",
				},
			),
		},
	},
}

RunCommand is the specification of the `run` command.

View Source
var SidecarCommand = cli.Command{
	Name:   "sidecar",
	Usage:  "runs the sidecar daemon",
	Action: sidecarCommand,
	OnUsageError: func(c *cli.Context, err error, isSubcommand bool) error {
		if runtime.GOOS != "linux" {
			return ErrNotLinux
		}
		_, _ = fmt.Fprintf(c.App.Writer, "%s %s\n\n", "Incorrect Usage.", err.Error())
		_ = cli.ShowAppHelp(c)
		return err
	},
	Flags: []cli.Flag{
		cli.GenericFlag{
			Name:     "runner, r",
			Required: true,
			Usage:    `Specifies the runner that will be scheduling tasks that should be managed by this sidecar. Options: ` + strings.Join(sidecar.GetRunners(), ", "),
			Value: &EnumValue{
				Allowed: sidecar.GetRunners(),
			},
		},
		cli.BoolFlag{
			Name:  "pprof",
			Usage: "Enable pprof service on port 6060",
		},
	},
}
View Source
var TerminateCommand = cli.Command{
	Name:   "terminate",
	Usage:  " terminates all jobs running on a runner",
	Action: terminateCommand,
	Flags: []cli.Flag{
		cli.StringFlag{
			Name:     "runner",
			Usage:    "specifies the runner to use; values include: 'local:exec', 'local:docker', 'cluster:k8s'",
			Required: true,
		},
	},
}

Functions

func ProcessContext

func ProcessContext() context.Context

Types

type EnumValue

type EnumValue struct {
	Allowed []string
	Default string
	// contains filtered or unexported fields
}

EnumValue is a cli.Generic flag type that enforces flag values from an enum.

func (*EnumValue) Set

func (e *EnumValue) Set(value string) error

func (*EnumValue) String

func (e *EnumValue) String() string

Jump to

Keyboard shortcuts

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