Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate crb yaml config #1429

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
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
801 changes: 445 additions & 356 deletions poetry.lock

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ oras = ">=0.2.2"
package = "bci_build.package:main"
scratch-build-bot = "staging.bot:main"
update-versions = "bci_build.package.versions:run_version_update"
dump-crb-yaml = "staging.release_bot:dump_data"

[tool.poetry.group.dev.dependencies]
ruff = ">=0.1.14"
Expand All @@ -32,6 +33,7 @@ pytest = ">=7.1"
types-aiofiles = ">=22.1"
pytest-asyncio = ">=0.20, != 0.22.0"
pyyaml = ">=6.0"
ruamel-yaml = ">=0.18.6"

[tool.ruff.lint]
select = [
Expand Down
32 changes: 32 additions & 0 deletions src/bci_build/package/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
#: that would also remove some package owned directories (not %ghost)
LOG_CLEAN: str = "rm -rf {/target,}/var/log/{alternatives.log,lastlog,tallylog,zypper.log,zypp/history,YaST2}"


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

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

#: A custom name for the test environment if it is not equal to the
#: container image's name
_custom_test_env: str = ""

@property
def publish_registry(self) -> Registry:
assert self._publish_registry
Expand Down Expand Up @@ -377,6 +382,20 @@ def oci_version(self) -> str:
"""
pass

@property
@abc.abstractmethod
def test_marker(self) -> str:
"""The marker used to identify this image in BCI-Tests"""
pass

@property
def test_environment(self) -> str:
"""The test environment name in BCI-Tests corresponding to this
container image

"""
return self._custom_test_env or self.name

@property
def build_name(self) -> str | None:
if self.build_tags:
Expand Down Expand Up @@ -1198,6 +1217,12 @@ def prepare_template(self) -> None:
def registry_prefix(self) -> str:
return self.publish_registry.registry_prefix(is_application=False)

@property
def test_marker(self) -> str:
if not self.version_in_uid:
return self.name
return f"{self.name}_{self.stability_tag or self.tag_version}"

@property
def image_type(self) -> ImageType:
return ImageType.SLE_BCI
Expand Down Expand Up @@ -1368,6 +1393,13 @@ def version_to_container_os_version(os_version: OsVersion) -> str:
return str(os_version)
return f"15.{os_version}"

@property
def test_marker(self) -> str:
return (
f"bci-{self.name}_{OsContainer.version_to_container_os_version(self.os_version)}"
+ ("-ltss" if self.os_version.is_ltss else "")
)

@property
def uid(self) -> str:
return self.name
Expand Down
16 changes: 4 additions & 12 deletions src/bci_build/package/appcontainers.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,9 @@ def _envsubst_pkg_name(os_version: OsVersion) -> str:
is_latest=os_version in CAN_BE_LATEST_OS_VERSION,
support_level=SupportLevel.L3,
version=(pcp_ver := get_pkg_version("pcp", os_version)),
tag_version=(pcp_major := format_version(pcp_ver, ParseVersion.MAJOR)),
version_in_uid=False,
additional_versions=[
format_version(pcp_ver, ParseVersion.MINOR),
format_version(pcp_ver, ParseVersion.MAJOR),
],
replacements_via_service=[
Replacement(
regex_in_build_description=f"%%pcp_{ver}%%",
package_name="pcp",
parse_version=ver,
)
for ver in (ParseVersion.MAJOR, ParseVersion.MINOR)
],
additional_versions=[format_version(pcp_ver, ParseVersion.MINOR), pcp_major],
license="(LGPL-2.1+ AND GPL-2.0+)",
package_list=[
"pcp",
Expand Down Expand Up @@ -105,6 +95,7 @@ def _envsubst_pkg_name(os_version: OsVersion) -> str:
is_latest=os_version in CAN_BE_LATEST_OS_VERSION,
version_in_uid=False,
support_level=SupportLevel.L3,
_custom_test_env="389ds",
oci_authors="[email protected]",
pretty_name="389 Directory Server",
package_list=["389-ds", "timezone", "openssl", "nss_synth"],
Expand Down Expand Up @@ -396,6 +387,7 @@ def _get_nginx_kwargs(os_version: OsVersion):
pretty_name="OCI Container Registry (Distribution)",
from_image=generate_from_image_tag(os_version, "bci-micro"),
os_version=os_version,
_custom_test_env="distribution",
is_latest=os_version in CAN_BE_LATEST_OS_VERSION,
version="%%registry_version%%",
version_in_uid=False,
Expand Down
2 changes: 2 additions & 0 deletions src/bci_build/package/basecontainers.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
pretty_name=f"{os_version.pretty_os_version_no_dash} Micro",
custom_description="A micro environment for containers {based_on_container}.",
from_image=None,
_custom_test_env="minimal",
build_recipe_type=BuildType.KIWI,
package_list=[
Package(name, pkg_type=PackageType.BOOTSTRAP)
Expand Down Expand Up @@ -309,6 +310,7 @@ def _get_minimal_kwargs(os_version: OsVersion):
logo_url="https://opensource.suse.com/bci/SLE_BCI_logomark_green.svg",
os_version=os_version,
supported_until=_SUPPORTED_UNTIL_SLE.get(os_version),
_custom_test_env="kernel_module",
is_latest=os_version in CAN_BE_LATEST_OS_VERSION,
package_list=(
[
Expand Down
1 change: 1 addition & 0 deletions src/bci_build/package/golang.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def _get_golang_kwargs(
"name": "golang",
"stability_tag": stability_tag,
"is_latest": (is_stable and (os_version in CAN_BE_LATEST_OS_VERSION)),
"_custom_test_env": "go",
"tag_version": f"{ver}{variant}",
"version": f"{golang_version_regex}{variant}",
"env": {
Expand Down
1 change: 1 addition & 0 deletions src/bci_build/package/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def _get_node_kwargs(ver: _NODE_VERSIONS, os_version: OsVersion):
"NODE_VERSION": ver,
},
"_min_release_counter": 30,
"_custom_test_env": "node",
}


Expand Down
1 change: 1 addition & 0 deletions src/bci_build/package/openjdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ def _get_openjdk_kwargs(
"package_list": [f"java-{java_version}-openjdk-devel", "maven"],
"cmd": ["/usr/bin/jshell"],
"from_image": f"{_build_tag_prefix(os_version)}/openjdk:{java_version}",
"_custom_test_env": "openjdk_devel",
}
return common | {
"name": "openjdk",
Expand Down
1 change: 1 addition & 0 deletions src/bci_build/package/php.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ def _create_php_bci(
},
custom_end=custom_end,
_min_release_counter=30,
_custom_test_env="php",
)


Expand Down
1 change: 1 addition & 0 deletions src/dotnet/updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ def __post_init__(self):
self._min_release_counter = {"8.0": 20, "6.0": 32, "9.0": 1}[
str(self.tag_version)
]
self._custom_test_env = "dotnet"

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