subscriber

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 3, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProwEventType          = "prow.k8s.io/pubsub.EventType"
	PeriodicProwJobEvent   = "prow.k8s.io/pubsub.PeriodicProwJobEvent"
	PresubmitProwJobEvent  = "prow.k8s.io/pubsub.PresubmitProwJobEvent"
	PostsubmitProwJobEvent = "prow.k8s.io/pubsub.PostsubmitProwJobEvent"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Metrics

type Metrics struct {
	// Common
	MessageCounter *prometheus.CounterVec
	ErrorCounter   *prometheus.CounterVec

	// Pull Server
	ACKMessageCounter  *prometheus.CounterVec
	NACKMessageCounter *prometheus.CounterVec

	// Push Server
	ResponseCounter *prometheus.CounterVec
}

func NewMetrics

func NewMetrics() *Metrics

type ProwJobEvent

type ProwJobEvent struct {
	Name string `json:"name"`
	// Refs are used by presubmit and postsubmit jobs supplying baseSHA and SHA
	Refs        *prowcrd.Refs     `json:"refs,omitempty"`
	Envs        map[string]string `json:"envs,omitempty"`
	Labels      map[string]string `json:"labels,omitempty"`
	Annotations map[string]string `json:"annotations,omitempty"`
}

ProwJobEvent contains the minimum information required to start a ProwJob.

func (*ProwJobEvent) FromPayload

func (pe *ProwJobEvent) FromPayload(data []byte) error

FromPayload set the ProwJobEvent from the PubSub message payload.

func (*ProwJobEvent) ToMessage

func (pe *ProwJobEvent) ToMessage() (*pubsub.Message, error)

ToMessage generates a PubSub Message from a ProwJobEvent.

func (*ProwJobEvent) ToMessageOfType

func (pe *ProwJobEvent) ToMessageOfType(t string) (*pubsub.Message, error)

ToMessage generates a PubSub Message from a ProwJobEvent.

type PullServer

type PullServer struct {
	Subscriber *Subscriber
	Client     pubsubClientInterface
}

PullServer listen to Pull Pub/Sub subscriptions and handle them.

func NewPullServer

func NewPullServer(s *Subscriber) *PullServer

NewPullServer creates a new PullServer

func (*PullServer) Run

func (s *PullServer) Run(ctx context.Context) error

Run will block listening to all subscriptions and return once the context is cancelled or one of the subscription has a unrecoverable error.

type Subscriber

type Subscriber struct {
	ConfigAgent       *config.Agent
	Metrics           *Metrics
	ProwJobClient     gangway.ProwJobClient
	Reporter          reportClient
	InRepoConfigCache *config.InRepoConfigCache
}

Subscriber handles Pub/Sub subscriptions, update metrics, validates them using Prow Configuration and use a ProwJobClient to create Prow Jobs.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL