BaseEnvironment to add one.
Run a custom sandbox
Custom sandboxes are not registered by name, so passmodule.path:ClassName to
--env (-e). Harbor imports the custom sandbox on the host. Install its
module and provider SDK in the same Python environment as Harbor. For a
MySandbox class in my_sandbox.py, use my_sandbox:MySandbox.
- CLI
- Config
- Python
--environment-kwarg (--ek) or
environment.kwargs:
Implement a custom sandbox
ExtendBaseEnvironment
and implement its lifecycle, command execution, and file-transfer methods.
Use _validate_definition() to reject tasks missing required files, such as
environment/Dockerfile. If no task files
are required, it can be empty.
BaseEnvironment interface
BaseEnvironment interface
my_sandbox.py
_merge_env() applies sandbox, agent-phase, and verifier-phase variables.
_resolve_user() applies Harbor’s default execution user. Use both in every
exec() implementation.
Declare only capabilities the provider enforces. If docker_compose is enabled,
also implement the per-service execution and file-transfer methods used by
Compose tasks.
Add
preflight() to check provider credentials before trials are queued. Keep
provider credentials in the Harbor process; see
Environment variables.
