Skip to content

Fix Testcontainers workflow#189

Merged
ribafish merged 3 commits intomainfrom
gk/testcontainers-jarfiletest-workaround
Mar 25, 2026
Merged

Fix Testcontainers workflow#189
ribafish merged 3 commits intomainfrom
gk/testcontainers-jarfiletest-workaround

Conversation

@ribafish
Copy link
Copy Markdown
Member

@ribafish ribafish commented Mar 19, 2026

Summary

Changes to the Testcontainers experiment workflow:

  • Bumped JDK from 11 to 17 (now required by the project)
  • Added post-checkout hook to exclude ContainerVolumeRemovalTest (fails in CI)
  • Added doNotCacheIf workaround for jarFileTest absolute path cache miss in experiment 3

Problem

jarFileTest sets systemProperty("jarFile", shadowJar.outputs.files.singleFile) which embeds an absolute path as a task input. When the project is built from a different location (experiment 3), the cache key changes even though the jar content is identical.

This was a temporary workaround until the upstream fix was merged:

Update

The upstream PR has been merged, so the doNotCacheIf workaround was removed. The post-checkout hook now only excludes ContainerVolumeRemovalTest.

🤖 Generated with Claude Code

ribafish added a commit that referenced this pull request Mar 19, 2026
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@ribafish ribafish force-pushed the gk/testcontainers-jarfiletest-workaround branch from e1ca15e to 79c793d Compare March 19, 2026 09:54
@ribafish
Copy link
Copy Markdown
Member Author

ribafish commented Mar 19, 2026

This workaround validated here: https://github.com/gradle/develocity-oss-projects/actions/runs/23289730204

@ribafish ribafish requested review from a team and Copilot March 19, 2026 10:21
Copy link
Copy Markdown

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

Adds a temporary workflow-level workaround to prevent :testcontainers:jarFileTest from causing cache-relocatability failures in experiment 3 when the upstream project is checked out in different locations.

Changes:

  • Switch the workflow JDK setup from 11 to 17.
  • Add a post-checkout git hook that appends Gradle configuration to (a) exclude known failing volume removal tests and (b) disable caching for jarFileTest via outputs.doNotCacheIf(...).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +27 to 31
- name: Set up JDK 17
uses: actions/setup-java@v5
with:
java-version: 11
java-version: 17
distribution: "temurin"
// Upstream fix: https://github.com/testcontainers/testcontainers-java/pull/11574
project(':testcontainers') {
afterEvaluate {
tasks.named('jarFileTest') {
Copy link
Copy Markdown
Member

@jprinet jprinet left a comment

Choose a reason for hiding this comment

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

LGTM


allprojects {
tasks.withType(Test).configureEach {
exclude '**/ComposeContainerVolumeRemovalTest*'
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe a single exclude rule with **/*ContainerVolumeRemovalTest* pattern would be simpler

@ribafish ribafish changed the title Add doNotCacheIf workaround for Testcontainers jarFileTest Remove Testcontainers jarFileTest caching workaround Mar 25, 2026
@ribafish ribafish changed the title Remove Testcontainers jarFileTest caching workaround Remove workaround and simplify test exclude for Testcontainers Mar 25, 2026
Bump JDK 11→17, exclude failing VolumeRemoval tests, and mark
jarFileTest as non-cacheable (absolute path in systemProperty).

Upstream fix: testcontainers/testcontainers-java#11574
tasks.named('jarFileTest') fails at root build.gradle evaluation time
because the task is registered in :testcontainers (core/) subproject's
own build.gradle which hasn't been evaluated yet.
@ribafish ribafish force-pushed the gk/testcontainers-jarfiletest-workaround branch from 370fa81 to b3c3609 Compare March 25, 2026 10:19
@ribafish ribafish changed the title Remove workaround and simplify test exclude for Testcontainers Fix Testcontainers workflow Mar 25, 2026
ribafish added a commit that referenced this pull request Mar 25, 2026
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@ribafish ribafish merged commit 68ab97d into main Mar 25, 2026
6 checks passed
@ribafish ribafish deleted the gk/testcontainers-jarfiletest-workaround branch March 25, 2026 10:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants