runner

package
v0.0.0-...-fc29aca Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2024 License: UPL-1.0 Imports: 45 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ArgURL is the Operator URL status command argument.
	ArgURL = "url"
	// ArgTimeout is the timeout status command argument.
	ArgTimeout = "timeout"
	// ArgInterval is the retry interval status command argument.
	ArgInterval = "interval"
	// ArgSkipInsecure is the skip insecure https checks status command argument.
	ArgSkipInsecure = "insecure-skip-tls-verify"
	// ArgCertAuthority is the location of the CA file status command argument.
	ArgCertAuthority = "certificate-authority"
	// ArgCert is the location of the cert file status command argument.
	ArgCert = "client-certificate"
	// ArgKey is the location of the key file status command argument.
	ArgKey = "client-key"
)
View Source
const (
	// ArgCommand is an additional command to run after initialisation
	ArgCommand = "cmd"
	// ArgRootDir is the root directory to initialise and directories files in
	ArgRootDir = "root"
	// ArgUtilsDir is the utils directory name
	ArgUtilsDir = "utils"
	// ArgPersistenceDir is root the persistence directory name
	ArgPersistenceDir = "persistence"
	// ArgSnapshotsDir is root the snapshots directory name
	ArgSnapshotsDir = "snapshots"
)
View Source
const (
	// CommandNetTest is the argument to launch a network test.
	CommandNetTest = "net-test"

	// CommandNetTestServer is the argument to launch a network test server.
	CommandNetTestServer = "server"

	// CommandNetTestOperator is the argument to launch a network test Operator simulation.
	CommandNetTestOperator = "operator"

	// CommandNetTestCluster is the argument to launch a network test Coherence cluster member simulation.
	CommandNetTestCluster = "cluster"

	// CommandNetTestHook is the argument to launch a network test that connects to the Operator web-hook port.
	CommandNetTestHook = "hook"

	// CommandNetTestClient is the argument to launch a simple network test client.
	CommandNetTestClient = "client"

	// ArgOperatorHostName is the argument to use to specify the Operator host name to connect to
	ArgOperatorHostName = "operator-host"

	// ArgClusterHostName is the argument to use to specify the Operator host name to connect to
	ArgClusterHostName = "cluster-host"

	// ArgHostName is the argument to use to specify the host name to connect to
	ArgHostName = "host"

	// ArgPort is the argument to use to specify the port to connect to
	ArgPort = "port"

	// ArgProtocol is the argument to use to specify the network protocol to use
	ArgProtocol = "protocol"
)
View Source
const (
	// CommandNode is the argument to launch a Node label reader.
	CommandNode = "node"

	// ArgNode is the name of the node to query
	ArgNode = "node-name"
	// ArgDir is the directory to write files to
	ArgDir = "dir"
	// ArkKubeConfig is the location of the k8s config
	ArkKubeConfig = "kubeconfig"
)
View Source
const (
	// CommandStatus is the argument to execute a deployment status query.
	CommandStatus = "status"

	// ArgOperatorURL is the Operator URL status command argument.
	ArgOperatorURL = "operator-url"
	// ArgNamespace is the Coherence resource namespace status command argument.
	ArgNamespace = "namespace"
	// ArgName is the Coherence resource name status command argument.
	ArgName = "name"
	// ArgCondition is the required condition status command argument.
	ArgCondition = "condition"
)
View Source
const (
	// DefaultMain is an indicator to run the default main class.
	DefaultMain = "$DEFAULT$"
	// HelidonMain is the default Helidon main class name.
	HelidonMain = "io.helidon.microprofile.cdi.Main"
	// ServerMain is the default server main class name.
	ServerMain = "com.oracle.coherence.k8s.Main"
	// SpringBootMain is the default Spring Boot main class name.
	SpringBootMain = "org.springframework.boot.loader.PropertiesLauncher"

	// AppTypeNone is the argument to specify no application type.
	AppTypeNone = ""
	// AppTypeJava is the argument to specify a Java application.
	AppTypeJava = "java"
	// AppTypeCoherence is the argument to specify a Coherence application.
	AppTypeCoherence = "coherence"
	// AppTypeHelidon is the argument to specify a Helidon application.
	AppTypeHelidon = "helidon"
	// AppTypeSpring is the argument to specify a Spring application.
	AppTypeSpring = "spring"
	// AppTypeOperator is the argument to specify running an Operator command.
	AppTypeOperator = "operator"
)
View Source
const (
	// CommandConsole is the argument to launch a Coherence console.
	CommandConsole = "console"
)
View Source
const (
	// CommandJShell is the argument to launch a JShell console.
	CommandJShell = "jshell"
)
View Source
const (
	// CommandOperator is the argument to launch the Operator manager.
	CommandOperator = "operator"
)
View Source
const (
	// CommandQueryPlus is the argument to launch a QueryPlus console.
	CommandQueryPlus = "queryplus"
)
View Source
const (
	// CommandReady is the argument to execute ready check.
	CommandReady = "ready"
)
View Source
const (
	// CommandServer is the argument to launch a server.
	CommandServer = "server"
)
View Source
const (
	// CommandSleep is the argument to sleep for a number of seconds.
	CommandSleep = "sleep"
)

Variables

This section is empty.

Functions

func NewRootCommand

func NewRootCommand(env map[string]string, v *viper.Viper) *cobra.Command

NewRootCommand builds the root cobra command that handles our command line tool.

Types

type EnvFunction

type EnvFunction func(string) string

EnvFunction is a function that returns an environment variable for a given name.

type Execution

type Execution struct {
	Cmd   *cobra.Command
	App   string
	OsCmd *exec.Cmd
	V     *viper.Viper
}

Execution is a holder of details of a command execution

func Execute

func Execute() (Execution, error)

Execute runs the runner with a given environment.

func ExecuteWithArgsAndNewViper

func ExecuteWithArgsAndNewViper(env map[string]string, args []string) (Execution, error)

ExecuteWithArgsAndNewViper runs the runner with a given environment and argument overrides.

func ExecuteWithArgsAndViper

func ExecuteWithArgsAndViper(env map[string]string, args []string, v *viper.Viper) (Execution, error)

ExecuteWithArgsAndViper runs the runner with a given environment and argument overrides.

type MaybeRunFunction

type MaybeRunFunction func(*RunDetails, *cobra.Command) (bool, error)

MaybeRunFunction is a function to maybe run a command depending on the return bool

type RunDetails

type RunDetails struct {
	Command           string
	CoherenceHome     string
	JavaHome          string
	UtilsDir          string
	Dir               string
	GetSite           bool
	UseOperatorHealth bool
	AppType           string
	Classpath         string
	Args              []string
	MainClass         string
	MainArgs          []string
	BuildPacks        *bool
	// contains filtered or unexported fields
}

RunDetails contains the information to run an application.

func NewRunDetails

func NewRunDetails(v *viper.Viper) *RunDetails

func (*RunDetails) Expand

func (in *RunDetails) Expand(s string, mapping func(string) string) string

Expand replaces ${var} or $(var) or $var in the string based on the mapping function. For example, os.ExpandEnv(s) is equivalent to os.Expand(s, os.Getenv).

func (*RunDetails) ExpandEnv

func (in *RunDetails) ExpandEnv(s string) string

ExpandEnv replaces ${var} or $(var) or $var in the string according to the values of the current environment variables. References to undefined variables are replaced by the empty string.

func (*RunDetails) Getenv

func (in *RunDetails) Getenv(name string) string

Getenv returns the value for the specified environment variable, or empty string if not set.

type RunFunction

type RunFunction func(*RunDetails, *cobra.Command)

RunFunction is a function to run a command

Jump to

Keyboard shortcuts

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