Skip to content

kci-dev usage for submitting build results to kcidb #263

@nuclearcat

Description

@nuclearcat

During the meetings we had suggestion that kernel developers, including Greg Kroah-Hartman, can submit to kcidb their kernel test results.
So here is draft proposal what i would like to implement.

Goal

Add a new kci-dev submit build command that can publish build results
directly to KCIDB (REST), using the KCIDB v5.3 I/O schema. This makes it
possible to take build data from scripts like Greg test_stable_ssh and
submit it in a single, explicit step.
It can be also kci-dev kcidb submit-build or something else, i am open to proposals.

Rationale and references in this repo

  • kcidb_submit_build.py already implements a minimal, working submitter
    (REST, schema v5.3) and shows the required/optional fields. I added draft of this script at end of document.
  • kcidb-io/kcidb_io/schema/v05_03.py documents the exact fields for
    checkouts and builds.
  • GREG/test_stable_ssh generates logs and has clear PASS/FAIL semantics
    that can map to KCIDB status. (It's in Greg repo)

Proposed CLI shape

Command:
kci-dev submit build [options]

Required-ish inputs (one of each group):

  • IDs:
    --checkout-id origin:...
    --build-id origin:...
    OR
  • Source identity (to derive checkout_id):
    --origin
    --git-repo-url
    --git-commit-hash
    [--git-branch ]
    [--patchset-hash ]
  • Build identity (to derive build_id):
    --build-start-time
    or
    --build-run-id (preferred for retries)

Recommended options (map to KCIDB v5.3):
--tree-name # checkout.tree_name
--checkout-valid <true|false> # checkout.valid
--checkout-start-time # checkout.start_time
--arch # build.architecture
--compiler # build.compiler
--config-name # build.config_name
--status <PASS|FAIL|ERROR|MISS|DONE|SKIP> # build.status
--build-start-time # build.start_time
--duration # build.duration
--comment # build.comment
--command # build.command

Logs and artifacts:
--log-url # build.log_url
--config-url # build.config_url

Behavior flags:
--dry-run # print JSON instead of submit
--schema # optionally validate against a specific schema major

ID generation (deterministic)

Follow the same logic as kcidb_submit_build.py:

  • checkout_id = sha256(repo_url | branch | commit | patchset_hash)
  • build_id = sha256(checkout_id | arch | config_name | compiler | run_id)

Note: build-run-id should be preferred over timestamps if the CI can provide
stable identifiers across retries. Timestamps can still be used when nothing
else is available.

KCIDB schema fields to target

Checkout fields (v5.3):
id, origin, tree_name, valid, start_time,
git_repository_url, git_repository_branch, git_commit_hash, patchset_hash,
log_url, log_excerpt, comment, misc

Build fields (v5.3):
id, origin, checkout_id, start_time, duration, status, architecture,
compiler, config_name, log_url, log_excerpt, config_url, comment, command,
input_files[], output_files[], misc

Config additions (kci-dev.toml)

Add a KCIDB REST target in the existing config file:

[kcidb]
rest_url = "https://db.kernelci.org/submit"
token = "your-jwt-or-bearer-token"

Resolution order:

  1. CLI flags --kcidb-rest / --kcidb-token (if provided)
  2. Env KCIDB_REST (already used by kcidb tools, e.g. "https://token@host/submit")
  3. [kcidb] in kci-dev.toml

Integration idea for GREG/test_stable_ssh

The script already produces:

  • PASS/FAIL from KTEST_RUN
  • build log at: ${REMOTE_DIR}/linux/log
  • total time as ${TIME}

Suggested additions inside run_test.sh (remote):

  • Record commit hash after patches are applied:
    git rev-parse HEAD > ${REMOTE_DIR}/commit.txt
  • Optionally record branch name, or use linux-${KERNEL_VERSION}.y
  • Optionally compute patchset hash when stable_queue.tar.gz is present
  • Compress log and make it accessible (scp back or upload)

Then, on the local machine (after retrieving the log and commit):
kci-dev submit build
--origin gregkh
--git-repo-url https://git.kernel.org/.../linux-stable.git
--git-branch linux-${KERNEL_VERSION}.y
--git-commit-hash "$(cat commit.txt)"
--arch x86_64
--config-name allmodconfig
--compiler "gcc-14"
--status PASS|FAIL
--build-start-time "$(cat start_time.txt)"
--duration "${TIME}"
--log-path ./linux.log

Notes:

  • Use --tree-name stable-${KERNEL_VERSION} (or similar) if you want the
    dashboard to group by tree name.
  • Any extra info (warnings/errors counts, builder host, ktest exit code) can
    be placed under misc for future use.

Minimal JSON to emit (build-only)

The command should emit a KCIDB v5.3 report with at least:

  • version.major/minor
  • checkouts[0]: id, origin, git_repository_url, git_commit_hash
  • builds[0]: id, origin, checkout_id, status

For reference, kcidb_submit_build.py early draft:
https://gist.github.com/nuclearcat/6d3f3ff74ece7a29fd50d85b2ce54dc4

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestquestionFurther information is requested

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions