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
8 changes: 5 additions & 3 deletions src/bci_build/os_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def os_version(self) -> str:
``latest``).

"""
if self.is_sle15:
if self.is_sle15 and not self.is_ltss:
return f"15.{str(self.value)}"
if self.value == OsVersion.SL16_0.value:
return "16.0"
Expand All @@ -139,6 +139,8 @@ def has_container_suseconnect(self) -> bool:

@property
def eula_package_names(self) -> tuple[str, ...]:
if self.is_ltss:
return ("skelcd-EULA-sles",)
if self.is_sle15:
return ("skelcd-EULA-bci",)
if self.is_sl16:
Expand All @@ -152,7 +154,7 @@ def release_package_names(self) -> tuple[str, ...]:
if self.is_sl16:
return ("SLES-release",)
if self.is_ltss:
return ("sles-ltss-release",)
return ("sles-ltss-release", "sles-release")

assert self.is_sle15
return ("sles-release",)
Expand Down Expand Up @@ -193,7 +195,7 @@ def libexecdir(self) -> str:
]

# List of SPs that are already under LTSS
ALL_OS_LTSS_VERSIONS: list[OsVersion] = [OsVersion.SP3, OsVersion.SP4]
ALL_OS_LTSS_VERSIONS: list[OsVersion] = [OsVersion.SP3, OsVersion.SP4, OsVersion.SP5]

# joint set of BASE and NON_BASE versions
ALL_OS_VERSIONS: set[OsVersion] = {
Expand Down
16 changes: 10 additions & 6 deletions src/bci_build/package/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,8 @@ class StableUser:
def _build_tag_prefix(os_version: OsVersion) -> str:
if os_version == OsVersion.TUMBLEWEED:
return "opensuse/bci"
if os_version == OsVersion.SP3:
return "suse/ltss/sle15.3"
if os_version == OsVersion.SP4:
return "suse/ltss/sle15.4"
if os_version.is_sle15 and os_version.is_ltss:
return "suse/ltss/sle%OS_VERSION_ID_SP%"

return "bci"

Expand Down Expand Up @@ -389,7 +387,7 @@ def build_version(self) -> str | None:
if self.build_recipe_type == BuildType.KIWI:
return f"{str(datetime.datetime.now().year)}.0"
elif self.os_version.is_sle15:
if isinstance(self, OsContainer):
if not self.os_version.is_ltss and isinstance(self, OsContainer):
return f"15.{int(self.os_version.value)}.0"
return f"15.{int(self.os_version.value)}"
elif self.os_version.is_sl16:
Expand Down Expand Up @@ -926,6 +924,8 @@ def title(self) -> str:
:py:attr:`~OsVersion.distribution_base_name`.

"""
if self.os_version.is_ltss:
return f"%OS_PRETTY_NAME% LTSS {self.pretty_name}"
return f"{self.os_version.distribution_base_name} BCI {self.pretty_name}"

@property
Expand Down Expand Up @@ -1388,7 +1388,11 @@ def uid(self) -> str:
@property
def oci_version(self) -> str:
# use the more standard VERSION-RELEASE scheme we use everywhere else for new containers
if self.os_version not in (OsVersion.SP4, OsVersion.SP5, OsVersion.SP6):
if self.os_version.is_ltss or self.os_version not in (
OsVersion.SP4,
OsVersion.SP5,
OsVersion.SP6,
):
return f"%OS_VERSION_ID_SP%-{_RELEASE_PLACEHOLDER}"

return f"%OS_VERSION_ID_SP%.{_RELEASE_PLACEHOLDER}"
Expand Down
79 changes: 63 additions & 16 deletions src/bci_build/package/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

from bci_build.container_attributes import Arch
from bci_build.container_attributes import BuildType
from bci_build.container_attributes import ImageType
from bci_build.container_attributes import PackageType
from bci_build.container_attributes import SupportLevel
from bci_build.os_version import CAN_BE_LATEST_BASE_OS_VERSION
Expand Down Expand Up @@ -53,14 +54,17 @@ def _get_base_config_sh_script(os_version: OsVersion) -> str:
#--------------------------------------
sed -i 's/.*rpm.install.excludedocs.*/rpm.install.excludedocs = yes/g' /etc/zypp/zypp.conf

{% if os_version.is_sle15 and not os_version.is_ltss -%}
#======================================
# Configure SLE BCI repositories
#--------------------------------------
{% if os_version.is_sle15 and not os_version.is_ltss -%}
zypper -n ar --refresh --gpgcheck --priority 100 --enable 'https://public-dl.suse.com/SUSE/Products/SLE-BCI/$releasever_major-SP$releasever_minor/$basearch/product/' SLE_BCI
zypper -n ar --refresh --gpgcheck --priority 100 --disable 'https://public-dl.suse.com/SUSE/Products/SLE-BCI/$releasever_major-SP$releasever_minor/$basearch/product_debug/' SLE_BCI_debug
zypper -n ar --refresh --gpgcheck --priority 100 --disable 'https://public-dl.suse.com/SUSE/Products/SLE-BCI/$releasever_major-SP$releasever_minor/$basearch/product_source/' SLE_BCI_source
{%- elif os_version.is_sl16 and not os_version.is_ltss -%}
#======================================
# Configure SLE BCI repositories
#--------------------------------------
zypper -n ar --refresh --gpgcheck --priority 100 --enable 'https://public-dl.suse.com/SUSE/Products/SLE-BCI/$releasever_major.$releasever_minor/$basearch/product/' SLE_BCI
zypper -n ar --refresh --gpgcheck --priority 100 --disable 'https://public-dl.suse.com/SUSE/Products/SLE-BCI/$releasever_major.$releasever_minor/$basearch/product_debug/' SLE_BCI_debug
zypper -n ar --refresh --gpgcheck --priority 100 --disable 'https://public-dl.suse.com/SUSE/Products/SLE-BCI/$releasever_major.$releasever_minor/$basearch/product_source/' SLE_BCI_source
Expand Down Expand Up @@ -126,18 +130,51 @@ class Sles15Image(OsContainer):
@property
def build_tags(self) -> list[str]:
tags: list[str] = []
if self.os_version.is_sle15:
if self.os_version.is_ltss:
tags.extend(
(
f"suse/ltss/sle%OS_VERSION_ID_SP%/sle15:{self.image_ref_name}",
"suse/ltss/sle%OS_VERSION_ID_SP%/sle15:%OS_VERSION_ID_SP%",
"suse/ltss/sle%OS_VERSION_ID_SP%/sle15:latest",
f"suse/ltss/sle%OS_VERSION_ID_SP%/bci-base:{self.image_ref_name}",
"suse/ltss/sle%OS_VERSION_ID_SP%/bci-base:%OS_VERSION_ID_SP%",
)
)
elif self.os_version.is_sle15:
tags.extend(
("suse/sle15:%OS_VERSION_ID_SP%", f"suse/sle15:{self.image_ref_name}")
)
if self.os_version in CAN_BE_LATEST_BASE_OS_VERSION:
tags.append("suse/sle15:latest")
tags += super().build_tags
tags += super().build_tags
return tags

@property
def image_type(self) -> ImageType:
if self.os_version.is_ltss:
return ImageType.LTSS
return super().image_type

@property
def uid(self) -> str:
return "sles15"
return "sles15-ltss" if self.os_version.is_ltss else "sles15"

@property
def eula(self) -> str:
if self.os_version.is_ltss:
return "sle-eula"
return super().eula

@property
def registry_prefix(self) -> str:
if self.os_version.is_ltss:
if self.os_version == OsVersion.SP3:
return "suse/ltss/sle15.3"
if self.os_version == OsVersion.SP4:
return "suse/ltss/sle15.4"
if self.os_version == OsVersion.SP5:
return "suse/ltss/sle15.5"
return super().registry_prefix


def _get_base_kwargs(os_version: OsVersion) -> dict:
Expand All @@ -149,15 +186,21 @@ def _get_base_kwargs(os_version: OsVersion) -> dict:

return {
"name": "base",
"pretty_name": "%OS_VERSION_NO_DASH% Base",
"pretty_name": ("Base" if os_version.is_ltss else "%OS_VERSION_NO_DASH% Base"),
"package_name": package_name,
"custom_description": "Image for containers based on %OS_PRETTY_NAME%.",
"logo_url": "https://opensource.suse.com/bci/SLE_BCI_logomark_green.svg",
"logo_url": (
None
if os_version.is_ltss
else "https://opensource.suse.com/bci/SLE_BCI_logomark_green.svg"
),
"build_recipe_type": BuildType.KIWI,
"from_image": None,
"os_version": os_version,
"support_level": SupportLevel.L3,
"supported_until": _SUPPORTED_UNTIL_SLE.get(os_version),
"supported_until": (
_SUPPORTED_UNTIL_SLE.get(os_version) if not os_version.is_ltss else None
),
# we need to exclude i586 and other ports arches from building base images
"exclusive_arch": [Arch.AARCH64, Arch.X86_64, Arch.PPC64LE, Arch.S390X],
"kiwi_ignore_packages": ["rpm"] if os_version.is_sle15 else [],
Expand All @@ -177,26 +220,28 @@ def _get_base_kwargs(os_version: OsVersion) -> dict:
"gzip",
"netcfg",
"openssl-3",
"patterns-base-minimal_base",
"tar",
"timezone",
# for run.oci.keep_original_groups=1 (see bsc#1212118)
"user(nobody)",
*os_version.eula_package_names,
]
# for run.oci.keep_original_groups=1 (see bsc#1212118)
+ (["user(nobody)"] if not os_version.is_ltss else [])
+ (
[
"sle-module-basesystem-release",
"sle-module-server-applications-release",
"sle-module-python3-release",
]
if os_version.is_sle15
if os_version.is_sle15 and not os_version.is_ltss
else []
)
+ (
["openSUSE-build-key"]
if os_version.is_tumbleweed
else ["suse-build-key"]
)
+ (["procps"] if os_version in (OsVersion.SP5,) else [])
)
]
+ [
Expand All @@ -220,11 +265,6 @@ def _get_base_kwargs(os_version: OsVersion) -> dict:
if os_version.is_sle15
else ["glibc-locale-base"]
)
+ (
["patterns-base-minimal_base"]
if os_version not in (OsVersion.SP5,)
else []
)
+ [*os_version.release_package_names]
)
]
Expand All @@ -242,7 +282,14 @@ def _get_base_kwargs(os_version: OsVersion) -> dict:

# TODO merge in tumbleweed changes and switch to ALL_BASE_OS_VERSIONS
BASE_CONTAINERS = [
Sles15Image(**_get_base_kwargs(os_ver)) for os_ver in (OsVersion.SP6, OsVersion.SP7)
Sles15Image(**_get_base_kwargs(os_ver))
for os_ver in (
OsVersion.SP3,
OsVersion.SP4,
OsVersion.SP5,
OsVersion.SP6,
OsVersion.SP7,
)
] + [
OsContainer(**_get_base_kwargs(os_version=os_ver))
for os_ver in (OsVersion.SL16_0, OsVersion.SL16_1)
Expand Down
16 changes: 14 additions & 2 deletions src/bci_build/package/base/README.md.j2
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{%- if image.os_version.is_ltss -%}
# SLE {{ image.os_version.pretty_os_version_no_dash }} LTSS Base Container Image
{%- else -%}
# SLE BCI {{ image.os_version.pretty_os_version_no_dash }} Base Container Image
{%- endif %}
{% include 'badges.j2' %}

## Description
Expand All @@ -15,8 +19,11 @@ testing environment.

## Usage

The container image comes with the `zypper` package manager, the free `SLE_BCI`
repository and the `container-suseconnect` utility. This allows you to access
The container image comes with the `zypper` package manager
{%- if not image.os_version.is_ltss %}
, the free `SLE_BCI` repository
{%- endif %}
and the `container-suseconnect` utility. This allows you to access
the full SLE repositories with a valid SLE subscription. The image is designed
to be extended by installing packages required for your specific scenario.

Expand Down Expand Up @@ -47,11 +54,13 @@ $ podman run -ti --rm {{ image.pretty_reference }}
{% set ref_list = image.pretty_reference.split(":") %}{{ ref_list[0] }}
```

{%- if not image.os_version.is_ltss %}
### The SLE_BCI repository

The container image comes with the free `SLE_BCI` repository. The repository
provides the latest version of a subset of packages from SUSE Linux Enterprise.
These packages are available at no cost and can be freely redistributed.
{%- endif %}

### Getting access to the SLE repositories

Expand All @@ -65,4 +74,7 @@ section in the container guide or in the tutorial ["How to use
container-suseconnect"](https://opensource.suse.com/bci-docs/guides/container-suseconnect/).


{% if image.os_version.is_ltss %}
{% include 'access_protected_images.j2' %}
{%- endif %}
{% include 'licensing_and_eula.j2' %}
12 changes: 6 additions & 6 deletions tests/test_project_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,17 @@
</project>""",
),
(
OsVersion.SP5,
OsVersion.SP6,
ProjectType.CR,
None,
(prj_name := f"home:{_OSC_USERNAME}:BCI:CR:SLE-15-SP5"),
(prj_name := f"home:{_OSC_USERNAME}:BCI:CR:SLE-15-SP6"),
f"""<project name="{prj_name}">
<title>Continuous Rebuild project for SLE 15 SP5</title>
<description>Continuous Rebuild project for SLE 15 SP5</description>
<title>Continuous Rebuild project for SLE 15 SP6</title>
<description>Continuous Rebuild project for SLE 15 SP6</description>
<person userid="avicenzi" role="maintainer"/>
<person userid="{_OSC_USERNAME}" role="maintainer"/>

<scmsync>https://github.com/SUSE/bci-dockerfile-generator#sle15-sp5</scmsync>
<scmsync>https://github.com/SUSE/bci-dockerfile-generator#sle15-sp6</scmsync>
<build>
<enable/>
</build>
Expand All @@ -86,7 +86,7 @@
</debuginfo>
<repository name="standard">
<path project="SUSE:Registry" repository="standard"/>
<path project="SUSE:SLE-15-SP5:Update" repository="standard"/>
<path project="SUSE:SLE-15-SP6:Update" repository="standard"/>
<arch>x86_64</arch>
<arch>aarch64</arch>
<arch>s390x</arch>
Expand Down