sippyserver

package
v0.0.0-...-7b077cb Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2026 License: Apache-2.0 Imports: 66 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Whether this instance of sippy is capable of displaying OpenShift-releated data. This
	// is basically always since we don't have a kube Sippy anymore.
	OpenshiftCapability = "openshift_releases"

	// LocalDB is whether we have a local DB client (currently postgres)
	LocalDBCapability = "local_db"

	// BuildclusterCapability is whether we have build cluster health data.
	BuildClusterCapability = "build_clusters"

	// ComponentReadiness capability is whether this sippy instance is configured for Component Readiness
	ComponentReadinessCapability = "component_readiness"

	// WriteEndpointsCapability is whether we have enabled write APIs on this server.
	WriteEndpointsCapability = "write_endpoints"

	// ChatCapability is whether this sippy instance is configured to proxy chat requests to sippy-chat service.
	ChatCapability = "chat"
)
View Source
const APIConfigError = "APIConfigError"

some standard error types

View Source
const (
	// MaxConversationSizeBytes is the maximum size of a conversation's messages in bytes (4MB)
	MaxConversationSizeBytes = 4194304
)
View Source
const ParameterInvalid = "ParameterInvalid"
View Source
const ParameterMissing = "ParameterMissing"

Variables

This section is empty.

Functions

func RefreshData

func RefreshData(dbc *db.DB, pinnedDateTime *time.Time, refreshMatviewsOnlyIfEmpty bool)

func SortByJobNameNT

func SortByJobNameNT(risks []*JobNewTestRisks)

func SortByJobNameRA

func SortByJobNameRA(ras []RiskAnalysisSummary)

Types

type AnalysisWorker

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

func (*AnalysisWorker) Run

func (aw *AnalysisWorker) Run()

type ChatConversationResponse

type ChatConversationResponse struct {
	ID        uuid.UUID         `json:"id"`
	CreatedAt string            `json:"created_at"`
	User      string            `json:"user"`
	Links     map[string]string `json:"links"`
}

ChatConversationResponse is the response for a chat conversation with HATEOAS links

type ChatProxy

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

ChatProxy handles proxying HTTP and WebSocket requests to the sippy-chat service

func NewChatProxy

func NewChatProxy(chatAPIURL string) (*ChatProxy, error)

NewChatProxy creates a new chat proxy instance

func (*ChatProxy) ServeHTTP

func (cp *ChatProxy) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP handles both HTTP and WebSocket requests

type CommentWorker

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

func (*CommentWorker) Run

func (cw *CommentWorker) Run()

type CreateChatConversationRequest

type CreateChatConversationRequest struct {
	Messages []map[string]interface{} `json:"messages"`
	Metadata map[string]interface{}   `json:"metadata,omitempty"`
	ParentID *uuid.UUID               `json:"parent_id,omitempty"`
}

CreateChatConversationRequest is the request payload for creating a new chat conversation

type DaemonProcess

type DaemonProcess interface {
	Run(ctx context.Context)
}

type DaemonServer

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

func NewDaemonServer

func NewDaemonServer(processes []DaemonProcess) *DaemonServer

func (*DaemonServer) Serve

func (da *DaemonServer) Serve()

type ExpandedTriage

type ExpandedTriage struct {
	*models.Triage
	RegressedTests []*componentreport.ReportTestSummary `json:"regressed_tests"`
}

ExpandedTriage allows for additional information to be included in the triage response. Currently, this is only the associated ReportTestSummaries which are useful for linking to the test_details report.

type FileBugRequest

type FileBugRequest struct {
	Summary         string   `json:"summary"`
	Description     string   `json:"description"`
	AffectsVersions []string `json:"affects_versions"`
	Components      []string `json:"components"`
	ComponentID     string   `json:"component_id"`
	Labels          []string `json:"labels"`
}

FileBugRequest represents the JSON request structure for filing Jira bugs

type FileBugResponse

type FileBugResponse struct {
	Success bool   `json:"success"`
	DryRun  bool   `json:"dry_run"`
	JiraKey string `json:"jira_key"`
	JiraURL string `json:"jira_url"`
}

FileBugResponse represents the JSON response structure for filing Jira bugs

type JobNewTestRisks

type JobNewTestRisks struct {
	JobName      string
	NewTestRisks map[string]*NewTestRisk // one risk record per new test name
}

JobNewTestRisks represents the new test risks for (all runs of) a single job

type JobRunFilter

type JobRunFilter interface {
	// OnlyLatestSha filters out runs that are not against the PR's latest sha
	OnlyLatestSha(entry *logrus.Entry, info prJobInfo) []*prow.ProwJob
	// JobFailedEarly determines if a run did not get far enough to be included in new test analysis
	JobFailedEarly(logger *logrus.Entry, run *models.ProwJobRun) bool
}

type Mode

type Mode string

Mode defines the server mode of operation, OpenShift or upstream Kubernetes.

const (
	ModeOpenShift  Mode = "openshift"
	ModeKubernetes Mode = "kube"
)

type NewTest

type NewTest struct {
	JobName  string
	JobRunID uint
	TestName string
	Success  bool
	Failure  bool // and if both, it's a flake
}

NewTest represents a test result whose name has not been seen in merged code before. we want to call out these out in comments alongside risk analysis.

type NewTestFilter

type NewTestFilter interface {
	// IsNewTest given a candidate test determines if it is really new with this PR
	IsNewTest(logger *logrus.Entry, test models.ProwJobRunTest) (bool, error)
}

type NewTestRisk

type NewTestRisk struct {
	TestName   string
	AnyMissing bool // it was a new test in one run but missing in another at same sha
	Runs       int  // how many job runs did we examine
	Failures   int  // how many of the test results were failure
	Flakes     int  // or flakes
	OnlyInOne  bool // new test was only seen in one job of multiple for this PR
	NewTests   []NewTest
	Level      apiModels.RiskLevel
	Reason     string
}

NewTestRisk is created for the following scenarios: 1. Any PR job adds a new test that appears in one run and not another at the same sha - high risk 2. PR adds new test that appears in only a single job and:

  • it fails at all - high risk
  • it succeeds or flakes - medium risk (might not be intended for multiple jobs)

3. PR adds new test that appears in more than one job and (at latest sha):

  • it fails at all - high risk
  • it succeeds or flakes - no risk (only included in list of all new tests)

type NewTestsWorker

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

NewTestsWorker analyzes PR jobs looking for new tests and determining their risks.

func StandardNewTestsWorker

func StandardNewTestsWorker(dbc *db.DB) *NewTestsWorker

StandardNewTestsWorker is a convenience method to create a NewTestsWorker with standard filters

type PreparedComment

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

PreparedComment is a comment that is ready to be posted on a github PR

type RiskAnalysisSummary

type RiskAnalysisSummary struct {
	Name             string
	URL              string
	RiskLevel        api.RiskLevel
	OverallReasons   []string
	TestRiskAnalysis []api.TestRiskAnalysis
}

type Server

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

func NewServer

func NewServer(
	mode Mode,
	listenAddr string,
	corsAllowedOrigin string,
	syntheticTestManager synthetictests.SyntheticTestManager,
	variantManager testidentification.VariantManager,
	sippyNG fs.FS,
	static fs.FS,
	dbClient *db.DB,
	gcsClient *storage.Client,
	gcsBucket string,
	bigQueryClient *bigquery.Client,
	pinnedDateTime *time.Time,
	cacheClient cache.Cache,
	crTimeRoundingFactor time.Duration,
	views *apitype.SippyViews,
	config *v1.SippyConfig,
	enableWriteEndpoints bool,
	chatAPIURL string,
	jiraClient *jira.Client,
) *Server

func (*Server) GetHTTPServer

func (s *Server) GetHTTPServer() *http.Server

func (*Server) GetReportEnd

func (s *Server) GetReportEnd() time.Time

func (*Server) Serve

func (s *Server) Serve()

type WorkProcessor

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

WorkProcessor coordinates the initialization, connection, and execution of all the workers that go into generating PR comments

func NewWorkProcessor

func NewWorkProcessor(dbc *db.DB, gcsBucket *storage.BucketHandle, commentAnalysisWorkers int, bigQueryClient *bigquery.Client, commentAnalysisRate, commentUpdaterRate time.Duration, ghCommenter *commenter.GitHubCommenter, dryRunOnly bool) *WorkProcessor

NewWorkProcessor creates a standard work processor from parameters. dbc: our database gcsBucket: handle to our root gcs bucket commentAnalysisWorkers: the number of threads active to process pending comment jobs commentAnalysisRate: the minimun duration between querying the db for pending jobs commentUpdaterRate: the minimum duration between adding a comment before we begin work on adding the next ghCommenter: the commenting implmentation dryRunOnly: default is true to prevent unintended commenting when running locally or in a test deployment

func (*WorkProcessor) Run

func (wp *WorkProcessor) Run(ctx context.Context)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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