models

package
v0.0.0-...-2faba83 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ReleasePresubmits = "Presubmits"

	CapComponentReadiness = "componentReadiness"
	CapSippyClassic       = "sippyClassic"
	CapMetrics            = "metrics"
	CapPullRequests       = "pullRequests"
	CapFeatureGates       = "featureGates"
	CapPayloadTags        = "payloadTags"
)
View Source
const (
	User                 resolutionReason = "user"
	RegressionsRolledOff resolutionReason = "regressions-rolled-off"
	JiraProgression      resolutionReason = "jira-progression"
)
View Source
const (
	ColResolved         = "resolved"
	ColResolutionReason = "resolution_reason"
)
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 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 ProwGARawTestDatum

type ProwGARawTestDatum struct {
	Release    string `gorm:"not null;index:idx_prow_ga_raw_release_window"`
	WindowDays int    `gorm:"not null;default:30;index:idx_prow_ga_raw_release_window"`
	TestID     uint   `gorm:"not null"`
	ProwJobID  uint   `gorm:"not null"`
	SuiteID    uint   `gorm:"not null;default:0"`
	Passes     int64  `gorm:"not null;default:0"`
	Failures   int64  `gorm:"not null;default:0"`
	Flakes     int64  `gorm:"not null;default:0"`
	Runs       int64  `gorm:"not null;default:0"`
}

ProwGARawTestDatum stores raw BigQuery test results for GA release windows. Fetched once per GA date and persisted for query-time aggregation. Each (release, window_days) pair holds results aggregated over a different lookback period (e.g. 1, 30, or 90 days before GA).

type ProwJob

type ProwJob struct {
	gorm.Model

	Kind     ProwKind
	Name     string         `gorm:"unique"`
	Release  string         `gorm:"index"`
	Variants pq.StringArray `gorm:"type:text[]"`
	// VariantCombinationID references variant_combinations.id, maintained by a
	// BEFORE INSERT/UPDATE trigger. NULL only when Variants is NULL.
	VariantCombinationID *uint `gorm:"column:variant_combination_id"`
	VariantCombination   *VariantCombination
	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
}

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"`
	// LIST partition key (denormalized from prow_jobs.release)
	ProwJobRelease string `gorm:"primaryKey;index:idx_prow_job_runs_release_timestamp"`

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

	GCSBucket    string
	URL          string
	TestFailures int
	TestFlakes   int                    `gorm:"not null;default:0"`
	Tests        []ProwJobRunTest       `gorm:"foreignKey:ProwJobRunID,ProwJobRunRelease,ProwJobRunTimestamp;references:ID,ProwJobRelease,Timestamp"`
	PullRequests []ProwPullRequest      `` /* 147-byte string literal not displayed */
	Annotations  []ProwJobRunAnnotation `gorm:"foreignKey:ProwJobRunID,ProwJobRunRelease,ProwJobRunTimestamp;references:ID,ProwJobRelease,Timestamp"`
	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
	// RANGE partition key
	Timestamp     time.Time `gorm:"primaryKey;index;index:idx_prow_job_runs_release_timestamp"`
	Duration      time.Duration
	OverallResult v1.JobOverallResult
	Labels        pq.StringArray `gorm:"type:text[]" 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:"-"`
	DeletedAt   gorm.DeletedAt
}

ProwJobRun represents a single execution of a ProwJob. Table is partitioned (LIST by prow_job_release, RANGE by timestamp) - schema managed by migration 000001, not AutoMigrate.

type ProwJobRunAnnotation

type ProwJobRunAnnotation struct {
	gorm.Model
	ProwJobRunID        uint   `gorm:"uniqueIndex:idx_prow_job_run_annotations_key"`
	Key                 string `gorm:"uniqueIndex:idx_prow_job_run_annotations_key"`
	Value               string
	ProwJobRunRelease   string    `gorm:"primaryKey;uniqueIndex:idx_prow_job_run_annotations_key;index:idx_prow_job_run_annotations_release_timestamp"`
	ProwJobRunTimestamp time.Time `gorm:"primaryKey;uniqueIndex:idx_prow_job_run_annotations_key;index:idx_prow_job_run_annotations_release_timestamp"`
	DeletedAt           gorm.DeletedAt
}

ProwJobRunAnnotation stores a single key-value annotation for a ProwJobRun. Table is partitioned (LIST by prow_job_run_release, RANGE by prow_job_run_timestamp) - schema managed by migration 000001, not AutoMigrate.

type ProwJobRunIDMap

type ProwJobRunIDMap struct {
	ID             uint      `gorm:"primaryKey"`
	ProwJobRelease string    `gorm:"not null"`
	Timestamp      time.Time `gorm:"not null"`
}

ProwJobRunIDMap maps a Prow build ID to the partition keys for prow_job_runs. Populated on ingest via pgwriter; used for partition-pruned lookups after prow_job_runs is partitioned (see docs/plans/trt-2709-job-run-id-mapping.md).

func (ProwJobRunIDMap) TableName

func (ProwJobRunIDMap) TableName() string

TableName overrides GORM's default pluralization, which would use prow_job_run_id_maps.

type ProwJobRunProwPullRequest

type ProwJobRunProwPullRequest struct {
	ProwJobRunID        uint      `gorm:"primaryKey"`
	ProwPullRequestID   uint      `gorm:"primaryKey;index:idx_prow_job_run_prow_pull_requests_prow_pull_request_id"`
	ProwJobRunRelease   string    `gorm:"primaryKey;index:idx_prow_job_run_prow_pull_requests_release_timestamp"`
	ProwJobRunTimestamp time.Time `gorm:"primaryKey;index:idx_prow_job_run_prow_pull_requests_release_timestamp"`
}

ProwJobRunProwPullRequest is the explicit join table for the many-to-many relationship between ProwJobRun and ProwPullRequest. Table is partitioned (LIST by prow_job_run_release, RANGE by prow_job_run_timestamp) - schema managed by migration 000001, not AutoMigrate.

type ProwJobRunTest

type ProwJobRunTest struct {
	gorm.Model
	ProwJobRunID uint
	ProwJobRun   ProwJobRun `gorm:"foreignKey:ProwJobRunID,ProwJobRunRelease,ProwJobRunTimestamp;references:ID,ProwJobRelease,Timestamp"`
	// used for variants
	// skips joining on ProwJobRunID just to get ProwJobID
	ProwJobID uint
	// used for partitioning - must be in primary key for RANGE partitioning
	ProwJobRunTimestamp time.Time `gorm:"primaryKey"`
	// denormalized for query optimization and LIST partitioning
	ProwJobRunRelease string `gorm:"primaryKey"`
	TestID            uint
	Test              Test
	// SuiteID may be nil if no suite name could be parsed from the testgrid test name.
	SuiteID   *uint
	Suite     Suite
	Status    int
	Duration  float64
	Lifecycle string `gorm:"default:blocking"`
	CreatedAt time.Time
	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.
	// No FK constraint - both tables partitioned, FK managed by migration
	// Relationship uses composite key (id, timestamp, release) to match partitioned table structure
	ProwJobRunTestOutput *ProwJobRunTestOutput `` /* 132-byte string literal not displayed */
}

ProwJobRunTest defines a join table linking tests to the job runs they execute in, along with the status for that execution. Table is partitioned (LIST→RANGE) - schema managed by migration 000002, not AutoMigrate

type ProwJobRunTestOutput

type ProwJobRunTestOutput struct {
	gorm.Model
	ProwJobRunTestID uint
	// Output stores the output of a ProwJobRunTest.
	Output string
	// Denormalized from parent for composite foreign key and partitioning
	// primaryKey required for RANGE partitioning
	ProwJobRunTestTimestamp time.Time `gorm:"primaryKey"`
	// Denormalized for query optimization and LIST partitioning
	ProwJobRunTestRelease string `gorm:"primaryKey"`
}

ProwJobRunTestOutput stores test failure output. Table is partitioned (LIST→RANGE) - schema managed by migration 000002, not AutoMigrate

type ProwKind

type ProwKind string

type ProwPullRequest

type ProwPullRequest struct {
	Model

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

	Number int    `json:"number" gorm:"index:idx_prow_pull_requests_org_repo_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 RegressionJobRun

type RegressionJobRun struct {
	ID           uint           `json:"id" gorm:"primaryKey"`
	RegressionID uint           `json:"regression_id" gorm:"column:regression_id;not null;uniqueIndex:idx_regression_job_run"`
	ProwJobRunID string         `json:"prowjob_run_id" gorm:"column:prow_job_run_id;not null;uniqueIndex:idx_regression_job_run"`
	ProwJobName  string         `json:"prowjob_name" gorm:"column:prow_job_name;not null"`
	ProwJobURL   string         `json:"prowjob_url" gorm:"column:prow_job_url"`
	StartTime    time.Time      `json:"start_time" gorm:"column:start_time"`
	TestFailed   bool           `json:"test_failed" gorm:"column:test_failed"`
	TestFailures int            `json:"test_failures" gorm:"column:test_failures"`
	JobLabels    pq.StringArray `json:"job_labels,omitempty" gorm:"column:job_labels;type:text[]"`
}

RegressionJobRun represents a single job run observed during the lifetime of a regression. It stores report data so the run remains available even if its source row is absent later.

type RegressionView

type RegressionView struct {
	TestRegressionID uint         `json:"test_regression_id" gorm:"primaryKey"`
	ViewName         string       `json:"view_name" gorm:"primaryKey"`
	Active           bool         `json:"active" gorm:"not null;default:true"`
	OpenedAt         time.Time    `json:"opened_at" gorm:"not null;default:now()"`
	ClosedAt         sql.NullTime `json:"closed_at"`
}

RegressionView associates a regression with a component readiness view. The Active flag tracks whether the regression currently appears in the view's component report.

type ReleaseDefinition

type ReleaseDefinition struct {
	Model

	Release              string         `json:"release" gorm:"uniqueIndex;column:release"`
	Major                int            `json:"major" gorm:"column:major"`
	Minor                int            `json:"minor" gorm:"column:minor"`
	Patch                *int           `json:"patch,omitempty" gorm:"column:patch"`
	PreviousRelease      string         `json:"previous_release" gorm:"column:previous_release"`
	GADate               *civil.Date    `json:"ga_date,omitempty" gorm:"column:ga_date;type:date"`
	LoadedGADate         *civil.Date    `json:"loaded_ga_date,omitempty" gorm:"column:ga_data_loaded_date;type:date"`
	DevelopmentStartDate *civil.Date    `json:"development_start_date" gorm:"column:development_start_date;type:date"`
	Product              string         `json:"product" gorm:"column:product"`
	Status               string         `json:"status" gorm:"column:status"`
	Capabilities         pq.StringArray `json:"capabilities" gorm:"type:text[];column:capabilities"`
}

ReleaseDefinition stores release metadata synced from BigQuery's Releases table. This is distinct from ReleaseTag, which tracks individual payload tags.

func (*ReleaseDefinition) HasCapability

func (rd *ReleaseDefinition) HasCapability(capability string) bool

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"`
	Labels         pq.StringArray `gorm:"type:text[];index:idx_release_job_runs_labels,type:gin" json:"labels"`
}

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 TestCumulativeSummary

type TestCumulativeSummary struct {
	Release              string     `gorm:"column:release;not null;uniqueIndex:idx_test_cumulative_summaries_key,priority:1"`
	Date                 civil.Date `gorm:"column:date;type:date;not null;uniqueIndex:idx_test_cumulative_summaries_key,priority:2"`
	TestID               uint       `gorm:"column:test_id;not null;uniqueIndex:idx_test_cumulative_summaries_key,priority:3"`
	SuiteID              uint       `gorm:"column:suite_id;not null;default:0;uniqueIndex:idx_test_cumulative_summaries_key,priority:4"`
	Lifecycle            string     `gorm:"column:lifecycle;not null;default:blocking;uniqueIndex:idx_test_cumulative_summaries_key,priority:5"`
	ProwJobID            uint       `` /* 139-byte string literal not displayed */
	PrefixSumSuccesses   int64      `gorm:"column:prefix_sum_successes;not null;default:0"`
	PrefixSumFailures    int64      `gorm:"column:prefix_sum_failures;not null;default:0"`
	PrefixSumFlakes      int64      `gorm:"column:prefix_sum_flakes;not null;default:0"`
	PrefixSumRuns        int64      `gorm:"column:prefix_sum_runs;not null;default:0"`
	PrefixMaxLastFailure *time.Time `gorm:"column:prefix_max_last_failure"`
	PrefixMaxLastSuccess *time.Time `gorm:"column:prefix_max_last_success"`
}

TestCumulativeSummary stores running totals of test_daily_totals values, ordered by date. Any date range [start, end] can be computed as cumulative(end) - cumulative(start-1). Keyed by immutable fields only (no variant_combination_id) so variant changes do not invalidate the data. Entities are carried forward on days with no data so the chain is unbroken. Table is partitioned (LIST by release, RANGE by date) - schema managed by migration 000006, not AutoMigrate.

type TestDailyTotal

type TestDailyTotal struct {
	Release               string     `gorm:"column:release;not null;uniqueIndex:idx_test_daily_totals_key,priority:1"`
	Date                  civil.Date `gorm:"column:date;type:date;not null;uniqueIndex:idx_test_daily_totals_key,priority:2"`
	TestID                uint       `gorm:"column:test_id;not null;uniqueIndex:idx_test_daily_totals_key,priority:3"`
	SuiteID               uint       `gorm:"column:suite_id;not null;default:0;uniqueIndex:idx_test_daily_totals_key,priority:4"`
	Lifecycle             string     `gorm:"column:lifecycle;not null;default:blocking;uniqueIndex:idx_test_daily_totals_key,priority:5"`
	ProwJobID             uint       `gorm:"column:prow_job_id;not null;uniqueIndex:idx_test_daily_totals_key,priority:6"`
	Successes             int32      `gorm:"column:successes;not null;default:0"`
	Failures              int32      `gorm:"column:failures;not null;default:0"`
	Flakes                int32      `gorm:"column:flakes;not null;default:0"`
	Runs                  int32      `gorm:"column:runs;not null;default:0"`
	FirstFailureTimestamp *time.Time `gorm:"column:first_failure_timestamp"`
	LastFailureTimestamp  *time.Time `gorm:"column:last_failure_timestamp"`
	FirstSuccessTimestamp *time.Time `gorm:"column:first_success_timestamp"`
	LastSuccessTimestamp  *time.Time `gorm:"column:last_success_timestamp"`
}

TestDailyTotal stores pre-aggregated daily test results. Table is partitioned (LIST by release, RANGE by date) - schema managed by migration 000006, not AutoMigrate.

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"`
	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"`
	CrossCompare bool           `json:"cross_compare" gorm:"not null;default:false"`
	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"`

	// ForceClosed indicates this regression was force closed via a resolved triage. Force closed regressions
	// are excluded from the regression reuse window (regressionHysteresisDays) so they are not reopened for
	// unrelated failures (TRT-2895). All force close metadata is stored directly on the regression so the
	// record is self-contained and needs no join back to the triage.
	ForceClosed bool `json:"force_closed" gorm:"not null;default:false"`

	// ForceClosedBy records the user who force closed this regression. It is nil when the regression
	// was not force closed (NULL means not applicable).
	ForceClosedBy *string `json:"force_closed_by"`

	// ForceClosedReason records the user supplied reason for force closing this regression. It is nil
	// when the regression was not force closed (NULL means not applicable).
	ForceClosedReason *string `json:"force_closed_reason"`

	// ForceClosedByTriageID references the triage whose resolution drove the force close, if any.
	ForceClosedByTriageID *uint `json:"force_closed_by_triage_id"`

	// JobRuns accumulates the unique set of all job runs ever observed while this regression was open.
	// As the 7-day sample window slides, old runs roll off and new ones appear, but this list retains all of them.
	JobRuns []RegressionJobRun `json:"job_runs,omitempty" gorm:"foreignKey:RegressionID;constraint:OnDelete:CASCADE;"`

	// Views tracks which component readiness views this regression has been observed in.
	Views []RegressionView `json:"views,omitempty" gorm:"foreignKey:TestRegressionID;constraint:OnDelete:CASCADE;"`

	// 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"
)

type VariantCombination

type VariantCombination struct {
	ID       uint           `gorm:"primaryKey"`
	Variants pq.StringArray `gorm:"type:text[];uniqueIndex:idx_variant_combinations_variants;not null"`
}

VariantCombination assigns an integer ID to each unique variants array, enabling efficient GROUP BY in matviews. Populated via a trigger on prow_jobs.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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