Skip to content

Fix repeated base image builds on main - #1431

Merged
lipoja merged 1 commit into
release-engineering:mainfrom
lipoja:fix_gha_build_base_image
Nov 20, 2026
Merged

lipoja merged 1 commit into
release-engineering:mainfrom
lipoja:fix_gha_build_base_image

Conversation

@lipoja

@lipoja lipoja commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

Compare changed paths against the previous push commit instead of the repository default branch. This prevents the base Dockerfile, already present on main, from matching every unrelated push.

Assisted-by: Codex, Luna 6

Compare changed paths against the previous push commit instead of the
repository default branch. This prevents the base Dockerfile, already
present on main, from matching every unrelated push.

Signed-off-by: Jan Lipovský <jlipovsk@redhat.com>
Assisted-by: Codex, Luna 6
@qodo-for-releng

Copy link
Copy Markdown

PR Summary by Qodo

Compare push commits to prevent repeated base image builds

🐞 Bug fix ⚙️ Configuration changes 🕐 Less than 10 minutes

Grey Divider

AI Description

• Compare changed paths against the previous push commit instead of the repository’s default branch.
• Build the base image only when the push changes its Dockerfile.
Diagram

graph TD
  P["Push to main"] -->|"before to SHA"| F{"Base Dockerfile changed?"} -->|Yes| B["Build base image"] --> W["Build worker"]
  F -->|No| W
Loading
High-Level Assessment

Explicitly supplying the push’s before and current SHAs is the direct fix: it preserves the existing path filter and avoids comparing main against the unrelated default branch.

Files changed (1) +4 / -0

Bug fix (1) +4 / -0
build_on_main.ymlScope base-image detection to the current push +4/-0

Scope base-image detection to the current push

• Sets the path filter’s base to the previous push commit and its ref to the current SHA. This prevents differences against the repository’s default branch from triggering base-image builds on unrelated pushes to main.

.github/workflows/build_on_main.yml

@qodo-for-releng

Copy link
Copy Markdown

Code Review by Qodo


View medium (1)
Remediation recommended
1. A failed base image build is never retried 🐞 Bug
Description
The base: ${{ github.event.before }} input limits paths-filter to the files changed in this single
push, so base_image is true only for the push that touched docker/Dockerfile-base-image. If
build_base_image fails on that push, build_iib_worker is skipped and no later push re-detects
the Dockerfile change, so iib-base-image:latest on Quay stays stale until someone edits that
Dockerfile again or runs the workflow manually.
Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

Issue description
The base-image detection now diffs only the current push (`base: ${{ github.event.before }}`). If `build_base_image` fails, no later push re-detects the Dockerfile change, so the base image on Quay stays stale and `build_iib_worker` stays blocked.

Fix Focus Areas
- .github/workflows/build_on_main.yml[40-66]

Recommended Fix
Document that a failed base build requires a manual `workflow_dispatch` of build_base_image.yml, or add a retry mechanism: for example, record the last successfully built base-image commit (a tag or artifact moved on success) and diff against it instead of `github.event.before`, as the dorny/paths-filter discussion suggests for deployment pipelines.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗


@fullsend-ai-review

fullsend-ai-review Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 2:49 PM UTC · Completed 3:04 PM UTC

Commit: bfcb1e7 · View workflow run →

Runtime: claude · Model: opus → claude-opus-4-6 · Effort: high · Cost: $4.18

@fullsend-ai-review fullsend-ai-review Bot added the risk/moderate PR risk: moderate label Nov 13, 2026
@fullsend-ai-review

Copy link
Copy Markdown

Risk Assessment: moderate (2/5)

Details

Minimal 4-line CI workflow change with no security concerns or dependencies, but the modification of a protected CI path and CI_WORKFLOW_CHANGED signal warrant moderate attention per the CI/CD anchor.

@fullsend-ai-review

Copy link
Copy Markdown

Review

Findings

High

  • [protected-path] .github/workflows/build_on_main.yml — This PR modifies a file under the protected path .github/. The PR has no linked issue providing justification for modifying governance or infrastructure files. Human approval is required for all protected-path changes.

Low

  • [edge-case] .github/workflows/build_on_main.yml:45 — When github.event.before is the null SHA (0000000000000000000000000000000000000000) — which occurs on the very first push to a newly created branch or on a force push that rewrites history — dorny/paths-filter will fail to resolve the base commit. The detect_changes job would error and build_iib_worker would not run (it requires detect_changes success via the needs chain). Since main is an established branch, this is unlikely in normal operation, but a force push could trigger the failure.
    Remediation: Consider adding a guard step before paths-filter that checks whether github.event.before equals the null SHA (or is otherwise unreachable) and, if so, falls back to treating all paths as changed (safe default: rebuild the base image when in doubt).

Labels: CI workflow bug fix modifying a GitHub Actions file with minimal review effort.


Next steps:

  • /fs-fix — agent addresses review findings automatically
  • /fs-fix <your instruction> — agent fixes with your specific guidance
  • Push commits directly — review re-runs automatically on push
  • /fs-fix-stop — disable automatic fix runs for this PR

@fullsend-ai-review fullsend-ai-review 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.

See the review comment for full details.

Comment thread .github/workflows/build_on_main.yml Resolved
@fullsend-ai-review fullsend-ai-review Bot added bug Something isn't working github_actions Pull requests that update GitHub Actions code Review effort 1/5 labels Nov 13, 2026
@lipoja
lipoja merged commit 1a8d417 into release-engineering:main Nov 20, 2026
33 checks passed
@lipoja
lipoja deleted the fix_gha_build_base_image branch November 20, 2026 12:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working github_actions Pull requests that update GitHub Actions code Review effort 1/5 risk/moderate PR risk: moderate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants