Skip to content

Commit

Permalink
Merge pull request #62 from bcgov/java-upgrade
Browse files Browse the repository at this point in the history
Upgrade to Java 21 and Spring Boot 3
  • Loading branch information
WadeBarnes authored Jun 10, 2024
2 parents 7ff19f8 + 58ec276 commit 6137afa
Show file tree
Hide file tree
Showing 25 changed files with 337 additions and 268 deletions.
5 changes: 3 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
{
"name": "Java",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
// "image": "mcr.microsoft.com/devcontainers/java:1-21-bookworm",
"image": "mcr.microsoft.com/devcontainers/java:1-11-bookworm",
"image": "mcr.microsoft.com/devcontainers/java:1-21-bookworm",
// "image": "mcr.microsoft.com/devcontainers/java:1-17-bookworm",
// "image": "mcr.microsoft.com/devcontainers/java:1-11-bookworm",

"features": {
"ghcr.io/devcontainers/features/java:1": {
Expand Down
45 changes: 45 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for more information:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
# https://containers.dev/guide/dependabot
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:

# Maintain dependencies for GitHub Actions
# - Check for updates once a week
# - Group all updates into a single PR
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
groups:
all-actions:
patterns: [ "*" ]

- package-ecosystem: "maven"
directory: "/"
schedule:
interval: "weekly"

- package-ecosystem: "maven"
directory: "/AutomatedTest"
schedule:
interval: "weekly"

- package-ecosystem: "devcontainers"
directory: "/"
schedule:
interval: "weekly"

- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "weekly"

- package-ecosystem: "docker"
directory: "/AutomatedTest"
schedule:
interval: "weekly"
51 changes: 26 additions & 25 deletions .github/workflows/automationtestapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
required: true
default: jag-cdds-tests
env:
description: 'Image Target Env'
description: 'Image Target Env'
required: true
default: 'dev'

Expand All @@ -28,22 +28,22 @@ jobs:
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Git Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

# Get the version number which is prefixed with the Github release branches in format release/{version}
- name: Get Release Version
run: |
branch=${GITHUB_REF##*/}
version=$(echo $branch | cut -d "/" -f2-)
echo "releaseVersion=$version" >> $GITHUB_ENV
# Get Git latest short Sha# from the release branch used. This Sha# will be used in image tagging as well as DC Pod labelling.
- name: Get git commit short sha
id: sha
run: |
shortSha=$(echo $(git rev-parse --short HEAD) | cut -c1-7)
echo "gitsha=$shortSha" >> $GITHUB_ENV
# Prints vital release paramters used
- name: Print Release Variables
run: |
Expand All @@ -53,22 +53,23 @@ jobs:
echo "Release Git Sha: ${{env.gitsha}}"
# Set up JDK build environment
- name: Set up JDK 11
uses: actions/setup-java@v1
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: 11

java-version: '21'
distribution: 'temurin'

# Runs build steps
- name: Maven Package
working-directory: AutomatedTest
run: mvn -ntp clean package

- name: Maven Spotless Check
run: mvn -ntp spotless:check

#Login to OpenShift Container Repository - Silver
- name: Login to OpenShift Container Repository - Silver
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
registry: ${{secrets.OPENSHIFT_EXTERNAL_REPOSITORY_SILVER}}
username: ${{secrets.OPENSHIFT_SA_USERNAME}}
Expand All @@ -86,10 +87,10 @@ jobs:
--tag ${IMAGE} \
${CONTEXT}
docker push ${IMAGE}
#Login to OpenShift Container Repository - Kamloops (OC PROD)
- name: Login to OpenShift Container Repository - Kamloops (OC PROD)
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
registry: ${{secrets.OPENSHIFT_EXTERNAL_REPOSITORY}}
username: ${{secrets.OPENSHIFT_SA_USERNAME}}
Expand All @@ -107,10 +108,10 @@ jobs:
--tag ${IMAGE} \
${CONTEXT}
docker push ${IMAGE}
#Login to OpenShift Container Repository - Calgary (OC DR)
- name: Login to OpenShift Container Repository - Calgary (OC DR)
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
registry: ${{secrets.OPENSHIFT_EXTERNAL_REPOSITORY_DR}}
username: ${{secrets.OPENSHIFT_SA_USERNAME}}
Expand All @@ -128,7 +129,7 @@ jobs:
--tag ${IMAGE} \
${CONTEXT}
docker push ${IMAGE}
#Login to Openshift using OC SA and Token of respective env. for Pod labelling - Silver
- name: Authenticate OC Env Specific SA - Silver
uses: redhat-actions/oc-login@v1
Expand All @@ -139,7 +140,7 @@ jobs:
openshift_server_url: ${{secrets.OPENSHIFT_SERVER_URL_SILVER}}
openshift_token: ${{secrets.OPENSHIFT_SA_ENV_DEPLOYER_TOKEN_SILVER}}
namespace: ${OPENSHIFT_NAMESPACE}

# Labels the deployment config of the application with release version number to spin up the pods labelled in same version - Silver
- name: Labelling DC to release version - Silver
env:
Expand All @@ -148,15 +149,15 @@ jobs:
openshiftEnvNamespace: ${{secrets.OPENSHIFT_LICENSE_PLATE_SILVER}}-${{ github.event.inputs.env }}
run: |
oc patch dc ${appName} -n ${openshiftEnvNamespace} --patch '{"spec":{"template":{"metadata":{"labels":{"version":"${{ env.releaseVersion }}.${{ env.gitsha }}"}}}}}'
# Wait to DC rollout to get completed before proceeding next stage - Silver
- name: Wait for DC rollout - Silver
env:
appName: ${{ github.event.inputs.app }}
openshiftEnvNamespace: ${{secrets.OPENSHIFT_LICENSE_PLATE_SILVER}}-${{ github.event.inputs.env }}
run: |
oc rollout status -n ${openshiftEnvNamespace} dc/${appName} --watch
#Login to Openshift using OC SA and Token of respective env. for Pod labelling - Kamloops (OC PROD)
- name: Authenticate OC Env Specific SA - Kamloops (OC PROD)
uses: redhat-actions/oc-login@v1
Expand All @@ -167,7 +168,7 @@ jobs:
openshift_server_url: ${{secrets.OPENSHIFT_SERVER_URL}}
openshift_token: ${{secrets.OPENSHIFT_SA_ENV_DEPLOYER_TOKEN}}
namespace: ${OPENSHIFT_NAMESPACE}

# Labels the deployment config of the application with release version number to spin up the pods labelled in same version - Kamloops (OC PROD)
- name: Labelling DC to release version - Kamloops (OC PROD)
env:
Expand All @@ -176,15 +177,15 @@ jobs:
openshiftEnvNamespace: ${{secrets.OPENSHIFT_LICENSE_PLATE}}-${{ github.event.inputs.env }}
run: |
oc patch dc ${appName} -n ${openshiftEnvNamespace} --patch '{"spec":{"template":{"metadata":{"labels":{"version":"${{ env.releaseVersion }}.${{ env.gitsha }}"}}}}}'
# Wait to DC rollout to get completed before proceeding next stage - Kamloops (OC PROD)
- name: Wait for DC rollout - Kamloops (OC PROD)
env:
appName: ${{ github.event.inputs.app }}
openshiftEnvNamespace: ${{secrets.OPENSHIFT_LICENSE_PLATE}}-${{ github.event.inputs.env }}
run: |
oc rollout status -n ${openshiftEnvNamespace} dc/${appName} --watch
#Login to Openshift using OC SA and Token of respective env. for Pod labelling - Calgary (OC DR)
- name: Authenticate OC Env Specific SA - Calgary (OC DR)
uses: redhat-actions/oc-login@v1
Expand All @@ -195,7 +196,7 @@ jobs:
openshift_server_url: ${{secrets.OPENSHIFT_SERVER_URL_DR}}
openshift_token: ${{secrets.OPENSHIFT_SA_ENV_DEPLOYER_TOKEN_DR}}
namespace: ${OPENSHIFT_NAMESPACE}

# Labels the deployment config of the application with release version number to spin up the pods labelled in same version - Calgary (OC DR)
- name: Labelling DC to release version - Calgary (OC DR)
env:
Expand All @@ -204,7 +205,7 @@ jobs:
openshiftEnvNamespace: ${{secrets.OPENSHIFT_LICENSE_PLATE}}-${{ github.event.inputs.env }}
run: |
oc patch dc ${appName} -n ${openshiftEnvNamespace} --patch '{"spec":{"template":{"metadata":{"labels":{"version":"${{ env.releaseVersion }}.${{ env.gitsha }}"}}}}}'
# Wait to DC rollout to get completed before proceeding next stage - Calgary (OC DR)
- name: Wait for DC rollout - Calgary (OC DR)
env:
Expand Down
31 changes: 16 additions & 15 deletions .github/workflows/codeclimate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ on:
jobs:
# This workflow contains a single job called "build"
build:

# The type of runner that the job will run on
runs-on: ubuntu-20.04

env:
FILE_COUNTER: 0
CC_TEST_REPORTER_ID: 1f9d1a63a1e35063669ac32d207d3a51101dbf43c3c4578e75974ab9a3076193
Expand All @@ -27,26 +27,27 @@ jobs:
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Git Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

# Set up JDK build environment
- name: Set up JDK 11
uses: actions/setup-java@v1
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: 11

java-version: '21'
distribution: 'temurin'

# Get Code Climate binary
- name: Download Code Climate Binary
run: curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter

# Permissions applied to the Code Climate Executable
- name: Apply executable perms to Code Climate Binary
run: chmod +x ./cc-test-reporter
run: chmod +x ./cc-test-reporter

# Before build
- name: Before build
run: ./cc-test-reporter before-build

# Set required Git env vars for either pull request
- name: Set ENV for codeclimate (pull_request)
run: |
Expand Down Expand Up @@ -74,21 +75,21 @@ jobs:

- name: Check Code Style
run: mvn -ntp spotless:check

- name: Run Maven Test
run: mvn -ntp verify

# Formatting the Code Coverage Report
- name: Format the coverage report
run: JACOCO_SOURCE_PATH="src/main/java target/generated-sources/xjc" ./cc-test-reporter format-coverage ./target/site/jacoco/jacoco.xml -t jacoco -o ./target/site/jacoco/codeclimate.json

# Upload JSON for debugging purposes
- name: Upload JSON for debugging purposes
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: cdds-coverage-report
path: ./target/site/jacoco/codeclimate.json

# Upload total coverage report to Code Climate
- name: Upload coverage report to Code Climate
run: ./cc-test-reporter upload-coverage -i ./target/site/jacoco/codeclimate.json
Loading

0 comments on commit 6137afa

Please sign in to comment.