Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions doozer/doozerlib/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from typing import Any, Dict, List, Optional, Set, Tuple, cast

from artcommonlib import util as artlib_util
from artcommonlib.constants import GOLANG_BUILDER_IMAGE_NAME
from artcommonlib.konflux.konflux_build_record import ArtifactType, Engine, KonfluxBuildOutcome, KonfluxBuildRecord
from artcommonlib.model import Missing, Model
from artcommonlib.pushd import Dir
Expand Down Expand Up @@ -1286,16 +1287,22 @@ def is_base_image(self) -> bool:
"""
Determines whether this image is configured as a base image.

Base images are identified by the base_only: true configuration field.
These images require special snapshot-to-release workflow processing
to generate dual URLs for streams.yml updates.
Base images are identified by the base_only: true configuration field
or by being a golang builder image. These images require special
snapshot-to-release workflow processing to generate dual URLs for
streams.yml updates.

Returns:
bool: True if this is a base image (base_only: true), False otherwise
bool: True if this is a base image (base_only: true) or golang builder, False otherwise
"""
base_only_config = getattr(self.config, 'base_only', Missing)
if base_only_config not in [Missing, None]:
return bool(base_only_config)

# Golang builders also need snapshot-to-release workflow
if hasattr(self.config, 'name') and self.config.name == GOLANG_BUILDER_IMAGE_NAME:
return True

return False

def is_snapshot_release_enabled(self) -> bool:
Expand Down
6 changes: 6 additions & 0 deletions doozer/tests/test_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -1392,6 +1392,7 @@ def test_get_required_artifacts_missing_resources(self):
self.assertEqual(result, [])

def test_is_base_image(self):
from artcommonlib.constants import GOLANG_BUILDER_IMAGE_NAME
from artcommonlib.model import Model

runtime = MagicMock()
Expand All @@ -1408,6 +1409,11 @@ def test_is_base_image(self):
regular_metadata = ImageMetadata(runtime, regular_data)
self.assertFalse(regular_metadata.is_base_image())

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())

def test_is_snapshot_release_enabled(self):
from artcommonlib.model import Model

Expand Down
Loading