dotnet / dotnet/docker-tools

DockerService, ManifestService, ImageDigestCache, and RegistryServiceClient classes are all too tightly coupled

Open
#1,265 2 comments 0 reactions 1 assignee Claimed by @lbussell View on GitHub
area-infrastructure wave1
Dominant language
C#
Stars
181
Forks
67
Avg merge
2d 15h
Merged PRs (30d)
10

Description

At a high level, DockerService depends on the ManifestService. However, DockerService only relies on the ManifestService for methods that have the exact same signature and behavior as ManifestService commands (or its extension methods).

https://github.com/dotnet/docker-tools/blob/f2d23ef5d1312903ae8de3a9cc095b7e74422f8b/src/Microsoft.DotNet.ImageBuilder/src/DockerService.cs#L59-L60

The DockerServiceCache is also tightly coupled with the ImageDigestCache class because of the same reason. ImageDigestCache simply makes and caches calls to the ManifestService class (through DockerService).

https://github.com/dotnet/docker-tools/blob/f2d23ef5d1312903ae8de3a9cc095b7e74422f8b/src/Microsoft.DotNet.ImageBuilder/src/DockerServiceCache.cs#L55-L56

https://github.com/dotnet/docker-tools/blob/f2d23ef5d1312903ae8de3a9cc095b7e74422f8b/src/Microsoft.DotNet.ImageBuilder/src/ImageDigestCache.cs#L37-L43

We should remove DockerService's dependency on the ManifestService class, since there are commands that use the DockerService that don't rely on any functionality from the ManifestService. ImageDigestCache should become ManifestServiceCache (or potentially RegistryServiceClientCache, since that is the only class making the single network call). We should experiment with combining ManifestService and RegistryServiceClient.

Also, ManifestServiceExtensions can be combined into the ManifestService class since they are in the same namespace.

I have put together a branch where I experimented with removing the DockerService dependency on the ManifestService, but it is currently incomplete and not fully functional - https://github.com/lbussell/docker-tools/commits/dev/loganbussell/1262playground/

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.