Skip to content

Commit

Permalink
Merge pull request #2127 from SUSE/helm_version_check
Browse files Browse the repository at this point in the history
Helm version check
  • Loading branch information
dirkmueller authored Dec 9, 2024
2 parents d5a5c68 + 4fde5a8 commit 1189112
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 28 deletions.
2 changes: 1 addition & 1 deletion src/bci_build/package/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1456,7 +1456,6 @@ def generate_disk_size_constraints(size_gb: int) -> str:
from .appcontainers import ALERTMANAGER_CONTAINERS # noqa: E402
from .appcontainers import BLACKBOX_EXPORTER_CONTAINERS # noqa: E402
from .appcontainers import GRAFANA_CONTAINERS # noqa: E402
from .appcontainers import HELM_CONTAINERS # noqa: E402
from .appcontainers import NGINX_CONTAINERS # noqa: E402
from .appcontainers import PCP_CONTAINERS # noqa: E402
from .appcontainers import PROMETHEUS_CONTAINERS # noqa: E402
Expand All @@ -1475,6 +1474,7 @@ def generate_disk_size_constraints(size_gb: int) -> str:
from .gcc import GCC_CONTAINERS # noqa: E402
from .git import GIT_CONTAINERS # noqa: E402
from .golang import GOLANG_CONTAINERS # noqa: E402
from .helm import HELM_CONTAINERS # noqa: E402
from .kea import KEA_DHCP_CONTAINERS # noqa: E402
from .kiwi import KIWI_CONTAINERS # noqa: E402
from .mariadb import MARIADB_CLIENT_CONTAINERS # noqa: E402
Expand Down
26 changes: 0 additions & 26 deletions src/bci_build/package/appcontainers.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,32 +386,6 @@ def _get_nginx_kwargs(os_version: OsVersion):
]


HELM_CONTAINERS = [
ApplicationStackContainer(
name="helm",
pretty_name="Kubernetes Package Manager",
from_image=generate_from_image_tag(os_version, "bci-micro"),
os_version=os_version,
is_latest=os_version in CAN_BE_LATEST_OS_VERSION,
version=get_pkg_version("helm", os_version),
version_in_uid=False,
license="Apache-2.0",
package_list=[
Package(name, pkg_type=PackageType.BOOTSTRAP)
for name in (
"ca-certificates-mozilla",
"helm",
)
],
entrypoint=["/usr/bin/helm"],
cmd=["help"],
build_recipe_type=BuildType.KIWI,
support_level=SupportLevel.L3,
)
for os_version in ALL_NONBASE_OS_VERSIONS
]


TRIVY_CONTAINERS = [
ApplicationStackContainer(
name="trivy",
Expand Down
49 changes: 49 additions & 0 deletions src/bci_build/package/helm.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
"""BCI Container definition for the helm container."""

from bci_build.container_attributes import SupportLevel
from bci_build.os_version import ALL_NONBASE_OS_VERSIONS
from bci_build.os_version import CAN_BE_LATEST_OS_VERSION
from bci_build.package import ApplicationStackContainer
from bci_build.package import ParseVersion
from bci_build.package import Replacement
from bci_build.package.helpers import generate_from_image_tag
from bci_build.package.helpers import generate_package_version_check
from bci_build.package.versions import format_version
from bci_build.package.versions import get_pkg_version

HELM_CONTAINERS = [
ApplicationStackContainer(
name="helm",
pretty_name="Kubernetes Package Manager",
os_version=os_version,
is_latest=os_version in CAN_BE_LATEST_OS_VERSION,
version="%%helm_version%%",
tag_version=format_version(
helm_ver := get_pkg_version("helm", os_version), ParseVersion.MINOR
),
additional_versions=[
format_version(helm_ver, ParseVersion.MAJOR),
],
from_target_image=generate_from_image_tag(os_version, "bci-micro"),
build_stage_custom_end=generate_package_version_check(
"helm", helm_ver, ParseVersion.MINOR, use_target=True
),
version_in_uid=False,
license="Apache-2.0",
package_list=[
"ca-certificates-mozilla",
"helm",
],
replacements_via_service=[
Replacement(
regex_in_build_description="%%helm_version%%",
package_name="helm",
parse_version=ParseVersion.PATCH,
)
],
entrypoint=["/usr/bin/helm"],
cmd=["help"],
support_level=SupportLevel.L3,
)
for os_version in ALL_NONBASE_OS_VERSIONS
]
2 changes: 1 addition & 1 deletion src/bci_build/package/helm/README.md.j2
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ $ podman run --rm -it {{ image.pretty_reference }} <helm-sub-command>
For instance, to display the Helm version, run:
```ShellSession
$ podman run --rm -it {{ image.pretty_reference }} version {% raw %}--template='{{.Version}}'{% endraw %}
v{{ image.version }}
v{{ image.tag_version }}
```

Refer to the full list of Helm commands, flags and environment variables, in the [official Helm documentation](https://helm.sh/docs/helm/helm/).
Expand Down

0 comments on commit 1189112

Please sign in to comment.