Skip to content

fix(build): only enforce registry pairing when pushing - #10

Merged
kalbasit merged 1 commit into
mainfrom
fix/fork-pr-oci-build-validation
Jun 7, 2026
Merged

kalbasit merged 1 commit into
mainfrom
fix/fork-pr-oci-build-validation

Conversation

@kalbasit

@kalbasit kalbasit commented Jun 7, 2026

Copy link
Copy Markdown
Owner

Summary

Fork PRs (and any run where the dockerhub_username repo variable is not exposed) were failing the reusable build.yml workflow at its "Validate registry inputs" step — even though the build is correctly configured to skip pushing on forks. The symptom was the spurious, ~8s failure:

::error::dockerhub_image and dockerhub_username must be set together (got image=true user=false)

This blocked consumer CI such as kalbasit/ncps#1317.

Root cause

Consumers pass dockerhub_image as a literal (e.g. kalbasit/ncps) and dockerhub_username from a repo variable (${{ vars.DOCKERHUB_USERNAME }}). GitHub withholds that variable from fork PRs, so the orchestrator forwards dockerhub_image="kalbasit/ncps" with dockerhub_username="" → image=true user=false. The caller (ci.yml) already forces push_oci: false for fork PRs, so nothing would push — but the pairing check ran unconditionally and exit 1'd. This directly contradicted the existing oci-build "PR from a fork" scenario.

Fix

Move the dockerhub_image/dockerhub_username pairing check inside the existing if [[ "$OCI_PUSH" == "true" ]] block, alongside the "at least one registry enabled" check.

  • push_oci == false (fork PRs, non-pushing runs): validation is a no-op. Every step that consumes the username/token (Login to Docker Hub, Push the OCI image, the oci-manifest job) is already if: inputs.push_oci ..., so a half-set pair can never reach an auth/push step.
  • push_oci == true: behavior is byte-for-byte identical to today — a misconfigured consumer still fails fast with the same message.

No change to inputs, secrets, or non-fork push behavior.

Verification

  • actionlint .github/workflows/build.yml → clean (exit 0)
  • Confirmed all login/push/manifest steps remain gated on inputs.push_oci
  • Post-merge: re-run CI on kalbasit/ncps#1317; the shared / build (x86_64-linux) and (aarch64-linux) legs should go green.

OpenSpec

Modifies the oci-build capability (tightens the "PR from a fork" scenario to require registry-input validation not fail when pushing is disabled). The change is archived in this PR so openspec-guard passes.

@coderabbitai

coderabbitai Bot commented Jun 7, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 70ae53fb-3e73-4d56-b3d4-ecc097491493

📥 Commits

Reviewing files that changed from the base of the PR and between 564f503 and ba7ce35.

📒 Files selected for processing (7)
  • .github/workflows/build.yml
  • openspec/changes/archive/2026-06-07-fork-pr-oci-build-validation/.openspec.yaml
  • openspec/changes/archive/2026-06-07-fork-pr-oci-build-validation/design.md
  • openspec/changes/archive/2026-06-07-fork-pr-oci-build-validation/proposal.md
  • openspec/changes/archive/2026-06-07-fork-pr-oci-build-validation/specs/oci-build/spec.md
  • openspec/changes/archive/2026-06-07-fork-pr-oci-build-validation/tasks.md
  • openspec/specs/oci-build/spec.md

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes

    • Fixed CI workflow to properly handle fork pull requests and non-push scenarios, preventing validation failures when registry credentials are not provided in these contexts.
  • Chores

    • Updated specification documentation to clarify registry validation behavior and workflow scenarios.

Walkthrough

The pull request fixes fork PR CI failures by scoping Docker Hub credential pair validation to only enforce when OCI pushing is enabled. The build workflow is modified to move validation inside the push guard, the oci-build specification is updated to define this behavior, and OpenSpec archive documentation captures the decision and full scenario specifications.

Changes

Registry Validation Scoping

Layer / File(s) Summary
Workflow validation narrowing
.github/workflows/build.yml
The dockerhub_image/dockerhub_username pairing check is moved inside the existing if [[ "$OCI_PUSH" == "true" ]] block, applying validation only when pushing is enabled.
Specification of new validation behavior
openspec/specs/oci-build/spec.md
Registry-input validation requirements are narrowed to apply only when push_oci is true; when push_oci is false, partially-set Docker Hub credentials must not cause failure. The fork PR scenario is updated to explicitly tolerate asymmetric credentials while still running flake-check and image build read-only steps.
Change decision and rationale
openspec/changes/archive/2026-06-07-fork-pr-oci-build-validation/.openspec.yaml, design.md, proposal.md
Design notes document the problem (fork PRs fail when credentials are withheld despite push_oci: false), the decision (moving validation inside the push guard), why it is safe (validation becomes a no-op when not pushing; push-path behavior remains enforced), and the impact on specification and consumers.
Archived specification snapshot and scenarios
openspec/changes/archive/2026-06-07-fork-pr-oci-build-validation/specs/oci-build/spec.md, tasks.md
Archive captures complete specification scenarios: disabled flake-check workflow, non-fork PRs with push enabled, test-system-restricted matrix runs, fork PRs with forced non-push (skipping codecov/manifest/push), and oci-disabled upstream cases, with task checklist for implementation and verification.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • kalbasit/gh-actions#2: Updates .github/workflows/build.yml validation logic for Docker Hub input pairing during OCI push setup, directly overlapping with this PR's workflow change.

Poem

🐰 In workflows where secrets dare hide,
A fork's credentials slip aside,
We gate the checks to push alone,
So CI won't fall, validation's known,
Now forks and pushes both can stride! 🚀

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: moving the registry pairing validation to only enforce when actually pushing OCI images.
Description check ✅ Passed The description thoroughly explains the problem (fork PRs failing validation), root cause, and fix with clear rationale and verification steps.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

The reusable build.yml "Validate registry inputs" step asserted that
`dockerhub_image` and `dockerhub_username` are both set or both empty,
unconditionally. On fork PRs the orchestrator forces `push_oci: false`
and the `dockerhub_username` variable is withheld (forks don't receive
repo variables) while `dockerhub_image` stays a literal, producing an
asymmetric pair (`image=true user=false`) that hard-failed the build leg
in ~8s — contradicting the existing "PR from a fork" spec scenario and
blocking consumer CI (e.g. kalbasit/ncps#1317).

Move the pairing check inside the existing `push_oci == true` guard,
alongside the at-least-one-registry check. When not pushing, an
asymmetric pair is harmless: every login/push/manifest step is already
gated on `push_oci`. Non-fork push behavior is unchanged.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@kalbasit
kalbasit force-pushed the fix/fork-pr-oci-build-validation branch from 29b6d58 to ba7ce35 Compare June 7, 2026 03:20

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request updates the oci-build specification to ensure that registry-input validation (specifically the pairing of dockerhub_image and dockerhub_username) is only enforced when push_oci is true. This prevents fork PRs, where the dockerhub_username variable is withheld by GitHub, from failing the validation step. The changes include archiving the design, proposal, and updated specification under the OpenSpec directory. There are no review comments, and I have no feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@kalbasit
kalbasit merged commit aea1f28 into main Jun 7, 2026
1 check passed
@kalbasit
kalbasit deleted the fix/fork-pr-oci-build-validation branch June 7, 2026 03:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant