goutamadwant opened a new pull request, #12855:
URL: https://github.com/apache/seatunnel/pull/12855
### Purpose of this pull request
Fixes #12854.
`EngineImageJdkUpgrader` copies the JDK from `eclipse-temurin:11-jdk`
without a platform, so on an arm64 host an aarch64 JDK goes into the amd64-only
engine images and the image build fails. This PR:
- pins the JDK stage to the source image's platform, read with `docker
inspect` (`FROM --platform=linux/amd64 eclipse-temurin:11-jdk AS jdk`);
- adds `LABEL org.apache.seatunnel.e2e.jdk-platform=<platform>` before the
copy. The classic builder (the Docker API default, used by Testcontainers)
caches `COPY --from=jdk` by the stage's image id, which is the same for every
platform of a multi-platform tag. Without the label, a JDK layer cached for
another platform is reused even with the pin.
Before (arm64 host):
```
FROM eclipse-temurin:11-jdk AS jdk -> aarch64 JDK, build fails
```
After:
```
FROM --platform=linux/amd64 eclipse-temurin:11-jdk AS jdk
FROM tyrantlucifer/spark:3.3.0
LABEL org.apache.seatunnel.e2e.jdk-platform=linux/amd64 -> x86_64 JDK,
build passes
```
On amd64 hosts the pinned platform is the one the stage already resolved to,
so CI gets the same JDK as before.
### Does this PR introduce _any_ user-facing change?
No. E2E test code only.
### How was this patch tested?
- Added `EngineImageJdkUpgraderTest` for the generated Dockerfile.
- On an arm64 Mac (Docker 29.8.1), with the official
`eclipse-temurin:11-jdk`:
- the old Dockerfile with `--no-cache` copies an aarch64 JDK and fails;
the new one copies x86_64 and passes;
- with an aarch64 JDK layer already cached, the pin alone still produces
an aarch64 JDK; pin plus label produces x86_64.
- `FakeIT` with `-pl :connector-fake-e2e -am` on JDK 11: 6/6 passed on Flink
1.13, 1.15, 1.18, 1.20 and Spark 2.4, 3.3. Each derived image reports
`OS_ARCH="x86_64"` and Java 11.0.32.1.
### Check list
* [ ] If any new Jar binary package adding in your PR, please add License
Notice according
[New License
Guide](https://github.com/apache/seatunnel/blob/dev/docs/en/developer/new-license.md)
* [ ] If necessary, please update the documentation to describe the new
feature. https://github.com/apache/seatunnel/tree/dev/docs
* [ ] If necessary, please update `incompatible-changes.md` to describe the
incompatibility caused by this PR.
* [ ] If you are contributing the connector code, please check that the
following files are updated:
1. Update
[plugin-mapping.properties](https://github.com/apache/seatunnel/blob/dev/plugin-mapping.properties)
and add new connector information in it
2. Update the pom file of
[seatunnel-dist](https://github.com/apache/seatunnel/blob/dev/seatunnel-dist/pom.xml)
3. Add ci label in
[label-scope-conf](https://github.com/apache/seatunnel/blob/dev/.github/workflows/labeler/label-scope-conf.yml)
4. Add e2e testcase in
[seatunnel-e2e](https://github.com/apache/seatunnel/tree/dev/seatunnel-e2e/seatunnel-connector-v2-e2e/)
5. Update connector
[plugin_config](https://github.com/apache/seatunnel/blob/dev/config/plugin_config)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]