Skip to content

Commit

Permalink
BFD-3050: Upgrade JDK to version 21 (#2066)
Browse files Browse the repository at this point in the history
  • Loading branch information
aadedejifearless authored Nov 29, 2023
1 parent e2a407d commit 6910b5a
Show file tree
Hide file tree
Showing 27 changed files with 65 additions and 62 deletions.
1 change: 0 additions & 1 deletion .github/workflows/ci-base-container-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ on:
paths:
- ops/Dockerfile
- .github/workflows/ci-base-container-image.yml

jobs:
build-container:
name: Build and Deliver Container
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/ci-java.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ env:
^ops/ansible/roles/bfd-pipeline/|\
^ops/ansible/roles/bfd-server/|\
^.github/workflows/ci-ansible.yml|\
^.github/workflows/ci-java.yml\
^.github/workflows/yml\
)"

jobs:
Expand Down Expand Up @@ -48,7 +48,7 @@ jobs:
- name: 'Setup JDK'
uses: actions/setup-java@v3
with:
java-version: '17'
java-version: '21'
distribution: 'corretto'
- name: 'Generate maven toolchain config'
run: |
Expand All @@ -57,7 +57,7 @@ jobs:
<toolchain>
<type>jdk</type>
<provides>
<version>17</version>
<version>21</version>
<vendor>OpenJDK</vendor>
</provides>
<configuration>
Expand All @@ -80,7 +80,7 @@ jobs:
- name: 'Setup JDK'
uses: actions/setup-java@v3
with:
java-version: '17'
java-version: '21'
distribution: 'corretto'
- name: 'Generate Maven Config'
run: |
Expand All @@ -89,7 +89,7 @@ jobs:
<toolchain>
<type>jdk</type>
<provides>
<version>17</version>
<version>21</version>
<vendor>OpenJDK</vendor>
</provides>
<configuration>
Expand Down
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ try {
containers: [
containerTemplate(
name: 'bfd-cbc-build',
image: 'public.ecr.aws/c2o1d8s9/bfd-cbc-build:jdk17-mvn3-tfenv3-kt1.9-latest', // TODO: consider a smarter solution for resolving this image
image: 'public.ecr.aws/c2o1d8s9/bfd-cbc-build:jdk21-mvn3-tfenv3-kt1.9-latest', // TODO: consider a smarter solution for resolving this image
command: 'cat',
ttyEnabled: true,
alwaysPullImage: false, // NOTE: This implies that we observe immutable container images
Expand Down
24 changes: 15 additions & 9 deletions apps/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
<project.reporting.outputEncoding>${project.build.sourceEncoding}</project.reporting.outputEncoding>

<!-- The version of Java that we'll use for everything. -->
<javaSourceVersion>17</javaSourceVersion>
<javaSourceVersion>21</javaSourceVersion>

<!-- Create a standard (but fake) timestamp for use in creating build artifacts so that
they are reproducible bit-by-bit no matter when/where they are generated.
Expand Down Expand Up @@ -128,7 +128,8 @@

<logback.jackson.version>0.1.5</logback.jackson.version>
<logback.json.classic.version>0.1.5</logback.json.classic.version>
<mockito.version>5.6.0</mockito.version>
<mockito.version>5.7.0</mockito.version>
<byte-buddy.version>1.14.9</byte-buddy.version>
<mockito-inline.version>5.2.0</mockito-inline.version>
<rest-assured.version>5.3.2</rest-assured.version>
<assertj.version>3.24.2</assertj.version>
Expand All @@ -148,19 +149,19 @@
<reflections.version>0.10.2</reflections.version>
<itextpdf.version>5.5.13.3</itextpdf.version>
<auto-service.version>1.1.1</auto-service.version>
<maven-plugin-api.version>3.9.4</maven-plugin-api.version>
<maven-plugin-api.version>3.9.5</maven-plugin-api.version>
<maven-core.version>3.9.4</maven-core.version>
<maven-plugin-annotations.version>3.9.0</maven-plugin-annotations.version>
<maven.plugin.version>3.7.1</maven.plugin.version>
<maven-plugin-annotations.version>3.10.2</maven-plugin-annotations.version>
<maven.plugin.version>3.10.2</maven.plugin.version>
<hibernate.validator.version>8.0.1.Final</hibernate.validator.version>
<jakarta.el.version>4.0.2</jakarta.el.version>
<poi.version>5.2.4</poi.version>
<javapoet.version>1.13.0</javapoet.version>
<!-- Using Jetty 10 LTS over Jetty 11 because Jetty 11 moves to the jakarta namespace for the servlet API which causes a problem for HAPI-->
<jetty.version>10.0.16</jetty.version>
<org.apache.httpcomponents.httpclient.version>4.5.14</org.apache.httpcomponents.httpclient.version>
<maven.surefire.plugin.version>3.1.2</maven.surefire.plugin.version>
<maven.failsafe.plugin.version>3.1.2</maven.failsafe.plugin.version>
<maven.surefire.plugin.version>3.2.2</maven.surefire.plugin.version>
<maven.failsafe.plugin.version>3.2.2</maven.failsafe.plugin.version>
<datasource-proxy.version>1.9</datasource-proxy.version>
<cors.filter.version>1.0.1</cors.filter.version>
<org.apache.spark.version>3.5.0</org.apache.spark.version>
Expand Down Expand Up @@ -225,7 +226,7 @@
<!-- https://github.com/GoogleContainerTools/jib/tree/master/jib-maven-plugin#quickstart -->
<jib.version>3.4.0</jib.version>
<!-- The base image (FROM) used to build images with jib. -->
<jib.from>amazoncorretto:17.0.7-alpine</jib.from>
<jib.from>amazoncorretto:21.0.1-alpine</jib.from>
<!--
The goal to use with the jib plugin. Override on command line to change behavior:
dockerBuild: build on local docker only
Expand Down Expand Up @@ -306,6 +307,12 @@
<artifactId>mockito-inline</artifactId>
<version>${mockito-inline.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/net.bytebuddy/byte-buddy -->
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId>
<version>${byte-buddy.version}</version>
</dependency>
<dependency>
<!-- Used to write fluent assertions in unit tests. -->
<groupId>org.assertj</groupId>
Expand Down Expand Up @@ -727,7 +734,6 @@
<configuration>
<toolchains>
<jdk>
<!-- Use a Java 17 JDK, by default. -->
<version>${javaSourceVersion}</version>
</jdk>
</toolchains>
Expand Down
9 changes: 6 additions & 3 deletions ops/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,22 @@ LABEL org.opencontainers.image.source=https://github.com/CMSgov/beneficiary-fhir
# * <https://github.com/solita/docker-systemd>: For Ubuntu, but works!
# * <https://github.com/moby/moby/issues/28614>: Also some useful info.
#
# NOTE: Packages sepecified below should generally be kept up-to-date
# NOTE: Packages specified below should generally be kept up-to-date
# with the dependencies encoded in the BFD platinum image
# instructions.
RUN yum update -y --security && \

RUN rpm --import https://yum.corretto.aws/corretto.key && \
curl -L -o /etc/yum.repos.d/corretto.repo https://yum.corretto.aws/corretto.repo && \
yum clean metadata && \
yum update -y --security && \
amazon-linux-extras install epel -y && \
yum -y groupinstall "Development Tools" && \
yum install -y \
java-21-amazon-corretto-devel \
amazon-cloudwatch-agent \
ansible \
gcc \
git \
java-17-amazon-corretto-devel \
libffi-devel \
openssl-devel \
selinux-policy \
Expand Down
8 changes: 0 additions & 8 deletions ops/ansible/playbooks-ccs/roles/install_java/tasks/main.yml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,23 @@
# Builds a 'Platinum' AMI (updates) and installs program specific dependencies
# from a base Gold Image in the CCS AWS Environment
##
- name: Import Corretto RPM key
ansible.builtin.command : rpm --import https://yum.corretto.aws/corretto.key
- name: Download Corretto repository configuration
ansible.builtin.command: curl -L -o /etc/yum.repos.d/corretto.repo https://yum.corretto.aws/corretto.repo
- name: Install dependencies
vars:
ansible_python_interpreter: /usr/bin/python
yum:
# NOTE: Packages sepecified below should generally be kept up-to-date
# NOTE: Packages specified below should generally be kept up-to-date
# with the dependencies encoded in ops/Dockerfile instructions.
name:
- "@Development Tools" # equivalent to `yum groupinstall "Development Tools"`
- amazon-cloudwatch-agent
- ansible
- gcc
- git
- java-17-amazon-corretto-devel
- java-21-amazon-corretto-devel
- libffi-devel
- openssl-devel
- selinux-policy
Expand Down
2 changes: 1 addition & 1 deletion ops/ansible/roles/bfd-db-migrator/tasks/migrator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
ansible_python_interpreter: /usr/bin/python
yum:
pkg:
- java-17-amazon-corretto-devel
- java-21-amazon-corretto-devel
- jq
become: true
tags:
Expand Down
2 changes: 1 addition & 1 deletion ops/ansible/roles/bfd-pipeline/tasks/etl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
ansible_python_interpreter: /usr/bin/python
yum:
pkg:
- java-17-amazon-corretto-devel
- java-21-amazon-corretto-devel
become: true
tags:
- pre-ami
Expand Down
2 changes: 1 addition & 1 deletion ops/ansible/roles/bfd-server/tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
ansible_python_interpreter: /usr/bin/python
yum:
pkg:
- java-17-amazon-corretto-devel
- java-21-amazon-corretto-devel
- iptables
become: true

Expand Down
8 changes: 4 additions & 4 deletions ops/deploy-ccs.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ class AmiIds implements Serializable {
def findAmis(String branchName) {
// Replace this lookup either with a lookup in SSM or in a build artifact.
return new AmiIds(
platinumAmiId: awsEc2.getAmiId("", "bfd-amzn2-jdk17-platinum-??????????????"),
bfdPipelineAmiId: awsEc2.getAmiId(branchName, "bfd-amzn2-jdk17-etl-??????????????"),
bfdServerAmiId: awsEc2.getAmiId(branchName, "bfd-amzn2-jdk17-fhir-??????????????"),
bfdMigratorAmiId: awsEc2.getAmiId(branchName, "bfd-amzn2-jdk17-db-migrator-??????????????"),
platinumAmiId: awsEc2.getAmiId("", "bfd-amzn2-jdk21-platinum-??????????????"),
bfdPipelineAmiId: awsEc2.getAmiId(branchName, "bfd-amzn2-jdk21-etl-??????????????"),
bfdServerAmiId: awsEc2.getAmiId(branchName, "bfd-amzn2-jdk21-fhir-??????????????"),
bfdMigratorAmiId: awsEc2.getAmiId(branchName, "bfd-amzn2-jdk21-db-migrator-??????????????"),
bfdDockerHostAmiId: awsEc2.getAmiId(branchName, "docker-host-??????????????")
)
}
Expand Down
2 changes: 1 addition & 1 deletion ops/jenkins/bfd-build-apps/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ spec:
serviceAccount: bfd
containers:
- name: bfd-cbc-build
image: 'public.ecr.aws/c2o1d8s9/bfd-cbc-build:jdk17-mvn3-tfenv3-kt1.9-latest'
image: 'public.ecr.aws/c2o1d8s9/bfd-cbc-build:jdk21-mvn3-tfenv3-kt1.9-latest'
command:
- cat
tty: true
Expand Down
2 changes: 1 addition & 1 deletion ops/jenkins/bfd-build-deploy/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ spec:
serviceAccount: bfd
containers:
- name: bfd-cbc-build
image: 'public.ecr.aws/c2o1d8s9/bfd-cbc-build:jdk17-mvn3-tfenv3-kt1.9-latest'
image: 'public.ecr.aws/c2o1d8s9/bfd-cbc-build:jdk21-mvn3-tfenv3-kt1.9-latest'
command:
- cat
tty: true
Expand Down
2 changes: 1 addition & 1 deletion ops/jenkins/bfd-build-deployment-process/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ spec:
serviceAccount: bfd
containers:
- name: bfd-cbc-build
image: 'public.ecr.aws/c2o1d8s9/bfd-cbc-build:jdk17-mvn3-tfenv3-kt1.9-latest'
image: 'public.ecr.aws/c2o1d8s9/bfd-cbc-build:jdk21-mvn3-tfenv3-kt1.9-latest'
command:
- cat
tty: true
Expand Down
4 changes: 2 additions & 2 deletions ops/jenkins/bfd-build-platinum/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ spec:
serviceAccount: bfd
containers:
- name: bfd-cbc-build
image: 'public.ecr.aws/c2o1d8s9/bfd-cbc-build:jdk17-mvn3-tfenv3-kt1.9-latest'
image: 'public.ecr.aws/c2o1d8s9/bfd-cbc-build:jdk21-mvn3-tfenv3-kt1.9-latest'
command:
- cat
tty: true
Expand Down Expand Up @@ -135,7 +135,7 @@ spec:
returnStdout: true,
script: "aws ec2 describe-images \
--filters 'Name=tag:amiSourceId,Values=${goldAmiId}' \
'Name=name,Values=bfd-amzn2-jdk17-platinum-??????????????' \
'Name=name,Values=bfd-amzn2-jdk21-platinum-??????????????' \
'Name=state,Values=available' --region us-east-1 \
--query 'Images[*].[ImageId]' \
--output text"
Expand Down
1 change: 0 additions & 1 deletion ops/jenkins/bfd-cbc-build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ ARG PACKER_VERSION
ARG YQ_VERSION

FROM maven:${MAVEN_VERSION}-amazoncorretto-${JAVA_VERSION} AS base

RUN yum update -y --security && \
amazon-linux-extras install epel -y && \
yum clean metadata && \
Expand Down
6 changes: 3 additions & 3 deletions ops/jenkins/bfd-cbc-build/build-push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ REPO_ROOT="$(cd "$BUILD_ROOT_DIR" && git rev-parse --show-toplevel)"
# Overridable Defaults
GIT_SHORT_HASH="$(git rev-parse --short HEAD)"
IMAGE_NAME="public.ecr.aws/c2o1d8s9/bfd-cbc-build"
IMAGE_TAG="${CBC_IMAGE_TAG:-"jdk17-mvn3-tfenv3-${GIT_SHORT_HASH}"}"
IMAGE_TAG_LATEST="${CBC_IMAGE_TAG_LATEST:-"jdk17-mvn3-tfenv3-kt1.9-latest"}"
IMAGE_TAG="${CBC_IMAGE_TAG:-"jdk21-mvn3-tfenv3-${GIT_SHORT_HASH}"}"
IMAGE_TAG_LATEST="${CBC_IMAGE_TAG_LATEST:-"jdk21-mvn3-tfenv3-kt1.9-latest"}"
CIPHER_SCRIPT="$(cat "$REPO_ROOT/apps/utils/cipher/cipher.main.kts")"

docker build "$BUILD_ROOT_DIR" \
--build-arg JAVA_VERSION="${CBC_JAVA_VERSION:-17}" \
--build-arg JAVA_VERSION="${CBC_JAVA_VERSION:-21}" \
--build-arg MAVEN_VERSION="${CBC_MAVEN_VERSION:-3}" \
--build-arg PACKER_VERSION="${CBC_PACKER_VERSION:-1.6.6}" \
--build-arg TFENV_REPO_HASH="${CBC_TFENV_REPO_HASH:-c05c364}" \
Expand Down
4 changes: 2 additions & 2 deletions ops/jenkins/bfd-cbc-build/toolchains.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
<toolchain>
<type>jdk</type>
<provides>
<version>17</version>
<version>21</version>
<vendor>openjdk</vendor>
</provides>
<configuration>
<jdkHome>/usr/lib/jvm/java-17-amazon-corretto</jdkHome>
<jdkHome>/usr/lib/jvm/java-21-amazon-corretto</jdkHome>
</configuration>
</toolchain>
</toolchains>
2 changes: 1 addition & 1 deletion ops/jenkins/bfd-data-fda/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
serviceAccount: bfd
containers:
- name: bfd-cbc-build
image: public.ecr.aws/c2o1d8s9/bfd-cbc-build:jdk17-mvn3-tfenv3-kt1.9-latest # TODO: resolve the container image rather than hard-coding it
image: public.ecr.aws/c2o1d8s9/bfd-cbc-build:jdk21-mvn3-tfenv3-kt1.9-latest # TODO: resolve the container image rather than hard-coding it
command:
- sleep
args:
Expand Down
2 changes: 1 addition & 1 deletion ops/jenkins/bfd-data-npi/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
serviceAccount: bfd
containers:
- name: bfd-cbc-build
image: public.ecr.aws/c2o1d8s9/bfd-cbc-build:jdk17-mvn3-tfenv3-kt1.9-latest # TODO: resolve the container image rather than hard-coding it
image: public.ecr.aws/c2o1d8s9/bfd-cbc-build:jdk21-mvn3-tfenv3-kt1.9-latest # TODO: resolve the container image rather than hard-coding it
command:
- sleep
args:
Expand Down
2 changes: 1 addition & 1 deletion ops/jenkins/bfd-deploy-apps/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ spec:
serviceAccount: bfd
containers:
- name: bfd-cbc-build
image: 'public.ecr.aws/c2o1d8s9/bfd-cbc-build:jdk17-mvn3-tfenv3-kt1.9-latest'
image: 'public.ecr.aws/c2o1d8s9/bfd-cbc-build:jdk21-mvn3-tfenv3-kt1.9-latest'
command:
- cat
tty: true
Expand Down
2 changes: 1 addition & 1 deletion ops/jenkins/bfd-deploy-pipeline-terraservice/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ spec:
restartPolicy: Never
containers:
- name: bfd-cbc-build
image: "public.ecr.aws/c2o1d8s9/bfd-cbc-build:jdk17-mvn3-tfenv3-kt1.9-latest" # TODO: consider a smarter solution for resolving this image
image: "public.ecr.aws/c2o1d8s9/bfd-cbc-build:jdk21-mvn3-tfenv3-kt1.9-latest" # TODO: consider a smarter solution for resolving this image
command:
- cat
tty: true
Expand Down
2 changes: 1 addition & 1 deletion ops/jenkins/bfd-destroy-environment/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ spec:
serviceAccount: bfd
containers:
- name: bfd-cbc-build
image: 'public.ecr.aws/c2o1d8s9/bfd-cbc-build:jdk17-mvn3-tfenv3-kt1.9-latest'
image: 'public.ecr.aws/c2o1d8s9/bfd-cbc-build:jdk21-mvn3-tfenv3-kt1.9-latest'
command:
- cat
tty: true
Expand Down
2 changes: 1 addition & 1 deletion ops/jenkins/bfd-jenkins-sonarqube/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ spec:
memory: '8192Mi'
cpu: '4000m'
- name: bfd-cbc-build
image: 'public.ecr.aws/c2o1d8s9/bfd-cbc-build:jdk17-mvn3-tfenv3-kt1.9-latest'
image: 'public.ecr.aws/c2o1d8s9/bfd-cbc-build:jdk21-mvn3-tfenv3-kt1.9-latest'
volumeMounts:
- name: docker-socket
mountPath: /var/run
Expand Down
2 changes: 1 addition & 1 deletion ops/jenkins/bfd-run-pipeline-oob/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ spec:
restartPolicy: Never
containers:
- name: bfd-cbc-build
image: "public.ecr.aws/c2o1d8s9/bfd-cbc-build:jdk17-mvn3-tfenv3-kt1.9-latest" # TODO: consider a smarter solution for resolving this image
image: "public.ecr.aws/c2o1d8s9/bfd-cbc-build:jdk21-mvn3-tfenv3-kt1.9-latest" # TODO: consider a smarter solution for resolving this image
command:
- cat
tty: true
Expand Down
Loading

0 comments on commit 6910b5a

Please sign in to comment.