Skip to content

infra: port ci.yml's four block run: steps to Python (GEN-005 sweep) #2851

Closed

Description

@zackees

Location

ci-lint precheck on origin/master (2dddbe15a) reports four GEN-005 findings for
.github/workflows/ci.yml, all of them multi-line run: blocks:

Job Step What
flatpak-runtime-reuse steps[2] Record Export Provenance gh api run-id validation, writes FLATPAK_ARTIFACT_SOURCE / FLATPAK_ARTIFACT_RUN to $GITHUB_ENV
flatpak-runtime-reuse steps[4] Install Runtime Test Infrastructure sudo -E uv run --no-project ci/host_apt_mirrors.py, apt-get update, apt-get install of the Flatpak/PipeWire test packages
flatpak-runtime-reuse steps[5] Run Installed Flatpak with Saved Capture Profile tar -xf the downloaded OSTree repo, then uv run --no-project ci/flatpak_runtime.py --repo … --output …
tier2-setup-consumer steps[8] Validate Prepared OFF and ON Suites mkdir, tar --zstd -xf the tree, read bundle.json's image_id, one docker run of rust/tools/linux-validate/validate.sh with OBS_TIER2_MODES=OFF ON

Header before: 5 violation(s), 360 approved exception(s), 10 needs_review.

Why GEN-005

The rule's shell budget is one line per run:; each of these four is control flow
(if/case-style validation, package installation, archive extraction, a docker run
whose arguments are built from a JSON file). The established fix in this tree is one repo
module with a subcommand per step, called as a single uv run --no-project --script …
line — the shape of #2824 (ci/scheduled_steps.py), #2827 (ci/push_release.py) and
#2820 (ci/windows_signing.py).

Proposed fix

ci/ci_gate_steps.py with four subcommands, each one step's argv and exit status:

  • record-export-provenance — the numeric SOURCE_RUN check, gh api repos/$GITHUB_REPOSITORY/actions/runs/$RUN --jq .head_sha, the 40-hex check, then the
    two $GITHUB_ENV lines.
  • install-runtime-deps — host_apt_mirrors.py under sudo -E, then the two apt-get
    invocations with their retry/timeout options unchanged.
  • run-saved-capture-profile — tar -xf plus flatpak_runtime.py with --repo/--output.
  • validate-prepared-suites — the tar --zstd extraction, the image_id read, and the
    docker run with the same --mount/--env set (including --env OBS_TIER2_MODES=OFF ON).

The two command -v uv mounts stay host-resolved by the module (shutil.which('uv')), so
the container still gets the runner's uv and no bare python3 token appears on a
workflow line (TOOL-003).

RED and GREEN

  • RED: ci/test_ci_gate_steps.py — asserts each of the four steps is a single
    uv run --no-project --script … line with no run: |, and drives each subcommand on
    stubs (a fake gh, apt-get, tar, docker on PATH) comparing argv and exit status
    with the step's shell block. Fails on master.
  • GREEN: the module, the four single-line steps, and the GEN-005 [[exceptions]] block
    for .github/workflows/ci.yml deleted. Header after: 5 violation(s), 356 approved exception(s), 10 needs_review (no other rule moving).

Evidence limits, stated up front

Both jobs are workflow_dispatch-gated: flatpak-runtime-reuse needs
inputs.flatpak-runtime-reuse-run, tier2-setup-consumer is skipped by
inputs.native-cache-measurement-only. PR CI never runs either, so the acceptance
evidence is the offline pins plus ci/local_gate.py --only self-test and the precheck
header, not a remote run.

Refs #962.

Activity

  1. added
    infra
    on Oct 28, 2026
  2. zackees commented on Oct 28, 2026

    @zackees
    MemberAuthor

    Claiming: investigation

    1. Port the four block run: steps in .github/workflows/ci.yml to ci/ci_gate_steps.py, one subcommand per step, with ci/test_ci_gate_steps.py as the RED (it fails on master: four run: | blocks, no module) and the GREEN being the module plus the four single-line uv run --no-project --script steps.
    2. Delete the path's GEN-005 [[exceptions]] block; RED/GREEN is the precheck header, 5 violation(s), 360 approved exception(s) -> 5 violation(s), 356 approved exception(s), no other rule moving.
    3. Both jobs are workflow_dispatch-gated, so PR CI cannot run them; the evidence is the offline pins plus ci/local_gate.py --only self-test, and I will say so in the PR.

    First PR: today, a draft with the RED commit.

  3. zackees commented on Oct 28, 2026

    @zackees
    MemberAuthor

    /ready

    Definition of Ready: the four findings are enumerated by ci-lint precheck with job/step indices, the fix shape is the repo's own (ci/scheduled_steps.py, ci/push_release.py), RED/GREEN is measurable offline, and the file scope is one workflow plus its ci.toml block. Acceptance is stated (header 360 -> 356 approved, no other rule moving) and the evidence limit (both jobs are workflow_dispatch-gated) is named up front.

  4. added
    needs-investigation
    on Oct 28, 2026
  5. added
    ready
    and removed
    needs-investigation
    on Oct 28, 2026
  6. zackees commented on Oct 28, 2026

    @zackees
    MemberAuthor

    Claiming: the four ci.yml block steps (GEN-005 port)

    PR #2852, draft, with the RED and GREEN commits already in it.

    • RED 50ed624e8 is ci/test_ci_gate_steps.py alone: on master it fails 17 cases and errors twice (no module, run: | still in both jobs, the path's GEN-005 block still in ci.toml).
    • GREEN 2c7d6f146 adds ci/ci_gate_steps.py (record-export-provenance, install-runtime-deps, run-saved-capture-profile, validate-prepared-suites), the four single-line steps, and deletes the block.

    Header measured on this branch: 5 violation(s), 360 approved exception(s), 10 needs_review -> 5 violation(s), 356 approved exception(s), 10 needs_review, no other rule moving. ci/local_gate.py --only self-test is ok over 294 files.

    Two pre-existing pins drove the ported steps as shell and are repointed in the same commit: ci/test_host_apt_failover.py (module driven under the same sudo/apt-get stubs; failover at mirror/update/install still propagates 42) and ci/test_flatpak_runtime.py (the two published variables are read from the module). Both jobs are workflow_dispatch-gated, so PR CI cannot run either — the PR says so rather than claiming a remote run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

infraready

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions