feat: allow for digest-pinned composefiles and test-coverage fixes#7
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7 +/- ##
==========================================
+ Coverage 99.74% 99.93% +0.19%
==========================================
Files 179 179
Lines 6610 6632 +22
Branches 1437 1444 +7
==========================================
+ Hits 6593 6628 +35
+ Misses 10 4 -6
+ Partials 7 0 -7
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:
|
There was a problem hiding this comment.
Pull request overview
This PR adds support for updating digest-pinned images in Docker Compose files. The feature intelligently handles different combinations of update types (tag vs. digest updates) and compose image formats (tag-only, digest-only, or tag+digest), preserving digest pinning when appropriate and skipping updates when replacement digests are unavailable.
Changes:
- Added helper functions to split digest references and build digest-aware image updates
- Enhanced service matching logic to correctly identify services when digest references are present
- Implemented logic to preserve digest pinning during tag updates when remote digests are available
- Added comprehensive test coverage for the update matrix of scenarios
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| app/triggers/providers/dockercompose/Dockercompose.ts | Added three new helper functions for digest handling, enhanced getServiceKey matching logic to compare images without digests, and modified mapCurrentVersionToUpdateVersion to preserve digest pinning when updating compose files |
| app/triggers/providers/dockercompose/Dockercompose.test.ts | Added comprehensive test coverage for digest-pinned compose file updates, including a test matrix covering all combinations of update types and compose image formats |
Comments suppressed due to low confidence (1)
app/triggers/providers/dockercompose/Dockercompose.ts:524
- While the current logic prevents
updateImagefrom being undefined when reaching line 524, consider adding an explicit null check or a comment explaining why this scenario cannot occur. This would make the code more defensive and easier to maintain, especially sincebuildUpdatedComposeImagecan return{ image: undefined, ... }in some cases.
const updateImage = digestAwareUpdate.image;
if (currentImage.includes('@') && !digestAwareUpdate.keptPinned) {
this.log.warn(
`Skip update for service ${serviceKeyToUpdate} (container ${container.name}) because compose image is digest-pinned and no replacement digest is available`,
);
return undefined;
}
return {
service: serviceKeyToUpdate,
current: currentImage,
update: updateImage,
currentNormalized: normalizeImplicitLatest(currentImage),
updateNormalized: normalizeImplicitLatest(updateImage),
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@copilot open a new pull request to apply changes based on the comments in this thread |
|
@Crow-Control I've opened a new pull request, #8, to work on those changes. Once the pull request is ready, I'll request review from you. |
* Initial plan * Export helper functions and add comprehensive unit tests Co-authored-by: Crow-Control <7613738+Crow-Control@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Crow-Control <7613738+Crow-Control@users.noreply.github.com>
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.