Skip to content

Commit 0abe9bf

Browse files
authored
Merge pull request #164 from hmcts/feat/java25
feat: upgrade for java25
2 parents 9778890 + 5c35265 commit 0abe9bf

File tree

13 files changed

+97
-123
lines changed

13 files changed

+97
-123
lines changed

.github/workflows/ci-build-publish.yml

Lines changed: 38 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
required: true
88
AZURE_DEVOPS_ARTIFACT_TOKEN:
99
required: true
10-
HMCTS_CP_ADO_PAT:
10+
HMCTS_ADO_PAT:
1111
required: true
1212
inputs:
1313
environment:
@@ -57,7 +57,6 @@ jobs:
5757
outputs:
5858
repo_name: ${{ steps.repo_vars.outputs.repo_name }}
5959
artefact_name: ${{ steps.repo_vars.outputs.artefact_name }}
60-
6160
steps:
6261
- name: Checkout source code
6362
uses: actions/checkout@v6
@@ -66,19 +65,45 @@ jobs:
6665
uses: actions/setup-java@v5
6766
with:
6867
distribution: 'temurin'
69-
java-version: '21'
68+
java-version: '25'
7069

7170
- name: Set up Gradle
7271
uses: gradle/actions/setup-gradle@v5
7372
with:
7473
gradle-version: current
7574

76-
- name: Gradle Build
75+
- name: Gradle Build and Publish
7776
env:
7877
ARTEFACT_VERSION: ${{ needs.Artefact-Version.outputs.artefact_version }}
78+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
79+
AZURE_DEVOPS_ARTIFACT_USERNAME: ${{ secrets.AZURE_DEVOPS_ARTIFACT_USERNAME }}
80+
AZURE_DEVOPS_ARTIFACT_TOKEN: ${{ secrets.AZURE_DEVOPS_ARTIFACT_TOKEN }}
81+
ENVIRONMENT: ${{ inputs.environment }}
7982
run: |
8083
echo "Building with ARTEFACT_VERSION=$ARTEFACT_VERSION"
81-
gradle build -DARTEFACT_VERSION=$ARTEFACT_VERSION
84+
echo "Active environment=$ENVIRONMENT"
85+
86+
./gradlew build -DARTEFACT_VERSION=$ARTEFACT_VERSION
87+
88+
if [ -z "AZURE_DEVOPS_ARTIFACT_USERNAME" ]; then
89+
echo "::warning::AZURE_DEVOPS_ARTIFACT_USERNAME is null or not set"
90+
fi
91+
92+
if [ -z "$AZURE_DEVOPS_ARTIFACT_TOKEN" ]; then
93+
echo "::warning::AZURE_DEVOPS_ARTIFACT_TOKEN is null or not set"
94+
fi
95+
96+
if [ "${{ inputs.is_publish }}" == "true" ]; then
97+
echo "Publishing artefact for version: $ARTEFACT_VERSION"
98+
99+
./gradlew publish \
100+
-DARTEFACT_VERSION=$ARTEFACT_VERSION \
101+
-DGITHUB_REPOSITORY=${{ github.repository }} \
102+
-DGITHUB_ACTOR=${{ github.actor }} \
103+
-DGITHUB_TOKEN=$GITHUB_TOKEN \
104+
-DAZURE_DEVOPS_ARTIFACT_USERNAME=$AZURE_DEVOPS_ARTIFACT_USERNAME \
105+
-DAZURE_DEVOPS_ARTIFACT_TOKEN=$AZURE_DEVOPS_ARTIFACT_TOKEN
106+
fi
82107
83108
- name: Extract repo name
84109
id: repo_vars
@@ -93,56 +118,8 @@ jobs:
93118
name: app.jar
94119
path: build/libs/${{ steps.repo_vars.outputs.artefact_name }}.jar
95120

96-
Provider-Deploy:
97-
needs: [ Artefact-Version, Build ]
98-
runs-on: ubuntu-latest
99-
environment:
100-
name: ${{ inputs.environment }}
101-
steps:
102-
- name: Checkout source code
103-
uses: actions/checkout@v6
104-
105-
- name: Set up JDK
106-
uses: actions/setup-java@v5
107-
with:
108-
distribution: 'temurin'
109-
java-version: '21'
110-
111-
- name: Set up Gradle
112-
uses: gradle/actions/setup-gradle@v5
113-
with:
114-
gradle-version: current
115-
116-
- name: Gradle Publish
117-
if: ${{ inputs.is_publish }}
118-
env:
119-
ARTEFACT_VERSION: ${{ needs.Artefact-Version.outputs.artefact_version }}
120-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
121-
AZURE_DEVOPS_ARTIFACT_USERNAME: ${{ secrets.AZURE_DEVOPS_ARTIFACT_USERNAME }}
122-
AZURE_DEVOPS_ARTIFACT_TOKEN: ${{ secrets.AZURE_DEVOPS_ARTIFACT_TOKEN }}
123-
ENVIRONMENT: ${{ inputs.environment }}
124-
run: |
125-
echo "Active environment=$ENVIRONMENT"
126-
if [ -z "AZURE_DEVOPS_ARTIFACT_USERNAME" ]; then
127-
echo "::warning::AZURE_DEVOPS_ARTIFACT_USERNAME is null or not set"
128-
fi
129-
130-
if [ -z "$AZURE_DEVOPS_ARTIFACT_TOKEN" ]; then
131-
echo "::warning::AZURE_DEVOPS_ARTIFACT_TOKEN is null or not set"
132-
fi
133-
134-
echo "Publishing artefact for version: $ARTEFACT_VERSION"
135-
136-
gradle publish \
137-
-DARTEFACT_VERSION=$ARTEFACT_VERSION \
138-
-DGITHUB_REPOSITORY=${{ github.repository }} \
139-
-DGITHUB_ACTOR=${{ github.actor }} \
140-
-DGITHUB_TOKEN=$GITHUB_TOKEN \
141-
-DAZURE_DEVOPS_ARTIFACT_USERNAME=$AZURE_DEVOPS_ARTIFACT_USERNAME \
142-
-DAZURE_DEVOPS_ARTIFACT_TOKEN=$AZURE_DEVOPS_ARTIFACT_TOKEN
143-
144121
Build-Docker:
145-
needs: [ Provider-Deploy, Build, Artefact-Version ]
122+
needs: [ Build, Artefact-Version ]
146123
if: ${{ inputs.trigger_docker }}
147124
runs-on: ubuntu-latest
148125
environment:
@@ -176,11 +153,11 @@ jobs:
176153
tags: |
177154
ghcr.io/${{ github.repository }}:${{ needs.Artefact-Version.outputs.artefact_version }}
178155
build-args: |
179-
BASE_IMAGE=eclipse-temurin:21
156+
BASE_IMAGE=eclipse-temurin:25
180157
JAR_FILENAME=${{ needs.Build.outputs.artefact_name }}.jar
181158
182159
Deploy:
183-
needs: [ Provider-Deploy, Build, Artefact-Version ]
160+
needs: [ Build, Artefact-Version ]
184161
if: ${{ inputs.trigger_deploy }}
185162
runs-on: ubuntu-latest
186163
steps:
@@ -191,11 +168,13 @@ jobs:
191168
uses: hmcts/trigger-ado-pipeline@v1
192169
with:
193170
pipeline_id: 460
194-
ado_pat: ${{ secrets.HMCTS_CP_ADO_PAT }}
171+
ado_pat: ${{ secrets.HMCTS_ADO_PAT }}
195172
template_parameters: >
196173
{
197174
"GROUP_ID": "uk.gov.hmcts.cp",
198175
"ARTIFACT_ID": "${{ env.REPO_NAME }}",
199176
"ARTIFACT_VERSION": "${{ needs.Artefact-Version.outputs.artefact_version }}",
200-
"TARGET_REPOSITORY": "${{ github.repository }}"
201-
}
177+
"TARGET_REPOSITORY": "${{ github.repository }}",
178+
"agentDemand": "ubuntu-j25",
179+
"baseImage": "hmcts/apm-services:25-jre"
180+
}

.github/workflows/ci-draft.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,5 @@ jobs:
1818
environment: dev
1919
is_publish: ${{ github.event_name == 'push' }}
2020
trigger_docker: ${{ github.event_name == 'push' }}
21-
trigger_deploy: ${{ github.event_name == 'push' }}
21+
trigger_deploy: ${{ github.event_name == 'push' }}
22+

.github/workflows/ci-released.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ jobs:
1414
is_release: true
1515
is_publish: true
1616
trigger_docker: true
17-
trigger_deploy: true
17+
trigger_deploy: true

.github/workflows/code-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- uses: actions/setup-java@v5
1818
with:
1919
distribution: 'temurin'
20-
java-version: '21'
20+
java-version: '25'
2121

2222
- uses: pmd/pmd-github-action@v2
2323
id: pmd

.github/workflows/codeql.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,25 @@ jobs:
3636
languages: ${{ matrix.language }}
3737
queries: security-extended
3838

39+
3940
- uses: actions/setup-java@v5
4041
with:
4142
distribution: 'temurin'
42-
java-version: '21'
43+
java-version: '25'
4344

4445
- name: Set up Gradle
4546
uses: gradle/actions/setup-gradle@v5
4647
with:
4748
gradle-version: current
4849

49-
- name: Gradle Build
50+
- name: Gradle Build and Publish
51+
env:
52+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5053
run: |
51-
gradle build cyclonedxBom -x test
54+
./gradlew build cyclonedxBom -x test \
55+
-DGITHUB_REPOSITORY=${{ github.repository }} \
56+
-DGITHUB_ACTOR=${{ github.actor }} \
57+
-DGITHUB_TOKEN=$GITHUB_TOKEN
5258
5359
# ℹ️ Command-line programs to run using the OS shell.
5460
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Secret Scanning
2+
on:
3+
pull_request:
4+
branches:
5+
- master
6+
- main
7+
schedule:
8+
- cron: '0 4 * * 4' # Every Thursday at 04:00
9+
workflow_dispatch:
10+
11+
jobs:
12+
scan:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v6
16+
with:
17+
fetch-depth: 0
18+
19+
- uses: hmcts/secrets-scanner@main
20+
with:
21+
github_token: ${{ secrets.GITHUB_TOKEN }}
22+
gitleaks_license: ${{ secrets.GITLEAKS_LICENSE }}
23+
gitleaks_regex_internal_url: ${{ secrets.HMCTS_CP_GITLEAKS_REGEX_INTERNAL_URL }}

Dockerfile

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
# Docker base image - note that this is currently overwritten by azure pipelines
1+
# See ci-build-publish.yml which sets baseImage=hmcts/apm-services:25-jre and agentDemand:ubuntu-j25
2+
# azure pipeline replaces $BASE_IMAGE with crmdvrepo01.azurecr.io + $baseImage
3+
# This image has the hmcts self signing certificate authority added to truststore so we dont need to worry about about the certs
4+
# If pulling this locally we need to authenticate to acr ... az login; az acr login -n crmdvrepo01
25
ARG BASE_IMAGE
3-
FROM ${BASE_IMAGE:-eclipse-temurin:21-jdk}
6+
FROM ${BASE_IMAGE:-eclipse-temurin:25-jre}
47

58
# run as non-root ... group and user "app"
69
RUN groupadd -r app && useradd -r -g app app
@@ -16,10 +19,5 @@ COPY docker/* /app/
1619
COPY build/libs/*.jar /app/
1720
COPY lib/applicationinsights.json /app/
1821

19-
# Not sure this does anything useful we can drop once we sort certificates
20-
RUN test -n "$JAVA_HOME" \
21-
&& test -f "$JAVA_HOME/lib/security/cacerts" \
22-
&& chmod 777 "$JAVA_HOME/lib/security/cacerts"
23-
2422
USER app
2523
ENTRYPOINT ["/bin/sh","./startup.sh"]

build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
plugins {
22
id 'application'
33
id 'java'
4-
id 'org.springframework.boot' version '4.0.1'
4+
id 'org.springframework.boot' version '4.0.3'
55
id 'io.spring.dependency-management' version '1.1.7'
66
id 'jacoco'
77
id 'maven-publish'
88
id 'com.github.ben-manes.versions' version '0.53.0'
9-
id "org.cyclonedx.bom" version "3.1.0"
10-
id 'com.avast.gradle.docker-compose' version '0.17.20'
9+
id "org.cyclonedx.bom" version "3.2.0"
10+
id 'com.avast.gradle.docker-compose' version '0.17.21'
1111
}
1212

1313
group = 'uk.gov.hmcts.cp'
@@ -27,7 +27,7 @@ apply {
2727
}
2828

2929
dependencies {
30-
implementation "uk.gov.hmcts.cp:api-cp-crime-schedulingandlisting-courtschedule:1.0.8"
30+
implementation "uk.gov.hmcts.cp:api-cp-crime-schedulingandlisting-courtschedule:1.1.0"
3131

3232
implementation 'org.springframework.boot:spring-boot-starter-actuator'
3333
implementation 'org.springframework.boot:spring-boot-starter-opentelemetry'

docker/README-certs.md

Lines changed: 0 additions & 11 deletions
This file was deleted.

docker/startup.sh

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,10 @@
11
#!/usr/bin/env sh
2-
# Script to add ssl trust certs into the current truststore / keystore before we start our spring boot app
3-
# We use self signed certificates in our dev and test environments so we need to add these to our chain of trust
4-
# The kubernetes startup will load any self signed certificates into /etc/certs
5-
# We load any certs found in the /etc/certs into the default keystore
6-
#
2+
# Add any startup requirements in here
73
logmsg() {
84
SCRIPTNAME=$(basename $0)
95
echo "$SCRIPTNAME : $1"
106
}
117

12-
logmsg "running and loading certificates ..."
13-
if [ -z "$JAVA_HOME" ]; then
14-
export JAVA_HOME="/usr/local/openjdk-21"
15-
fi
16-
export KEYSTORE="$JAVA_HOME/lib/security/cacerts"
17-
if [ -z "$CERTS_DIR" ]; then
18-
logmsg "Warning - expects \$CERTS_DIR to be set. i.e. export CERTS_DIR="/etc/certs
19-
logmsg "Defaulting to /etc/certs"
20-
export CERTS_DIR="/etc/certs"
21-
fi
22-
23-
if [ ! -f "$KEYSTORE" ]; then
24-
logmsg "Error - expects keystore $KEYSTORE to already exist"
25-
exit 1
26-
fi
27-
28-
export count=1
29-
logmsg "Loading certificates from $CERTS_DIR into keystore $KEYSTORE"
30-
for FILE in $(ls $CERTS_DIR)
31-
do
32-
alias="mojcert$count"
33-
logmsg "Adding $CERTS_DIR/$FILE to keystore with alias $alias"
34-
keytool -importcert -file $CERTS_DIR/$FILE -keystore $KEYSTORE -storepass changeit -alias $alias -noprompt
35-
count=$((count+1))
36-
done
37-
38-
keytool -list -keystore $KEYSTORE -storepass changeit | grep "Your keystore contains"
39-
408
export LOCALJARFILE=$(ls ./build/libs/*.jar 2>/dev/null | grep -v 'plain' | head -n1)
419
export DOCKERJARFILE=$(ls /app/*.jar 2>/dev/null | grep -v 'plain' | head -n1)
4210
if [ -f "$DOCKERJARFILE" ]; then

0 commit comments

Comments
 (0)