Add Java 17 support (#12895)

* Add Java 17 support

* Change Test HTTP client provider

* Create Tests HTTP Client once

* Create Tests HTTP Client once

* fix(CI): Update CI to use jdk 17 and dockerfiles as well

---------

Co-authored-by: Akash-Jain <Akash.J@deuexsolutions.com>
This commit is contained in:
Sriharsha Chintalapani 2023-10-03 01:35:50 -07:00 committed by GitHub
parent 9ef3ff7a58
commit 03ca972887
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 73 additions and 62 deletions

View File

@ -67,11 +67,11 @@ jobs:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'adopt'
java-version: '17'
distribution: 'temurin'
- name: Set up Python 3.9
uses: actions/setup-python@v4

View File

@ -101,12 +101,12 @@ jobs:
restore-keys: |
${{ runner.os }}-yarn-
- name: Set up JDK 11
- name: Set up JDK 17
if: steps.cache-output.outputs.exit-code == 0
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'adopt'
java-version: '17'
distribution: 'temurin'
- name: Generating Data Models
run: |

View File

@ -101,12 +101,12 @@ jobs:
restore-keys: |
${{ runner.os }}-yarn-
- name: Set up JDK 11
- name: Set up JDK 17
if: steps.cache-output.outputs.exit-code == 0
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'adopt'
java-version: '17'
distribution: 'temurin'
- name: Generating Data Models
run: |

View File

@ -29,10 +29,11 @@ jobs:
- name: Checkout
uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v1
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 11
java-version: 17
distribution: 'temurin'
- name: Install antlr cli
run: |

View File

@ -63,11 +63,11 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'adopt'
java-version: '17'
distribution: 'temurin'
- name: Run checkstyle
run: mvn googleformatter:format@reformat-sources

View File

@ -85,12 +85,12 @@ jobs:
restore-keys: |
${{ runner.os }}-maven-
- name: Set up JDK 11
- name: Set up JDK 17
if: steps.cache-output.outputs.exit-code == 0
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'adopt'
java-version: '17'
distribution: 'temurin'
- name: Install Ubuntu dependencies
if: steps.cache-output.outputs.exit-code == 0

View File

@ -84,12 +84,12 @@ jobs:
restore-keys: |
${{ runner.os }}-maven-
- name: Set up JDK 11
- name: Set up JDK 17
if: steps.cache-output.outputs.exit-code == 0
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'adopt'
java-version: '17'
distribution: 'temurin'
- name: Install Ubuntu dependencies
if: steps.cache-output.outputs.exit-code == 0

View File

@ -85,12 +85,12 @@ jobs:
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Set up JDK 11
- name: Set up JDK 17
if: steps.cache-output.outputs.exit-code == 0
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'adopt'
java-version: '17'
distribution: 'temurin'
- name: Set up Python
uses: actions/setup-python@v4
with:

View File

@ -85,12 +85,12 @@ jobs:
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Set up JDK 11
- name: Set up JDK 17
if: steps.cache-output.outputs.exit-code == 0
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'adopt'
java-version: '17'
distribution: 'temurin'
- name: Set up Python
uses: actions/setup-python@v4
with:

View File

@ -46,11 +46,11 @@ jobs:
swap-storage: true
- uses: actions/checkout@v3
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 11
distribution: 'adopt'
java-version: 17
distribution: 'temurin'
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD

View File

@ -32,11 +32,11 @@ jobs:
- name: Checkout
uses: actions/checkout@v3
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'adopt'
java-version: '17'
distribution: 'temurin'
- name: Set up Python 3.9
uses: actions/setup-python@v4

View File

@ -62,11 +62,11 @@ jobs:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'adopt'
java-version: '17'
distribution: 'temurin'
- name: Set up Python ${{ matrix.py-version }}
uses: actions/setup-python@v4

View File

@ -39,11 +39,11 @@ jobs:
with:
python-version: 3.9
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'adopt'
java-version: '17'
distribution: 'temurin'
- name: Install Ubuntu dependencies
run: |

View File

@ -53,11 +53,11 @@ jobs:
docker-images: true
swap-storage: true
- uses: actions/checkout@v3
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'adopt'
java-version: '17'
distribution: 'temurin'
- name: Generating Data Models
run: |

View File

@ -23,7 +23,7 @@ FROM alpine:3.16
EXPOSE 8585
RUN apk add --update --no-cache bash openjdk11-jre
RUN apk add --update --no-cache bash openjdk17-jre
COPY --from=build /opt/openmetadata /opt/openmetadata
COPY docker/openmetadata-start.sh /

View File

@ -37,7 +37,7 @@ LABEL org.open-metadata.commit-id=$COMMIT_ID
EXPOSE 8585 8586
COPY docker/openmetadata-start.sh ./
COPY --from=build /opt/openmetadata /opt/openmetadata
RUN apk add --update --no-cache bash openjdk11-jre && \
RUN apk add --update --no-cache bash openjdk17-jre && \
chmod 777 openmetadata-start.sh
WORKDIR /opt/openmetadata
ENTRYPOINT [ "/bin/bash" ]

View File

@ -32,7 +32,7 @@ RUN apt install -y python-dev && \
python /tmp/get-pip.py
# java
RUN apt install -y openjdk-8-jdk
RUN apt install -y openjdk-17-jdk
# maven
#RUN apt install -y maven=3.3.9-3

View File

@ -339,6 +339,12 @@
<version>2.0.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.connectors</groupId>
<artifactId>jersey-grizzly-connector</artifactId>
<version>2.40</version>
<scope>test</scope>
</dependency>
<!-- JSON-P: Java API for JSON Processing (JSR 374) -->
<dependency>
<groupId>javax.json</groupId>
@ -576,7 +582,7 @@
<reuseForks>false</reuseForks>
<parallel>classes</parallel>
<forkCount>1C</forkCount>
<argLine>-Xmx512m</argLine>
<argLine>-Xmx1G</argLine>
</configuration>
<executions>
<execution>
@ -626,7 +632,7 @@
<reuseForks>false</reuseForks>
<parallel>classes</parallel>
<forkCount>1C</forkCount>
<argLine>-Xmx512m</argLine>
<argLine>-Xmx1G</argLine>
</configuration>
<executions>
<execution>

View File

@ -23,14 +23,15 @@ import io.dropwizard.testing.junit5.DropwizardAppExtension;
import java.util.HashSet;
import java.util.Set;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.WebTarget;
import lombok.extern.slf4j.Slf4j;
import org.apache.http.HttpHost;
import org.elasticsearch.client.RestClient;
import org.flywaydb.core.Flyway;
import org.glassfish.jersey.client.ClientConfig;
import org.glassfish.jersey.client.ClientProperties;
import org.glassfish.jersey.client.HttpUrlConnectorProvider;
import org.glassfish.jersey.client.JerseyClientBuilder;
import org.glassfish.jersey.grizzly.connector.GrizzlyConnectorProvider;
import org.jdbi.v3.core.Jdbi;
import org.jdbi.v3.sqlobject.SqlObjectPlugin;
import org.jdbi.v3.sqlobject.SqlObjects;
@ -66,6 +67,8 @@ public abstract class OpenMetadataApplicationTest {
private static String HOST;
private static String PORT;
private static Client client;
static {
CollectionRegistry.addTestResource(webhookCallbackResource);
Fernet.getInstance().setFernetKey(FERNET_KEY_1);
@ -136,6 +139,16 @@ public abstract class OpenMetadataApplicationTest {
validateAndRunSystemDataMigrations(
jdbi, ConnectionType.from(sqlContainer.getDriverClassName()), nativeMigrationScripsLocation, false);
APP.before();
createClient();
}
private static void createClient() {
ClientConfig config = new ClientConfig();
config.connectorProvider(new GrizzlyConnectorProvider());
config.register(new JacksonFeature(APP.getObjectMapper()));
config.property(ClientProperties.CONNECT_TIMEOUT, 0);
config.property(ClientProperties.READ_TIMEOUT, 0);
client = ClientBuilder.newClient(config);
}
@AfterAll
@ -149,25 +162,16 @@ public abstract class OpenMetadataApplicationTest {
ELASTIC_SEARCH_CONTAINER.stop();
}
public static Client getClient() {
return new JerseyClientBuilder()
.register(new JacksonFeature(APP.getObjectMapper()))
.property(ClientProperties.CONNECT_TIMEOUT, 0)
.property(ClientProperties.READ_TIMEOUT, 0)
.property(HttpUrlConnectorProvider.SET_METHOD_WORKAROUND, true)
.build();
}
public static RestClient getSearchClient() {
return RestClient.builder(HttpHost.create(ELASTIC_SEARCH_CONTAINER.getHttpHostAddress())).build();
}
public static WebTarget getResource(String collection) {
return getClient().target(format("http://localhost:%s/api/v1/%s", APP.getLocalPort(), collection));
return client.target(format("http://localhost:%s/api/v1/%s", APP.getLocalPort(), collection));
}
public static WebTarget getConfigResource(String resource) {
return getClient().target(format("http://localhost:%s/api/v1/system/config/%s", APP.getLocalPort(), resource));
return client.target(format("http://localhost:%s/api/v1/system/config/%s", APP.getLocalPort(), resource));
}
private static void overrideElasticSearchConfig() {

View File

@ -786,8 +786,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version>
<configuration>
<source>11</source>
<target>11</target>
<source>17</source>
<target>17</target>
</configuration>
</plugin>
<plugin>