Skip to content

Commit

Permalink
switch to JDK 21
Browse files Browse the repository at this point in the history
  • Loading branch information
matihost committed Oct 10, 2023
1 parent ba193f0 commit 6e68d09
Show file tree
Hide file tree
Showing 18 changed files with 39 additions and 35 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
runs-on: ${{ inputs.runner || 'ubuntu-22.04' }}
timeout-minutes: 5
container:
image: maven:3-openjdk-17
image: maven:3-amazoncorretto-21-debian
outputs:
GIT_COMMIT_HASH: ${{ steps.git_hash.outputs.GIT_COMMIT_HASH }}
steps:
Expand Down Expand Up @@ -73,7 +73,7 @@ jobs:
runs-on: ${{ inputs.runner || 'ubuntu-22.04' }}
timeout-minutes: 30
container:
image: maven:3-openjdk-17
image: maven:3-amazoncorretto-21-debian
steps:
- name: Download sources
uses: actions/cache/restore@v3
Expand All @@ -93,10 +93,10 @@ jobs:
# Do not use actions/setup-java@v3 cache option as it requires downloading java again, but container image contains java already
# Use actions/cache to cache M2 repository manually instead
#
# - name: Set up JDK 17
# - name: Set up JDK 21
# uses: actions/setup-java@v3
# with:
# java-version: '17'
# java-version: '21'
# distribution: 'adopt'
# cache: maven
- name: Build Java source code
Expand Down Expand Up @@ -174,7 +174,7 @@ jobs:
runs-on: ${{ inputs.runner || 'ubuntu-22.04' }}
timeout-minutes: 30
container:
image: maven:3-openjdk-17
image: maven:3-amazoncorretto-21-debian
steps:
- name: Download sources
uses: actions/cache/restore@v3
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/jenkins-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
- uses: actions/setup-java@v3
with:
distribution: adopt
java-version: '17'
java-version: '21'
- run: cd java && make build
- name: Upload Artifacts
uses: actions/upload-artifact@v3
Expand All @@ -88,7 +88,7 @@ jobs:
# # This item has no matching transformer
# - container:
# isLiteral: true
# value: maven-jdk17
# value: maven-jdk21
- name: Upload Artifacts
uses: actions/upload-artifact@v3
if: always()
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/kaniko.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
images:
runs-on: 'ubuntu-22.04'
container:
image: maven:3-openjdk-17
image: maven:3-amazoncorretto-21-debian
steps:
- name: checkout
uses: actions/checkout@v4
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/travis-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
- uses: actions/setup-java@v3
with:
distribution: adopt
java-version: '17'
java-version: '21'
- run: cd java && make build
project-euler:
runs-on: ubuntu-20.04
Expand All @@ -57,7 +57,7 @@ jobs:
- uses: actions/setup-java@v3
with:
distribution: adopt
java-version: '17'
java-version: '21'
- run: cd algorithms/project-euler && make build
rust:
runs-on: ubuntu-20.04
Expand Down
10 changes: 5 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
---
dist: jammy
branches:
only:
- master
# branches:
# only:
# - master
jobs:
include:
- stage: build
language: java
jdk: openjdk17
jdk: openjdk21
before_script: cd java
script: make build
cache:
Expand All @@ -16,7 +16,7 @@ jobs:
env:
- CACHE=java
- language: java
jdk: openjdk17
jdk: openjdk21
before_script: cd algorithms/project-euler
script: make build
cache:
Expand Down
8 changes: 4 additions & 4 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ spec:
runAsUser: 1000
fsGroup: 1000
containers:
- name: maven-jdk17
image: maven:3-openjdk-17
- name: maven-jdk21
image: maven:3-amazoncorretto-21-debian
command:
- sleep
args:
Expand Down Expand Up @@ -108,7 +108,7 @@ spec:
parallel {
stage('Build :: Java') {
steps {
container("maven-jdk17"){
container("maven-jdk21"){
dir("java"){
echo "Building ${pwd()}..."
sh """
Expand All @@ -128,7 +128,7 @@ spec:
}
stage('Build :: Project Euler') {
steps {
container("maven-jdk17"){
container("maven-jdk21"){
dir("algorithms/project-euler"){
echo "Building ${pwd()}..."
sh """
Expand Down
4 changes: 2 additions & 2 deletions algorithms/project-euler/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ Project Euler algorithms [description](algorithms.md).
## Prerequisites

```bash
# JDK 17
sudo apt install openjdk-17-jdk openjdk-17-source
# JDK 21
sudo apt install openjdk-21-jdk openjdk-21-source

# maven (via sdkman)
curl -s "https://get.sdkman.io" | bash
Expand Down
2 changes: 1 addition & 1 deletion algorithms/project-euler/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
</scm>

<properties>
<java.version>17</java.version>
<java.version>21</java.version>
<maven.compiler.release>${java.version}</maven.compiler.release>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
Expand Down
4 changes: 2 additions & 2 deletions cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ substitutions:
_MVN_SETTINGS: ".mvn/settings.xml"
steps:
- id: algorithms
name: maven:3-openjdk-17
name: maven:3-amazoncorretto-21-debian
entrypoint: 'bash'
dir: "algorithms/project-euler"
args:
Expand All @@ -16,7 +16,7 @@ steps:
- '-c'
- |-
mvn -s ${_MVN_SETTINGS} clean install
- name: maven:3-openjdk-17
- name: maven:3-amazoncorretto-21-debian
waitFor: ['algorithms']
entrypoint: 'bash'
dir: "java"
Expand Down
4 changes: 3 additions & 1 deletion java/apps/command-line/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
ARG JAR_FILE
FROM eclipse-temurin:17 as jreBuilder
# TODO bring back temuring when temurin 21 is released
# FROM eclipse-temurin:21 as jreBuilder
FROM amazoncorretto:21 as jreBuilder
# build JRE with only modules app depens on
# + jfr and jcmd tooling (jcmd,jps,jmap,jstack etc.) ~ adds 6 MiB to image size
RUN jlink \
Expand Down
4 changes: 3 additions & 1 deletion java/apps/mq/client/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
ARG JAR_FILE
FROM eclipse-temurin:17 as jreBuilder
# TODO bring back temuring when temurin 21 is released
# FROM eclipse-temurin:21 as jreBuilder
FROM amazoncorretto:21 as jreBuilder
# build JRE with only modules app depens on
# + jfr and jcmd tooling (jcmd,jps,jmap,jstack etc.) ~ adds 6 MiB to image size
RUN jlink \
Expand Down
4 changes: 2 additions & 2 deletions java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
</modules>

<properties>
<java.version>17</java.version>
<java.version>21</java.version>
<maven.compiler.release>${java.version}</maven.compiler.release>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
Expand All @@ -47,7 +47,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

<!-- Travis CI openjdk17 image has build in Maven 3.6.3 -->
<!-- Travis CI openjdk21 image has build in Maven 3.6.3 -->
<enforce.maven.version>3.6</enforce.maven.version>

<!-- Spock -->
Expand Down
2 changes: 1 addition & 1 deletion k8s/gh-arc/files/prerequisites.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
name: "{{ runner.namespace | mandatory }}"
labels:
# Ensure Istio does not inject sidecar to runner delegated jobs as they crash automatically
# ##[debug]Using image 'maven:3-openjdk-17' for job image
# ##[debug]Using image 'maven:3-amazoncorretto-21-debian' for job image
# ##[debug]Job pod created, waiting for it to come online matihost-monorepo-8blcq-87ffq-workflow
# ##[debug]Job pod is ready for traffic
# ##[debug]{"message":"command terminated with non-zero exit code: Error executing in Docker Container: 1","details":{"causes":[{"reason":"ExitCode","message":"1"}]}}
Expand Down
2 changes: 1 addition & 1 deletion k8s/gh-arc/v1/deploy-arc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
name: "{{ repo.ci_namespace | mandatory }}"
labels:
# Ensure Istio does not inject sidecar to runner delegated jobs as they crash automatically
# ##[debug]Using image 'maven:3-openjdk-17' for job image
# ##[debug]Using image 'maven:3-amazoncorretto-21-debian' for job image
# ##[debug]Job pod created, waiting for it to come online matihost-monorepo-8blcq-87ffq-workflow
# ##[debug]Job pod is ready for traffic
# ##[debug]{"message":"command terminated with non-zero exit code: Error executing in Docker Container: 1","details":{"causes":[{"reason":"ExitCode","message":"1"}]}}
Expand Down
4 changes: 2 additions & 2 deletions k8s/images/gh-images/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
ARG JAVA_VERSION=17
ARG JAVA_VERSION=21
FROM alpine as certs
RUN apk --update add ca-certificates
FROM gcr.io/kaniko-project/executor:debug as kaniko
FROM maven:3-openjdk-${JAVA_VERSION}
FROM maven:3-amazoncorretto-${JAVA_VERSION}-debian
RUN echo -e "[google-cloud-cli]\nname=Google Cloud CLI\nbaseurl=https://packages.cloud.google.com/yum/repos/cloud-sdk-el8-x86_64\nenabled=1\ngpgcheck=1\nrepo_gpgcheck=0\ngpgkey=https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg" > /etc/yum.repos.d/google-cloud-sdk.repo \
&& microdnf install google-cloud-cli kubectl google-cloud-cli-kubectl-oidc google-cloud-cli-gke-gcloud-auth-plugin \
&& microdnf clean all && rm -rf /var/cache/yum
Expand Down
2 changes: 1 addition & 1 deletion k8s/images/gh-images/Dockerfile.ubuntu
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM alpine as certs
RUN apk --update add ca-certificates
FROM gcr.io/kaniko-project/executor:debug as kaniko
FROM ubuntu:22.04
ARG JAVA_VERSION=17
ARG JAVA_VERSION=21
RUN apt -y update && apt -y install curl wget lsb-release gnupg apt-transport-https ca-certificates openjdk-${JAVA_VERSION}-jdk maven\
&& curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key --keyring /usr/share/keyrings/cloud.google.gpg add - \
&& echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" > /etc/apt/sources.list.d/google-cloud-sdk.list \
Expand Down
2 changes: 1 addition & 1 deletion k8s/images/gh-images/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
TAG := latest
JAVA_VERSION := 17
JAVA_VERSION := 21
build: ## builds docker image
DOCKER_BUILDKIT=1 BUILDKIT_PROGRESS=plain docker build --build-arg=JAVA_VERSION=$(JAVA_VERSION) -t quay.io/matihost/gh-gcp-java-kaniko:$(TAG) .

Expand Down
2 changes: 1 addition & 1 deletion k8s/images/gitpod/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# To build & test: docker build -f .gitpod.Dockerfile -t gitpod-dockerfile-test . && docker run -it gitpod-dockerfile-test bash
# To force gitpod to rebuild cached image: https://gitpod.io/#imagebuild/https://github.com/matihost/monorepo
ARG JDK_FLAVOR=17.0.7-tem
ARG JDK_FLAVOR=21-open
FROM gitpod/workspace-full:latest


Expand Down

0 comments on commit 6e68d09

Please sign in to comment.