Skip to content

Comments

allow granularity when requesting PR images#255

Merged
mangelajo merged 1 commit intomainfrom
build-specific-image
Feb 25, 2026
Merged

allow granularity when requesting PR images#255
mangelajo merged 1 commit intomainfrom
build-specific-image

Conversation

@bennyz
Copy link
Member

@bennyz bennyz commented Feb 20, 2026

Allow to set labels like build-pr-images/jumpstarter to build only the jumpstarter issues to reduce chances for throttle and speed up the process

fixes #252

Summary by CodeRabbit

Release Notes

  • Chores
    • Enhanced the automated build workflow with improved image selection logic, enabling more flexible build scenarios. Refined workflow conditions to prevent unnecessary build execution and improved the feedback system to support selective or comprehensive image builds.

Allow to set labels like build-pr-images/jumpstarter to build
only the jumpstarter issues to reduce chances for throttle and
speed up the process

Signed-off-by: Benny Zlotnik <bzlotnik@redhat.com>
Assisted-by: claude-opus-4.6
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 20, 2026

📝 Walkthrough

Walkthrough

The PR reworks the image-selection logic in the build workflow, replacing array-based label checks with JSON-based checks and introducing a pre-check step that conditionally gates subsequent build steps based on PR labels.

Changes

Cohort / File(s) Summary
GitHub Actions Workflow Configuration
.github/workflows/build-images.yaml
Refactored PR-based image-selection logic from contains() array checks to JSON-based label verification. Added pre-check step to compute skip flags per image. Extended matrix entries with explicit labels for seven image targets. Propagated skip conditions across build, push, and attestation steps. Enhanced PR comment logic to filter images based on labels.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

build-pr-images

Suggested reviewers

  • NickCao

Poem

🐰 A workflow refined with careful thought,
Per-image labels now newly taught,
Pre-checks guard the pipeline's way,
Building only what's asked that day! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately reflects the main change: introducing granular control over PR image builds through selective label-based filtering instead of building all images.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch build-specific-image

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@bennyz bennyz added the build-pr-images/jumpstarter request to build only the jumpstarter image from PR label Feb 20, 2026
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
.github/workflows/build-images.yaml (2)

204-220: Hardcoded allImages list must stay in sync with the matrix.

The allImages array (lines 206-214) duplicates the image names from the matrix (lines 33-61). If a new image is added to the matrix or one is removed, this list must be updated in lockstep—easy to forget.

GitHub Actions doesn't provide a straightforward way to pass the matrix definition into a downstream job, so this is a known limitation. Consider adding a comment near both locations cross-referencing each other to reduce drift risk, e.g.:

+            // NOTE: keep in sync with the matrix in build-and-push-image
             const allImages = [
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/build-images.yaml around lines 204 - 220, The duplicated
hardcoded image list in the workflow (the const allImages array) can drift from
the matrix; add a clear cross-reference comment adjacent to the allImages
declaration and the matrix definition that states they must be kept in sync
(e.g., "Keep in sync with matrix 'images' above" and link to the other section),
and optionally note the label format (`build-pr-images/<shortName>`) used by the
images filtering logic (variables: allImages, images,
labels.includes('build-pr-images')). This ensures future maintainers see the
relationship and update both places together.

22-22: Substring match on contains(toJSON(...), ...) could produce false positives.

contains(toJSON(...), 'build-pr-images') matches any label whose name includes that substring (e.g., a hypothetical no-build-pr-images). The inner pre-check step (lines 77-79) uses exact jq matching, so actual builds are safe, but the job itself would still spin up matrix runners unnecessarily in that edge case.

A stricter alternative would be to use fromJSON + a jq-like check or simply match startsWith:

if: >-
  github.event_name != 'pull_request' ||
  contains(github.event.pull_request.labels.*.name, 'build-pr-images') ||
  join(toJSON(github.event.pull_request.labels.*.name), ',') ...

That said, with the inner pre-check gating, the practical risk is near-zero—just runner allocation cost on a false match.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/build-images.yaml at line 22, The current conditional uses
contains(toJSON(github.event.pull_request.labels.*.name), 'build-pr-images')
which performs a substring search and can yield false positives; update the if
condition to perform an exact label-element match instead by replacing
contains(toJSON(...), 'build-pr-images') with
contains(github.event.pull_request.labels.*.name, 'build-pr-images') (or
alternatively use a join/toJSON approach or startsWith on each label name) so
the check matches whole label names rather than substrings.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In @.github/workflows/build-images.yaml:
- Around line 204-220: The duplicated hardcoded image list in the workflow (the
const allImages array) can drift from the matrix; add a clear cross-reference
comment adjacent to the allImages declaration and the matrix definition that
states they must be kept in sync (e.g., "Keep in sync with matrix 'images'
above" and link to the other section), and optionally note the label format
(`build-pr-images/<shortName>`) used by the images filtering logic (variables:
allImages, images, labels.includes('build-pr-images')). This ensures future
maintainers see the relationship and update both places together.
- Line 22: The current conditional uses
contains(toJSON(github.event.pull_request.labels.*.name), 'build-pr-images')
which performs a substring search and can yield false positives; update the if
condition to perform an exact label-element match instead by replacing
contains(toJSON(...), 'build-pr-images') with
contains(github.event.pull_request.labels.*.name, 'build-pr-images') (or
alternatively use a join/toJSON approach or startsWith on each label name) so
the check matches whole label names rather than substrings.

@github-actions
Copy link

Container Images

The following container images have been built for this PR:

Image URI
jumpstarter quay.io/jumpstarter-dev/jumpstarter:pr-255

Images expire after 7 days.

@bennyz bennyz requested a review from mangelajo February 20, 2026 09:10
@mangelajo mangelajo merged commit 0858223 into main Feb 25, 2026
25 checks passed
@bennyz bennyz deleted the build-specific-image branch February 25, 2026 10:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build-pr-images/jumpstarter request to build only the jumpstarter image from PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

When using build-pr-images label, support requesting a specific image

2 participants