Documentation
¶
Overview ¶
package extended implements a well-behaved, higher-level client for the step-runner gRPC service. The primary entry point, RunAndFollow(), will initiate a steps job, Follow*() the logs to completion, and on completion get the job's Status() and Close() the job, releasing all resources.
While it does not do so currently, this client will in the future automatically reconnect and re-initiate Following on connection errors using the specified DialFunc.
Callers can use the FollowOutput type to receive streaming logs.
Note that if it is cancelled or times out, the context passed to RunAndFollow will cancel the client AND also call Close() on the job, effectively cancelling it on the server side too.
Index ¶
- type Dialer
- type FollowOutput
- type StepRunnerClient
- func (c *StepRunnerClient) CloseConn() error
- func (c *StepRunnerClient) Follow(ctx context.Context, jobID string, out *FollowOutput) (client.Status, error)
- func (c *StepRunnerClient) RunAndFollow(ctx context.Context, runRequest *client.RunRequest, out *FollowOutput) (status client.Status, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dialer ¶
type Dialer interface {
Dial() (*grpc.ClientConn, error)
}
type FollowOutput ¶
type StepRunnerClient ¶
type StepRunnerClient struct {
*basic.StepRunnerClient
// contains filtered or unexported fields
}
func New ¶
func New(dialer Dialer) (*StepRunnerClient, error)
func (*StepRunnerClient) CloseConn ¶
func (c *StepRunnerClient) CloseConn() error
CloseConn closes the connection to the step-runner service.
func (*StepRunnerClient) Follow ¶
func (c *StepRunnerClient) Follow(ctx context.Context, jobID string, out *FollowOutput) (client.Status, error)
Follow follows log streams as configured by FollowOutput, and return the job's final status. If nil is specified for either sink, that stream will not be followed. At least one sink must be specified.
func (*StepRunnerClient) RunAndFollow ¶
func (c *StepRunnerClient) RunAndFollow(ctx context.Context, runRequest *client.RunRequest, out *FollowOutput) (status client.Status, err error)
RunAndFollow manages the complete lifecycle of a step run request, including initiating the run request, following output streams (as configured by FollowOutput), querying the final job status, and finally Closing the job.
Note that if ctx is cancelled or times out, Close will be called on the job, effectively cancelling it on the server too.