Track Testcontainers images as Gradle test inputs - #12633
gh-worker-dd-mergequeue-cf854d[bot] merged 15 commits into
Conversation
This comment has been minimized.
This comment has been minimized.
🟢 Java Benchmark SLOs — All performance SLOs passed
PR vs. master results
Commit: Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 940c875f0b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Two independent test-configuration issues were found: Redis container tests fail in CI because mirrored images are not declared as compatible substitutes, and the WebSphere smoke test now runs only on Java 25, dropping the established Java 8 coverage.
🤖 Bits Code Review · Commit 940c875 · @DataDog review to ask questions
|
Did a review with Codex and it left one comment that could use a look: |
There was a problem hiding this comment.
IIUC the goal of this PR is to ensure the Gradle cache considers the Testcontainers images when deciding whether or not the cache can be reused ? The new plugin resolves the declared image tag and registers this freshly-resolved image as a Gradle task input. Then the cache is only used if the images are the same, preventing running tests with outdated images.
This otherwise seems reasonable to me!
amarziali
left a comment
There was a problem hiding this comment.
looks good. I've added an idea (that can be discarded or addressed later if useful)
|
/merge |
|
View all feedbacks in Devflow UI.
It will be processed automatically as soon as GitHub reports it as mergeable. View in MergeQueue UI.
The expected merge time in
|
What Does This Do
Introduces an opt-in
dd-trace-java.testcontainersplugin that model docker images as dependencies, allowing to track their digest as task input.Each declaration associates an image with a system property used by the test. Before Gradle evaluates the test task’s cache inputs, the plugin resolves the effective image to an immutable digest and passes that value under the system property.
The test need to be written using the constructor accepting
DockerImageName, e.g. :Where,
test.cassandra.imagewll have a value like thatregistry-1.docker.io/library/cassandra@sha256:b9451ebdfa53f9e22b470e1420f2a94a3433738b7f25350472d3443f0b203b75.This PR adopts the plugin in the existing usage.
Motivation
Using Test Container constructors like
new CassandraContainer("cassandra:4"), ornew GenericContainer("icr.io/appcafe/websphere-traditional:latest"). Indeed, mutable image tag can change without any change to test sources or Java dependencies, thus defeating the Gradle fingerprinting.Resolving the tag on every invocation means an unchanged digest allow to safely reuse build-cache results, before it wasn't guranteed.
Additional Notes
Our test suite relied on a feature of Test Container that allowed to change the image name prefix, this mechanism need to be handled at the plugin level now. As such Docker Hub is used locally, while CI the defines a
TESTCONTAINERS_HUB_IMAGE_NAME_PREFIXand will instead resolve the image toregistry.ddbuild.io/images/mirror/cassandra@sha256:b9451ebdfa53f9e22b470e1420f2a94a3433738b7f25350472d3443f0b203b75.Note that implicit Testcontainers helper images are not tracked as they are not explicitly declared.
This related to #12604
Contributor Checklist
type:and (comp:orinst:) labels in addition to any other useful labelsclose,fix, or any linking keywords when referencing an issueUse
solvesinstead, and assign the PR milestone to the issue