From dfce4a517db03fbd9bd29560bfb17b7ecfeccda2 Mon Sep 17 00:00:00 2001 From: Denys Fedoryshchenko Date: Mon, 30 Jun 2025 16:23:46 +0300 Subject: pkg/kcidb: upgrade submission schema to v5.3 Upgrading KCIDB schema, as old versions going to be deprecated soon. Ref: https://github.com/kernelci/kcidb-io/tree/main/kcidb_io/schema Signed-off-by: Denys Fedoryshchenko --- pkg/kcidb/client.go | 22 ++-- pkg/kcidb/schema.go | 348 +++++++++++++++++++++++++++++++++++----------------- 2 files changed, 248 insertions(+), 122 deletions(-) (limited to 'pkg') diff --git a/pkg/kcidb/client.go b/pkg/kcidb/client.go index 687386f37..c733aa910 100644 --- a/pkg/kcidb/client.go +++ b/pkg/kcidb/client.go @@ -90,19 +90,18 @@ func kcidbValidate(data []byte) error { func (c *Client) convert(target *targets.Target, bug *dashapi.BugReport) *Kcidb { res := &Kcidb{ Version: &Version{ - Major: 3, - Minor: 0, + Major: 5, + Minor: 3, }, - Revisions: []*Revision{ + Checkouts: []*Checkout{ { Origin: c.origin, - ID: bug.KernelCommit, + ID: c.extID(bug.KernelCommit), GitRepositoryURL: normalizeRepo(bug.KernelRepo), GitCommitHash: bug.KernelCommit, GitRepositoryBranch: bug.KernelBranch, - Description: bug.KernelCommitTitle, - PublishingTime: bug.KernelCommitDate.Format(time.RFC3339), - DiscoveryTime: bug.BuildTime.Format(time.RFC3339), + Comment: bug.KernelCommitTitle, + StartTime: bug.BuildTime.Format(time.RFC3339), Valid: true, }, }, @@ -110,18 +109,18 @@ func (c *Client) convert(target *targets.Target, bug *dashapi.BugReport) *Kcidb { Origin: c.origin, ID: c.extID(bug.BuildID), - RevisionID: bug.KernelCommit, + CheckoutID: c.extID(bug.KernelCommit), Architecture: target.KernelArch, Compiler: bug.CompilerID, StartTime: bug.BuildTime.Format(time.RFC3339), ConfigURL: bug.KernelConfigLink, - Valid: true, + Status: "PASS", }, }, } if strings.Contains(bug.Title, "build error") { build := res.Builds[0] - build.Valid = false + build.Status = "FAIL" build.LogURL = bug.LogLink build.Misc = &BuildMisc{ OriginURL: bug.Link, @@ -156,9 +155,8 @@ func (c *Client) convert(target *targets.Target, bug *dashapi.BugReport) *Kcidb Path: "syzkaller", StartTime: bug.CrashTime.Format(time.RFC3339), OutputFiles: outputFiles, - Description: bug.Title, + Comment: bug.Title, Status: "FAIL", - Waived: false, Misc: &TestMisc{ OriginURL: bug.Link, ReportedBy: bug.CreditEmail, diff --git a/pkg/kcidb/schema.go b/pkg/kcidb/schema.go index 1d4549f2f..4bce84637 100644 --- a/pkg/kcidb/schema.go +++ b/pkg/kcidb/schema.go @@ -24,14 +24,40 @@ package kcidb // Extra free-form data can be stored under "misc" fields associated with various objects throughout the schema, // if necessary. That data could later be used as the basis for defining new properties to house it. type Kcidb struct { - Revisions []*Revision `json:"revisions,omitempty"` + Checkouts []*Checkout `json:"checkouts,omitempty"` Builds []*Build `json:"builds,omitempty"` Tests []*Test `json:"tests,omitempty"` + Issues []*Issue `json:"issues,omitempty"` + Incidents []*Incident `json:"incidents,omitempty"` Version *Version `json:"version"` } -// A build of a revision. +// A build of a checkout. type Build struct { + // The last time the build was updated in the database. + Timestamp string `json:"_timestamp,omitempty"` + + // ID of the built source code checkout. The checkout must be valid for the build to be considered valid. + CheckoutID string `json:"checkout_id"` + + // Build ID. + // Must start with a non-empty string identifying the CI system which submitted the build, + // followed by a colon ':' character. The rest of the string is generated by the origin CI system, + // and must identify the build uniquely among all builds, coming from that CI system. + ID string `json:"id"` + + // The name of the CI system which submitted the build. + Origin string `json:"origin"` + + // A human-readable comment regarding the build. + Comment string `json:"comment,omitempty"` + + // The time the build was started. + StartTime string `json:"start_time,omitempty"` + + // The number of seconds it took to complete the build. + Duration float64 `json:"duration,omitempty"` + // Target architecture of the build. Architecture string `json:"architecture,omitempty"` @@ -41,47 +67,29 @@ type Build struct { // Name and version of the compiler used to make the build. Compiler string `json:"compiler,omitempty"` + // A list of build input files. E.g. configuration. + InputFiles []*Resource `json:"input_files,omitempty"` + + // A list of build output files: images, packages, etc. + OutputFiles []*Resource `json:"output_files,omitempty"` + // A name describing the build configuration options. ConfigName string `json:"config_name,omitempty"` // The URL of the build configuration file. ConfigURL string `json:"config_url,omitempty"` - // Human-readable description of the build. - Description string `json:"description,omitempty"` - - // The number of seconds it took to complete the build. - Duration float64 `json:"duration,omitempty"` - - // Build ID. - // Must start with a non-empty string identifying the CI system which submitted the build, - // followed by a colon ':' character. The rest of the string is generated by the origin CI system, - // and must identify the build uniquely among all builds, coming from that CI system. - ID string `json:"id"` + // The URL of the plain-text build log file. + LogURL string `json:"log_url,omitempty"` - // A list of build input files. E.g. configuration. - InputFiles []*Resource `json:"input_files,omitempty"` + // A part of the build log most relevant to its outcome. + LogExcerpt string `json:"log_excerpt,omitempty"` - // The URL of the build log file. - LogURL string `json:"log_url,omitempty"` + // Build status: FAIL, ERROR, MISS, PASS, DONE, or SKIP. + Status string `json:"status,omitempty"` // Miscellaneous extra data about the build. Misc *BuildMisc `json:"misc,omitempty"` - - // The name of the CI system which submitted the build. - Origin string `json:"origin"` - - // A list of build output files: images, packages, etc. - OutputFiles []*Resource `json:"output_files,omitempty"` - - // ID of the built revision. The revision must be valid for the build to be considered valid. - RevisionID string `json:"revision_id"` - - // The time the build was started. - StartTime string `json:"start_time,omitempty"` - - // True if the build is valid, i.e. if it could be completed. - Valid bool `json:"valid"` } // Miscellaneous extra data about the build. @@ -93,8 +101,11 @@ type BuildMisc struct { // The environment the test ran in. E.g. a host, a set of hosts, or a lab; // amount of memory/storage/CPUs, for each host; process environment variables, etc. type Environment struct { - // Human-readable description of the environment. - Description string `json:"description,omitempty"` + // The values from the root-level 'compatible' property of the system's device tree. + Compatible []string `json:"compatible,omitempty"` + + // Human-readable comment of the environment. + Comment string `json:"comment,omitempty"` // Miscellaneous extra data about the environment. Misc *EnvironmentMisc `json:"misc,omitempty"` @@ -104,73 +115,86 @@ type Environment struct { type EnvironmentMisc struct { } -// A revision of the tested code. +// A checkout of the tested code. // // Represents a way the tested source code could be obtained. E.g. checking out a particular commit from a git repo, // and applying a set of patches on top. -type Revision struct { - // List of e-mail addresses of contacts concerned with this revision, such as authors, reviewers, and mail lists. - Contacts []string `json:"contacts,omitempty"` +type Checkout struct { + // The last time the checkout was updated in the database. + Timestamp string `json:"_timestamp,omitempty"` + + // Source code checkout ID. + // Must start with a non-empty string identifying the CI system which submitted the checkout, + // followed by a colon ':' character. The rest of the string is generated by the origin CI system, + // and must identify the checkout uniquely among all checkouts, coming from that CI system. + ID string `json:"id"` + + // The name of the CI system which submitted the checkout. + Origin string `json:"origin"` - // Human-readable description of the revision. E.g. a release version, or the subject of a patchset message. - Description string `json:"description,omitempty"` + // The widely-recognized name of the sub-tree (fork) of the main code tree where the checked out + // base source code came from. + TreeName string `json:"tree_name,omitempty"` - // The time the revision was discovered by the CI system. E.g. the time the CI system found a patch message, - // or noticed a new commit or a new tag in a git repo. - DiscoveryTime string `json:"discovery_time,omitempty"` + // The URL of the Git repository which contains the base code of the checkout. The shortest possible https:// URL. + GitRepositoryURL string `json:"git_repository_url,omitempty"` - // The full commit hash of the revision's base code. + // The full commit hash of the checked out base source code. GitCommitHash string `json:"git_commit_hash,omitempty"` - // A human-readable name of the commit containing the base code of the revision, - // as would be output by "git describe", at the discovery time. + // A human-readable name of the commit containing the checked out base source code, as would be + // output by "git describe", at the checkout time. GitCommitName string `json:"git_commit_name,omitempty"` - // The Git repository branch in which the commit with the revision's base code was discovered. + // The list of (annotated) tags, found in the repository, pointing directly at the checked out commit. + GitCommitTags []string `json:"git_commit_tags,omitempty"` + + // The complete message of the commit being checked out, both the subject and the body. + GitCommitMessage string `json:"git_commit_message,omitempty"` + + // The Git repository branch from which the commit with the base source code was checked out. GitRepositoryBranch string `json:"git_repository_branch,omitempty"` - // The URL of the Git repository which contains the base code of the revision. - // The shortest possible https:// URL, or, if that's not available, the shortest possible git:// URL. - GitRepositoryURL string `json:"git_repository_url,omitempty"` + // Whether the checked out commit was at the tip of the specified branch at checkout time. + GitRepositoryBranchTip bool `json:"git_repository_branch_tip,omitempty"` - // Revision ID. - // - // Must contain the full commit hash of the revision's base code in the Git repository. - // - // If the revision had patches applied to the base code, the commit hash should be followed by the '+' - // character and a sha256 hash over newline-terminated sha256 hashes of each applied patch, in order. - // E.g. generated with this shell command: "sha256sum *.patch | cut -c-64 | sha256sum | cut -c-64". - ID string `json:"id"` + // List of patch files applied to the checked out base source code, in order of application. + PatchsetFiles []*Resource `json:"patchset_files,omitempty"` - // The URL of the log file of the attempt to construct this revision from its parts. E.g. 'git am' output. - LogURL string `json:"log_url,omitempty"` + // The patchset hash. Empty if no patches were applied. + PatchsetHash string `json:"patchset_hash,omitempty"` - // The value of the Message-ID header of the e-mail message introducing this code revision, - // if any. E.g. a message with the revision's patchset, or a release announcement sent to a maillist. + // The value of the Message-ID header of the e-mail message introducing the checkout, if any. MessageID string `json:"message_id,omitempty"` - // Miscellaneous extra data about the revision. - Misc *RevisionMisc `json:"misc,omitempty"` + // A human-readable comment regarding the checkout. E.g. the checked out release version. + Comment string `json:"comment,omitempty"` - // The name of the CI system which submitted the revision. - Origin string `json:"origin"` + // The time the checkout was started. + StartTime string `json:"start_time,omitempty"` - // List of mboxes containing patches applied to the base code of the revision, in order of application. - PatchMboxes []*Resource `json:"patch_mboxes,omitempty"` + // The time the checkout origin finished all planned builds for it. + OriginBuildsFinishTime string `json:"origin_builds_finish_time,omitempty"` - // The time the revision was made public. E.g. the timestamp on a patch message, a commit, or a tag. - PublishingTime string `json:"publishing_time,omitempty"` + // The time the checkout origin finished all planned tests for it. + OriginTestsFinishTime string `json:"origin_tests_finish_time,omitempty"` - // The widely-recognized name of the sub-tree (fork) of the main code tree that the revision belongs to. - TreeName string `json:"tree_name,omitempty"` + // The URL of a plain-text log file of the checkout attempt. E.g. 'git am' output. + LogURL string `json:"log_url,omitempty"` - // True if the revision is valid, i.e. if its parts could be combined. - // False if not, e.g. if its patches failed to apply. - Valid bool `json:"valid"` + // A part of the checkout log most relevant to its outcome. + LogExcerpt string `json:"log_excerpt,omitempty"` + + // True if the checkout succeeded, i.e. if the source code parts could be combined. + // False if not, e.g. if the patches failed to apply. + Valid bool `json:"valid,omitempty"` + + // Miscellaneous extra data about the checkout. + Misc *CheckoutMisc `json:"misc,omitempty"` } -// Miscellaneous extra data about the revision. -type RevisionMisc struct { +// Miscellaneous extra data about the checkout. +type CheckoutMisc struct { } // A test run against a build. @@ -182,60 +206,72 @@ type RevisionMisc struct { // which could identify a specific test within a test suite (e.g. "LTPlite.sem01"), a whole test suite // (e.g. "LTPlite"), or the summary of all tests for a build ( - the empty string). type Test struct { + // The last time the test was updated in the database. + Timestamp string `json:"_timestamp,omitempty"` + // ID of the tested build. The build must be valid for the test run to be considered valid. BuildID string `json:"build_id"` - // Human-readable description of the test run. - Description string `json:"description,omitempty"` - - // The number of seconds it took to run the test. - Duration float64 `json:"duration,omitempty"` - - // The environment the test ran in. E.g. a host, a set of hosts, or a lab; amount of memory/storage/CPUs, - // for each host; process environment variables, etc. - Environment *Environment `json:"environment,omitempty"` - // ID of the test run. // Must start with a non-empty string identifying the CI system which submitted the test run, // followed by a colon ':' character. The rest of the string is generated by the origin CI system, // and must identify the test run uniquely among all test runs, coming from that CI system. ID string `json:"id"` - // Miscellaneous extra data about the test run. - Misc *TestMisc `json:"misc,omitempty"` - // The name of the CI system which submitted the test run. Origin string `json:"origin"` - // A list of test outputs: logs, dumps, etc. - OutputFiles []*Resource `json:"output_files,omitempty"` + // The environment the test ran in. E.g. a host, a set of hosts, or a lab; amount of memory/storage/CPUs, + // for each host; process environment variables, etc. + Environment *Environment `json:"environment,omitempty"` // Dot-separated path to the node in the test classification tree the executed test belongs to. // E.g. "ltp.sem01". The empty string signifies the root of the tree, i.e. all tests for the build, // executed by the origin CI system. Path string `json:"path,omitempty"` + // A human-readable comment regarding the test run. + Comment string `json:"comment,omitempty"` + + // The URL of the plain-text test output or log file. If multiple outputs exist, this should point to the + // highest-level overview of the test's operation. The rest should go into output_files. + LogURL string `json:"log_url,omitempty"` + + // A part of the test log most relevant to the test outcome. + LogExcerpt string `json:"log_excerpt,omitempty"` + + // The test status string: FAIL, ERROR, MISS, PASS, DONE, or SKIP. + Status string `json:"status,omitempty"` + + // The numerical output produced by the test, if any. + Number *TestNumber `json:"number,omitempty"` + // The time the test run was started. StartTime string `json:"start_time,omitempty"` - // The test status string, one of the following. "ERROR" - the test is faulty, the status of the tested - // code is unknown. - // "FAIL" - the test has failed, the tested code is faulty. - // "PASS" - the test has passed, the tested code is correct. - // "DONE" - the test has finished successfully, the status of the tested code is unknown. - // "SKIP" - the test wasn't executed, the status of the tested code is unknown. - // - // The status names above are listed in priority order (highest to lowest), which could be used for producing - // a summary status for a collection of test runs, e.g. for all testing done on a build, based on results of - // executed test suites. The summary status would be the highest priority status across all test runs - // in a collection. - Status string `json:"status,omitempty"` + // The number of seconds it took to run the test. + Duration float64 `json:"duration,omitempty"` + + // Test input files (rootfs, initramfs, etc.). + InputFiles []*Resource `json:"input_files,omitempty"` - // True if the test status should be ignored. - // Could be used for reporting test results without affecting the overall test status and alerting - // the contacts concerned with the tested code revision. For example, for collecting test reliability - // statistics when the test is first introduced, or is being fixed. - Waived bool `json:"waived"` + // A list of test outputs: logs, dumps, etc. Except the file referenced by log_url. + OutputFiles []*Resource `json:"output_files,omitempty"` + + // Miscellaneous extra data about the test run. + Misc *TestMisc `json:"misc,omitempty"` +} + +// The numerical output produced by a test run. +type TestNumber struct { + // The floating-point output value. + Value float64 `json:"value"` + + // The (compound) unit symbols the value is measured in. + Unit string `json:"unit,omitempty"` + + // The type of prefix to add to the unit when displaying the value: "metric" or "binary". + Prefix string `json:"prefix,omitempty"` } // Miscellaneous extra data about the test. @@ -267,5 +303,97 @@ type Version struct { // // Increases represent backward-compatible changes. E.g. relaxing value restrictions, // making a property optional, or adding a new optional property. - Minor int `json:"minor"` + Minor int `json:"minor,omitempty"` +} + +// An issue found in reports. +type Issue struct { + // The last time the issue was updated in the database. + Timestamp string `json:"_timestamp,omitempty"` + + // Issue ID. + // Must start with a non-empty string identifying the CI system which submitted the issue, + // followed by a colon ':' character. The rest of the string is generated by the origin CI system, + // and must identify the issue uniquely among all issues, coming from that CI system. + ID string `json:"id"` + + // The modification version number of the issue. Only the highest-numbered version is used for triaging. + Version int `json:"version"` + + // The name of the CI system which submitted the issue. + Origin string `json:"origin"` + + // Dot-separated paths pointing to nodes in the categorization tree the issue belongs to. + Categories []string `json:"categories,omitempty"` + + // The URL of a report describing the issue. + ReportURL string `json:"report_url,omitempty"` + + // The subject of the report describing the issue. + ReportSubject string `json:"report_subject,omitempty"` + + // Layers of the execution stack responsible for the issue. If all are false, the issue is considered invalid. + Culprit *IssueCulprit `json:"culprit,omitempty"` + + // A human-readable comment regarding the issue. E.g. a brief description, or a report subject. + Comment string `json:"comment,omitempty"` + + // Miscellaneous extra data about the issue. + Misc *IssueMisc `json:"misc,omitempty"` +} + +// The layers responsible for an issue. +type IssueCulprit struct { + // The built/tested code. + Code bool `json:"code,omitempty"` + + // The tool - the static analyzer, the build toolchain, the test, etc. + Tool bool `json:"tool,omitempty"` + + // The harness - the system controlling the execution of the build/test. + Harness bool `json:"harness,omitempty"` +} + +// Miscellaneous extra data about the issue. +type IssueMisc struct { +} + +// An incident - an issue occurrence/absence. +type Incident struct { + // The last time the incident was updated in the database. + Timestamp string `json:"_timestamp,omitempty"` + + // Incident ID. + // Must start with a non-empty string identifying the CI system which submitted the incident, + // followed by a colon ':' character. The rest of the string is generated by the origin CI system, + // and must identify the incident uniquely among all incidents, coming from that CI system. + ID string `json:"id"` + + // The name of the CI system which submitted the incident. + Origin string `json:"origin"` + + // The ID of the occurring/absent issue. + IssueID string `json:"issue_id"` + + // The modification version number of the occurring/absent issue. + IssueVersion int `json:"issue_version"` + + // The ID of the build object exhibiting/missing the issue. + BuildID string `json:"build_id,omitempty"` + + // The ID of the test object exhibiting/missing the issue. + TestID string `json:"test_id,omitempty"` + + // True if the issue occurred in the linked objects. False if it was absent. + Present bool `json:"present,omitempty"` + + // A human-readable comment regarding the incident. + Comment string `json:"comment,omitempty"` + + // Miscellaneous extra data about the incident. + Misc *IncidentMisc `json:"misc,omitempty"` +} + +// Miscellaneous extra data about the incident. +type IncidentMisc struct { } -- cgit mrf-deployment