Documentation ¶
Index ¶
- Constants
- Variables
- func LocalTarCmdArgs(path, exclude string) []string
- func NewTarStreamReader(cwd, path, exclude string) (io.Reader, error)
- func RemoteTarCommand(dir string) string
- func ResolveLocalPath(cwd, path, env string) (string, error)
- type Client
- type Command
- type Commands
- type EnvList
- type EnvVar
- type ErrConnect
- type ErrMustUpdate
- type ErrTask
- type ErrUnsupportedSupfileVersion
- type LocalhostClient
- func (c *LocalhostClient) Close() error
- func (c *LocalhostClient) Connect(_ string) error
- func (c *LocalhostClient) Prefix() (string, int)
- func (c *LocalhostClient) Run(task *Task) error
- func (c *LocalhostClient) Signal(sig os.Signal) error
- func (c *LocalhostClient) Stderr() io.Reader
- func (c *LocalhostClient) Stdin() io.WriteCloser
- func (c *LocalhostClient) Stdout() io.Reader
- func (c *LocalhostClient) Wait() error
- func (c *LocalhostClient) Write(p []byte) (n int, err error)
- func (c *LocalhostClient) WriteClose() error
- type Network
- type Networks
- type SSHClient
- func (c *SSHClient) Close() error
- func (c *SSHClient) Connect(host string) error
- func (c *SSHClient) ConnectWith(host string, dialer SSHDialFunc) error
- func (sc *SSHClient) DialThrough(net, addr string, config *ssh.ClientConfig) (*ssh.Client, error)
- func (c *SSHClient) Prefix() (string, int)
- func (c *SSHClient) Run(task *Task) error
- func (c *SSHClient) Signal(sig os.Signal) error
- func (c *SSHClient) Stderr() io.Reader
- func (c *SSHClient) Stdin() io.WriteCloser
- func (c *SSHClient) Stdout() io.Reader
- func (c *SSHClient) Wait() error
- func (c *SSHClient) Write(p []byte) (n int, err error)
- func (c *SSHClient) WriteClose() error
- type SSHDialFunc
- type Stackup
- type Supfile
- type Targets
- type Task
- type Upload
Constants ¶
const VERSION = "0.5"
Variables ¶
var ( Colors = []string{ "\033[32m", "\033[33m", "\033[36m", "\033[35m", "\033[31m", "\033[34m", } ResetColor = "\033[0m" )
Functions ¶
func LocalTarCmdArgs ¶
func NewTarStreamReader ¶
NewTarStreamReader creates a tar stream reader from a local path. TODO: Refactor. Use "archive/tar" instead.
func RemoteTarCommand ¶
RemoteTarCommand returns command to be run on remote SSH host to properly receive the created TAR stream. TODO: Check for relative directory.
func ResolveLocalPath ¶
Types ¶
type Command ¶
type Command struct { Name string `yaml:"-"` // Command name. Desc string `yaml:"desc"` // Command description. Local string `yaml:"local"` // Command(s) to be run locally. Run string `yaml:"run"` // Command(s) to be run remotelly. Script string `yaml:"script"` // Load command(s) from script and run it remotelly. Upload []Upload `yaml:"upload"` // See Upload struct. Stdin bool `yaml:"stdin"` // Attach localhost STDOUT to remote commands' STDIN? Once bool `yaml:"once"` // The command should be run "once" (on one host only). Serial int `yaml:"serial"` // Max number of clients processing a task in parallel. // API backward compatibility. Will be deprecated in v1.0. RunOnce bool `yaml:"run_once"` // The command should be run once only. }
Command represents command(s) to be run remotely.
type Commands ¶ added in v0.5.1
type Commands struct { Names []string // contains filtered or unexported fields }
Commands is a list of user-defined commands
func (*Commands) UnmarshalYAML ¶ added in v0.5.1
type EnvList ¶
type EnvList []*EnvVar
EnvList is a list of environment variables that maps to a YAML map, but maintains order, enabling late variables to reference early variables.
func (*EnvList) ResolveValues ¶ added in v0.5.1
func (*EnvList) UnmarshalYAML ¶
type EnvVar ¶
EnvVar represents an environment variable
type ErrConnect ¶
func (ErrConnect) Error ¶
func (e ErrConnect) Error() string
type ErrMustUpdate ¶
type ErrMustUpdate struct {
Msg string
}
func (ErrMustUpdate) Error ¶
func (e ErrMustUpdate) Error() string
type ErrUnsupportedSupfileVersion ¶ added in v0.5.1
type ErrUnsupportedSupfileVersion struct {
Msg string
}
func (ErrUnsupportedSupfileVersion) Error ¶ added in v0.5.1
func (e ErrUnsupportedSupfileVersion) Error() string
type LocalhostClient ¶
type LocalhostClient struct {
// contains filtered or unexported fields
}
Client is a wrapper over the SSH connection/sessions.
func (*LocalhostClient) Close ¶
func (c *LocalhostClient) Close() error
func (*LocalhostClient) Connect ¶
func (c *LocalhostClient) Connect(_ string) error
func (*LocalhostClient) Prefix ¶
func (c *LocalhostClient) Prefix() (string, int)
func (*LocalhostClient) Run ¶
func (c *LocalhostClient) Run(task *Task) error
func (*LocalhostClient) Stderr ¶
func (c *LocalhostClient) Stderr() io.Reader
func (*LocalhostClient) Stdin ¶
func (c *LocalhostClient) Stdin() io.WriteCloser
func (*LocalhostClient) Stdout ¶
func (c *LocalhostClient) Stdout() io.Reader
func (*LocalhostClient) Wait ¶
func (c *LocalhostClient) Wait() error
func (*LocalhostClient) WriteClose ¶
func (c *LocalhostClient) WriteClose() error
type Network ¶
type Network struct { Env EnvList `yaml:"env"` Inventory string `yaml:"inventory"` Hosts []string `yaml:"hosts"` Bastion string `yaml:"bastion"` // Jump host for the environment // Should these live on Hosts too? We'd have to change []string to struct, even in Supfile. User string // `yaml:"user"` IdentityFile string // `yaml:"identity_file"` }
Network is group of hosts with extra custom env vars.
func (Network) ParseInventory ¶
ParseInventory runs the inventory command, if provided, and appends the command's output lines to the manually defined list of hosts.
type Networks ¶ added in v0.5.1
type Networks struct { Names []string // contains filtered or unexported fields }
Networks is a list of user-defined networks
func (*Networks) UnmarshalYAML ¶ added in v0.5.1
type SSHClient ¶
type SSHClient struct {
// contains filtered or unexported fields
}
Client is a wrapper over the SSH connection/sessions.
func (*SSHClient) Connect ¶
Connect creates SSH connection to a specified host. It expects the host of the form "[ssh://]host[:port]".
func (*SSHClient) ConnectWith ¶
func (c *SSHClient) ConnectWith(host string, dialer SSHDialFunc) error
ConnectWith creates a SSH connection to a specified host. It will use dialer to establish the connection. TODO: Split Signers to its own method.
func (*SSHClient) DialThrough ¶
DialThrough will create a new connection from the ssh server sc is connected to. DialThrough is an SSHDialer.
func (*SSHClient) Stdin ¶
func (c *SSHClient) Stdin() io.WriteCloser
func (*SSHClient) Wait ¶
Wait waits until the remote command finishes and exits. It closes the SSH session.
func (*SSHClient) WriteClose ¶
type SSHDialFunc ¶
SSHDialFunc can dial an ssh server and return a client
type Supfile ¶
type Supfile struct { Networks Networks `yaml:"networks"` Commands Commands `yaml:"commands"` Targets Targets `yaml:"targets"` Env EnvList `yaml:"env"` Version string `yaml:"version"` }
Supfile represents the Stack Up configuration YAML file.
func NewSupfile ¶
NewSupfile parses configuration file and returns Supfile or error.
type Targets ¶ added in v0.5.1
type Targets struct { Names []string // contains filtered or unexported fields }
Targets is a list of user-defined targets