From a172082161b0e35620d58db0743080a56644cc34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dirk=20M=C3=BCller?= Date: Mon, 25 Nov 2024 11:43:19 +0100 Subject: [PATCH 1/2] Split git container into its own top level module --- src/bci_build/package/__init__.py | 2 +- src/bci_build/package/appcontainers.py | 43 ------------------- src/bci_build/package/git.py | 58 ++++++++++++++++++++++++++ 3 files changed, 59 insertions(+), 44 deletions(-) create mode 100644 src/bci_build/package/git.py diff --git a/src/bci_build/package/__init__.py b/src/bci_build/package/__init__.py index be863fbce..fdbfd4e7f 100644 --- a/src/bci_build/package/__init__.py +++ b/src/bci_build/package/__init__.py @@ -1438,7 +1438,6 @@ def generate_disk_size_constraints(size_gb: int) -> str: from .apache_tomcat import TOMCAT_CONTAINERS # noqa: E402 from .appcontainers import ALERTMANAGER_CONTAINERS # noqa: E402 from .appcontainers import BLACKBOX_EXPORTER_CONTAINERS # noqa: E402 -from .appcontainers import GIT_CONTAINERS # noqa: E402 from .appcontainers import GRAFANA_CONTAINERS # noqa: E402 from .appcontainers import HELM_CONTAINERS # noqa: E402 from .appcontainers import NGINX_CONTAINERS # noqa: E402 @@ -1457,6 +1456,7 @@ def generate_disk_size_constraints(size_gb: int) -> str: from .basecontainers import MINIMAL_CONTAINERS # noqa: E402 from .cosign import COSIGN_CONTAINERS # noqa: E402 from .gcc import GCC_CONTAINERS # noqa: E402 +from .git import GIT_CONTAINERS # noqa: E402 from .golang import GOLANG_CONTAINERS # noqa: E402 from .kea import KEA_DHCP_CONTAINERS # noqa: E402 from .kiwi import KIWI_CONTAINERS # noqa: E402 diff --git a/src/bci_build/package/appcontainers.py b/src/bci_build/package/appcontainers.py index c924eff4a..b26046d92 100644 --- a/src/bci_build/package/appcontainers.py +++ b/src/bci_build/package/appcontainers.py @@ -345,49 +345,6 @@ def _get_nginx_kwargs(os_version: OsVersion): for os_version in ALL_NONBASE_OS_VERSIONS ] -GIT_CONTAINERS = [ - ApplicationStackContainer( - name="git", - os_version=os_version, - support_level=SupportLevel.L3, - pretty_name=f"{os_version.pretty_os_version_no_dash} with Git", - custom_description="A micro environment with Git {based_on_container}.", - from_image=generate_from_image_tag(os_version, "bci-micro"), - build_recipe_type=BuildType.KIWI, - is_latest=os_version in CAN_BE_LATEST_OS_VERSION, - version="%%git_version%%", - tag_version=format_version( - get_pkg_version("git", os_version), ParseVersion.MINOR - ), - additional_versions=["%%git_major_version%%"], - version_in_uid=False, - replacements_via_service=[ - Replacement( - regex_in_build_description="%%git_version%%", - package_name="git-core", - ), - Replacement( - regex_in_build_description="%%git_major_version%%", - package_name="git-core", - parse_version=ParseVersion.MAJOR, - ), - ], - license="GPL-2.0-only", - package_list=[ - Package(name, pkg_type=PackageType.BOOTSTRAP) - for name in ( - "git-core", - "openssh-clients", - ) - + (() if os_version == OsVersion.TUMBLEWEED else ("skelcd-EULA-bci",)) - ], - # intentionally empty - config_sh_script=""" -""", - ) - for os_version in ALL_NONBASE_OS_VERSIONS -] - REGISTRY_CONTAINERS = [ ApplicationStackContainer( diff --git a/src/bci_build/package/git.py b/src/bci_build/package/git.py new file mode 100644 index 000000000..41a097a6d --- /dev/null +++ b/src/bci_build/package/git.py @@ -0,0 +1,58 @@ +"""Container description for the Git application container.""" + +from bci_build.container_attributes import BuildType +from bci_build.container_attributes import PackageType +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.os_version import OsVersion +from bci_build.package import ApplicationStackContainer +from bci_build.package import Package +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.versions import format_version +from bci_build.package.versions import get_pkg_version + +GIT_CONTAINERS = [ + ApplicationStackContainer( + name="git", + os_version=os_version, + support_level=SupportLevel.L3, + pretty_name=f"{os_version.pretty_os_version_no_dash} with Git", + custom_description="A micro environment with Git {based_on_container}.", + from_image=generate_from_image_tag(os_version, "bci-micro"), + build_recipe_type=BuildType.KIWI, + is_latest=os_version in CAN_BE_LATEST_OS_VERSION, + version="%%git_version%%", + tag_version=format_version( + get_pkg_version("git", os_version), ParseVersion.MINOR + ), + additional_versions=["%%git_major_version%%"], + version_in_uid=False, + replacements_via_service=[ + Replacement( + regex_in_build_description="%%git_version%%", + package_name="git-core", + ), + Replacement( + regex_in_build_description="%%git_major_version%%", + package_name="git-core", + parse_version=ParseVersion.MAJOR, + ), + ], + license="GPL-2.0-only", + package_list=[ + Package(name, pkg_type=PackageType.BOOTSTRAP) + for name in ( + "git-core", + "openssh-clients", + ) + + (() if os_version == OsVersion.TUMBLEWEED else ("skelcd-EULA-bci",)) + ], + # intentionally empty + config_sh_script=""" +""", + ) + for os_version in ALL_NONBASE_OS_VERSIONS +] From 5edfcfbd7ba752fe8e5990dfe4f184d85a063501 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dirk=20M=C3=BCller?= Date: Mon, 25 Nov 2024 11:59:10 +0100 Subject: [PATCH 2/2] Add README Co-authored-by: Dmitri Popov --- src/bci_build/package/git/README.md.j2 | 29 ++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/bci_build/package/git/README.md.j2 diff --git a/src/bci_build/package/git/README.md.j2 b/src/bci_build/package/git/README.md.j2 new file mode 100644 index 000000000..43db998ab --- /dev/null +++ b/src/bci_build/package/git/README.md.j2 @@ -0,0 +1,29 @@ +# {{ image.title }}: Git application container +{% include 'badges.j2' %} + + +## Description + +Git is a distributed version control system that tracks +versions of files. Git is primarily designed for controlling source code in collaborative software development. + + +## Usage + +This container provides the {{ image.publish_registry.vendor }} version of Git. + +Example of using Git container: + +```ShellSession +$ podman run {{ image.pretty_reference }} git help +``` + +As Git requires a repository, the container +does not explicitly set an entrypoint. This way, you can launch the container in +interactive mode to clone a repository and work on it. To avoid losing all your changes when exiting the container, use a persistent volume mount on launch. + +For more use cases and documentation, refer to the +[Git SCM documentation](https://git-scm.com/doc). + + +{% include 'licensing_and_eula.j2' %}