Skip to content

Commit

Permalink
CME-50 update to Java 21 (#235)
Browse files Browse the repository at this point in the history
* CME-50 update to Java 21

* revert alternative JAVA_HOME to run job under

* remove alt java

* remove ALT_JAVA_HOME

* Remove cruft

* remove unused import
  • Loading branch information
rapolaskaseliscgi authored Oct 28, 2024
1 parent 740cb40 commit aacf97a
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 29 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/dependency-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ jobs:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle-
- name: Set up JDK 11
uses: actions/setup-java@v3
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: 11
java-version: 21
distribution: 'zulu'
- name: Run dependencyCheck
run: ./gradlew dependencyCheckAggregate
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG APP_INSIGHTS_AGENT_VERSION=3.2.10
FROM hmctspublic.azurecr.io/base/java:17-distroless
ARG APP_INSIGHTS_AGENT_VERSION=3.5.4
FROM hmctspublic.azurecr.io/base/java:21-distroless

COPY build/libs/ccd-next-hearing-date-updater.jar /opt/app/

Expand Down
3 changes: 0 additions & 3 deletions Jenkinsfile_CNP
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,6 @@ env.CCD_API_GATEWAY_OAUTH2_REDIRECT_URL = "https://www-ccd.aat.platform.hmcts.ne
env.CCD_API_GATEWAY_OAUTH2_CLIENT_ID = "ccd_gateway"
env.CCD_API_GATEWAY_S2S_ID = "ccd_gw"

// alternative JAVA_HOME to run job under
env.ALT_JAVA_HOME = "/usr/lib/jvm/java-17-openjdk-amd64"

// temporary workaround for platform changes: turn BEFTA header checks to warning mode
env.BEFTA_RESPONSE_HEADER_CHECK_POLICY="JUST_WARN"

Expand Down
5 changes: 1 addition & 4 deletions Jenkinsfile_nightly
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,6 @@ withNightlyPipeline(type, product, component) {
env.CCD_API_GATEWAY_OAUTH2_CLIENT_ID = "ccd_gateway"
env.CCD_API_GATEWAY_S2S_ID = "ccd_gw"

// alternative JAVA_HOME to run job under
env.ALT_JAVA_HOME = "/usr/lib/jvm/java-17-openjdk-amd64"

// temporary workaround for platform changes: turn BEFTA header checks to warning mode
env.BEFTA_RESPONSE_HEADER_CHECK_POLICY="JUST_WARN"

Expand All @@ -97,7 +94,7 @@ withNightlyPipeline(type, product, component) {
afterAlways('mutationTest') {
steps.archiveArtifacts allowEmptyArchive: true, artifacts: 'functional-output/**/*'
}

before('fullFunctionalTest') {
echo "Loading the secrets"
loadVaultSecrets(secrets)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ This microservice implements `The Next Hearing Date` feature outlined in [this w
## Getting Started

### Prerequisites
- [JDK 17](https://openjdk.org/projects/jdk/17/)
- [JDK 21](https://openjdk.org/projects/jdk/21/)
- [Docker](https://www.docker.com)

### Building the application
Expand Down
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ version = '0.0.1'

java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
languageVersion = JavaLanguageVersion.of(21)
}
}

Expand Down Expand Up @@ -304,14 +304,14 @@ project.tasks['pitest'].group = "Verification"
ext {
set('springCloudVersion', "2021.0.8")
reformLogging = '6.0.1'
lombokVersion = '1.18.24'
lombokVersion = '1.18.34'
jacksonVersion = '2.14.2'
springFrameworkVersion = '5.3.27'
springFrameworkSecurityVersion = '5.8.10'
cucumberVersion = '5.7.0'
wiremockVersion = '2.35.0'
elasticsearchVersion = '7.17.8'
testcontainersVersion = '1.17.6'
testcontainersVersion = '1.20.2'
gradlePitestVersion = '1.9.0'
pitestVersion = '1.9.11'
sonarPitestVersion = '0.5'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import uk.gov.hmcts.befta.data.ResponseData;
import uk.gov.hmcts.befta.exception.FunctionalTestException;
import uk.gov.hmcts.befta.util.BeftaUtils;
import uk.gov.hmcts.befta.util.EnvironmentVariableUtils;
import uk.gov.hmcts.reform.next.hearing.date.updater.utils.StreamGobbler;

import java.io.IOException;
Expand All @@ -32,7 +31,7 @@
@SuppressWarnings("PMD")
public class JobExecutionStepDefs {

private static final String ALT_JAVA_HOME = EnvironmentVariableUtils.getOptionalVariable("ALT_JAVA_HOME");
private static final String JAVA_EXECUTABLE = "java";

private static final int EXIT_SUCCESS = 0;

Expand Down Expand Up @@ -209,7 +208,7 @@ private void executeJob(final String... params) {
System.getProperty("user.dir"));

// log java version information
ResponseData versionResponse = executeCommand(getJavaPath(), "-version");
ResponseData versionResponse = executeCommand(JAVA_EXECUTABLE, "-version");
BeftaUtils.defaultLog("java -version\n" + versionResponse.getResponseMessage());
Assert.assertEquals("Java version check failed with exit value '" + versionResponse.getResponseCode() + "'.",
EXIT_SUCCESS, versionResponse.getResponseCode());
Expand All @@ -218,7 +217,7 @@ private void executeJob(final String... params) {

// run job direct from jar
ArrayList<String> command = new ArrayList<>();
command.add(getJavaPath());
command.add(JAVA_EXECUTABLE);
command.add("-jar");
command.addAll(Arrays.stream(params).toList());
command.add(executableJar);
Expand Down Expand Up @@ -270,13 +269,4 @@ private String buildCsv(final String contextName) {
private String getFilename() {
return scenarioContext.getParentContext().getCurrentScenarioTag() + ".csv";
}

private String getJavaPath() {
if (ALT_JAVA_HOME == null) {
return "java";
} else {
return ALT_JAVA_HOME + "/bin/java";
}
}

}

0 comments on commit aacf97a

Please sign in to comment.