Documentation ¶
Index ¶
- func BasicPipeHandler(r io.Reader, logout chan []byte, wg *sync.WaitGroup)
- func CreateSSHDockerContainer(t *testing.T, forwardPort string) (cleanup func(), ctx context.Context)
- type Channel
- func (c *Channel) AppendGlobals(envs []string)
- func (c *Channel) CheckConnection() error
- func (c *Channel) Close() error
- func (c *Channel) JustRun(cmd string, envs []string) error
- func (c *Channel) RunAndLog(cmd string, envs []string, logout chan []byte, streamingFunc StreamingFunc) error
- func (c *Channel) SetGlobals(envs []string)
- func (c *Channel) Setenvs(extraEnvs ...string) error
- type StreamingFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BasicPipeHandler ¶
BasicPipeHandler is a simple implementation of the StreamingFunc function type. It does not transform the data coming in, it just writes it directly to the logout channel.
Types ¶
type Channel ¶
type Channel struct {
// contains filtered or unexported fields
}
func CreateSSHChannel ¶
CreateSSHChannel will use the werker's configured ssh facts to create an SSH client. It will error at this point
if the client cannot connect to the remote sshd. It will also kick off the handleCtx method that will kill the active session and attempt to stop any associated processes
func (*Channel) AppendGlobals ¶
func (*Channel) CheckConnection ¶
CheckConnection will create a session and attempt to run an echo command. Will return any errors; if error is
nil you can assume everything is a-ok for running commands.
func (*Channel) RunAndLog ¶
func (c *Channel) RunAndLog(cmd string, envs []string, logout chan []byte, streamingFunc StreamingFunc) error
RunAndLog runs a given command remotely via the ContextConnection's ssh client. The stdout and stderr will be processed by the given StreamingFunc function and written to logout. the function will wait for the StreamingFunc function to close its done channel on both the stdout processing and the stderr processing.
func (*Channel) SetGlobals ¶
type StreamingFunc ¶
StreamingFunc is the function that will read off the Reader and transform it, then write it to the logout channel. call wg.Done(), it synchronizes the ssh command execution. See BasicPipeHandler for implementation