Skip to content

extends #224

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 27, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions apps/docs/content/zerops-yaml/specification.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,49 @@ zerops:

Each service configuration requires `build` and `run` sections. An optional `deploy` section can be added for readiness checks.

## Service Inheritance

### extends <Badge type="optional" />

The `extends` key allows you to inherit configuration from another service defined in the same `zerops.yaml` file. This is useful for creating environment-specific configurations while maintaining a common base.

```yaml
zerops:
- setup: base
build:
buildCommands:
- echo "hello"
deployFiles: ./
run:
start: server run

- setup: prod
extends: base
run:
crontab:
- command: xyz
allContainers: false
timing: "* * * * *"

- setup: dev
extends: base
run:
crontab:
- command: different command
allContainers: false
timing: "* * * * *"
```

When using `extends`:
- The `extends` value must refer to another service's `setup` value in the same file
- The child service inherits all configuration from the base service
- Configuration is merged at the section level (`build`, `run`, `deploy`)
- You can override specific sections by redefining them

:::tip
Create a base service with common configuration and extend it for environment-specific services to keep your `zerops.yaml` file DRY (Don't Repeat Yourself).
:::

## Build Configuration

### base <Badge type="required" />
Expand Down