From d75b0fc080d57e78aea9ed7908cc7b3af5ad6e01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Billeter?= Date: Tue, 31 Mar 2020 09:09:17 +0200 Subject: Drop concept of partially supported sandbox configuration Allowing builds without affecting the cache key but disallowing push, when the sandbox configuration is not fully compatible, results in an inconsistent user experience and may lead to unexpected build issues. Especially as push is allowed or disallowed based on the sandbox available at the time of push, not at the time of build. The previous commit making build-uid and build-gid configuration optional allows each project to decide whether the sandbox is required to support UID/GID configuration or not. --- src/buildstream/_platform/darwin.py | 2 +- src/buildstream/_platform/fallback.py | 2 +- src/buildstream/_platform/linux.py | 2 +- src/buildstream/_platform/platform.py | 2 +- src/buildstream/_platform/win32.py | 2 +- src/buildstream/element.py | 16 ++-------------- src/buildstream/sandbox/_sandboxbuildboxrun.py | 2 -- src/buildstream/sandbox/_sandboxbwrap.py | 2 -- 8 files changed, 7 insertions(+), 23 deletions(-) diff --git a/src/buildstream/_platform/darwin.py b/src/buildstream/_platform/darwin.py index 2e244557e..e880ea6f6 100644 --- a/src/buildstream/_platform/darwin.py +++ b/src/buildstream/_platform/darwin.py @@ -47,7 +47,7 @@ class Darwin(Platform): @staticmethod def _check_dummy_sandbox_config(config): - return True + pass @staticmethod def _create_dummy_sandbox(*args, **kwargs): diff --git a/src/buildstream/_platform/fallback.py b/src/buildstream/_platform/fallback.py index b9e9f520d..d80ac8fde 100644 --- a/src/buildstream/_platform/fallback.py +++ b/src/buildstream/_platform/fallback.py @@ -21,7 +21,7 @@ from .platform import Platform class Fallback(Platform): def _check_dummy_sandbox_config(self, config): - return True + pass def _create_dummy_sandbox(self, *args, **kwargs): kwargs["dummy_reason"] = ( diff --git a/src/buildstream/_platform/linux.py b/src/buildstream/_platform/linux.py index c5192c86d..670cfc6b9 100644 --- a/src/buildstream/_platform/linux.py +++ b/src/buildstream/_platform/linux.py @@ -86,7 +86,7 @@ class Linux(Platform): def _check_sandbox_config_bwrap(self, config): from ..sandbox._sandboxbwrap import SandboxBwrap - return SandboxBwrap.check_sandbox_config(self, config) + SandboxBwrap.check_sandbox_config(self, config) def _create_bwrap_sandbox(self, *args, **kwargs): from ..sandbox._sandboxbwrap import SandboxBwrap diff --git a/src/buildstream/_platform/platform.py b/src/buildstream/_platform/platform.py index e0a0cf7ce..f3a9964d1 100644 --- a/src/buildstream/_platform/platform.py +++ b/src/buildstream/_platform/platform.py @@ -268,7 +268,7 @@ class Platform: def _check_sandbox_config_buildboxrun(self, config): from ..sandbox._sandboxbuildboxrun import SandboxBuildBoxRun - return SandboxBuildBoxRun.check_sandbox_config(self, config) + SandboxBuildBoxRun.check_sandbox_config(self, config) @staticmethod def _create_buildboxrun_sandbox(*args, **kwargs): diff --git a/src/buildstream/_platform/win32.py b/src/buildstream/_platform/win32.py index a2529d8f6..33645e030 100644 --- a/src/buildstream/_platform/win32.py +++ b/src/buildstream/_platform/win32.py @@ -45,7 +45,7 @@ class Win32(Platform): @staticmethod def _check_dummy_sandbox_config(config): - return True + pass @staticmethod def _create_dummy_sandbox(*args, **kwargs): diff --git a/src/buildstream/element.py b/src/buildstream/element.py index 35bc8513d..03b64e760 100644 --- a/src/buildstream/element.py +++ b/src/buildstream/element.py @@ -328,13 +328,9 @@ class Element(Plugin): # Extract Sandbox config self.__sandbox_config = self.__extract_sandbox_config(context, project, meta) - self.__sandbox_config_supported = True if not self.__use_remote_execution(): platform = context.platform - if not platform.check_sandbox_config(self.__sandbox_config): - # Local sandbox does not fully support specified sandbox config. - # This will taint the artifact, disable pushing. - self.__sandbox_config_supported = False + platform.check_sandbox_config(self.__sandbox_config) def __lt__(self, other): return self.name < other.name @@ -1544,14 +1540,6 @@ class Element(Plugin): context = self._get_context() with self._output_file() as output_file: - if not self.__sandbox_config_supported: - self.warn( - "Sandbox configuration is not supported by the platform.", - detail="Falling back to UID {} GID {}. Artifact will not be pushed.".format( - self.__sandbox_config.build_uid, self.__sandbox_config.build_gid - ), - ) - # Explicitly clean it up, keep the build dir around if exceptions are raised os.makedirs(context.builddir, exist_ok=True) @@ -2454,7 +2442,7 @@ class Element(Plugin): workspaced_dependencies = self.__artifact.get_metadata_workspaced_dependencies() # Other conditions should be or-ed - self.__tainted = workspaced or workspaced_dependencies or not self.__sandbox_config_supported + self.__tainted = workspaced or workspaced_dependencies return self.__tainted diff --git a/src/buildstream/sandbox/_sandboxbuildboxrun.py b/src/buildstream/sandbox/_sandboxbuildboxrun.py index aa9e447b9..7f35213af 100644 --- a/src/buildstream/sandbox/_sandboxbuildboxrun.py +++ b/src/buildstream/sandbox/_sandboxbuildboxrun.py @@ -72,8 +72,6 @@ class SandboxBuildBoxRun(SandboxREAPI): if config.build_gid is not None and "platform:unixGID" not in cls._capabilities: raise SandboxError("Configuring sandbox GID is not supported by buildbox-run.") - return True - def _execute_action(self, action, flags): stdout, stderr = self._get_output() diff --git a/src/buildstream/sandbox/_sandboxbwrap.py b/src/buildstream/sandbox/_sandboxbwrap.py index e7c494e5f..851cc0969 100644 --- a/src/buildstream/sandbox/_sandboxbwrap.py +++ b/src/buildstream/sandbox/_sandboxbwrap.py @@ -122,8 +122,6 @@ class SandboxBwrap(Sandbox): if config.build_arch != host_arch and not local_platform.can_crossbuild(config): raise SandboxError("Configured architecture and host architecture don't match.") - return True - def _run(self, command, flags, *, cwd, env): stdout, stderr = self._get_output() -- cgit v1.2.1