Skip to content

Fail fast when the e2e docker targets run on a JDK older than 17 - #14072

Merged
wu-sheng merged 1 commit into
masterfrom
fix/e2e-spring-ai-docker-jdk-guard
Sep 11, 2026
Merged

Fail fast when the e2e docker targets run on a JDK older than 17#14072
wu-sheng merged 1 commit into
masterfrom
fix/e2e-spring-ai-docker-jdk-guard

Conversation

@wu-sheng

Copy link
Copy Markdown
Member

Fix make -C test docker silently producing a missing or stale e2e-spring-ai-service jar

Follow-up to #14071, addressing a review finding on test/Makefile.

DOCKER_TARGETS lists docker.e2e-spring-ai-service unconditionally, but the e2e reactor only builds that module under its jdk-17 profile (<jdk>[17,)</jdk>, needed because Spring AI requires Java 17 / Spring Boot 4). The Makefile and the pom disagreed about when the module exists, which gives two failures:

  1. Clean checkout on JDK 11DOCKER_RULE copies a jar that was never produced:
    cp: .../e2e-spring-ai-service/target/e2e-spring-ai-service-2.0.0.jar: No such file or directory
    make: *** [docker.e2e-spring-ai-service] Error 1
    
  2. Existing checkout — the quiet onebuild.e2e-service runs clean package, but clean only reaches modules in the reactor. On JDK 11 the module is excluded, so a jar left from an earlier JDK 17 build survives and is packaged into an image tagged with the current commit.

Neither failure names the cause, and the downstream symptom is worse than either. The jar is bind-mounted by path, so when it is absent Docker creates a directory where the file should be and the container dies with:

Error: Invalid or corrupt jarfile /services/app.jar

That mentions neither the module nor the JDK, and it leaves a bogus directory in the tree that a later mvn package then fails to write over.

This refuses at parse time instead, before any work happens:

$ make -C test docker          # on JDK 11
Makefile:56: *** e2e-spring-ai-service requires JDK 17+ for Spring AI / Spring Boot 4;
found Java 11. Set JAVA_HOME to a 17+ JDK, or build the other images by name,
e.g. make docker.e2e-service-provider.  Stop.

The check is -ge 17, mirroring the profile's [17,) rather than pinning exactly 17, so JDK 21 and 25 still build the image — the e2e-test-java-versions matrix runs [11, 17, 25], and an == 17 check would wrongly refuse on the 25 leg.

It is scoped to the goals that actually need the module, so the other four images stay buildable by name on any JDK. Verified across both JDKs:

goal JDK 11 JDK 17
docker error proceeds
docker.e2e-service error proceeds
docker.push-e2e-service error proceeds
docker.e2e-spring-ai-service error proceeds
push.docker.e2e-spring-ai-service error proceeds
docker.e2e-service-provider proceeds proceeds
docker.e2e-mock-llm-server proceeds proceeds
init / no goal proceeds proceeds

CI behaviour is unchanged: publish-docker-e2e-service.yaml pins JDK 17 and its make -C test build.e2e-service docker.push-e2e-service invocation still builds and pushes all five images. Confirmed by a real make -C test docker.e2e-spring-ai-service on JDK 17 after the change.

Version parsing was checked against every installed JDK plus the legacy 1.8.x form (1.8.0_3228, not 1); if java is absent entirely the comparison yields no match and the guard fires, which is the safe direction.

  • If this pull request closes/resolves/fixes an existing issue, replace the issue number. Closes #.
  • Update the CHANGES log.

The CHANGES entry is folded into #14071's existing 11.1.0 bullet rather than added as a separate line, since both are part of the same unreleased change and a build-tooling guard is not a distinct user-facing item.

test/Makefile listed docker.e2e-spring-ai-service unconditionally, but the e2e
reactor only builds that module under its jdk-17 profile. On JDK 11 the docker
target therefore copied a jar that was never produced, and on a checkout that
had previously built under JDK 17 it packaged a stale one instead -- `clean`
never reaches a module the profile excluded.

Neither failure points at the cause. The missing jar is bind-mounted by path,
so Docker creates a directory in its place and the container dies with
"Invalid or corrupt jarfile", naming neither the module nor the JDK.

Refuse at parse time instead, scoped to the goals that need the module so the
other four images stay buildable by name on any JDK.
@wu-sheng wu-sheng added this to the 11.1.0 milestone Sep 11, 2026
@wu-sheng wu-sheng added test Test requirements about performance, feature or before release. chore Chores about the project, like code cleaning up, typos, upgrading dependencies, etc. labels Sep 11, 2026
@wu-sheng
wu-sheng merged commit 476afad into master Sep 11, 2026
463 of 469 checks passed
@wu-sheng
wu-sheng deleted the fix/e2e-spring-ai-docker-jdk-guard branch September 11, 2026 01:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Chores about the project, like code cleaning up, typos, upgrading dependencies, etc. test Test requirements about performance, feature or before release.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants