.ona/automations.yaml in your repository root. You can change this location in Projects.
database, buildAll) is used to reference the item in dependencies and CLI commands. Keys must match the pattern ^[a-zA-Z0-9_-]{1,128}$ (alphanumeric, underscores, and hyphens, 1-128 characters).
Service schema
Services are long-running processes that stay active throughout your session.Service fields
Service commands
Thecommands object controls the service lifecycle:
When stopping a service, if the process doesn’t exit within 2 minutes, SIGKILL is sent automatically.
Service example
Service phases
Services transition through these phases during their lifecycle:Task schema
Tasks are one-off actions that run to completion.Task fields
Task example
Task execution phases
Task executions transition through these phases:Triggers
Control when tasks and services run automatically:Additional triggers (API only)
The following triggers can only be set via the API, not inautomations.yaml:
Prebuilds and triggers
During a prebuild, only automations (tasks and services) with theprebuild trigger run. All other triggers (postDevcontainerStart, postEnvironmentStart) are skipped. This is intentional: prebuilds run without user context (no user secrets), so running automations during a prebuild is opt-in.
When a user creates an environment from a prebuild, the normal triggers fire: postDevcontainerStart, postEnvironmentStart, etc. The prebuild trigger does not fire in user environments.
Common pattern — tasks: Use both triggers on the same task when you want it to run during prebuilds and when the Dev Container is rebuilt in a user environment:
npm ci runs during the prebuild (so the snapshot includes node_modules) and also runs if a user rebuilds their Dev Container (which creates a fresh container without the snapshot).
Common pattern — services: Start a service during prebuilds so that prebuild tasks can depend on it:
ready command, the service is considered ready immediately, so the prebuild may snapshot before the service has finished initializing (e.g., before a Docker image is fully pulled). Always define a ready command for prebuild services so that setup work is captured in the snapshot. If the service fails, the prebuild still completes.
Requiring task success in prebuilds
By default, a task that fails during a prebuild produces a warning but the prebuild still succeeds and creates a snapshot. SetprebuildRequiresSuccess: true to treat a non-successful outcome (failed or stopped) as a prebuild failure instead — no snapshot is created and the prebuild moves to the Failed phase.
This applies only to tasks with a prebuild or beforeSnapshot trigger. The flag is ignored for other triggers.
prebuildRequiresSuccess: true and more than one fails, the failure message lists all of them.
Execution environment
By default, tasks and services run inside the Dev Container. TherunsOn field lets you change where they execute.
Run on the host machine
UserunsOn: machine to run directly on the VM, outside the Dev Container. This is useful for services that need to start before the Dev Container is ready (e.g., with the postMachineStart API trigger) or that need direct access to the host.
Run in a Docker container
UserunsOn: docker to run in a separate Docker container with a specific image:
Complete example
This example demonstrates all available schema features:Iterating on Tasks and Services
You can iterate on tasks and services using the CLI which is available by default in every Ona environment. The CLI can- reload the tasks and services file using:
- start a task or service: