remote

package
v0.24.0 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2026 License: Apache-2.0 Imports: 17 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package remote implements SSH-based remote command execution for node workflows.

Index

Constants

View Source
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.

type SSHOptions

type SSHOptions struct {
	User         string
	Password     string
	IdentityFile string
	AgentSocket  string
	Port         int
	Timeout      time.Duration
	UseAgent     bool
	VerifyHost   bool
}

SSHOptions configures native SSH connections.

type Target

type Target struct {
	Host string `json:"host"`
}

Target identifies one remote host.

Jump to

Keyboard shortcuts

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