pubsub

package
v0.0.0-...-4359601 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package reporter contains helpers for publishing statues to Pub statuses in GitHub.

Index

Constants

View Source
const (
	// PubSubProjectLabel annotation
	PubSubProjectLabel = "prow.k8s.io/pubsub.project"
	// PubSubTopicLabel annotation
	PubSubTopicLabel = "prow.k8s.io/pubsub.topic"
	// PubSubRunIDLabel annotation
	PubSubRunIDLabel = "prow.k8s.io/pubsub.runID"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a reporter client fed to crier controller

func NewReporter

func NewReporter(cfg config.Getter) *Client

NewReporter creates a new Pub/Sub reporter

func (*Client) GetName

func (c *Client) GetName() string

GetName returns the name of the reporter

func (*Client) Report

Report takes a prowjob, and generate a pubsub ReportMessage and publish to specific Pub/Sub topic based on Pub/Sub related labels if they exist in this prowjob

func (*Client) ShouldReport

func (c *Client) ShouldReport(_ context.Context, _ *logrus.Entry, pj *prowapi.ProwJob) bool

ShouldReport tells if a prowjob should be reported by this reporter

type ReportMessage

type ReportMessage struct {
	Project string               `json:"project"`
	Topic   string               `json:"topic"`
	RunID   string               `json:"runid"`
	Status  prowapi.ProwJobState `json:"status"`
	URL     string               `json:"url"`
	GCSPath string               `json:"gcs_path"`
	Refs    []prowapi.Refs       `json:"refs,omitempty"`
	JobType prowapi.ProwJobType  `json:"job_type"`
	JobName string               `json:"job_name"`
	Message string               `json:"message,omitempty"`
}

ReportMessage is a message structure used to pass a prowjob status to Pub/Sub topic.s

Jump to

Keyboard shortcuts

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