Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Support digest in IImage, DockerImage and in the WithImage(string) implementation #1249

Merged
merged 8 commits into from
Sep 15, 2024

Conversation

Kielek
Copy link
Contributor

@Kielek Kielek commented Sep 2, 2024

What does this PR do?

Support for digest passed to the image parser.
Dropped workaround to fully utilize docker api and support digest in the requirements.

Why is it important?

OpenTelemetry recommend to reference all docker images by the name, tag, followed by the digest.
Part of implementing this recommendation is open-telemetry/opentelemetry-dotnet-instrumentation#3514

Passing full name to the Container API leads to

System.ArgumentException
Cannot parse image: confluentinc/cp-zookeeper:7.6.1@sha256:4dc780642bfc5ec3a2d4901e2ff1f9ddef7f7c5c0b793e1e2911cbfb4e3a3214 (Parameter 'image')
   at DotNet.Testcontainers.Images.MatchImage.Match(String image) in /_/src/Testcontainers/Images/MatchImage.cs:line 34
   at DotNet.Testcontainers.Images.DockerImage..ctor(String image) in /_/src/Testcontainers/Images/DockerImage.cs:line 41
   at DotNet.Testcontainers.Builders.ContainerBuilder`3.WithImage(String image) in /_/src/Testcontainers/Builders/ContainerBuilder`3.cs:line 67
   at IntegrationTests.KafkaFixture.LaunchZookeeper(INetwork containerNetwork) in C:\GitHub\opentelemetry-dotnet-instrumentation\test\IntegrationTests\KafkaCollection.cs:line 63
   at IntegrationTests.KafkaFixture.InitializeAsync() in C:\GitHub\opentelemetry-dotnet-instrumentation\test\IntegrationTests\KafkaCollection.cs:line 39
   at Xunit.Sdk.ExceptionAggregator.RunAsync(Func`1 code) in /_/src/xunit.core/Sdk/ExceptionAggregator.cs:line 90

Related issues

How to test this PR

Unit tests extended.
You can check also code similar to.

        var container = new ContainerBuilder()
            .WithImage("confluentinc/cp-zookeeper:7.6.1@sha256:4dc780642bfc5ec3a2d4901e2ff1f9ddef7f7c5c0b793e1e2911cbfb4e3a3214")
            .Build();

Do not tested with Docker 4..13.1. The latest version is fine. The question is if the support can be dropped for 2-years old version. I think that it can be dropped as Docker for Desktop was released couple of time with security fixes. 4.13.1 should be treated as insecure and not recommended to use.

Follow-ups

Release new version. I will be happy to proceed with open-telemetry/opentelemetry-dotnet-instrumentation#3514

Copy link

netlify bot commented Sep 2, 2024

Deploy Preview for testcontainers-dotnet ready!

Name Link
🔨 Latest commit 360212f
🔍 Latest deploy log https://app.netlify.com/sites/testcontainers-dotnet/deploys/66e686c571f13500089f5527
😎 Deploy Preview https://deploy-preview-1249--testcontainers-dotnet.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@HofmeisterAn HofmeisterAn changed the base branch from develop to main September 11, 2024 13:14
@HofmeisterAn HofmeisterAn changed the base branch from main to develop September 11, 2024 13:14
@HofmeisterAn HofmeisterAn changed the title feat: Support for digest in the image definition feat: Support digest in IImage and in the DockerImage implementation Sep 12, 2024
@HofmeisterAn HofmeisterAn added the enhancement New feature or request label Sep 12, 2024
@HofmeisterAn HofmeisterAn changed the title feat: Support digest in IImage and in the DockerImage implementation feat: Support digest in IImage, DockerImage and in the WithImage(string) implementation Sep 15, 2024
@HofmeisterAn HofmeisterAn merged commit 4834c3b into testcontainers:develop Sep 15, 2024
11 checks passed
@Kielek Kielek deleted the digest-support branch September 15, 2024 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Enhancement]: Support for digest in the image definition
2 participants