fix(autodiscovery): correctly handle wrong docker image name#7659
Merged
olblak merged 6 commits intoupdatecli:mainfrom Feb 6, 2026
Merged
fix(autodiscovery): correctly handle wrong docker image name#7659olblak merged 6 commits intoupdatecli:mainfrom
olblak merged 6 commits intoupdatecli:mainfrom
Conversation
Signed-off-by: Olblak <[email protected]>
This reverts commit 5c04a9c.
Signed-off-by: Olblak <[email protected]>
Signed-off-by: Olblak <[email protected]>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes issue #7658 where updatecli would panic with a nil pointer dereference when processing Docker Compose files containing images with environment variables. The fix includes two key changes: adding proper error handling in the sanitizeRegistryEndpoint function to prevent nil pointer dereferences, and adding logic to skip Docker Compose services that use environment variables in their image references.
Changes:
- Fixed nil pointer dereference by returning empty string on parse error in
sanitizeRegistryEndpoint - Added environment variable detection to skip unsupported Docker Compose image references
- Updated test data to include a service with environment variables and corrected a malformed SHA256 digest
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| pkg/plugins/resources/dockerimage/spec.go | Added return statement after parse error to prevent nil pointer dereference |
| pkg/plugins/autodiscovery/dockercompose/compose.go | Added check to skip Docker Compose images containing environment variables |
| pkg/plugins/autodiscovery/dockercompose/testdata/docker-compose.yaml | Added postgres service test case with environment variables and corrected SHA256 digest prefix |
| pkg/plugins/autodiscovery/dockercompose/utils_test.go | Updated test expectations to include the new postgres service |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Olblak <[email protected]>
Signed-off-by: Olblak <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix #7658
Fix two issues
Test
To test this pull request, you can run the following commands:
pkg/plugins/resources/dockerimage/ go testAdditional Information
Checklist
Tradeoff
Potential improvement