Skip to content
Merged
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
3 changes: 3 additions & 0 deletions artcommon/artcommonlib/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
"logging": "art-logging-tenant",
"mta": "art-mta-tenant",
"oadp": "art-oadp-tenant",
"oc-mirror": "ocp-art-tenant",
"ocp": "ocp-art-tenant",
"openshift-logging": "art-logging-tenant",
"quay": "art-quay-tenant",
Expand Down Expand Up @@ -133,6 +134,8 @@
"logging": "LOGGING_KONFLUX_SA_KUBECONFIG",
"mta": "MTA_KONFLUX_SA_KUBECONFIG",
"oadp": "OADP_KONFLUX_SA_KUBECONFIG",
"oc-mirror": "KONFLUX_SA_KUBECONFIG",
Comment thread
coderabbitai[bot] marked this conversation as resolved.
"oc-mirror-2.0": "KONFLUX_SA_KUBECONFIG",
"ocp": "KONFLUX_SA_KUBECONFIG",
"openshift-logging": "LOGGING_KONFLUX_SA_KUBECONFIG",
"quay": "QUAY_KONFLUX_SA_KUBECONFIG",
Expand Down
17 changes: 17 additions & 0 deletions artcommon/tests/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,23 @@ def test_validate_bridge_release_basis_group_rejects_mismatch(self):
# Use product-based resolvers: resolve_konflux_kubeconfig_by_product() and resolve_konflux_namespace_by_product()


class TestProductBasedResolution(unittest.TestCase):
"""Test product-based configuration resolution"""

@patch.dict("os.environ", {"KONFLUX_SA_KUBECONFIG": "/path/to/kubeconfig"})
def test_product_kubeconfig_resolution(self):
# Test that both oc-mirror and oc-mirror-2.0 resolve to the same KONFLUX_SA_KUBECONFIG path
self.assertEqual(util.resolve_konflux_kubeconfig_by_product("oc-mirror"), "/path/to/kubeconfig")
self.assertEqual(util.resolve_konflux_kubeconfig_by_product("oc-mirror-2.0"), "/path/to/kubeconfig")

# Test that ocp also resolves to KONFLUX_SA_KUBECONFIG path
self.assertEqual(util.resolve_konflux_kubeconfig_by_product("ocp"), "/path/to/kubeconfig")

def test_product_kubeconfig_resolution_precedence(self):
# Explicitly provided kubeconfig should take precedence
self.assertEqual(util.resolve_konflux_kubeconfig_by_product("oc-mirror-2.0", "/custom/path"), "/custom/path")


class TestExtractRelatedImagesFromFBC(unittest.TestCase):
"""Tests for extract_related_images_from_fbc function with artifact fallback logic"""

Expand Down