Skip to content

fix(autodiscovery): correctly handle wrong docker image name#7659

Merged
olblak merged 6 commits intoupdatecli:mainfrom
olblak:issue/7658
Feb 6, 2026
Merged

fix(autodiscovery): correctly handle wrong docker image name#7659
olblak merged 6 commits intoupdatecli:mainfrom
olblak:issue/7658

Conversation

@olblak
Copy link
Member

@olblak olblak commented Feb 5, 2026

Fix #7658

Fix two issues

  • Correctly handle nil pointer
  • Don't generate Updatecli manifest for docker compose file that uses environment variable

Test

To test this pull request, you can run the following commands:

pkg/plugins/resources/dockerimage/
go test

Additional Information

Checklist

  • I have updated the documentation via pull request in website repository.

Tradeoff

  • Updatecli won't update the tag for an image composed of environment variable. I think this usecase is very fragile and should be handle case by case with a declarative pipeline

Potential improvement

@olblak olblak added bug Something isn't working resource-docker Resource of kind Docker Image autodiscovery All things related to the autodiscovery feature labels Feb 5, 2026
@olblak olblak enabled auto-merge (squash) February 5, 2026 19:33
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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]>
@olblak olblak merged commit aa86f48 into updatecli:main Feb 6, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autodiscovery All things related to the autodiscovery feature bug Something isn't working resource-docker Resource of kind Docker Image

Projects

None yet

Development

Successfully merging this pull request may close these issues.

panic: runtime error: invalid memory address or nil pointer dereference

2 participants