From e3df24bc777e594725d041abdc05575a86bfe82d Mon Sep 17 00:00:00 2001 From: mattgogerly Date: Tue, 28 Nov 2023 17:58:07 +0000 Subject: [PATCH] feat(java17): use JRE17, run tests on JRE17, compile with JDK11 --- .github/workflows/build.yml | 30 +++++++++++++++++++++++++++++- .github/workflows/pr.yml | 24 +++++++++++++++++++++++- .github/workflows/release.yml | 29 ++++++++++++++++++++++++++++- Dockerfile.java11.slim | 9 +++++++++ Dockerfile.java11.ubuntu | 8 ++++++++ Dockerfile.slim | 2 +- Dockerfile.ubuntu | 2 +- build.gradle | 11 +++++++++++ fiat-web/config/fiat.yml | 11 +++++++++++ 9 files changed, 121 insertions(+), 5 deletions(-) create mode 100644 Dockerfile.java11.slim create mode 100644 Dockerfile.java11.ubuntu diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9fdf93ed9..40eb4e2f5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 @@ -72,3 +74,29 @@ 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 + platforms: linux/amd64,linux/arm64 + 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" \ No newline at end of file diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index ccbc493e2..f394645eb 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -19,7 +19,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 @@ -51,3 +53,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" \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 78c67b545..753f9dd0b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -43,7 +43,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 @@ -128,6 +130,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 diff --git a/Dockerfile.java11.slim b/Dockerfile.java11.slim new file mode 100644 index 000000000..7443d9417 --- /dev/null +++ b/Dockerfile.java11.slim @@ -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 fiat-web/build/install/fiat /opt/fiat +RUN mkdir -p /opt/fiat/plugins && chown -R spinnaker:nogroup /opt/fiat/plugins +USER spinnaker +CMD ["/opt/fiat/bin/fiat"] diff --git a/Dockerfile.java11.ubuntu b/Dockerfile.java11.ubuntu new file mode 100644 index 000000000..336d9f7a5 --- /dev/null +++ b/Dockerfile.java11.ubuntu @@ -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 fiat-web/build/install/fiat /opt/fiat +RUN mkdir -p /opt/fiat/plugins && chown -R spinnaker:nogroup /opt/fiat/plugins +USER spinnaker +CMD ["/opt/fiat/bin/fiat"] diff --git a/Dockerfile.slim b/Dockerfile.slim index 7443d9417..da2102729 100644 --- a/Dockerfile.slim +++ b/Dockerfile.slim @@ -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 fiat-web/build/install/fiat /opt/fiat diff --git a/Dockerfile.ubuntu b/Dockerfile.ubuntu index 336d9f7a5..0c9512b40 100644 --- a/Dockerfile.ubuntu +++ b/Dockerfile.ubuntu @@ -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 fiat-web/build/install/fiat /opt/fiat RUN mkdir -p /opt/fiat/plugins && chown -R spinnaker:nogroup /opt/fiat/plugins diff --git a/build.gradle b/build.gradle index ad4dafd39..c73916267 100644 --- a/build.gradle +++ b/build.gradle @@ -49,6 +49,17 @@ subprojects { failOnError = false } + tasks.withType(JavaCompile).configureEach { + javaCompiler = javaToolchains.compilerFor { + languageVersion = JavaLanguageVersion.of(11) + } + } + tasks.withType(Test).configureEach { + javaLauncher = javaToolchains.launcherFor { + languageVersion = JavaLanguageVersion.of(17) + } + } + tasks.withType(JavaExec) { if (System.getProperty('DEBUG', 'false') == 'true') { jvmArgs '-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=7103' diff --git a/fiat-web/config/fiat.yml b/fiat-web/config/fiat.yml index c121be23f..8939c5a3e 100644 --- a/fiat-web/config/fiat.yml +++ b/fiat-web/config/fiat.yml @@ -12,3 +12,14 @@ okHttpClient: logging: config: classpath:logback-defaults.xml + +services: + front50: + enabled: true + baseUrl: http://localhost:8080 + clouddriver: + enabled: false + baseUrl: http://localhost:7002 + igor: + enabled: false + baseUrl: http://localhost:8088