Documentation
¶
Overview ¶
Package script is the API surface for deployment scripts executed by the script.go GitHub Action. A script builds a Runner once and uses it to run local commands, run remote commands over SSH, copy files, and write env files on the remote host.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶ added in v1.2.0
type Config struct {
// User is the SSH user. Required.
User string
// Host is the remote host. Required.
Host string
// Port is the SSH port. Defaults to 22.
Port int
// PrivateKeyEnv is the name of the environment variable holding the SSH
// private key. Defaults to "SSH_PRIVATE_KEY".
PrivateKeyEnv string
// DefaultLocalPath is the key file used when PrivateKeyEnv is unset.
// Defaults to "~/.ssh/id_rsa".
DefaultLocalPath string
// HostPublicKey optionally pins the remote host key, in authorized_keys
// format (e.g. one line of `ssh-keyscan host` output). When empty, host
// key verification is disabled.
HostPublicKey string
// Timeout bounds the connection attempt. Defaults to 30 seconds.
Timeout time.Duration
}
Config describes how to reach the remote host.
type Runner ¶ added in v1.2.0
type Runner interface {
ssh.Runner
// RunLocal executes cmds sequentially through `sh -c`, so shell quoting,
// pipes, and redirection work. ${workspace} and ${ANY_ENV_VAR}
// references are expanded before execution; unknown references are left
// for the shell.
RunLocal(workspace string, cmds ...string) error
}
Runner combines local and remote execution. Close it when the script is done to release the SSH connection.
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
script-go
command
|
|
|
internal
|
|
|
expand
Package expand implements ${VAR} substitution for commands and env files.
|
Package expand implements ${VAR} substitution for commands and env files. |
|
plugins
Package plugins loads compiled Go plugins and invokes their exported Runner symbol, which must be a `func(workspace string) error`.
|
Package plugins loads compiled Go plugins and invokes their exported Runner symbol, which must be a `func(workspace string) error`. |
|
pkg
|
|
|
ssh
Package ssh provides a small SSH client for running remote commands, copying files, and writing env files on a remote host.
|
Package ssh provides a small SSH client for running remote commands, copying files, and writing env files on a remote host. |
Click to show internal directories.
Click to hide internal directories.