From ecbaab9b039a078fa5aa158bd6303a0206b8a191 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Deleuze?= Date: Sun, 17 Oct 2021 21:25:43 +0200 Subject: [PATCH] Add Java 17 build This commits refactors the CI configuration to add Java 17 builds: - No more stable qualifier - Add spring-native qualifier to ci-image to avoid side effects for other projects - Provide Java 17 CI, GraalVM and Spring Native images - Use parameters.yml for JDK URL This commit also renames jdk-identifier to labsjdk-identifier for clarity. See gh-773 --- ci/images/README.adoc | 2 +- ci/images/ci-image/Dockerfile | 8 - ci/images/get-jdk-url.sh | 11 - ci/images/graalvm-ce-image/Dockerfile | 6 +- ci/images/setup.sh | 3 +- ci/images/spring-native-ci-image/Dockerfile | 9 + ci/parameters.yml | 8 +- ci/pipeline.yml | 248 +++++++++++++----- ci/tasks/build-graalvm-ce-image.yml | 2 +- ...e.yml => build-spring-native-ci-image.yml} | 1 + 10 files changed, 206 insertions(+), 92 deletions(-) delete mode 100644 ci/images/ci-image/Dockerfile delete mode 100755 ci/images/get-jdk-url.sh create mode 100644 ci/images/spring-native-ci-image/Dockerfile rename ci/tasks/{build-ci-image.yml => build-spring-native-ci-image.yml} (95%) diff --git a/ci/images/README.adoc b/ci/images/README.adoc index a0f862e09..cbc195dec 100644 --- a/ci/images/README.adoc +++ b/ci/images/README.adoc @@ -15,7 +15,7 @@ NOTE: Some image requires build arguments. To build the CI image that is used for releases and deployment, invoke the following: ---- -$ docker build --no-cache -f ci-image/Dockerfile . +$ docker build --no-cache --build-arg JDK_URL=... -f spring-native-ci-image/Dockerfile . ---- To build the image that has the required GraalVM installation, you need two build diff --git a/ci/images/ci-image/Dockerfile b/ci/images/ci-image/Dockerfile deleted file mode 100644 index 8e6f7bdf6..000000000 --- a/ci/images/ci-image/Dockerfile +++ /dev/null @@ -1,8 +0,0 @@ -FROM ubuntu:focal-20210217 - -ADD setup.sh /setup.sh -ADD get-jdk-url.sh /get-jdk-url.sh -RUN ./setup.sh java11 - -ENV JAVA_HOME /opt/openjdk -ENV PATH $JAVA_HOME/bin:$PATH \ No newline at end of file diff --git a/ci/images/get-jdk-url.sh b/ci/images/get-jdk-url.sh deleted file mode 100755 index 70c71056f..000000000 --- a/ci/images/get-jdk-url.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -set -e - -case "$1" in - java11) - echo "https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.10%2B9/OpenJDK11U-jdk_x64_linux_hotspot_11.0.10_9.tar.gz" - ;; - *) - echo $"Unknown java version" - exit 1 -esac diff --git a/ci/images/graalvm-ce-image/Dockerfile b/ci/images/graalvm-ce-image/Dockerfile index 24fc9449a..35a533d46 100644 --- a/ci/images/graalvm-ce-image/Dockerfile +++ b/ci/images/graalvm-ce-image/Dockerfile @@ -1,6 +1,6 @@ FROM springci/ci-image:main -ARG JDK_IDENTIFIER +ARG LABSJDK_IDENTIFIER ARG GRAALVM_BRANCH ENV PATH="/opt/mx:$PATH" @@ -13,8 +13,8 @@ RUN cd /opt \ && git clone --single-branch --branch master https://github.com/graalvm/mx.git \ && git clone --single-branch --branch $GRAALVM_BRANCH https://github.com/oracle/graal.git -RUN mx --quiet fetch-jdk --jdk-id $JDK_IDENTIFIER --configuration /opt/graal/common.json --to /opt \ - || mx --quiet fetch-jdk --jdk-id $JDK_IDENTIFIER --to /opt +RUN mx --quiet fetch-jdk --jdk-id $LABSJDK_IDENTIFIER --configuration /opt/graal/common.json --to /opt \ + || mx --quiet fetch-jdk --jdk-id $LABSJDK_IDENTIFIER --to /opt RUN mv /opt/labsjdk-ce-* /opt/openjdk-jvmci diff --git a/ci/images/setup.sh b/ci/images/setup.sh index a49b23eda..a9874a060 100755 --- a/ci/images/setup.sh +++ b/ci/images/setup.sh @@ -19,10 +19,9 @@ curl --output /opt/concourse-release-scripts.jar https://repo.spring.io/release/ ########################################################### # JAVA ########################################################### -JDK_URL=$( ./get-jdk-url.sh $1 ) mkdir -p /opt/openjdk cd /opt/openjdk -curl -L ${JDK_URL} | tar zx --strip-components=1 +curl -L $1 | tar zx --strip-components=1 test -f /opt/openjdk/bin/java test -f /opt/openjdk/bin/javac \ No newline at end of file diff --git a/ci/images/spring-native-ci-image/Dockerfile b/ci/images/spring-native-ci-image/Dockerfile new file mode 100644 index 000000000..f0913c291 --- /dev/null +++ b/ci/images/spring-native-ci-image/Dockerfile @@ -0,0 +1,9 @@ +FROM ubuntu:focal + +ARG JDK_URL + +ADD setup.sh /setup.sh +RUN ./setup.sh $JDK_URL + +ENV JAVA_HOME /opt/openjdk +ENV PATH $JAVA_HOME/bin:$PATH \ No newline at end of file diff --git a/ci/parameters.yml b/ci/parameters.yml index aa8e9454c..ee15d3331 100644 --- a/ci/parameters.yml +++ b/ci/parameters.yml @@ -11,6 +11,10 @@ registry-mirror-host: docker.repo.spring.io registry-mirror-username: ((artifactory-username)) registry-mirror-password: ((artifactory-password)) +jdk-url-java11: "https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.12%2B7/OpenJDK11U-jdk_x64_linux_hotspot_11.0.12_7.tar.gz" +jdl-url-java17: "https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17%2B35/OpenJDK17-jdk_x64_linux_hotspot_17_35.tar.gz" + graalvm-repo: "https://github.com/oracle/graal.git" -graalvm-stable-branch: "release/graal-vm/21.2" -jdk-identifier-java11: "labsjdk-ce-11" +graalvm-branch: "release/graal-vm/21.2" +labsjdk-identifier-java11: "labsjdk-ce-11" +labsjdk-identifier-java17: "labsjdk-ce-17" diff --git a/ci/pipeline.yml b/ci/pipeline.yml index fe4ade885..f5a40a629 100644 --- a/ci/pipeline.yml +++ b/ci/pipeline.yml @@ -83,32 +83,54 @@ resources: repository: ((github-repo-name)) base_branch: ((branch)) ignore_paths: ["ci/*"] - - name: graalvm-stable-git-repo + - name: graalvm-git-repo type: git icon: github source: uri: ((graalvm-repo)) - branch: ((graalvm-stable-branch)) - - name: ci-image + branch: ((graalvm-branch)) + - name: spring-native-ci-java11-image type: registry-image icon: docker source: <<: *registry-image-resource-source repository: ((docker-hub-organization))/spring-native-ci - - name: graalvm-ce-stable-java11-image + tag: java11-((milestone)) + - name: spring-native-ci-java17-image + type: registry-image + icon: docker + source: + <<: *registry-image-resource-source + repository: ((docker-hub-organization))/spring-native-ci + tag: java17-((milestone)) + - name: graalvm-ce-java11-image + type: registry-image + icon: docker + source: + <<: *registry-image-resource-source + repository: ((docker-hub-organization))/graalvm-ce + tag: java11-((milestone)) + - name: graalvm-ce-java17-image type: registry-image icon: docker source: <<: *registry-image-resource-source repository: ((docker-hub-organization))/graalvm-ce - tag: stable-java11-((milestone)) - - name: spring-native-stable-java11-image + tag: java17-((milestone)) + - name: spring-native-java11-image type: registry-image icon: docker source: <<: *registry-image-resource-source repository: ((docker-hub-organization))/spring-native - tag: stable-java11-((milestone)) + tag: java11-((milestone)) + - name: spring-native-java17-image + type: registry-image + icon: docker + source: + <<: *registry-image-resource-source + repository: ((docker-hub-organization))/spring-native + tag: java17-((milestone)) - name: artifactory-repo type: artifactory-resource icon: package-variant @@ -138,113 +160,195 @@ resources: type: time source: {interval: 24h} jobs: - - name: build-ci-image + - name: build-spring-native-ci-java11-image + old_name: build-ci-image + plan: + - get: git-repo + - get: ci-images-git-repo + trigger: true + - task: build-spring-native-ci-image + privileged: true + file: git-repo/ci/tasks/build-spring-native-ci-image.yml + output_mapping: + image: spring-native-ci-java11-image + vars: + jdk-url: ((jdk-url-java11)) + ci-image-name: spring-native-ci-java11-image + <<: *registry-mirror-vars + - put: spring-native-ci-java11-image + params: + image: spring-native-ci-java11-image/image.tar + - name: build-spring-native-ci-java17-image plan: - get: git-repo - get: ci-images-git-repo trigger: true - - task: build-ci-image + - task: build-spring-native-ci-image privileged: true - file: git-repo/ci/tasks/build-ci-image.yml + file: git-repo/ci/tasks/build-spring-native-ci-image.yml output_mapping: - image: ci-image + image: spring-native-ci-java17-image vars: - ci-image-name: ci-image + jdk-url: ((jdk-url-java17)) + ci-image-name: spring-native-ci-java17-image <<: *registry-mirror-vars - - put: ci-image + - put: spring-native-ci-java17-image params: - image: ci-image/image.tar - - name: check-graalvm-ce-stable-change + image: spring-native-ci-java17-image/image.tar + - name: check-graalvm-ce-change + old_name: check-graalvm-ce-stable-change plan: - - get: graalvm-stable-git-repo + - get: graalvm-git-repo trigger: true - - name: check-graalvm-ce-stable-every-day + - name: check-graalvm-ce-every-day + old_name: check-graalvm-ce-stable-every-day plan: - - get: graalvm-stable-git-repo - passed: [check-graalvm-ce-stable-change] + - get: graalvm-git-repo + passed: [check-graalvm-ce-change] - get: every-day trigger: true - - name: build-graalvm-ce-stable-image + - name: build-graalvm-ce-java11-image + old_name: build-graalvm-ce-stable-image + plan: + - get: git-repo + - get: ci-images-git-repo + - get: graalvm-git-repo + passed: [check-graalvm-ce-every-day] + trigger: true + - get: every-day + passed: [check-graalvm-ce-every-day] + - task: build-graalvm-ce-image + privileged: true + file: git-repo/ci/tasks/build-graalvm-ce-image.yml + output_mapping: + image: graalvm-ce-java11-image + vars: + ci-image-name: graalvm-ce-image + labsjdk-identifier: ((labsjdk-identifier-java11)) + graalvm-branch: ((graalvm-branch)) + <<: *registry-mirror-vars + - put: graalvm-ce-java11-image + params: + image: graalvm-ce-java11-image/image.tar + - name: build-graalvm-ce-java17-image plan: - get: git-repo - get: ci-images-git-repo - - get: graalvm-stable-git-repo - passed: [check-graalvm-ce-stable-every-day] + - get: graalvm-git-repo + passed: [ check-graalvm-ce-every-day ] trigger: true - get: every-day - passed: [check-graalvm-ce-stable-every-day] - - task: build-graalvm-ce-stable-image + passed: [ check-graalvm-ce-every-day ] + - task: build-graalvm-ce-image privileged: true file: git-repo/ci/tasks/build-graalvm-ce-image.yml output_mapping: - image: graalvm-ce-stable-java11-image + image: graalvm-ce-java17-image vars: ci-image-name: graalvm-ce-image - jdk-identifier: ((jdk-identifier-java11)) - graalvm-branch: ((graalvm-stable-branch)) + labsjdk-identifier: ((labsjdk-identifier-java17)) + graalvm-branch: ((graalvm-branch)) <<: *registry-mirror-vars - - put: graalvm-ce-stable-java11-image + - put: graalvm-ce-java17-image params: - image: graalvm-ce-stable-java11-image/image.tar - - name: build-spring-native-stable-image + image: graalvm-ce-java17-image/image.tar + - name: build-spring-native-java11-image + old_name: build-spring-native-stable-image plan: - get: git-repo - get: ci-images-git-repo - get: every-day - passed: [build-graalvm-ce-stable-image] + passed: [build-graalvm-ce-java11-image] trigger: true - - task: build-spring-native-stable-image + - task: build-spring-native-image privileged: true file: git-repo/ci/tasks/build-spring-native-image.yml output_mapping: - image: spring-native-stable-java11-image + image: spring-native-java11-image vars: - ci-image-name: spring-native-image - base-image: "((docker-hub-organization))/graalvm-ce:stable-java11-((milestone))" + ci-image-name: spring-native-java11-image + base-image: "((docker-hub-organization))/graalvm-ce:java11-((milestone))" <<: *registry-mirror-vars - - put: spring-native-stable-java11-image + - put: spring-native-java11-image params: - image: spring-native-stable-java11-image/image.tar + image: spring-native-java11-image/image.tar + - name: build-spring-native-java17-image + plan: + - get: git-repo + - get: ci-images-git-repo + - get: every-day + passed: [ build-graalvm-ce-java17-image ] + trigger: true + - task: build-spring-native-image + privileged: true + file: git-repo/ci/tasks/build-spring-native-image.yml + output_mapping: + image: spring-native-java17-image + vars: + ci-image-name: spring-native-java17-image + base-image: "((docker-hub-organization))/graalvm-ce:java17-((milestone))" + <<: *registry-mirror-vars + - put: spring-native-java17-image + params: + image: spring-native-java17-image/image.tar - name: build-key-samples-java11 public: true serial: true plan: - - get: spring-native-stable-java11-image + - get: spring-native-java11-image - get: git-repo trigger: true - task: build privileged: true - image: spring-native-stable-java11-image + image: spring-native-java11-image file: git-repo/ci/tasks/build-key-samples.yml params: <<: *docker-hub-task-params - - name: build-samples-aot-stable-java11 + - name: build-samples-aot-java11 + old_name: build-samples-aot-stable-java11 public: true plan: - - get: spring-native-stable-java11-image + - get: spring-native-java11-image - get: git-repo - get: every-day trigger: true - do: - task: build privileged: true - image: spring-native-stable-java11-image + image: spring-native-java11-image file: git-repo/ci/tasks/build-samples.yml params: AOT_ONLY: true <<: *docker-hub-task-params <<: *wavefront-params - - name: build-samples-stable-java11 + - name: build-samples-aot-java17 + public: true + plan: + - get: spring-native-java17-image + - get: git-repo + - get: every-day + trigger: true + - do: + - task: build + privileged: true + image: spring-native-java17-image + file: git-repo/ci/tasks/build-samples.yml + params: + AOT_ONLY: true + <<: *docker-hub-task-params + <<: *wavefront-params + - name: build-samples-java11 + old_name: build-samples-stable-java11 public: true plan: - - get: spring-native-stable-java11-image + - get: spring-native-java11-image - get: git-repo - get: every-day trigger: true - do: - task: build privileged: true - image: spring-native-stable-java11-image + image: spring-native-java11-image file: git-repo/ci/tasks/build-samples.yml params: AOT_ONLY: false @@ -255,16 +359,32 @@ jobs: - put: slack-alert params: <<: *slack-fail-params + - name: build-samples-java17 + public: true + plan: + - get: spring-native-java17-image + - get: git-repo + - get: every-day + trigger: true + - do: + - task: build + privileged: true + image: spring-native-java17-image + file: git-repo/ci/tasks/build-samples.yml + params: + AOT_ONLY: false + <<: *docker-hub-task-params + <<: *wavefront-params - name: deploy public: true plan: - - get: ci-image + - get: spring-native-java11-image - get: git-repo passed: - build-key-samples-java11 trigger: true - task: build-project - image: ci-image + image: spring-native-java11-image privileged: true timeout: ((task-timeout)) file: git-repo/ci/tasks/build-project.yml @@ -275,7 +395,7 @@ jobs: serial: true public: true plan: - - get: spring-native-stable-java11-image + - get: spring-native-java11-image - get: git-repo resource: git-pull-request trigger: true @@ -287,7 +407,7 @@ jobs: status: pending - task: build-project privileged: true - image: spring-native-stable-java11-image + image: spring-native-java11-image file: git-repo/ci/tasks/build-pr-project.yml params: <<: *docker-hub-task-params @@ -305,11 +425,11 @@ jobs: - name: stage-milestone serial: true plan: - - get: ci-image + - get: spring-native-ci-java11-image - get: git-repo trigger: false - task: stage - image: ci-image + image: spring-native-java11-image file: git-repo/ci/tasks/stage.yml params: RELEASE_TYPE: M @@ -323,11 +443,11 @@ jobs: - name: stage-rc serial: true plan: - - get: ci-image + - get: spring-native-ci-java11-image - get: git-repo trigger: false - task: stage - image: ci-image + image: spring-native-java11-image file: git-repo/ci/tasks/stage.yml params: RELEASE_TYPE: RC @@ -341,11 +461,11 @@ jobs: - name: stage-release serial: true plan: - - get: ci-image + - get: spring-native-ci-java11-image - get: git-repo trigger: false - task: stage - image: ci-image + image: spring-native-java11-image file: git-repo/ci/tasks/stage.yml params: RELEASE_TYPE: RELEASE @@ -359,7 +479,7 @@ jobs: - name: promote-milestone serial: true plan: - - get: ci-image + - get: spring-native-ci-java11-image - get: git-repo trigger: false - get: artifactory-repo @@ -369,7 +489,7 @@ jobs: download_artifacts: false save_build_info: true - task: promote - image: ci-image + image: spring-native-java11-image file: git-repo/ci/tasks/promote.yml params: RELEASE_TYPE: M @@ -390,7 +510,7 @@ jobs: - name: promote-rc serial: true plan: - - get: ci-image + - get: spring-native-ci-java11-image - get: git-repo trigger: false - get: artifactory-repo @@ -400,7 +520,7 @@ jobs: download_artifacts: false save_build_info: true - task: promote - image: ci-image + image: spring-native-java11-image file: git-repo/ci/tasks/promote.yml params: RELEASE_TYPE: RC @@ -421,7 +541,7 @@ jobs: - name: promote-release serial: true plan: - - get: ci-image + - get: spring-native-ci-java11-image - get: git-repo trigger: false - get: artifactory-repo @@ -431,7 +551,7 @@ jobs: download_artifacts: true save_build_info: true - task: promote - image: ci-image + image: spring-native-java11-image file: git-repo/ci/tasks/promote.yml params: RELEASE_TYPE: RELEASE @@ -439,7 +559,7 @@ jobs: - name: create-github-release serial: true plan: - - get: ci-image + - get: spring-native-ci-java11-image - get: git-repo - get: artifactory-repo trigger: true @@ -462,10 +582,10 @@ jobs: body: generated-changelog/changelog.md groups: - name: "builds" - jobs: ["build-key-samples-java11", "deploy", "build-samples-aot-stable-java11", "build-samples-stable-java11"] + jobs: ["build-key-samples-java11", "deploy", "build-samples-aot-java11", "build-samples-aot-java17", "build-samples-java11", "build-samples-java17"] - name: "releases" jobs: ["stage-milestone", "stage-rc", "stage-release", "promote-milestone", "promote-rc", "promote-release", "create-github-release"] - name: "ci-images" - jobs: ["build-ci-image", "check-graalvm-ce-stable-change", "check-graalvm-ce-stable-every-day", "build-graalvm-ce-stable-image", "build-spring-native-stable-image" ] + jobs: ["build-spring-native-ci-java11-image", "build-spring-native-ci-java17-image", "check-graalvm-ce-change", "check-graalvm-ce-every-day", "build-graalvm-ce-java11-image", "build-graalvm-ce-java17-image", "build-spring-native-java11-image", "build-spring-native-java17-image" ] - name: "pull-requests" jobs: [ "build-pull-requests" ] diff --git a/ci/tasks/build-graalvm-ce-image.yml b/ci/tasks/build-graalvm-ce-image.yml index 9e2764d08..90932d428 100644 --- a/ci/tasks/build-graalvm-ce-image.yml +++ b/ci/tasks/build-graalvm-ce-image.yml @@ -19,7 +19,7 @@ params: CONTEXT: ci-images-git-repo/ci/images DOCKERFILE: ci-images-git-repo/ci/images/((ci-image-name))/Dockerfile DOCKER_HUB_AUTH: ((docker-hub-auth)) - BUILD_ARG_JDK_IDENTIFIER: ((jdk-identifier)) + BUILD_ARG_LABSJDK_IDENTIFIER: ((labsjdk-identifier)) BUILD_ARG_GRAALVM_BRANCH: ((graalvm-branch)) run: path: /bin/sh diff --git a/ci/tasks/build-ci-image.yml b/ci/tasks/build-spring-native-ci-image.yml similarity index 95% rename from ci/tasks/build-ci-image.yml rename to ci/tasks/build-spring-native-ci-image.yml index 1ca249dac..c44dc131b 100644 --- a/ci/tasks/build-ci-image.yml +++ b/ci/tasks/build-spring-native-ci-image.yml @@ -19,6 +19,7 @@ params: CONTEXT: ci-images-git-repo/ci/images DOCKERFILE: ci-images-git-repo/ci/images/((ci-image-name))/Dockerfile DOCKER_HUB_AUTH: ((docker-hub-auth)) + BUILD_ARG_JDK_URL: ((jdk-url)) run: path: /bin/sh args: