feat: add automatic compose file location fetching#9
Conversation
There was a problem hiding this comment.
Pull request overview
This PR extends Docker/Compose integration by allowing the Docker watcher to automatically derive a Compose file path from native Docker Compose labels, reducing the need to set dd.compose.file manually.
Changes:
- Add compose-native discovery via
dd.compose.native/wud.compose.native(and watcher-levelcomposenative) to derive compose file paths fromcom.docker.compose.project.{working_dir,config_files}. - Improve dockercompose trigger handling for digest-pinned images and expand related test coverage.
- Update API/router tests and tighten Vitest coverage thresholds.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| app/watchers/providers/docker/label.ts | Adds new label constants for compose-native discovery toggle. |
| app/watchers/providers/docker/Docker.ts | Implements compose-native compose file path resolution and config flag. |
| app/watchers/providers/docker/Docker.test.ts | Adds tests for compose-native discovery and trigger include caching behavior. |
| app/triggers/providers/dockercompose/Dockercompose.ts | Adds digest-aware matching/updating helpers for compose images. |
| app/triggers/providers/dockercompose/Dockercompose.test.ts | Expands tests for digest/tag update matrix and helper functions. |
| app/api/trigger.ts | Tweaks remote trigger warning log formatting. |
| app/api/trigger.test.ts | Adds tests for mustTrigger non-function cases and missing container id behavior. |
| app/api/container.test.ts | Adds tests for missing trigger configuration and remote container trigger filtering. |
| app/vitest.config.ts | Raises coverage thresholds to 100%. |
| README.md | Documents compose-native discovery labels and watcher default. |
| CHANGELOG.md | Adds unreleased entries describing compose-native discovery additions. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
096d49a to
b571267
Compare
b571267 to
c6e6238
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #9 +/- ##
=======================================
Coverage 99.93% 99.93%
=======================================
Files 179 179
Lines 6632 6664 +32
Branches 1444 1451 +7
=======================================
+ Hits 6628 6660 +32
Misses 4 4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| test('getComposeFilePathFromLabels should return undefined when compose-native config files are only empty entries', () => { | ||
| const composeFile = testable_getComposeFilePathFromLabels( | ||
| { | ||
| 'com.docker.compose.project.config_files': ' , , ', | ||
| 'dd.compose.native': 'true', | ||
| }, | ||
| false, | ||
| ); | ||
| expect(composeFile).toBeUndefined(); | ||
| }); |
There was a problem hiding this comment.
Missing test coverage for multiple config files scenario. The implementation includes a comment "first file wins" when multiple files are present in com.docker.compose.project.config_files, but there's no test case verifying this behavior. Consider adding a test case with 'com.docker.compose.project.config_files': 'docker-compose.yml,docker-compose.override.yml' to ensure only the first file is used.
| ); | ||
| expect(composeFile).toBeUndefined(); | ||
| }); | ||
|
|
There was a problem hiding this comment.
Missing test coverage for the wud.compose.native fallback label. While the integration tests cover dd.compose.native, there's no test verifying that wud.compose.native works as a fallback when dd.compose.native is not set. This is important because the label constants define both variants and getLabel is used to check both.
| test('getComposeFilePathFromLabels should use wud.compose.native as a fallback when dd.compose.native is not set', () => { | |
| const composeFile = testable_getComposeFilePathFromLabels( | |
| { | |
| 'com.docker.compose.project.config_files': ' , , ', | |
| 'wud.compose.native': 'true', | |
| }, | |
| false, | |
| ); | |
| expect(composeFile).toBeUndefined(); | |
| }); |
Description
⚒️ Fixes #
⚙️ Type of change
🧪 How Has This Been Tested?
📃 Notes:
✔️ Checklist:
feat(chart-name):,fix(chart-name):,chore(chart-name):,docs(chart-name):orfix(docs):➕ App addition
If this PR is an app addition please make sure you have done the following.
icon.pngPlease don't blindly check all the boxes. Read them and only check those that apply.
Those checkboxes are there for the reviewer to see what is this all about and
the status of this PR with a quick glance.