Openjdk-tests: external tests docker images are hard coded to adoptopenjdk

Created on 9 Dec 2019  路  12Comments  路  Source: AdoptOpenJDK/openjdk-tests

Hi,

We are trying to run the external tests in our own infrastructure. One improvements that I would like to make is make the external tests more configurable.

My plan is similar to the dockerImageTag variable, and I am planing add another 2 variables, dockerImageName.

For IMAGE_NAME, I want to do something like this inside https://github.com/AdoptOpenJDK/openjdk-tests/blob/master/external/build.xml file:

<if>
    <isset property="env.IMAGE_NAME"/>
    <then>
        <property name="dockerImageName" value="${env.IMAGE_NAME}"/>
    </then>
    <else>
        <property name="dockerImageName" value="adoptopenjdk"/>
    </else>
</if>

Please let me know what you think.

I will test this idea in our infrastructure first.

Thanks!

bug

All 12 comments

hi @junyzheng - thanks for looking at this, I am also currently working on a clean-up of these external tests, before we enable testing of the other Docker images that we produce at the project... my very initial branch of this was here: https://github.com/smlambert/openjdk-tests/tree/expandExternal - see in particular the external/build.xml file for how we redirect to the other tags. Starting this work has now led to a bigger overhaul of the external test repo... where we will get rid of some of the duplication we have and use common Dockerfiles for most of the applications.

It will be great to co-ordinate with you, and get your input! I will try to push an update of my branch later this week to share where I was thinking of going with it...

Hi @smlambert just checked your branch and it looks awesome! I want to branch out from your branch, and add a patch to make the hard coded adoptopenjdk configurable. I will create a PR against your branch so you can see whether it makes sense or not. Please let me know what you think about this approach.

Go for it, we can talk later in the week, to see how things look. :)

Hi @junyzheng - please see if the approach in https://github.com/AdoptOpenJDK/openjdk-tests/pull/1660 addresses this hardcoding issue you have raised. (we will merge 1660 shortly and follow on with a 2nd PR to convert the remaining external dirs).

@junyzheng Like @smlambert mentioned #1660 will address this. You should be able to pass in a build arg allowing you to overwrite the FROM image with whatever image you need. What image where you looking to utilize?

@junyzheng can you update this ticket with the results of your test?

sorry, just saw this. I will check this today.

@smlambert hmm, I saw the IMAGE_NAME in the dockerfile, but it seems there is no way to override it. Just wondering is this expected or did I miss something?

Yes @junyzheng, the Dockerfile that is present will no longer be used (and soon will be removed from all the directories). Instead we now generate the Dockerfiles on the fly, based on DOCKERIMAGE_TAG and using build_image.sh script

As I reread this issue, do I understand you wish not to use the BASE image from AdoptOpenJDK docker hub registry but from some other registry? As its true, even when we build the test Dockerfiles on the fly, use the AdoptOpenJDK Docker images as the base.

@junyzheng Like @smlambert the Dockerfiles that are present will be removed in favor of dynamically generating the Dockerfiles.

With that being said, both the present and generated Dockerfile support building with a different base image.

In the current images, the top of the Dockerfile might look like this:

ARG SDK=openjdk8
ARG IMAGE_NAME=adoptopenjdk/$SDK
ARG IMAGE_VERSION=nightly

FROM $IMAGE_NAME:$IMAGE_VERSION

When building the Dockerfile, which happens when you run a test, you could pass in the build args of IMAGE_NAME and IMAGE_VERSION. Thus allowing you to pull from whatever base image you want be it OpenJDK or another Java base image.

As for the new generated Dockerfile there are similar build args. Here is what one generated Dockerfile looks like:

ARG SDK=openjdk8
ARG IMAGE_NAME=adoptopenjdk/$SDK
ARG OS=alpine
ARG IMAGE_VERSION=nightly
ARG TAG=$OS-$IMAGE_VERSION

FROM $IMAGE_NAME:$TAG

This time around I tried to make the build args more robust. In the end you can still pass in build args for IMAGE_NAME and TAG, which again will allow you to pull from any base image you need.

@smlambert Currently, using the grinders is there still an option to put in Docker build args? If so this would allow @junyzheng to build and run tests against any base image he needs.

@junyzheng Does provide the flexibility you need?

@smlambert because we have our internal docker registry so need to pull image from our internal one instead of the AdoptOpenJDK.

@james-crowley Thanks! The IMAGE_NAME and TAG options sounds like a good plan, it will solve all the problem and make the configuration very robust.

Was this page helpful?
0 / 5 - 0 ratings