Documentation
¶
Overview ¶
Package remote implements SSH-based remote command execution for node workflows.
Index ¶
Constants ¶
const DefaultBootstrapURL = "https://omnitruck.cinc.sh/install.sh"
Variables ¶
This section is empty.
Functions ¶
func BootstrapCommand ¶
func BootstrapCommand(opts BootstrapOptions) (string, error)
BootstrapCommand builds the shell command executed on the target.
Types ¶
type BootstrapOptions ¶
type BootstrapOptions struct {
NodeName string
ServerURL string
ClientKeyPEM string
RunList []string
Environment string
PolicyName string
PolicyGroup string
Sudo bool
BootstrapURL string
BootstrapVersion string
}
BootstrapOptions describes the remote Cinc Client bootstrap script.
type CommandResult ¶
type CommandResult struct {
Host string `json:"host"`
Stdout string `json:"stdout,omitempty"`
Stderr string `json:"stderr,omitempty"`
ExitCode int `json:"exit_code"`
Error string `json:"error,omitempty"`
// Skipped marks a host the command was never attempted on, because
// --exit-on-error stopped the run first. It is not a failure: the host
// was not asked to do anything, so nothing is known about it.
Skipped bool `json:"skipped,omitempty"`
}
CommandResult is the result of one command on one host.
func RunMany ¶
func RunMany(ctx context.Context, runner Runner, targets []Target, command string, opts SSHOptions, concurrency int, exitOnError bool) []CommandResult
RunMany executes command across targets, limiting concurrency and preserving the input order in the returned results.
With exitOnError, the first non-zero exit stops further launches. Commands already running are left to finish, which is what the flag promises, and every host that never ran comes back marked Skipped rather than failed.
type NativeRunner ¶
type NativeRunner struct{}
NativeRunner is a Runner backed by golang.org/x/crypto/ssh.
func (NativeRunner) Run ¶
func (NativeRunner) Run(ctx context.Context, target Target, command string, opts SSHOptions) CommandResult
Run executes command on target through SSH.
type Runner ¶
type Runner interface {
Run(ctx context.Context, target Target, command string, opts SSHOptions) CommandResult
}
Runner executes a command on a target.