Skip to content

Commit

Permalink
feat(java17): use JRE17, run tests on JRE17, compile with JDK11
Browse files Browse the repository at this point in the history
  • Loading branch information
mattgogerly committed Nov 28, 2023
1 parent d1f7ee2 commit 09c2df5
Show file tree
Hide file tree
Showing 9 changed files with 114 additions and 7 deletions.
29 changes: 28 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ jobs:
uses: docker/setup-buildx-action@v3
- uses: actions/setup-java@v3
with:
java-version: 11
java-version: |
17
11
distribution: 'zulu'
cache: 'gradle'
- name: Prepare build variables
Expand Down Expand Up @@ -72,3 +74,28 @@ jobs:
tags: |
"${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:${{ github.ref_name }}-latest-unvalidated-ubuntu"
"${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:${{ steps.build_variables.outputs.VERSION }}-unvalidated-ubuntu"
- name: Build and publish slim JRE 11 container image
# Only run this on repositories in the 'spinnaker' org, not on forks.
if: startsWith(github.repository, 'spinnaker/')
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile.java11.slim
platforms: linux/amd64,linux/arm64
push: true
tags: |
"${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:${{ github.ref_name }}-latest-java11-unvalidated"
"${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:${{ steps.build_variables.outputs.VERSION }}-java11-unvalidated"
"${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:${{ github.ref_name }}-latest-java11-unvalidated-slim"
"${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:${{ steps.build_variables.outputs.VERSION }}-java11-unvalidated-slim"
- name: Build and publish ubuntu JRE 11 container image
# Only run this on repositories in the 'spinnaker' org, not on forks.
if: startsWith(github.repository, 'spinnaker/')
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile.java11.ubuntu
push: true
tags: |
"${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:${{ github.ref_name }}-latest-java11-unvalidated-ubuntu"
"${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:${{ steps.build_variables.outputs.VERSION }}-java11-unvalidated-ubuntu"
30 changes: 27 additions & 3 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,12 @@ jobs:
- name: Gradle validation step
uses: gradle/wrapper-validation-action@v1

- name: Set up JDK 11
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: 11
java-version: |
17
11
distribution: 'zulu'
cache: 'gradle'

Expand All @@ -72,7 +74,9 @@ jobs:
uses: docker/setup-buildx-action@v3
- uses: actions/setup-java@v3
with:
java-version: 11
java-version: |
17
11
distribution: 'zulu'
cache: 'gradle'
- name: Prepare build variables
Expand Down Expand Up @@ -105,3 +109,23 @@ jobs:
tags: |
"${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:latest-ubuntu"
"${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:${{ steps.build_variables.outputs.VERSION }}-ubuntu"
- name: Build slim JRE 11 container image
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile.java11.slim
platforms: linux/amd64,linux/arm64
tags: |
"${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:latest-java11"
"${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:${{ steps.build_variables.outputs.VERSION }}-java11"
"${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:latest-java11-slim"
"${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:${{ steps.build_variables.outputs.VERSION }}-java11-slim"
- name: Build ubuntu JRE 11 container image
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile.java11.ubuntu
platforms: linux/amd64,linux/arm64
tags: |
"${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:latest-java11-ubuntu"
"${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:${{ steps.build_variables.outputs.VERSION }}-java11-ubuntu"
29 changes: 28 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ jobs:
uses: docker/setup-buildx-action@v3
- uses: actions/setup-java@v3
with:
java-version: 11
java-version: |
17
11
distribution: 'zulu'
cache: 'gradle'
- name: Assemble release info
Expand Down Expand Up @@ -108,6 +110,31 @@ jobs:
tags: |
"${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:${{ steps.release_info.outputs.RELEASE_VERSION }}-unvalidated-ubuntu"
"${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:${{ steps.release_info.outputs.RELEASE_VERSION }}-${{ steps.build_variables.outputs.VERSION }}-unvalidated-ubuntu"
- name: Build and publish slim JRE 11 container image
# Only run this on repositories in the 'spinnaker' org, not on forks.
if: startsWith(github.repository, 'spinnaker/')
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile.java11.slim
platforms: linux/amd64,linux/arm64
push: true
tags: |
"${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:${{ steps.release_info.outputs.RELEASE_VERSION }}-java11-unvalidated"
"${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:${{ steps.release_info.outputs.RELEASE_VERSION }}-java11-unvalidated-slim"
"${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:${{ steps.release_info.outputs.RELEASE_VERSION }}-${{ steps.build_variables.outputs.VERSION }}-java11-unvalidated-slim"
- name: Build and publish ubuntu JRE 11 container image
# Only run this on repositories in the 'spinnaker' org, not on forks.
if: startsWith(github.repository, 'spinnaker/')
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile.java11.ubuntu
platforms: linux/amd64,linux/arm64
push: true
tags: |
"${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:${{ steps.release_info.outputs.RELEASE_VERSION }}-java11-unvalidated-ubuntu"
"${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:${{ steps.release_info.outputs.RELEASE_VERSION }}-${{ steps.build_variables.outputs.VERSION }}-java11-unvalidated-ubuntu"
- name: Create release
if: steps.release_info.outputs.SKIP_RELEASE == 'false'
uses: softprops/action-gh-release@v1
Expand Down
9 changes: 9 additions & 0 deletions Dockerfile.java11.slim
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM alpine:3.16
LABEL maintainer="sig-platform@spinnaker.io"
RUN apk --no-cache add --update bash openjdk11-jre
RUN addgroup -S -g 10111 spinnaker
RUN adduser -S -G spinnaker -u 10111 spinnaker
COPY kayenta-web/build/install/kayenta /opt/kayenta
RUN mkdir -p /opt/kayenta/plugins && chown -R spinnaker:nogroup /opt/kayenta/plugins
USER spinnaker
CMD ["/opt/kayenta/bin/kayenta"]
8 changes: 8 additions & 0 deletions Dockerfile.java11.ubuntu
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM ubuntu:bionic
LABEL maintainer="sig-platform@spinnaker.io"
RUN apt-get update && apt-get -y install openjdk-11-jre-headless wget
RUN adduser --system --uid 10111 --group spinnaker
COPY kayenta-web/build/install/kayenta /opt/kayenta
RUN mkdir -p /opt/kayenta/plugins && chown -R spinnaker:nogroup /opt/kayenta/plugins
USER spinnaker
CMD ["/opt/kayenta/bin/kayenta"]
2 changes: 1 addition & 1 deletion Dockerfile.slim
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM alpine:3.16
LABEL maintainer="sig-platform@spinnaker.io"
RUN apk --no-cache add --update bash openjdk11-jre
RUN apk --no-cache add --update bash openjdk17-jre
RUN addgroup -S -g 10111 spinnaker
RUN adduser -S -G spinnaker -u 10111 spinnaker
COPY kayenta-web/build/install/kayenta /opt/kayenta
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.ubuntu
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM ubuntu:bionic
LABEL maintainer="sig-platform@spinnaker.io"
RUN apt-get update && apt-get -y install openjdk-11-jre-headless wget
RUN apt-get update && apt-get -y install openjdk-17-jre-headless wget
RUN adduser --system --uid 10111 --group spinnaker
COPY kayenta-web/build/install/kayenta /opt/kayenta
RUN mkdir -p /opt/kayenta/plugins && chown -R spinnaker:nogroup /opt/kayenta/plugins
Expand Down
11 changes: 11 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,17 @@ subprojects { project ->
}
}

tasks.withType(JavaCompile).configureEach {
javaCompiler = javaToolchains.compilerFor {
languageVersion = JavaLanguageVersion.of(11)
}
}
tasks.withType(Test).configureEach {
javaLauncher = javaToolchains.launcherFor {
languageVersion = JavaLanguageVersion.of(17)
}
}

configurations.all {
exclude group: 'org.mortbay.jetty', module: 'servlet-api'
exclude group: 'javax.servlet', module: 'servlet-api'
Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ orcaVersion=8.45.0
org.gradle.parallel=true
spinnakerGradleVersion=8.31.0
targetJava11=true
org.gradle.jvmargs=-Xmx2g

0 comments on commit 09c2df5

Please sign in to comment.