Skip to main content
Ona loads tasks and services from .ona/automations.yaml in your repository root. You can change this location in Projects.
services:
  # long-running processes (databases, servers)

tasks:
  # one-off actions (build, test, seed)
The key (e.g., database, buildAll) is used to reference the item in dependencies and CLI commands.

Services in the automations.yaml

Example workflow:
services:
    database:
        name: PostgreSQL
        description: The backend database
        triggeredBy:
            - postEnvironmentStart
        commands:
            start: 'docker run --rm -t --name database postgres:latest'
    redis:
        name: Redis
        description: Our message bus
        triggeredBy:
            - postEnvironmentStart
        commands:
            start: >-
                docker run --rm -t --name redis -p 6379:6379
                redis/redis-stack-server:latest
    backend:
        name: Application Backend
        description: The application backend
        triggeredBy:
            - postEnvironmentStart
        commands:
            start: cd backend && go run main.go

Tasks in the automations.yaml

Example workflow:
tasks:
    buildAll:
        name: Build All
        description: builds all code
        command: go build .
    runUnitTests:
        name: Runs unit tests
        command: go test -v ./...
    validate:
        name: Validate
        description: Builds and tests the code
        triggeredBy:
            - postEnvironmentStart
        dependsOn:
            - buildAll
            - runUnitTests

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:
gitpod automations update [optional-path-to-automations.yaml]
  • start a task or service:
gitpod automations service start ...
gitpod automations task start ...

Using Tasks and Services outside of an environment

The CLI commands to interact with an environment’s tasks and services are also available outside of an environment. The following snippet brings up an environment, adds a task, runs it, waits for the task to complete and brings the environment back down again:
# gitpod env create will set the environment context to the newly created env
gitpod env create https://github.com/some/repo

# add the task to the environment
cat <<EOF | gitpod automations update -
tasks:
  build:
    command: go build ./...
EOF

# run it
gitpod automations task start build

# stop the environment
gitpod env stop