Skip to content

Commit

Permalink
Merge pull request #638 from SUSE/lts_container
Browse files Browse the repository at this point in the history
Add support for LTS container handling
  • Loading branch information
dirkmueller authored Sep 15, 2023
2 parents 2942a4b + 0a17d39 commit 657dcad
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 3 deletions.
34 changes: 33 additions & 1 deletion src/bci_build/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,11 @@ def pretty_os_version_no_dash(self) -> str:

#: Operating system versions that have the label ``com.suse.release-stage`` set
#: to ``released``.
RELEASED_OS_VERSIONS = [OsVersion.SP4, OsVersion.SP5, OsVersion.TUMBLEWEED]
RELEASED_OS_VERSIONS = [OsVersion.SP3] + [
OsVersion.SP4,
OsVersion.SP5,
OsVersion.TUMBLEWEED,
]

# For which versions to create Application and Language Containers?
ALL_NONBASE_OS_VERSIONS = [OsVersion.SP5, OsVersion.SP6, OsVersion.TUMBLEWEED]
Expand Down Expand Up @@ -233,6 +237,8 @@ def _build_tag_prefix(os_version: OsVersion) -> str:
return "opensuse/bci"
if os_version == OsVersion.BASALT:
return "alp/bci"
if os_version == OsVersion.SP3:
return "suse/ltss/sle15.3"
return "bci"


Expand Down Expand Up @@ -261,6 +267,9 @@ class ImageProperties:
#: Url to the vendor's home page
url: str

#: The EULA identifier to set
eula: str

#: Url to learn about the support lifecycle of the image
lifecycle_url: str

Expand All @@ -284,6 +293,7 @@ class ImageProperties:
vendor="openSUSE Project",
registry="registry.opensuse.org",
url="https://www.opensuse.org",
eula="sle-bci",
lifecycle_url="https://en.opensuse.org/Lifetime",
label_prefix="org.opensuse",
distribution_base_name="openSUSE Tumbleweed",
Expand All @@ -297,18 +307,34 @@ class ImageProperties:
vendor="SUSE LLC",
registry="registry.suse.com",
url="https://www.suse.com/products/server/",
eula="sle-bci",
lifecycle_url="https://www.suse.com/lifecycle#suse-linux-enterprise-server-15",
label_prefix="com.suse",
distribution_base_name="SLE",
build_tag_prefix=_build_tag_prefix(OsVersion.SP5),
application_container_build_tag_prefix="suse",
)

#: Image properties for SUSE Linux Enterprise 15 SP3 LTSS images
_SLE_15_SP3_LTSS_IMAGE_PROPS = ImageProperties(
maintainer="SUSE LLC (https://www.suse.com/)",
vendor="SUSE LLC",
registry="registry.suse.com",
url="https://www.suse.com/products/server/",
eula="sle-eula",
lifecycle_url="https://www.suse.com/lifecycle#suse-linux-enterprise-server-15",
label_prefix="com.suse",
distribution_base_name="SLE LTSS",
build_tag_prefix=_build_tag_prefix(OsVersion.SP3),
application_container_build_tag_prefix="suse",
)

_BASALT_IMAGE_PROPS = ImageProperties(
maintainer="SUSE LLC (https://www.suse.com/)",
vendor="SUSE LLC",
registry="registry.suse.com",
url="https://susealp.io/",
eula="sle-bci",
lifecycle_url="https://www.suse.com/lifecycle",
label_prefix="com.suse.basalt",
distribution_base_name="Basalt Project",
Expand Down Expand Up @@ -481,6 +507,8 @@ def __post_init__(self) -> None:
self._image_properties = _OPENSUSE_IMAGE_PROPS
elif self.os_version == OsVersion.BASALT:
self._image_properties = _BASALT_IMAGE_PROPS
elif self.os_version == OsVersion.SP3:
self._image_properties = _SLE_15_SP3_LTSS_IMAGE_PROPS
else:
self._image_properties = _SLE_IMAGE_PROPS

Expand Down Expand Up @@ -518,6 +546,10 @@ def build_version(self) -> Optional[str]:
return f"15.{epoch}{int(self.os_version.value)}"
return None

@property
def eula(self) -> str:
return self._image_properties.eula

@property
def lifecycle_url(self) -> str:
return self._image_properties.lifecycle_url
Expand Down
4 changes: 2 additions & 2 deletions src/bci_build/templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
{%- if image.supported_until %}
LABEL com.suse.supportlevel.until="{{ image.supported_until }}"
{%- endif %}
LABEL com.suse.eula="sle-bci"
LABEL com.suse.eula="{{ image.eula }}"
LABEL com.suse.lifecycle-url="{{ image.lifecycle_url }}"
LABEL com.suse.image-type="{{ image.image_type }}"
LABEL com.suse.release-stage="{{ image.release_stage }}"{% endif %}
Expand Down Expand Up @@ -92,7 +92,7 @@
<label name="com.suse.supportlevel.until" value="{{ image.supported_until }}"/>
{%- endif %}
<label name="com.suse.image-type" value="{{ image.image_type }}"/>
<label name="com.suse.eula" value="sle-bci"/>{% endif %}
<label name="com.suse.eula" value="{{ image.eula }}"/>{% endif %}
<label name="{% if image.is_opensuse %}org.opensuse{% else %}com.suse{% endif %}.release-stage" value="{{ image.release_stage }}"/>
<label name="{% if image.is_opensuse %}org.opensuse{% else %}com.suse{% endif %}.lifecycle-url" value="{{ image.lifecycle_url }}"/>
{{- image.extra_label_xml_lines }}
Expand Down

0 comments on commit 657dcad

Please sign in to comment.