Skip to content

Fix: Name the repository on every Gerrit checkout - #25

Merged
ModeSevenIndustrialSolutions merged 1 commit into
lfreleng-actions:mainfrom
modeseven-lfreleng-actions:fix/gerrit-checkout-repository
Aug 18, 2026
Merged

Fix: Name the repository on every Gerrit checkout#25
ModeSevenIndustrialSolutions merged 1 commit into
lfreleng-actions:mainfrom
modeseven-lfreleng-actions:fix/gerrit-checkout-repository

Conversation

@ModeSevenIndustrialSolutions

Copy link
Copy Markdown
Contributor

Summary

Names the repository on all 6 Gerrit checkouts. One line per site, no
behaviour change for current consumers.

Part of an estate-wide sweep following an outage in
lfreleng-actions/docs-workflows#9, which carried this pattern from the shared
skeletons.

Root cause

checkout-gerrit-change-action declares:

  repository:
    required: false
    default: ${{ github.repository }}

Inside a reusable workflow github.repository names the caller, not the
project under review. Each Gerrit checkout passed ref: but omitted
repository:, so a central .github repository acting for another project
seeds the tree from itself and then looks for the project's branch there:

fatal: couldn't find remote ref refs/heads/master

Where the branch names happen to match, the checkout succeeds against the
wrong repository
— the worse outcome, since the job then reports on the
caller's content.

The paired plain checkout in each of these steps already got it right:

      - name: 'Checkout repository'
        if: inputs.gerrit_refspec == ''
        uses: actions/checkout@3d3c42e...
        with:
          repository: ${{ inputs.repository || github.repository }}   # correct

So inputs.repository was a declared, documented input that the Gerrit lane
discarded without a word.

The fix

   delay: '0s'
+  repository: ${{ inputs.repository || github.repository }}
   ref: refs/heads/${{ inputs.gerrit_branch }}
File Sites
gradle-build-test.yaml 3
maven-build-test.yaml 3

tag-push.yaml keeps its checkouts untouched: it is repo-local CI rather than
a reusable workflow, so it checks out this repository on purpose.

Blast radius

Nil for current consumers, which call these workflows from their own
repository, where the default already resolved correctly and gerrit_refspec
is empty anyway.

The defect reaches a run only where the caller differs from the project, which
today means the ONAP and O-RAN-SC central .github topology. Those call
docs-workflows alone, so this repository was latent rather than broken — but
one adoption away.

Verification

Check Result
prek run --all-files All hooks pass
zizmor --persona auditor .github/workflows/ No findings
Shape check across the reusable workflows Checked 2 reusable workflow(s); 0 problem(s).

The shape check asserts that a checkout omitting repository fails when either
the workflow declares a repository input, or a Gerrit checkout pins ref.
lfreleng-actions/workflows-template#36 adds it as a CI job so new repositories
inherit it; worth deciding whether to backfill it here too.

The Gerrit checkout steps passed 'ref' but omitted 'repository', so the
action fell back to its default of github.repository. Inside a reusable
workflow that names the caller, not the project under review, so a
central .github repository acting for another project seeds the tree
from itself and then looks for the project's branch there:

    fatal: couldn't find remote ref refs/heads/master

The plain checkout paired with each Gerrit checkout already passed the
right expression, so 'repository' was a declared, documented input that
the Gerrit path discarded without a word.

The same omission in docs-workflows failed every ONAP documentation
check once ONAP adopted it. Six sites across gradle-build-test and
maven-build-test now pass what the plain checkouts used.

Repositories calling these workflows from their own repository see no
change, because there the default already resolved correctly. The
defect reaches a run only where the caller differs from the project,
which today means the ONAP and O-RAN-SC central .github topology.

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Matthew Watkins <mwatkins@linuxfoundation.org>
@ModeSevenIndustrialSolutions
ModeSevenIndustrialSolutions requested review from a team and a balanced review from Copilot August 18, 2026 08:33
@github-actions github-actions Bot added the bug Something isn't working label Aug 18, 2026

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.

Pull request overview

Ensures reusable Maven and Gradle workflows check out Gerrit changes from the explicitly requested repository.

Changes:

  • Passes the repository input to all six Gerrit checkout steps.
  • Preserves the calling repository as the fallback.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
.github/workflows/maven-build-test.yaml Names the repository in three Gerrit checkouts.
.github/workflows/gradle-build-test.yaml Names the repository in three Gerrit checkouts.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@zxiiro zxiiro 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.

🤖 Auto-approved by agent: reviewed workflow/code change for security and CI/CD impact, found low risk. Same fix as the sibling *-workflows repos: adds explicit repository: input to Gerrit checkout steps; purely additive, no permission/security changes.

@ModeSevenIndustrialSolutions
ModeSevenIndustrialSolutions merged commit 15b3c1e into lfreleng-actions:main Aug 18, 2026
9 checks passed
@ModeSevenIndustrialSolutions
ModeSevenIndustrialSolutions deleted the fix/gerrit-checkout-repository branch August 18, 2026 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants