Skip to content

Feat: Gate Gerrit examples on change visibility - #101

Merged
ModeSevenIndustrialSolutions merged 1 commit into
lfreleng-actions:mainfrom
lfreleng-bot-forks:code-monkey/issue-100
Oct 30, 2026
Merged

ModeSevenIndustrialSolutions merged 1 commit into
lfreleng-actions:mainfrom
lfreleng-bot-forks:code-monkey/issue-100

Conversation

@lf-releng-code-monkey-bot

@lf-releng-code-monkey-bot lf-releng-code-monkey-bot Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

INFO The workflow Copilot review request was accepted but no Copilot reviewer was added; no Copilot review was requested for this pull request, so a maintainer should request one.

Closes #100

Authored by an AI agent; human review required
Command Exit
prek run --files examples/change-isolation/gerrit.yaml examples/change-isolation/gerrit-info-yaml-only.yaml .github/zizmor.yml docs/change-isolation.md README.md 0
zizmor --offline --persona auditor --no-progress examples/change-isolation/gerrit.yaml examples/change-isolation/gerrit-info-yaml-only.yaml examples/release/gerrit.yaml 0
grep -n "egress-policy" examples/change-isolation/*.yaml 0
aislop scan --changes --json . 0
git commit -s (pre-commit and commit-msg hooks) 0

The github-code-monkey-bot workflow opened this pull request.
Nobody has merged it; a maintainer must review it first.
Review findings on this pull request are answered by a later revision round of this workflow, up to ten rounds; a maintainer must act on any finding that remains after that, and reviews every round before merge.


What changed

Both Gerrit change isolation callers (examples/change-isolation/gerrit.yaml and gerrit-info-yaml-only.yaml) now:

  1. Start with a visibility job running lfreleng-actions/gerrit-change-visible-action@31eb69fc… (v0.0.1) in its default ssh mode, as the voting account (GERRIT_SERVER, GERRIT_SSH_REQUIRED_USER, GERRIT_KNOWN_HOSTS, GERRIT_SSH_REQUIRED_PRIVKEY). It exposes visible as a job output.
  2. Gate every later job on it:
    • prepare: needs: visibility, if: needs.visibility.outputs.visible == 'true'
    • change-isolation: needs: [visibility, prepare], same if:
    • vote: needs: [visibility, prepare, change-isolation], if: ${{ always() && needs.visibility.outputs.visible == 'true' }}. The existing vote expression that refuses a positive vote when prepare or change-isolation did not succeed is unchanged.
  3. Run visibility, prepare and vote in block mode. Each egress-policy: audit step is replaced with harden-runner-block-action v0.14.0 loading lf-gerrit-servers/gerrit_servers.txt by explicit path, followed by step-security/harden-runner v2.22.3 (46b06cea…) with egress-policy: block, disable-telemetry: true and allowed-endpoints: ${{ env.CONNECTION_ALLOW_LIST }}. No extra hosts are added.

Each example's header comment now gives the job list, the three cases below, a note that the gate can be removed once the dispatcher fix is deployed, and where the variables, secret and egress allow-list come from. The concurrency block, the workflow_dispatch inputs and the all-zero generic-workflows placeholder are unchanged. The two examples still differ only in their header text, workflow name, concurrency prefix and checks.

What each gating if: produces

Case visibility prepare / change-isolation (visible == 'true') vote (always() && visible == 'true')
Readable change succeeds, visible=true run as before runs, including when an earlier job failed
Private (unreadable) change succeeds, visible=false skipped skipped: no vote, no failure email
Gerrit unreachable, bad credential or unreadable answer fails, no output skipped (a failed needs and an empty output) skipped: the empty output makes the comparison false even under always(). The failed visibility job is the signal

.github/zizmor.yml

Every line-scoped entry for these two files now points at its new line:

  • placeholder (impostor-commit, stale-action-refs): gerrit.yaml:213, gerrit-info-yaml-only.yaml:213
  • secrets-outside-env: gerrit.yaml:164/196/265, gerrit-info-yaml-only.yaml:164/196/264. Lines 164 are the new visibility references. The justification comment now names gerrit-change-visible-action.

No entry was widened to a whole file.

Docs

  • docs/change-isolation.md: a new section, "Private changes and the visibility gate", covering why the gate exists, the three-case table and when to remove it. "Voting" now covers the extra job and the always() interaction, and "Network egress" says the callers' Gerrit-talking jobs use the Gerrit-servers list while the reusable keeps its per-job lists.
  • README.md: one sentence on the gate in the change isolation section.

Validation

  • prek run --files <the 5 changed files>: passes, with exit 0. That covers yamllint, actionlint, zizmor (--offline), check-jsonschema for the examples and timeouts, markdownlint, write-good, codespell and reuse. The commit hooks (including gitlint) also passed.
  • zizmor --offline --persona auditor --no-progress examples/change-isolation/*.yaml examples/release/gerrit.yaml: No findings to report. Good job! (6 ignored), exit 0.
  • grep -n "harden-runner@" examples/change-isolation/*.yaml: every match is 46b06cea… (v2.22.3). grep -n "egress-policy" shows only block.
  • aislop scan --changes --json: empty diagnostics. aislop scores no YAML or Markdown, so this gate covers no files here.

For the reviewer

  • gerrit.yaml:51 is unchanged on purpose. The issue lists it among the entries to re-point, but zizmor matches on base filename, and line 51 is the placeholder in examples/release/gerrit.yaml, not in the change isolation example. The change isolation placeholder was at :128, now :213. None of the new gerrit.yaml line numbers falls on a uses: or secret line in the 66-line release example.
  • zizmor ran offline only. This session had no GitHub token, so the online-only audits (impostor-commit, stale-action-refs) were not run. As a result the new placeholder entries at :213, and the new pins for gerrit-change-visible-action and harden-runner-block-action, have not been checked online. The pins were copied verbatim from the issue.
  • The vote job now loads the Gerrit-servers list in block mode. im-open/workflow-conclusion only calls the GitHub API, which harden-runner always allows, so no host was added.
  • The header comments grew by about 30 lines each, to carry the case table and deployment notes the issue asked for.

gerrit_to_platform dispatches the required verify for private
changes too. The voting account cannot read them, so 'prepare' and
'vote' fail with 'Not found' and mail the author. Until the
dispatcher fix (lfit/releng-gerrit_to_platform#116) is deployed, both
change isolation examples start with a 'visibility' job running
gerrit-change-visible-action as the voting account, and every later
job runs only when it reports the change visible. A failed check
fails that job and skips the rest, never reading as "not visible".

The examples' Gerrit-talking jobs now run harden-runner v2.22.3 in
block mode with the organisation's Gerrit-servers allow-list, loaded
by explicit path through harden-runner-block-action, in place of
audit mode.

The zizmor ignores follow the lines the new job moves, and cover the
visibility job's secret reference. The change isolation docs and the
README describe the gate, its three outcomes and when to remove it.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: lf-releng-code-monkey-bot[bot] <332050256+lf-releng-code-monkey-bot[bot]@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues block approval of the visibility-gating and network-hardening updates.

No open issues 🎉

What changed in this PR

This PR updates the Gerrit change-isolation examples for issue #100, adding a voting-account visibility check so unreadable private changes skip verification and voting while visibility-check failures remain visible.

Changes:

  • Add a visibility job and gate downstream jobs in both callers, preserving voting after verification failures for readable changes.
  • Switch Gerrit-facing jobs to block-mode network hardening with the pinned Gerrit-servers allow-list.
  • Document the gate’s behavior and removal conditions, and update line-scoped zizmor suppressions.
File Description
README.md Summarizes the visibility gate and links to detailed guidance.
examples/​change-isolation/​gerrit.yaml Adds visibility gating and block-mode hardening to the two-check caller.
examples/​change-isolation/​gerrit-info-yaml-only.yaml Applies the same gating and hardening to the INFO.yaml-only caller.
docs/​change-isolation.md Explains visibility outcomes, voting behavior, gate removal, and network restrictions.
.github/​zizmor.yml Updates exact-line suppressions and covers the new visibility job’s secret reference.

Review effort: Balanced

@ModeSevenIndustrialSolutions
ModeSevenIndustrialSolutions merged commit 12feb2f into lfreleng-actions:main Oct 30, 2026
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feat: Gate the Gerrit examples on change visibility

2 participants