Skip to content

Commit

Permalink
fix: skip handling local parent image
Browse files Browse the repository at this point in the history
KFLUXBUGS-1293

Signed-off-by: Chenxiong Qi <[email protected]>
  • Loading branch information
tkdchen committed Jun 18, 2024
1 parent 224278f commit f8f8f54
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
7 changes: 7 additions & 0 deletions source-container-build/app/source_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,14 @@ def resolve_source_image_by_manifest(image: str) -> str | None:
log.info("Source container image %s does not exist.", source_image)


def is_local_image(image: str) -> bool:
return image.startswith("localhost/")


def resolve_source_image(binary_image: str, registries_allow_list: list[str]) -> str | None:
if is_local_image(binary_image):
logger.info("Skip handling local image %s.", binary_image)
return None
allowed = urlparse("docker://" + binary_image).netloc in registries_allow_list
if allowed:
return resolve_source_image_by_version_release(binary_image)
Expand Down
10 changes: 10 additions & 0 deletions source-container-build/app/test_source_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import subprocess
import tarfile
import json
import textwrap
import unittest
import zipfile
from unittest.mock import patch, MagicMock, Mock
Expand Down Expand Up @@ -959,6 +960,15 @@ def test_resolve_konflux_source_image(self):
expect_parent_image_sources_included=True,
)

def test_skip_handling_local_image(self):
parent_images = textwrap.dedent(
"""\
registry.io/ubi9/ubi:9.3-1@sha256:123
localhost/konflux-final-image@sha256:123
"""
)
self._test_include_sources(parent_images=parent_images, expect_parent_image_sources_included=False)

@patch("source_build.run")
def test_create_a_temp_dir_as_workspace(self, run):
def run_side_effect(cmd, **kwargs):
Expand Down

0 comments on commit f8f8f54

Please sign in to comment.