Documentation ¶
Index ¶
- Constants
- func CollectConsumerInfo(nc *nats.Conn, streamName string) ([]*jetstream.ConsumerInfo, error)
- func CollectStreamInfo(nc *nats.Conn, names []string) ([]*jetstream.StreamInfo, error)
- func ConvertToHumanReadableDateType(timestamp *time.Time) string
- func ErrorToAPIStatus(err error) *metav1.Status
- func GRPCCode(err error) gcerrors.ErrorCode
- func HTTPStatusFromCode(code gcerrors.ErrorCode) int32
- func NewConnection(addr, credFile string) (nc *nats.Conn, err error)
- func RenderConsumerInfo(consumers []*jetstream.ConsumerInfo) []byte
- func RenderStreamInfo(streams []*jetstream.StreamInfo) []byte
- func ReportStatus(nc *nats.Conn, name string, s Status, comments ...string)
- func RunsOnSelfHosted(e *github.WorkflowJobEvent) (string, bool)
- func SubmitPayload(gh *github.Client, nc *nats.Conn, r *http.Request, secretToken []byte) error
- func UseHighPriorityRunner(gh *github.Client, org string, private bool) string
- func UseRegularRunner(gh *github.Client, org string, private bool) string
- type MachineStatus
- type Manager
- func (mgr *Manager) EnsureStreams(jsOpts ...jetstream.JetStreamOpt) error
- func (mgr *Manager) ProcessCompletedJobs() error
- func (mgr *Manager) ProcessCompletedJobs__() error
- func (mgr *Manager) ProcessCompletedMsg(payload []byte) (*github.WorkflowJobEvent, error)
- func (mgr *Manager) RunVMs()
- func (mgr *Manager) Start(ctx context.Context, jsOpts ...jetstream.JetStreamOpt) error
- type NATSOptions
- type Options
- type Status
- type StatusReporter
Constants ¶
const ( NatsConnectionTimeout = 350 * time.Millisecond NatsConnectionRetryInterval = 100 * time.Millisecond NatsRequestTimeout = 10 * time.Second StreamPrefix = "gha_" )
const ( RunnerRegular = "firecracker" RunnerHigh = "f0" RunnerLabelDetector = "label-detector" )
Variables ¶
This section is empty.
Functions ¶
func CollectConsumerInfo ¶ added in v0.0.14
func CollectConsumerInfo(nc *nats.Conn, streamName string) ([]*jetstream.ConsumerInfo, error)
func CollectStreamInfo ¶ added in v0.0.14
func CollectStreamInfo(nc *nats.Conn, names []string) ([]*jetstream.StreamInfo, error)
func ConvertToHumanReadableDateType ¶ added in v0.0.14
ConvertToHumanReadableDateType returns the elapsed time since timestamp in human-readable approximation. ref: https://github.com/kubernetes/apimachinery/blob/v0.21.1/pkg/api/meta/table/table.go#L63-L70 But works for timestamp before or after now.
func ErrorToAPIStatus ¶
ErrorToAPIStatus converts an error to an metav1.Status object.
func GRPCCode ¶
GRPCCode extracts the gRPC status code and converts it into an ErrorCode. It returns Unknown if the error isn't from gRPC.
func HTTPStatusFromCode ¶
HTTPStatusFromCode converts a gRPC error code into the corresponding HTTP response status. See: https://github.com/googleapis/googleapis/blob/master/google/rpc/code.proto See: https://github.com/grpc-ecosystem/grpc-gateway/blob/v2.11.3/runtime/errors.go#L34-L77
func NewConnection ¶
NewConnection creates a new NATS connection
func RenderConsumerInfo ¶ added in v0.0.14
func RenderConsumerInfo(consumers []*jetstream.ConsumerInfo) []byte
func RenderStreamInfo ¶ added in v0.0.14
func RenderStreamInfo(streams []*jetstream.StreamInfo) []byte
func ReportStatus ¶ added in v0.0.14
func RunsOnSelfHosted ¶ added in v0.0.14
func RunsOnSelfHosted(e *github.WorkflowJobEvent) (string, bool)
func SubmitPayload ¶
func UseHighPriorityRunner ¶ added in v0.0.14
Types ¶
type MachineStatus ¶ added in v0.0.14
func (MachineStatus) Strings ¶ added in v0.0.14
func (ms MachineStatus) Strings() []string
type Manager ¶
func (*Manager) EnsureStreams ¶ added in v0.0.14
func (mgr *Manager) EnsureStreams(jsOpts ...jetstream.JetStreamOpt) error
func (*Manager) ProcessCompletedJobs ¶ added in v0.0.14
func (*Manager) ProcessCompletedJobs__ ¶ added in v0.0.14
func (*Manager) ProcessCompletedMsg ¶
func (mgr *Manager) ProcessCompletedMsg(payload []byte) (*github.WorkflowJobEvent, error)
type NATSOptions ¶
func NewNATSOptions ¶
func NewNATSOptions() *NATSOptions
func (*NATSOptions) AddFlags ¶
func (opts *NATSOptions) AddFlags(fs *pflag.FlagSet)
type Options ¶
type Options struct { AckWait time.Duration // hostname Name string NumWorkers int Provider string }
func DefaultOptions ¶
func DefaultOptions() Options
type StatusReporter ¶ added in v0.0.14
type StatusReporter struct {
// contains filtered or unexported fields
}
func NewStatusReporter ¶ added in v0.0.14
func NewStatusReporter(nc *nats.Conn) (*StatusReporter, error)
func (*StatusReporter) GenerateHTMLReport ¶ added in v0.0.14
func (sp *StatusReporter) GenerateHTMLReport() (string, error)
func (*StatusReporter) GenerateMarkdownReport ¶ added in v0.0.14
func (sp *StatusReporter) GenerateMarkdownReport() ([]byte, error)