Skip to content

Commit

Permalink
feat(java17): build JRE 17 images, run tests with JRE 17
Browse files Browse the repository at this point in the history
  • Loading branch information
mattgogerly committed Sep 26, 2023
1 parent a6e00b2 commit a1f42da
Show file tree
Hide file tree
Showing 12 changed files with 119 additions and 11 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@v2
- 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 @@ -71,3 +73,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"
24 changes: 23 additions & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ jobs:
uses: docker/setup-buildx-action@v2
- 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 @@ -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"
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@v2
- 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
8 changes: 8 additions & 0 deletions Dockerfile.java11.slim
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Not using the alpine image because it lacks a package gRPC needed to establish pub/sub listeners.
FROM openjdk:11
LABEL maintainer="sig-platform@spinnaker.io"
RUN adduser --system --uid 10111 --group spinnaker
COPY echo-web/build/install/echo /opt/echo
RUN mkdir -p /opt/echo/plugins && chown -R spinnaker:nogroup /opt/echo/plugins
USER spinnaker
CMD ["/opt/echo/bin/echo"]
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 echo-web/build/install/echo /opt/echo
RUN mkdir -p /opt/echo/plugins && chown -R spinnaker:nogroup /opt/echo/plugins
USER spinnaker
CMD ["/opt/echo/bin/echo"]
2 changes: 1 addition & 1 deletion Dockerfile.slim
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Not using the alpine image because it lacks a package gRPC needed to establish pub/sub listeners.
FROM openjdk:11
FROM openjdk:17
LABEL maintainer="sig-platform@spinnaker.io"
RUN adduser --system --uid 10111 --group spinnaker
COPY echo-web/build/install/echo /opt/echo
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 echo-web/build/install/echo /opt/echo
RUN mkdir -p /opt/echo/plugins && chown -R spinnaker:nogroup /opt/echo/plugins
Expand Down
13 changes: 12 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,17 @@ subprojects {
}
}

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=8189'
Expand All @@ -57,7 +68,7 @@ subprojects {

if (name != "echo-bom" && name != "echo-api") {
jacoco {
toolVersion = '0.8.3'
toolVersion = '0.8.7'
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class SlackInteractiveNotificationService extends SlackNotificationService imple
Map payload = parseSlackPayload(request.getBody())
log.debug("Received callback event from Slack of type ${payload.type}")

if (payload.actions.size > 1) {
if (payload.actions.size() > 1) {
log.warn("Expected a single selected action from Slack, but received ${payload.actions.size}")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,14 +161,14 @@ class ManualJudgmentTemplateTest extends Specification {
where:
// Note, there's a whitespace after each new line of the `instructions` because of `Jsoup.parse(...)`.
// This is because the field is HTML parsed to plaintext. Which also can contain Slack's psudo-markdown flavor.
// This is because the field is HTML parsed to plaintext. Which also can contain Slack's pseudo-markdown flavor.
expected = '''\
Stage <SPINNAKER_URL/#/applications/testapp/executions/details/exec-id?refId=stage-id&step=1|stage-name> for *testapp*'s *exe-name* pipeline build #*12345* is awaiting manual judgment.
*Instructions:*
This is an example message from spinnaker that's more than 80 characters to make sure that we won't wrap it. Note the extra whitespace at the end here:
This is an example message from spinnaker that's more than 80 characters to make sure that we won't wrap it. Note the extra whitespace at the end here:
``` This test was added was because code blocks in Slack would word wrap at 80 characters and inject newlines in codeblocks. Note the extra whitespaces after each original newline. ```
``` This test was added was because code blocks in Slack would word wrap at 80 characters and inject newlines in codeblocks. Note the extra whitespaces after each original newline. ```
'''.stripIndent()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ class SlackServiceSpec extends Specification {
attachmentsJson[0]["fallback"] == "the text"
attachmentsJson[0]["footer"] == "Spinnaker"
attachmentsJson[0]["mrkdwn_in"] == ["text"]
attachmentsJson[0]["actions"].size == 1
attachmentsJson[0]["actions"].size() == 1
attachmentsJson[0]["actions"][0] == [
type: "button",
name: "choice",
Expand Down
5 changes: 5 additions & 0 deletions echo-web/config/echo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ spinnaker:
front50:
baseUrl: ${services.front50.baseUrl:http://localhost:8080}

services:
fiat:
enabled: ${services.fiat.enabled:false}
baseUrl: ${services.fiat.baseUrl:http://localhost:8089}

igor:
enabled: ${services.igor.enabled:false}
baseUrl: ${services.igor.baseUrl:http://localhost:8088}
Expand Down

0 comments on commit a1f42da

Please sign in to comment.