teeth

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package teeth contains a job that will read leech and pull request event records from BigQuery and publish any available log invocations in a PR comment.

Index

Constants

This section is empty.

Variables

View Source
var PublisherSourceQuery string

PublisherSourceQuery is the source query that teeth job pipeline will use to publish results.

Functions

func SetUpPublisherSourceQuery

func SetUpPublisherSourceQuery(ctx context.Context, bqClient BigQueryClient) (*bigquery.Query, error)

SetUpPublisherSourceQuery converts the PublisherSourceQuery string into a Query object that the BigQueryClient can then execute. It populates the query parameters with the BigQuery config values.

Types

type BQConfig

type BQConfig struct {
	PullRequestEventsTable       string
	InvocationCommentStatusTable string
	EventsTable                  string
	LeechStatusTable             string
}

TODO: Add query limit param.

BQConfig defines configuration parameters for the BigQuery tables used by the teeth job pipeline.

type BigQueryClient

type BigQueryClient interface {
	Config() *BQConfig
	Query(string) *bigquery.Query
}

BigQueryClient defines the spec for calls to read from and write to BigQuery tables.

type InvocationCommentStatusRecord

type InvocationCommentStatusRecord struct {
	PullRequestID  int                `bigquery:"pull_request_id"`
	PullRequestURL string             `bigquery:"pull_request_html_url"`
	ProcessedAt    time.Time          `bigquery:"processed_at"`
	CommentID      bigquery.NullInt64 `bigquery:"comment_id"`
	Status         string             `bigquery:"status"`
	JobName        string             `bigquery:"job_name"`
}

InvocationCommentStatusRecord is the output data structure that maps to the teeth pipeline's output table schema for invocation comment statuses.

type PublisherSourceRecord

type PublisherSourceRecord struct {
	DeliveryID     string    `bigquery:"delivery_id"`
	PullRequestID  int       `bigquery:"pull_request_id"`
	PullRequestURL string    `bigquery:"pull_request_html_url"`
	Received       time.Time `bigquery:"received"`
	LogsURI        string    `bigquery:"logs_uri"`
	HeadSHA        string    `bigquery:"head_sha"`
}

PublisherSourceRecord maps the columns from the driving BigQuery query to a usable structure.

Jump to

Keyboard shortcuts

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