Skip to content

fix(doozer): recognize golang builders as base images for snapshot releases#2693

Open
lgarciaaco wants to merge 1 commit intoopenshift-eng:mainfrom
lgarciaaco:feat/golang-builder-snapshot-release
Open

fix(doozer): recognize golang builders as base images for snapshot releases#2693
lgarciaaco wants to merge 1 commit intoopenshift-eng:mainfrom
lgarciaaco:feat/golang-builder-snapshot-release

Conversation

@lgarciaaco
Copy link
Copy Markdown
Contributor

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:

  • 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.

…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
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci bot commented Apr 1, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign vfreex for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 1, 2026

Walkthrough

The is_base_image() method in ImageMetadata has been extended to identify golang builder images as base images by checking if the image's config name matches GOLANG_BUILDER_IMAGE_NAME. Supporting test case added.

Changes

Cohort / File(s) Summary
Implementation
doozer/doozerlib/image.py
Added import of GOLANG_BUILDER_IMAGE_NAME and modified is_base_image() logic to return True for golang builder images. Updated docstring to reflect new "base_only OR golang builder" definition.
Tests
doozer/tests/test_image.py
Extended test_is_base_image() to import GOLANG_BUILDER_IMAGE_NAME and added test case asserting golang builder images return True for is_base_image().

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

Copy link
Copy Markdown
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.

Actionable comments posted: 1

🧹 Nitpick comments (1)
doozer/tests/test_image.py (1)

1412-1415: Add a regression case for base_only: false + golang builder name.

Current test only checks missing base_only. Add explicit base_only: False to 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

📥 Commits

Reviewing files that changed from the base of the PR and between de37e29 and 0fdc8d7.

📒 Files selected for processing (2)
  • doozer/doozerlib/image.py
  • doozer/tests/test_image.py

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci bot commented Apr 1, 2026

@lgarciaaco: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/security 0fdc8d7 link false /test security

Full PR test history. Your PR dashboard.

Details

Instructions 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.

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