[BuildStream] Platform - Sandbox refactoring



Hi everyone,

As part of my ongoing work with a Docker sandbox POC [0],
I have been struggling with how the `sandbox`s and the `platform`s are coupled.

I would like to propose another way of handling this in this thread. Please let me know your thoughts.

--- Problem ---
First, a more thorough explanation of the problem:

We currently have three platforms:
  - Darwin
  - Linux
  - Unix
 
- Darwin does not support other sandboxes than "SandboxDummy"
- Linux supports "SandboxBwrap" and has a fallback on "SandboxDummy"
- Unix supports "SandboxChroot" but does not fallback on "SandboxDummy"

Each platform is currently responsible for checking if a sandbox is available and usable and initiating it.
This means that for adding a new sandbox to all of them, we would need to have the checks in three places.
Moreover, it is not possible to configure the platform explicitly (What if I want the chroot platform on Linux
for whatever reason?).

Moreover, that also means the platform needs to know what the sandbox needs in order to check it. This makes
both tightly coupled and hard to setup.

--- Changes ---
I would like to change the system such that:

- The platform's responsibility is to go over a list of available sandboxes (We know that some platforms
won't have some sandboxes, so there is no need to use them) and try to instantiate it.
  - If that fails, the platform tries the next sandbox until there are none left and falls back to the DummySandbox.
  - If one succeeds, it will be used.
 
- We add a configuration entry in the user's config to specify which sandbox to use. Or even better, a list of them, in preference order.
  If that (those) sandbox is unavailable, we fail.
 
- The sandbox itself checks whether it can be used or not on instantiation. A successful instantiation means the
  sandbox is completely functional.
 
What do you think about this change? Does it make sense?

Once (if) we reach consensus, I will tackle the code changes.

Cheers,
Benjamin

[0] https://mail.gnome.org/archives/buildstream-list/2018-October/msg00055.html




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]