RFR(S): 8221342: [TESTBUG] Generate Dockerfile for docker testing
mikhailo.seledtsov at oracle.com
mikhailo.seledtsov at oracle.com
Mon Mar 25 15:24:29 UTC 2019
Hi Severin,
Thank you for review.
On 3/25/19 4:17 AM, Severin Gehwolf wrote:
> Hi Misha,
>
> First, nice work! Thanks for doing this. I like it. It works for me and
> my workflow (and the old docker version I have). A few comments below.
>
> On Fri, 2019-03-22 at 18:07 -0700, mikhailo.seledtsov at oracle.com wrote:
>> Please review this improvement to docker/container related testing in
>> HotSpot and JDK.
>> This change came out of discussion for "8221221 make test
>> TEST="jtreg:test/hotspot/jtreg/runtime/containers" failed on Ubuntu
>> 18.04". This fix is more generic, allowing to specify platform-specific
>> docker base images, as well custom base images specified via test
>> properties at test execution time. Also, it eliminates duplication
>> (duplicate Dockerfile-xyz).
>>
>> JBS: https://bugs.openjdk.java.net/browse/JDK-8221342
>> Webrev: http://cr.openjdk.java.net/~mseledtsov/8221342.01/
> We should get aarch64 (et.al) image users on board with testing that
> patch too.
>
> + static String getBaseImageVersion() {
> + String version = System.getProperty("jdk.test.docker.image.version");
> + if (version != null) {
> + System.out.println("DockerfileConfig: using custom image version: " + version);
> + return version;
> + }
> +
> + switch (Platform.getOsArch()) {
> + case "aarch64":
> + case "ppc64le":
> + case "s390x":
> + return "";
> + default:
> + return "7.6";
> + }
>
> And:
>
> + generateDockerFile(buildDir.resolve("Dockerfile"),
> + DockerfileConfig.getBaseImageName(),
> + DockerfileConfig.getBaseImageVersion());
>
> // Build the docker
> execute("docker", "build", "--no-cache", "--tag", imageName, buildDir.toString())
> @@ -250,6 +245,18 @@
> }
>
>
> + private static void generateDockerFile(Path dockerfile, String baseImage,
> + String baseImageVersion) throws Exception {
> + String template =
> + "FROM %s:%s\n" +
> + "COPY /jdk /jdk\n" +
> + "ENV JAVA_HOME=/jdk\n" +
> + "CMD [\"/bin/bash\"]\n";
> + String dockerFileStr = String.format(template, baseImage, baseImageVersion);
>
> So for the default case on aarch64 the FROM tag will look like:
>
> "FROM aarch64/ubuntu:"
>
> That's not a legal image spec. Instead of returning the empty string
> for getBaseImageVersion() we should return "latest" because
> "aarch64/ubuntu:latest" is a valid image spec and it reflects current
> behaviour.
Good catch. I will fix this.
>
> Other than that, looks good!
Thank you,
Misha
>
> Thanks,
> Severin
>
More information about the hotspot-runtime-dev
mailing list