Skip to content

Commit 42e2635

Browse files
committed
Add test_environment & test_marker properties to BCI
1 parent 10cb0c9 commit 42e2635

5 files changed

Lines changed: 34 additions & 0 deletions

File tree

src/bci_build/package/__init__.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
#: that would also remove some package owned directories (not %ghost)
4747
LOG_CLEAN: str = "rm -rf {/target,}/var/log/{alternatives.log,lastlog,tallylog,zypper.log,zypp/history,YaST2}"
4848

49+
4950
#: The string to use as a placeholder for the build source services to put in the release number
5051
_RELEASE_PLACEHOLDER = "%RELEASE%"
5152

@@ -311,6 +312,10 @@ class BaseContainerImage(abc.ABC):
311312
#: The registry implementation for which this container is being built.
312313
_publish_registry: Registry | None = None
313314

315+
#: A custom name for the test environment if it is not equal to the
316+
#: container image's name
317+
_custom_test_env: str = ""
318+
314319
@property
315320
def publish_registry(self) -> Registry:
316321
assert self._publish_registry
@@ -377,6 +382,20 @@ def oci_version(self) -> str:
377382
"""
378383
pass
379384

385+
@property
386+
@abc.abstractmethod
387+
def test_marker(self) -> str:
388+
"""The marker used to identify this image in BCI-Tests"""
389+
pass
390+
391+
@property
392+
def test_environment(self) -> str:
393+
"""The test environment name in BCI-Tests corresponding to this
394+
container image
395+
396+
"""
397+
return self._custom_test_env or self.name
398+
380399
@property
381400
def build_name(self) -> str | None:
382401
if self.build_tags:
@@ -1198,6 +1217,10 @@ def prepare_template(self) -> None:
11981217
def registry_prefix(self) -> str:
11991218
return self.publish_registry.registry_prefix(is_application=False)
12001219

1220+
@property
1221+
def test_marker(self) -> str:
1222+
return f"{self.name}_{self.stability_tag or self.version}"
1223+
12011224
@property
12021225
def image_type(self) -> ImageType:
12031226
return ImageType.SLE_BCI
@@ -1368,6 +1391,13 @@ def version_to_container_os_version(os_version: OsVersion) -> str:
13681391
return str(os_version)
13691392
return f"15.{os_version}"
13701393

1394+
@property
1395+
def test_marker(self) -> str:
1396+
return (
1397+
f"{self.name}_{OsContainer.version_to_container_os_version(self.os_version)}"
1398+
+ ("-ltss" if self.os_version.is_ltss else "")
1399+
)
1400+
13711401
@property
13721402
def uid(self) -> str:
13731403
return self.name

src/bci_build/package/node.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ def _get_node_kwargs(ver: _NODE_VERSIONS, os_version: OsVersion):
6060
"NODE_VERSION": ver,
6161
},
6262
"_min_release_counter": 30,
63+
"_custom_test_env": "node",
6364
}
6465

6566

src/bci_build/package/openjdk.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ def _get_openjdk_kwargs(
6868
"package_list": [f"java-{java_version}-openjdk-devel", "maven"],
6969
"cmd": ["/usr/bin/jshell"],
7070
"from_image": f"{_build_tag_prefix(os_version)}/openjdk:{java_version}",
71+
"_custom_test_env": "openjdk_devel",
7172
}
7273
return common | {
7374
"name": "openjdk",

src/bci_build/package/php.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ def _create_php_bci(
188188
},
189189
custom_end=custom_end,
190190
_min_release_counter=30,
191+
_custom_test_env="php",
191192
)
192193

193194

src/dotnet/updater.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ def __post_init__(self):
194194
self.custom_labelprefix_end = self.name.replace("-", ".")
195195
self.exclusive_arch = _DOTNET_EXCLUSIVE_ARCH
196196
self._min_release_counter = {"8.0": 20, "6.0": 32}[str(self.tag_version)]
197+
self._custom_test_env = "dotnet"
197198

198199
def _fetch_ordinary_package(self, pkg: str | Package) -> list[RpmPackage]:
199200
"""Fetches the package `pkg` from the microsoft .Net repository and

0 commit comments

Comments
 (0)