- Introduction
- Getting started
- Configuration
- Dev Container
- Automations
- Editors
- VS Code
- Cursor
- JetBrains
- Zed
- Gitpod Desktop
- Self-Hosted Runner
- AWS
- Azure
Coming soon
- GCP
Coming soon
- Linux
Coming soon
- Source Control
- GitHub
- GitLab
Coming soon
- Bitbucket
Coming soon
- Integrations
- Port sharing
- Personal access tokens
- Administration
- Organizations
- Projects
- Billing
- Reference
- CLI
Basic configuration
When an environment is created the system loads Automations from the default file: .gitpod/automations.yaml
relative to your repository root. You can change this location using Projects. An automations.yaml
consists of services and tasks defined at the root level, for example:
services: ...
tasks: ...
Services and tasks are a map where the key serves as reference for the corresponding item. When looking at task dependencies their use becomes clear.
See reference for a full example.
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 Automations
You can iterate on Automations using the CLI which is available by default in every Gitpod environment. The CLI can
- reload the Automations file using:
gitpod automations update [optional-path-to-automations.yaml]
- start a task or service:
gitpod automations service start ...
gitpod automations task start ...
- Simulate an environment trigger:
gitpod automations trigger postEnvironmentStart
Using Automations outside of an environment
The CLI commands to interact with an environment’s Automations 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