Documentation
¶
Overview ¶
Package autoflowutils holds what the `glab autoflow workflow` commands share.
Index ¶
- Constants
- func GetWorkflow(ctx context.Context, client autoflowrpcv1.AutoFlowServiceClient, ...) (*autoflowrpcv1.GetWorkflowResponse, error)
- func NewChannelTokenFlag(cmd *cobra.Command) *cmdutils.SecretFile
- func NewTokenBindingFlag(cmd *cobra.Command) *cmdutils.SecretFile
- func NewWorkflowTokenFlag(cmd *cobra.Command) *cmdutils.SecretFile
- func State(s autoflowrpcv1.WorkflowState) string
- type Connection
- type Wait
Constants ¶
const CallTimeout = 30 * time.Second
CallTimeout bounds a single RPC to the AutoFlow service.
Variables ¶
This section is empty.
Functions ¶
func GetWorkflow ¶
func GetWorkflow(ctx context.Context, client autoflowrpcv1.AutoFlowServiceClient, req *autoflowrpcv1.GetWorkflowRequest) (*autoflowrpcv1.GetWorkflowResponse, error)
GetWorkflow reads the workflow req addresses.
func NewChannelTokenFlag ¶
func NewChannelTokenFlag(cmd *cobra.Command) *cmdutils.SecretFile
NewChannelTokenFlag registers --channel-token-file on cmd.
func NewTokenBindingFlag ¶
func NewTokenBindingFlag(cmd *cobra.Command) *cmdutils.SecretFile
NewTokenBindingFlag registers --token-binding-file on cmd.
func NewWorkflowTokenFlag ¶
func NewWorkflowTokenFlag(cmd *cobra.Command) *cmdutils.SecretFile
NewWorkflowTokenFlag registers --workflow-token-file on cmd.
func State ¶
func State(s autoflowrpcv1.WorkflowState) string
State returns the name of s without its enum prefix, as the commands print it.
Types ¶
type Connection ¶
type Connection struct {
// NamespaceID is the parsed --namespace-id, set by Complete, or the
// organization of the AutoFlow token, set by Dial.
NamespaceID uuid.UUID
// contains filtered or unexported fields
}
Connection is the set of flags that addresses the AutoFlow service and a namespace in it.
func (*Connection) AddFlags ¶
func (c *Connection) AddFlags(cmd *cobra.Command)
AddFlags registers the connection flags on cmd.
func (*Connection) Complete ¶
func (c *Connection) Complete() error
Complete parses and validates the connection flags.
func (*Connection) Dial ¶
func (c *Connection) Dial(ctx context.Context, ios *iostreams.IOStreams, apiClient func(repoHost string) (*api.Client, error)) (autoflowrpcv1.AutoFlowServiceClient, io.Closer, error)
Dial connects to the AutoFlow service with a token exchanged on the GitLab instance and sets NamespaceID to the token's organization unless --namespace-id is set. The caller must close the returned connection.
type Wait ¶
type Wait struct {
Enabled bool
// contains filtered or unexported fields
}
Wait is the set of flags that makes a command poll a workflow until it has finished.
func (*Wait) Until ¶
func (w *Wait) Until(ctx context.Context, client autoflowrpcv1.AutoFlowServiceClient, req *autoflowrpcv1.GetWorkflowRequest) (*autoflowrpcv1.GetWorkflowResponse, error)
Until reads the workflow req addresses every poll interval until it has finished. It keeps polling through up to maxTransientFailures consecutive failures that a retry can fix, such as a restarting Relay.