diff --git a/pyproject.toml b/pyproject.toml index 8208c78..c7174d6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "riptide-lib" -version = "0.9.0" +version = "0.9.1" description = "Tool to manage development environments for web applications using containers - Library Package" readme = "README.rst" requires-python = ">=3.8" diff --git a/riptide/config/document/command.py b/riptide/config/document/command.py index 9fa794e..589e2a7 100644 --- a/riptide/config/document/command.py +++ b/riptide/config/document/command.py @@ -168,6 +168,13 @@ def schema_in_service(cls): If enabled, the container uses network mode `host`. Overrides network and port settings Default: False + [ignore_original_entrypoint]: bool + If true, Riptide will not run the original entrypoint of the OCI image, but instead run the + command directly, as if no entrypoint was defined in the image. + Note that engines might ignore this setting, if they don't support it. + + Default: False + **Example Document:** .. code-block:: yaml @@ -185,6 +192,7 @@ def schema_in_service(cls): Optional('environment'): {str: str}, Optional('read_env_file'): bool, Optional('use_host_network'): bool, + Optional('ignore_original_entrypoint'): bool }) @classmethod @@ -215,6 +223,9 @@ def _initialize_data_after_variables(self, data: dict) -> dict: if "read_env_file" not in self: data["read_env_file"] = True + + if "ignore_original_entrypoint" not in data: + data["ignore_original_entrypoint"] = False return data def get_project(self) -> 'Project': diff --git a/riptide/config/document/service.py b/riptide/config/document/service.py index 68615a5..0a91560 100644 --- a/riptide/config/document/service.py +++ b/riptide/config/document/service.py @@ -1,19 +1,16 @@ import warnings from collections import OrderedDict -from typing import List - +from configcrunch import ConfigcrunchError +from configcrunch import variable_helper from dotenv import dotenv_values from schema import Schema, Optional, Or -from configcrunch import YamlConfigDocument, ConfigcrunchError -from configcrunch import variable_helper from riptide.config.document.common_service_command import ContainerDefinitionYamlConfigDocument from riptide.config.errors import RiptideDeprecationWarning from riptide.config.files import CONTAINER_SRC_PATH from riptide.config.service.config_files import * from riptide.config.service.logging import * - # todo: validate actual schema values -> better schema | ALL documents from riptide.config.service.ports import get_additional_port from riptide.config.service.volumes import process_additional_volumes @@ -262,7 +259,6 @@ def schema(cls) -> Schema: or image default. Default is 'auto' which means the value of `run_as_current_user` will be used. - [allow_full_memlock]: bool Whether to set memlock ulimit to -1:-1 (soft:hard). This is required for some database services, such as Elasticsearch. @@ -274,6 +270,13 @@ def schema(cls) -> Schema: If enabled, read the environment variables in the env-files defined in the project (``env_files``). Default: True + [ignore_original_entrypoint]: bool + If true, Riptide will not run the original entrypoint of the OCI image, but instead run the + command directly, as if no entrypoint was defined in the image. + Note that engines might ignore this setting, if they don't support it. + + Default: False + **Example Document:** .. code-block:: yaml @@ -344,7 +347,8 @@ def schema(cls) -> Schema: Optional('config'): { str: { 'from': str, - '$source': str, # Path to the document that "from" references. Is added durinng loading of service + '$source': str, + # Path to the document that "from" references. Is added durinng loading of service 'to': str, Optional('force_recreate'): bool } @@ -383,7 +387,8 @@ def schema(cls) -> Schema: 'name': str, 'config': any # defined by driver }, - Optional('read_env_file'): bool + Optional('read_env_file'): bool, + Optional('ignore_original_entrypoint'): bool } ) @@ -427,6 +432,9 @@ def _initialize_data_after_merge(self, data): if "read_env_file" not in data: data["read_env_file"] = True + if "ignore_original_entrypoint" not in data: + data["ignore_original_entrypoint"] = False + if "additional_subdomains" not in data: data["additional_subdomains"] = [] @@ -736,8 +744,10 @@ def domain(self) -> str: something: 'https://project--service.riptide.local' """ if "main" in self.internal_get("roles"): - return self.get_project().internal_get("name") + "." + self.parent_doc.parent_doc.parent_doc.internal_get("proxy")["url"] - return self.get_project().internal_get("name") + DOMAIN_PROJECT_SERVICE_SEP + self.internal_get("$name") + "." + self.parent_doc.parent_doc.parent_doc.internal_get("proxy")["url"] + return self.get_project().internal_get("name") + "." + \ + self.parent_doc.parent_doc.parent_doc.internal_get("proxy")["url"] + return self.get_project().internal_get("name") + DOMAIN_PROJECT_SERVICE_SEP + self.internal_get("$name") + "." + \ + self.parent_doc.parent_doc.parent_doc.internal_get("proxy")["url"] @variable_helper def additional_domains(self) -> Dict[str, str]: @@ -760,7 +770,9 @@ def additional_domains(self) -> Dict[str, str]: second: 'https://seccond.project--service.riptide.local' """ if "main" in self.internal_get("roles"): - return {subdomain: f'{subdomain}.{self.get_project().internal_get("name")}.{self.parent_doc.parent_doc.parent_doc.internal_get("proxy")["url"]}' - for subdomain in self.internal_get("additional_subdomains")} - return {subdomain: f'{subdomain}.{self.get_project().internal_get("name")}{DOMAIN_PROJECT_SERVICE_SEP}{self.internal_get("$name")}.{self.parent_doc.parent_doc.parent_doc.internal_get("proxy")["url"]}' + return { + subdomain: f'{subdomain}.{self.get_project().internal_get("name")}.{self.parent_doc.parent_doc.parent_doc.internal_get("proxy")["url"]}' for subdomain in self.internal_get("additional_subdomains")} + return { + subdomain: f'{subdomain}.{self.get_project().internal_get("name")}{DOMAIN_PROJECT_SERVICE_SEP}{self.internal_get("$name")}.{self.parent_doc.parent_doc.parent_doc.internal_get("proxy")["url"]}' + for subdomain in self.internal_get("additional_subdomains")}