ci: Switch docker compose to extends#2205
ci: Switch docker compose to extends#2205thompson-tomo wants to merge 10 commits intoopen-telemetry:mainfrom
Conversation
…metry#1984) * Add commit id into source code url to enable removal on deprecation. open-telemetry#1961 * ensure compliance with rubocop * switch to tags * typo fix * Update source code URI in net_ldap gemspec metadata
There was a problem hiding this comment.
Pull request overview
This PR refactors the Docker Compose setup to replace YAML anchors with extends, enabling service config reuse across multiple compose files as the project moves toward further splitting docker-compose.yml.
Changes:
- Added a new
docker-base.ymldefining a reusablebaseservice configuration. - Updated
docker-compose.ymlservices toextendsfromdocker-base.ymlinstead of using YAML anchors. - Included
docker-base.ymlin the top-level composeincludelist.
Show a summary per file
| File | Description |
|---|---|
| docker-compose.yml | Switches services from YAML anchor merging to extends and adds docker-base.yml to include. |
| docker-base.yml | Introduces the shared base service definition (and a bundle volume definition). |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 2/2 changed files
- Comments generated: 3
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
arielvalentin
left a comment
There was a problem hiding this comment.
Note
🤖 This review was generated with AI assistance (GitHub Copilot CLI). Findings were validated locally by running docker compose config and diffing the resolved output between main and this branch.
Summary
The extends migration is the right direction for enabling per-gem compose files. Most services translate correctly. However, I found two behavioral regressions when comparing the resolved docker compose config output between main and this branch.
🚫 Issue 1: base is exposed as a runnable service
Because docker-base.yml appears in both the include: block and as an extends.file target, base becomes a first-class service:
$ docker compose config --services | grep base
base
docker compose up would attempt to start it. On main, the config lived under x-shared-config (an extension field ignored by Compose).
Fix: Remove - ./docker-base.yml from the include: list. The extends.file directive references the file directly and does not require include.
🚫 Issue 2: ex-instrumentation-pg-test — tmpfs not cleared
With YAML anchors (<<: *base), writing tmpfs: [] replaces the parent value. With extends, sequences are merged, so tmpfs: [] is silently ignored and /tmp remains a tmpfs from the parent.
Verified locally with docker compose config:
main |
This PR | |
|---|---|---|
tmpfs |
[] (cleared) |
- /tmp (inherited) |
postgres_socket:/tmp |
✅ present | ❌ removed |
postgres_socket:/var/run/postgresql |
✅ present | ✅ present |
The tests use TCP (TEST_POSTGRES_HOST=postgres) so this likely does not break anything today, but it is an unintended semantic change for a mechanical refactor.
Fix: Use tmpfs: !reset [] to properly clear the inherited value under extends. If socket-based connectivity parity is desired, also restore the postgres_socket:/tmp volume mount.
✅ Everything else looks good
- All 22 CI checks pass
docker compose configvalidates cleanly- All other service translations are semantically equivalent
- The
extendspattern sets up well for the stated goal of splitting compose files per-gem
|
Both fixes implemented @arielvalentin. What I wasn't aware of was the reset option for tmpfs hence the change in mounts which has been reverted. |
This moves from using yaml anchors to using extends due to anchors not working across files.
This is necessary for further splitting of the docker-compose.yml so that examples can reside within the appropriate folder.