fix(doozer): recognize golang builders as base images for snapshot releases#2693
fix(doozer): recognize golang builders as base images for snapshot releases#2693lgarciaaco wants to merge 1 commit intoopenshift-eng:mainfrom
Conversation
…leases The is_base_image() function was only checking for base_only: true configuration, excluding golang builder images from snapshot-to-release workflow. This caused golang builders to skip the snapshot release process after successful Konflux builds. Changes: - Update is_base_image() to return True for openshift-golang-builder images - Add test coverage for golang builder base image detection This ensures golang builders get the same snapshot-to-release workflow as other base images, fixing missing snapshot releases in the build pipeline. rh-pre-commit.version: 2.3.2 rh-pre-commit.check-secrets: ENABLED
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
WalkthroughThe Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
doozer/tests/test_image.py (1)
1412-1415: Add a regression case forbase_only: false+ golang builder name.Current test only checks missing
base_only. Add explicitbase_only: Falseto lock in the intended OR semantics and prevent regressions from early-return logic.Suggested test addition
golang_builder = Model({'name': GOLANG_BUILDER_IMAGE_NAME}) golang_data = Model({'key': 'golang-builder', 'data': golang_builder, 'filename': 'golang-builder.yaml'}) golang_metadata = ImageMetadata(runtime, golang_data) self.assertTrue(golang_metadata.is_base_image()) + + golang_builder_explicit_false = Model({'name': GOLANG_BUILDER_IMAGE_NAME, 'base_only': False}) + golang_false_data = Model( + {'key': 'golang-builder-false', 'data': golang_builder_explicit_false, 'filename': 'golang-builder-false.yaml'} + ) + golang_false_metadata = ImageMetadata(runtime, golang_false_data) + self.assertTrue(golang_false_metadata.is_base_image())🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@doozer/tests/test_image.py` around lines 1412 - 1415, Add a regression test that explicitly sets base_only: False to ensure the OR logic still treats the golang builder name as a base image; specifically, in the same test file use Model to create golang_builder (Model({'name': GOLANG_BUILDER_IMAGE_NAME, 'base_only': False})) or attach base_only False into golang_data (the Model passed into ImageMetadata), then construct ImageMetadata(runtime, golang_data) and assert that golang_metadata.is_base_image() is True to prevent early-return regressions in ImageMetadata.is_base_image.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@doozer/doozerlib/image.py`:
- Around line 1299-1304: The early return in is_base_image() uses "if
base_only_config not in [Missing, None]: return bool(base_only_config)" which
prevents the golang-builder check from running when base_only is explicitly
False; change the logic so that if base_only_config is truthy you return True,
otherwise continue to evaluate the golang-builder condition and return True if
self.config.name == GOLANG_BUILDER_IMAGE_NAME, finally return False if neither
is true—update the code around the base_only_config check in is_base_image() to
implement this OR semantics using the symbols base_only_config, is_base_image,
self.config.name, and GOLANG_BUILDER_IMAGE_NAME.
---
Nitpick comments:
In `@doozer/tests/test_image.py`:
- Around line 1412-1415: Add a regression test that explicitly sets base_only:
False to ensure the OR logic still treats the golang builder name as a base
image; specifically, in the same test file use Model to create golang_builder
(Model({'name': GOLANG_BUILDER_IMAGE_NAME, 'base_only': False})) or attach
base_only False into golang_data (the Model passed into ImageMetadata), then
construct ImageMetadata(runtime, golang_data) and assert that
golang_metadata.is_base_image() is True to prevent early-return regressions in
ImageMetadata.is_base_image.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 59a36af5-3c1e-43fe-908d-79427f2d0450
📒 Files selected for processing (2)
doozer/doozerlib/image.pydoozer/tests/test_image.py
|
@lgarciaaco: The following test failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
Summary
fix(doozer): recognize golang builders as base images for snapshot releases
Changes
The is_base_image() function was only checking for base_only: true configuration,
excluding golang builder images from snapshot-to-release workflow. This caused
golang builders to skip the snapshot release process after successful Konflux builds.
Changes:
This ensures golang builders get the same snapshot-to-release workflow as other
base images, fixing missing snapshot releases in the build pipeline.