models

package
v0.0.0-...-9219c3d Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	User                 resolutionReason = "user"
	RegressionsRolledOff resolutionReason = "regressions-rolled-off"
	JiraProgression      resolutionReason = "jira-progression"
)
View Source
const (
	OldTriageKey   contextKey = "old_triage"
	CurrentUserKey contextKey = "current_user"
)

Variables

This section is empty.

Functions

func ValidTriageType

func ValidTriageType(triageType TriageType) bool

Types

type APISnapshot

type APISnapshot struct {
	gorm.Model
	// Name is a user friendly name for this snapshot, i.e. "4.12 GA"
	Name    string `json:"name" gorm:"unique"`
	Release string `json:"release"`

	// OverallHealth is json from the /api/health?release=X API.
	OverallHealth pgtype.JSONB `json:"overall_health" gorm:"type:jsonb"`

	// PayloadHealth is json from the /api/releases/health?release=4.12 API and contains stats on payload health for
	// each stream in the release.
	PayloadHealth pgtype.JSONB `json:"payload_health" gorm:"type:jsonb"`

	// VariantHealth is json from the /api/variants?release=4.12 API and contains stats on job pass rates
	// for each variant.
	VariantHealth pgtype.JSONB `json:"variant_health" gorm:"type:jsonb"`

	// InstallHealth is json from the /api/install?release=4.12 API and contains stats on install success rates
	// by variant.
	InstallHealth pgtype.JSONB `json:"install_health" gorm:"type:jsonb"`

	// UpgradeHealth is json from the /api/upgrade?release=4.12 API and contains stats on upgrade success rates
	// by variant.
	UpgradeHealth pgtype.JSONB `json:"upgrade_health" gorm:"type:jsonb"`
}

APISnapshot is a minimal implementation of historical data tracking. On GA or other dates of interest, we use the snapshot CLI command to query some of the main API endpoints, and store the resulting json with an type (indicating the API) into our database.

type AuditLog

type AuditLog struct {
	ID        uint      `json:"id" gorm:"primaryKey"`
	TableName string    `json:"table_name" gorm:"not null"`
	Operation string    `json:"operation" gorm:"not null"`
	RowID     uint      `json:"row_id" gorm:"not null"`
	OldData   []byte    `json:"old_data" gorm:"type:jsonb"`
	NewData   []byte    `json:"new_data" gorm:"type:jsonb"`
	User      string    `json:"user" gorm:"not null"`
	CreatedAt time.Time `json:"created_at" gorm:"autoCreateTime"`
}

type Bug

type Bug struct {
	ID              uint           `json:"id" gorm:"primaryKey"`
	Key             string         `json:"key" gorm:"index"`
	CreatedAt       time.Time      `json:"created_at"`
	UpdatedAt       time.Time      `json:"updated_at"`
	DeletedAt       gorm.DeletedAt `json:"deleted_at" gorm:"index"`
	Status          string         `json:"status"`
	LastChangeTime  time.Time      `json:"last_change_time"`
	Summary         string         `json:"summary"`
	AffectsVersions pq.StringArray `json:"affects_versions" gorm:"type:text[]"`
	FixVersions     pq.StringArray `json:"fix_versions" gorm:"type:text[]"`
	TargetVersions  pq.StringArray `json:"target_versions" gorm:"type:text[]"`
	Components      pq.StringArray `json:"components" gorm:"type:text[]"`
	Labels          pq.StringArray `json:"labels" gorm:"type:text[]"`
	URL             string         `json:"url"`
	ReleaseBlocker  string         `json:"release_blocker"`
	Tests           []Test         `json:"-" gorm:"many2many:bug_tests;constraint:OnDelete:CASCADE;"`
	Jobs            []ProwJob      `json:"-" gorm:"many2many:bug_jobs;constraint:OnDelete:CASCADE;"`
}

Bug represents a Jira bug.

type BuildClusterHealth

type BuildClusterHealth struct {
	Cluster        string    `json:"cluster"`
	Period         time.Time `json:"period"`
	TotalRuns      int       `json:"total_runs"`
	Passes         int       `json:"passes"`
	Failures       int       `json:"failures"`
	PassPercentage float64   `json:"pass_percentage"`
}

type BuildClusterHealthReport

type BuildClusterHealthReport struct {
	ID                    int     `json:"id"`
	Cluster               string  `json:"cluster,omitempty"`
	CurrentPassPercentage float64 `json:"current_pass_percentage"`
	CurrentRuns           int     `json:"current_runs"`
	CurrentPasses         int     `json:"current_passes,omitempty"`
	CurrentFails          int     `json:"current_fails,omitempty"`

	PreviousPassPercentage float64 `json:"previous_pass_percentage"`
	PreviousRuns           int     `json:"previous_runs"`
	PreviousPasses         int     `json:"previous_passes,omitempty"`
	PreviousFails          int     `json:"previous_fails,omitempty"`

	NetImprovement float64 `json:"net_improvement"`
}

type ChatConversation

type ChatConversation struct {
	ID        uuid.UUID      `json:"id" gorm:"type:uuid;primaryKey;default:gen_random_uuid()"`
	CreatedAt time.Time      `json:"created_at"`
	UpdatedAt time.Time      `json:"updated_at"`
	DeletedAt gorm.DeletedAt `json:"deleted_at,omitempty" gorm:"index"`

	// User who shared/created this conversation
	User string `json:"user" gorm:"not null;index"`

	// ParentID is the UUID of the conversation this was forked from, if any
	ParentID *uuid.UUID `json:"parent_id,omitempty" gorm:"type:uuid;index"`

	// Messages contains the full conversation history in JSONB format
	Messages pgtype.JSONB `json:"messages" gorm:"type:jsonb;not null"`

	// Metadata stores additional information like persona, page context, etc
	Metadata pgtype.JSONB `json:"metadata,omitempty" gorm:"type:jsonb"`

	// Links contains REST links for clients to follow. Most notably "self".
	// These are injected by the API and not stored in the DB.
	Links map[string]string `json:"links,omitempty" gorm:"-"`
}

ChatConversation stores shared chat conversation history

type ChatRating

type ChatRating struct {
	Model

	// Rating is the star rating given by the user (1-5)
	Rating int `json:"rating" gorm:"not null"`

	// ClientID is a unique anonymous identifier
	ClientID uuid.UUID `json:"clientId" gorm:"type:uuid;index"`

	// Metadata contains additional information about the chat session
	// such as message counts, tool calls, LLM thoughts, and interaction size
	Metadata pgtype.JSONB `json:"metadata" gorm:"type:jsonb"`
}

ChatRating stores user feedback ratings for chat interactions

type ClusterData

type ClusterData struct {
	Release               string
	FromRelease           string
	Platform              string
	Architecture          string
	Network               string
	Topology              string
	NetworkStack          string
	CloudRegion           string
	CloudZone             string
	ClusterVersionHistory []string
}

type CommentType

type CommentType int
const (
	CommentTypeRiskAnalysis CommentType = 0
)

type FeatureGate

type FeatureGate struct {
	*Model
	Release     string `gorm:"column:release;not null;primaryKey;index" json:"release"`
	Topology    string `gorm:"column:topology;not null;primaryKey;index" json:"topology"`
	FeatureSet  string `gorm:"column:feature_set;not null;primaryKey;index" json:"feature_set"`
	FeatureGate string `gorm:"column:feature_gate;not null;primaryKey;index" json:"feature_gate"`
	Status      string `gorm:"column:status;not null" json:"status"`
}

FeatureGate maps feature gates to feature sets for a specific release.

feature gate = NetworkSegmentation
feature set  = Default
topology     = SelfManagedHA
release      = 4.19
status       = enabled

type IDName

type IDName struct {
	ID   uint
	Name string `gorm:"unique"`
}

IDName is a partial struct to query limited fields we need for caching. Can be used with any type that has a unique name and an ID we need to lookup. https://gorm.io/docs/advanced_query.html#Smart-Select-Fields

type JiraComponent

type JiraComponent struct {
	Model

	// Name is the name of the component
	Name string

	// Description is the description of the component
	Description string

	// LeadName is the component owner
	LeadName string

	// LeadEmail is the component owner's e-mail
	LeadEmail string
}

type JiraIncident

type JiraIncident struct {
	Model

	// Key is the jira key, i.e. TRT-162
	Key string `json:"key" gorm:"index"`

	// Summary contains a description of the incident
	Summary string `json:"summary"`

	// StartTime is the issue was opened
	StartTime *time.Time `json:"start_time" gorm:"index"`

	// ResolutionTime is the time the issue was resolved
	ResolutionTime *time.Time `json:"resolution_time" gorm:"index"`
}

JiraIncident is an implementation of incident tracking.

type JobRunLabel

type JobRunLabel struct {
	ID         string         `bigquery:"prowjob_build_id"`
	StartTime  civil.DateTime `bigquery:"prowjob_start"`
	Label      string         `bigquery:"label"`
	Comment    string         `bigquery:"comment"`
	User       string         `bigquery:"user"`
	CreatedAt  civil.DateTime `bigquery:"created_at"`
	UpdatedAt  civil.DateTime `bigquery:"updated_at"`
	SourceTool string         `bigquery:"source_tool"`
	SymptomID  string         `bigquery:"symptom_id"`
	URL        string         `bigquery:"-"`
}

JobRunLabel represents a label applied to a job run, stored in BigQuery's job_labels table.

type Model

type Model struct {
	ID        uint           `json:"id" gorm:"primaryKey,column:id"`
	CreatedAt time.Time      `json:"created_at"`
	UpdatedAt time.Time      `json:"updated_at"`
	DeletedAt gorm.DeletedAt `json:"deleted_at" gorm:"index"`
}

Model is similar to gorm.Model, but sends lower snake case JSON, which is what the UI expects.

type OperationType

type OperationType string
const (
	Create OperationType = "CREATE"
	Update OperationType = "UPDATE"
	Delete OperationType = "DELETE"
)

type PayloadFailedTest

type PayloadFailedTest struct {
	ID            uint
	Release       string
	Architecture  string
	Stream        string
	ReleaseTag    string
	TestID        uint
	SuiteID       uint
	Status        int
	Name          string
	ProwJobRunID  uint
	ProwJobRunURL string
	ProwJobName   string
}

type PayloadPhaseCount

type PayloadPhaseCount struct {
	Phase string `gorm:"column:phase"`
	Count int    `gorm:"column:count"`
}

type PayloadStatistics

type PayloadStatistics struct {
	MinSecondsBetween  int64 `json:"min_seconds_between"`
	MeanSecondsBetween int64 `json:"mean_seconds_between"`
	MaxSecondsBetween  int64 `json:"max_seconds_between"`
}

type ProwJob

type ProwJob struct {
	gorm.Model

	Kind        ProwKind
	Name        string         `gorm:"unique"`
	Release     string         `gorm:"varchar(10)"`
	Variants    pq.StringArray `gorm:"type:text[];index:idx_prow_jobs_variants,type:gin"`
	TestGridURL string
	// Bugs maps to all the bugs we scanned and found this prowjob name mentioned in the description or any comment.
	Bugs    []Bug        `gorm:"many2many:bug_jobs;"`
	JobRuns []ProwJobRun `gorm:"constraint:OnDelete:CASCADE;"`
}

ProwJob represents a prow job and stores data about its variants, associated bugs, etc.

type ProwJobRun

type ProwJobRun struct {
	gorm.Model

	// ProwJob is a link to the prow job this run belongs to.
	ProwJob   ProwJob
	ProwJobID uint `gorm:"index"`

	// Cluster is the cluster where the prow job was run.
	Cluster string

	GCSBucket    string
	URL          string
	TestFailures int
	Tests        []ProwJobRunTest  `gorm:"constraint:OnDelete:CASCADE;"`
	PullRequests []ProwPullRequest `gorm:"many2many:prow_job_run_prow_pull_requests;constraint:OnDelete:CASCADE;"`
	Failed       bool
	// InfrastructureFailure is true if the job run failed, for reasons which appear to be related to test/CI infra.
	InfrastructureFailure bool
	// KnownFailure is true if the job run failed, but we found a bug that is likely related already filed.
	KnownFailure  bool
	Succeeded     bool
	Timestamp     time.Time `gorm:"index;index:idx_prow_job_runs_timestamp_date,expression:DATE(timestamp AT TIME ZONE 'UTC')"`
	Duration      time.Duration
	OverallResult v1.JobOverallResult `gorm:"index"`
	// Labels stores the IDs of labels applied to this job run
	// This is populated from symptom detection or manual annotation
	Labels pq.StringArray `gorm:"type:text[];index:idx_prow_job_runs_labels,type:gin" json:"labels"`
	// used to pass the TestCount in via the api, we have the actual tests in the db and can calculate it here so don't persist
	TestCount   int         `gorm:"-"`
	ClusterData ClusterData `gorm:"-"`
}

type ProwJobRunTest

type ProwJobRunTest struct {
	gorm.Model
	ProwJobRunID uint `gorm:"index"`
	ProwJobRun   ProwJobRun
	TestID       uint `gorm:"index"`
	Test         Test
	// SuiteID may be nil if no suite name could be parsed from the testgrid test name.
	SuiteID   *uint `gorm:"index"`
	Suite     Suite
	Status    int `gorm:"index"`
	Duration  float64
	CreatedAt time.Time `gorm:"index"`
	DeletedAt gorm.DeletedAt

	// ProwJobRunTestOutput collect the output of a failed test run. This is stored as a separate object in the DB, so
	// we can keep the test result for a longer period of time than we keep the full failure output.
	ProwJobRunTestOutput *ProwJobRunTestOutput `gorm:"constraint:OnDelete:CASCADE;"`
}

ProwJobRunTest defines a join table linking tests to the job runs they execute in, along with the status for that execution.

type ProwJobRunTestOutput

type ProwJobRunTestOutput struct {
	gorm.Model
	ProwJobRunTestID uint `gorm:"index"`
	// Output stores the output of a ProwJobRunTest.
	Output string
}

type ProwKind

type ProwKind string

type ProwPullRequest

type ProwPullRequest struct {
	Model

	// Org is something like kubernetes or k8s.io
	Org string `json:"org"`
	// Repo is something like test-infra
	Repo string `json:"repo"`

	Number int    `json:"number"`
	Author string `json:"author"`
	Title  string `json:"title,omitempty"`

	// SHA is the specific commit at HEAD.
	SHA string `json:"sha" gorm:"index:pr_link_sha,unique"`
	// Link links to the pull request itself.
	Link string `json:"link,omitempty" gorm:"index:pr_link_sha,unique"`

	// MergedAt contains the time retrieved from GitHub that this PR was merged.
	MergedAt *time.Time `json:"merged_at,omitempty" gorm:"merged_at"`
}

ProwPullRequest represents a GitHub pull request, there can be multiple entries for a pull request, if it was tested with different HEADs (SHA). This lets us track jobs at a more granular level, allowing us to differentiate between code pushes and retests.

type PullRequestComment

type PullRequestComment struct {
	CreatedAt             time.Time
	UpdatedAt             time.Time
	PullNumber            int       `json:"pullNumber" gorm:"primaryKey"`
	CommentType           int       `json:"commentType" gorm:"primaryKey"`
	SHA                   string    `json:"sha" gorm:"primaryKey"`
	Org                   string    `json:"org" gorm:"primaryKey"`
	Repo                  string    `json:"repo" gorm:"primaryKey"`
	ProwJobRoot           string    `json:"prowJobRoot"`
	LastCommentAttempt    time.Time `json:"lastCommentAttempt"`
	FailedCommentAttempts int       `json:"failedCommentAttempts"`
}

PullRequestComment tracks the risk analysis comment lifecycle for a single PR

type ReleaseJobRun

type ReleaseJobRun struct {
	Model

	ReleaseTag     ReleaseTag `json:"release_tag" gorm:"foreignKey:release_tag_id"`
	ReleaseTagID   string     `gorm:"column:release_tag_id"`
	Name           uint       `json:"name" gorm:"column:prow_job_run_id;index:,unique"` // TODO: this could use a rename to ProwJobRunID
	JobName        string     `json:"job_name" gorm:"column:job_name"`
	Kind           string     `json:"kind" gorm:"column:kind"`
	State          string     `json:"state" gorm:"column:state"`
	TransitionTime time.Time  `json:"transition_time"`
	Retries        int        `json:"retries"`
	URL            string     `json:"url" gorm:"column:url"`
	UpgradesFrom   string     `json:"upgrades_from" gorm:"column:upgrades_from"`
	UpgradesTo     string     `json:"upgrades_to" gorm:"column:upgrades_to"`
	Upgrade        bool       `json:"upgrade" gorm:"column:upgrade"`
}

type ReleasePullRequest

type ReleasePullRequest struct {
	Model

	// URL is a link to the pull request.
	URL string `json:"url" gorm:"index:pr_url_name,unique;column:url"`

	// PullRequestID contains the ID of the GitHub pull request.
	PullRequestID string `json:"pull_request_id" gorm:"column:pull_request_id"`

	// Name contains the names as the repository is known in the release payload.
	Name string `json:"name" gorm:"index:pr_url_name,unique;column:name"`

	// Description is the PR description.
	Description string `json:"description" gorm:"column:description"`

	// BugURL links to the bug, if any.
	BugURL string `json:"bug_url" gorm:"column:bug_url"`
}

ReleasePullRequest represents a pull request that was included for the first time in a release payload.

type ReleaseRepository

type ReleaseRepository struct {
	Model

	// Name of the repository, as known by the release payload.
	Name string `json:"name" gorm:"column:name"`

	// ReleaseTag this specific repository ref references.
	ReleaseTag ReleaseTag `gorm:"foreignKey:release_tag_id"`

	// ReleaseTagID foreign key.
	ReleaseTagID string `json:"release_tag" gorm:"column:release_tag_id"`

	// Head is the SHA of the git repo.
	Head string `json:"repository_head" gorm:"column:repository_head"`

	// DiffURL is a link to the git diff.
	DiffURL string `json:"url" gorm:"column:diff_url"`
}

type ReleaseTag

type ReleaseTag struct {
	Model

	// ReleaseTag contains the release version, e.g. 4.8.0-0.nightly-2021-10-28-013428.
	ReleaseTag string `json:"release_tag" gorm:"column:release_tag"`

	// Release contains the release X.Y version, e.g. 4.8
	Release string `json:"release" gorm:"column:release"`

	// Stream contains the payload stream, e.g. nightly or ci.
	Stream string `json:"stream" gorm:"column:stream"`

	// Architecture contains the arch for a release, e.g. amd64
	Architecture string `json:"architecture" gorm:"column:architecture"`

	// Phase contains the overall status of a payload: e.g. Ready, Accepted,
	// Rejected. We do not store Ready payloads in bigquery, as we only want
	// the release after it's "fully baked."
	Phase string `json:"phase" gorm:"column:phase"`

	Forced bool `json:"forced" gorm:"column:forced"`

	// ReleaseTime contains the timestamp of the release (the suffix of the tag, -YYYY-MM-DD-HHMMSS).
	ReleaseTime time.Time `json:"release_time" gorm:"column:release_time"`

	// PreviousReleaseTag contains the previously accepted build, on which any
	// changelog is based from.
	PreviousReleaseTag string `json:"previous_release_tag" gorm:"column:previous_release_tag"`

	// KubernetesVersion contains the kube version for this payload.
	KubernetesVersion string `json:"kubernetes_version" gorm:"column:kubernetes_version"`

	// CurrentOSVersion contains the current machine OS version.
	CurrentOSVersion string `json:"current_os_version" gorm:"current_os_version"`

	// PreviousOSVersion, if any, indicates this release included a machine OS
	// upgrade and this field contains the prior version.
	PreviousOSVersion string `json:"previous_os_version" gorm:"previous_os_version"`

	// CurrentOSURL is a link to the release page for this machine OS version.
	CurrentOSURL string `json:"current_os_url" gorm:"current_os_url"`

	// PreviousOSURL is a link to the release page for the previous machine OS version.
	PreviousOSURL string `json:"previous_os_url" gorm:"previous_os_url"`

	// OSDiffURL is a link to the release page diffing the two OS versions.
	OSDiffURL string `json:"os_diff_url" gorm:"os_diff_url"`

	// ReleasePullRequest contains a list of all the PR's in a release.
	PullRequests []ReleasePullRequest `json:"-" gorm:"many2many:release_tag_pull_requests;constraint:OnDelete:CASCADE;"`

	Repositories []ReleaseRepository `json:"-" gorm:"foreignKey:release_tag_id;constraint:OnDelete:CASCADE;"`

	JobRuns []ReleaseJobRun `json:"-" gorm:"foreignKey:release_tag_id;constraint:OnDelete:CASCADE;"`

	// RejectReason is category of failure for why the payload was rejected. Today this is manually assigned
	// by TRT, and there is no guarantee it will always be set.
	RejectReason string `json:"reject_reason" gorm:"column:reject_reason"`

	// RejectReasonNote is a description from TRT as to why the payload was categorized as it was.
	RejectReasonNote string `json:"reject_reason_note" gorm:"column:reject_reason_note"`

	// RejectReasons represents multiple RejectReasons; the value of RejectReason is the first array element.
	RejectReasons pq.StringArray `json:"reject_reasons" gorm:"type:text[]"`
}

type SchemaHash

type SchemaHash struct {
	gorm.Model

	// Type is "matview", "index", "function".
	Type string `json:"type"`
	// Name of the resource
	Name string `json:"name"`
	// Hash is the SHA256 hash of the string we generate programatically to see if anything
	// has changed since last applied.
	Hash string `json:"hash"`
}

SchemaHash stores a hash of schema we apply programatically in sippy on startup. This is used to manage materialized views, their indicies, and functions that are not a good fit for schema management with goose.

type Suite

type Suite struct {
	gorm.Model
	Name string `gorm:"uniqueIndex"`
}

Suite defines a junit testsuite. Used to differentiate the same test being run in different suites in ProwJobRunTest.

type Test

type Test struct {
	gorm.Model
	Name           string          `gorm:"uniqueIndex"`
	Bugs           []Bug           `gorm:"many2many:bug_tests;"`
	TestOwnerships []TestOwnership `gorm:"constraint:OnDelete:CASCADE;"`
}

type TestAnalysisByJobByDate

type TestAnalysisByJobByDate struct {
	Date     time.Time `gorm:"index:test_release_date,unique"`
	TestID   uint      `gorm:"index:test_release_date,unique"`
	Release  string    `gorm:"index:test_release_date,unique"`
	JobName  string    `gorm:"index:test_release_date,unique"`
	TestName string
	Runs     int
	Passes   int
	Flakes   int
	Failures int
}

type TestOwnership

type TestOwnership struct {
	Model

	// APIVersion specifies the schema version, in case we ever need to make
	// changes to the bigquery table that are not simple column additions.
	APIVersion string `bigquery:"apiVersion"`

	// Kind is a string value representing the resource this object represents.
	Kind string `bigquery:"kind"`

	// UniqueID is a stable name for the test. This should hold the oldest name
	// of the test, which allows us to make comparisons even when the test
	// name has changed.
	UniqueID string `bigquery:"id"`

	// Name is the current name for the test.
	Name string `bigquery:"name" gorm:"uniqueIndex:idx_name_suite"`

	// TestID is the ID of the test in Sippy's database.
	TestID uint `gorm:"index"`

	// Suite is the name for the junit test suite, if any.  Generally leave this blank, and we'll
	// fill it in from the supplied TestInfo.
	Suite string `bigquery:"suite" gorm:"uniqueIndex:idx_name_suite"`

	// SuiteID is the ID of the suite in Sippy's database.
	SuiteID *uint `gorm:"index"`

	// Product is the layer product name, to support the possibility of multiple
	// component readiness dashboards. Generally leave this blank.
	Product string `bigquery:"product"`

	// Priority allows the ability to take priority on a test's ownership. If
	// two components are vying for a test's ownership and one wants to force
	// the matter, you may use a higher priority value (default: 0). The highest
	// value wins.
	Priority int `bigquery:"priority"`

	// StaffApprovedObsolete controls removal of tests.  If tests are removed but was
	// previously assigned to a component without this flag being set, then the component
	// readiness dashboard will show this as a problem. This should always be false, unless
	// a staff engineer approves returning true.
	StaffApprovedObsolete bool `bigquery:"staff_approved_obsolete"`

	// Component is the principal owner of a test. It should map directly to a JIRA bug component.
	// A test should only have one component owner, see above about the priority flag when contention
	// for ownership of a test arises.
	Component string `bigquery:"component"`

	// Capabilities are the particular capability a test is testing.  A test may map to multiple
	// capabilities. For example, a networking test could belong to OVN, IPv6, and EndpointSlices capabilities.
	Capabilities pq.StringArray `json:"capabilities" gorm:"type:text[]"`

	// JiraComponent specifies the JIRA component that this test belongs to.
	JiraComponent string `bigquery:"jira_component"`

	// JiraComponent specifies the JIRA component that this test belongs to.
	JiraComponentID *uint `gorm:"index"`
}

type TestRegression

type TestRegression struct {
	ID      uint   `json:"id" gorm:"primaryKey,column:id"`
	View    string `json:"view" gorm:"not null"`
	Release string `json:"release" gorm:"not null;index:idx_test_regression_release"`
	// BaseRelease is the release this test was marked regressed against. It may not match the view's base release
	// if the view uses release fallback and this test was flagged regressed against a prior release with better pass rate.
	BaseRelease string         `json:"base_release"`
	Component   string         `json:"component"`
	Capability  string         `json:"capability"`
	TestID      string         `json:"test_id" gorm:"not null"`
	TestName    string         `json:"test_name" gorm:"not null;index:idx_test_regression_test_name"`
	Variants    pq.StringArray `json:"variants" gorm:"not null;type:text[]"`
	Opened      time.Time      `json:"opened" gorm:"not null"`
	Closed      sql.NullTime   `json:"closed"`
	Triages     []Triage       `json:"triages" gorm:"many2many:triage_regressions;"`
	// LastFailure is the last failure in the sample we saw while this regression was open.
	LastFailure sql.NullTime `json:"last_failure"`
	// MaxFailures is the maximum number of failures we found in the reporting window while this regression was open.
	// This is intended to help inform the min fail thresholds we should be using, and what kind of regressions
	// disappear on their own.
	MaxFailures int `json:"max_failures"`

	// Links contains HATEOAS-style links for this regression record (not stored in database)
	Links map[string]string `json:"links,omitempty" gorm:"-"`
}

TestRegression is used for rows in the test_regressions table and is used to track when we detect test regressions opening and closing.

type Triage

type Triage struct {
	ID        uint      `json:"id" gorm:"primarykey"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`

	// URL references the core URL to follow for details on this triage, typically a Jira bug.
	URL string `json:"url" gorm:"not null"`

	// Description contains a short description regarding the URL
	Description string `json:"description,omitempty"`

	// Type provides information about the type of regression being triaged, a best guess by the
	// individual performing triage.
	Type TriageType `json:"type" gorm:"not null"`

	// Bug is populated if and when we have a URL for a valid Jira imported into our db.
	// Because a user may link a URL that is not yet in sippy's db, we need to differentiate
	// between the two. During bug import we explicitly bring in any triaged bugs we can find.
	// Once imported, useful data is available for the triage via this reference.
	Bug   *Bug  `json:"bug,omitempty"`
	BugID *uint `json:"bug_id,omitempty"`

	// Links contains REST links for clients to follow for this specific triage. Most notably "self".
	// These are injected by the API and not stored in the DB.
	Links map[string]string `json:"links" gorm:"-"`

	// Regressions ties this triage record to specific component readiness test regressions.
	// Triage will often tie to regressions, often multiple (as regressions are broken out by variant / suite),
	// but it may also be empty in
	// cases where we're mass triaging something that has not surfaced in component readiness.
	// TODO: still not sure about this, it feels like there would always be at least one...
	// otherwise what are we triaging? We might later map to job runs that are not associated with
	// any regression, but this would be fine...
	// If we could establish this, it may mean less data duplication.
	Regressions []TestRegression `json:"regressions" gorm:"constraint:OnDelete:CASCADE;many2many:triage_regressions;"`

	// Resolution is an important field presently set by a user indicating a claimed time this issue was resolved,
	// and thus all associated regressions should be fixed.
	// Setting this will immediately change the regressions icon to one indicate the issue is believed to
	// be fixed. If we see failures beyond the resolved time, you will see another icon to highlight this situation.
	Resolved sql.NullTime `json:"resolved"`

	// ResolutionReason details the cause of the triage being resolved. It will be set by the system, and not be editable
	// by the user. If the triage is resolved multiple times, this will store the latest reason
	ResolutionReason resolutionReason `json:"resolution_reason"`
}

Triage contains data tying failures or regressions to specific bugs.

func (*Triage) AfterCreate

func (t *Triage) AfterCreate(db *gorm.DB) error

func (*Triage) AfterDelete

func (t *Triage) AfterDelete(db *gorm.DB) error

func (*Triage) AfterUpdate

func (t *Triage) AfterUpdate(db *gorm.DB) error

func (*Triage) BeforeDelete

func (t *Triage) BeforeDelete(db *gorm.DB) error

func (*Triage) BeforeUpdate

func (t *Triage) BeforeUpdate(db *gorm.DB) error

type TriageType

type TriageType string
const (
	// TriageTypeCIInfra is used for CI infra problems that did not impact actual customers. (build cluster outages
	// cloud account problems, etc.)
	TriageTypeCIInfra TriageType = "ci-infra"
	// TriageTypeProductInfra is used for infrastructure problems that impacted CI but also would have hit customers.
	// (registry outages/caching issues, etc)
	TriageTypeProductInfra TriageType = "product-infra"
	// TriageProduct is used for actual product regressions.
	TriageTypeProduct TriageType = "product"
	// TriageTest is used for regressions isolated to the test framework where no product fix is actually required.
	TriageTypeTest TriageType = "test"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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