From 7a2e0debf397fd1f6e3051835e8405cea8cab985 Mon Sep 17 00:00:00 2001 From: Usman Saleem Date: Tue, 11 Apr 2023 15:18:49 +1000 Subject: [PATCH] Use Java 17 for build and runtime (#752) * build.gradle: Java 17 * circleci: Java 17 * build.gradle: removing jdk11 docker tag * changelog * license reporting config: MIT license normalized * Update gatling (performance test) gradle plugin version * CircleCI: Install Java 17 for machine executors * circleci: machine image to use ubuntu-2204:current --- .circleci/config.yml | 23 ++++++--- CHANGELOG.md | 6 +++ acceptance-tests/build.gradle | 2 +- build.gradle | 10 ++-- docker/jdk11/Dockerfile | 50 ------------------- .../license-normalizer.json | 1 + 6 files changed, 30 insertions(+), 62 deletions(-) delete mode 100644 docker/jdk11/Dockerfile diff --git a/.circleci/config.yml b/.circleci/config.yml index a100a61ee..87ef55b68 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -7,7 +7,7 @@ orbs: executors: executor_med: # 2cpu, 4G ram docker: - - image: cimg/openjdk:11.0 + - image: cimg/openjdk:17.0 auth: &docker-auth # Don't panic, throw away account to avoid Docker rate limits when downloading. # Second reason we're doing this is so that forked PRs from external contributors works ie env vars aren't visible to forked PRs from within contexts @@ -21,7 +21,7 @@ executors: executor_large: # 4cpu, 8G ram docker: - - image: cimg/openjdk:11.0 + - image: cimg/openjdk:17.0 auth: <<: *docker-auth resource_class: large @@ -33,7 +33,7 @@ executors: executor_large_with_fc_devnet: # 4cpu, 8G ram docker: # Primary container - - image: cimg/openjdk:11.0 + - image: cimg/openjdk:17.0 auth: <<: *docker-auth # Secondary container running lotus as devnet on port 7777 @@ -55,7 +55,7 @@ executors: machine_executor_arm64: machine: - image: ubuntu-2004:202201-02 # Ubuntu 20.04, Docker v20.10.12, Docker Compose v1.29.2 + image: ubuntu-2204:current # https://circleci.com/developer/machine/image/ubuntu-2204 resource_class: arm.medium environment: architecture: "arm64" @@ -63,7 +63,7 @@ executors: machine_executor_amd64: machine: - image: ubuntu-2004:202201-02 # Ubuntu 20.04, Docker v20.10.12, Docker Compose v1.29.2 + image: ubuntu-2204:current # https://circleci.com/developer/machine/image/ubuntu-2204 docker_layer_caching: true working_directory: ~/project environment: @@ -81,7 +81,15 @@ commands: - deps-{{ checksum "build.gradle" }}-{{ .Branch }}-{{ .Revision }} - deps-{{ checksum "build.gradle" }} - deps- - + machine_java_17: + description: "Install Java 17 on machine executors" + steps: + - run: + name: Java 17 + command: | + sudo apt update + sudo apt install -q --assume-yes openjdk-17-jre-headless openjdk-17-jdk-headless + sudo update-java-alternatives -a capture_test_results: description: "Capture test results" steps: @@ -253,6 +261,7 @@ jobs: - prepare - attach_workspace: at: ~/project + - machine_java_17 - run: name: build and test Docker image command: | @@ -265,6 +274,7 @@ jobs: - prepare - attach_workspace: at: ~/project + - machine_java_17 - docker_trust_sign - docker_publish_images - notify @@ -275,6 +285,7 @@ jobs: - prepare - attach_workspace: at: ~/project + - machine_java_17 - docker_trust_sign - docker_publish_images - notify diff --git a/CHANGELOG.md b/CHANGELOG.md index 147eb1064..d3fb610d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,13 @@ # Changelog + ## Upcoming release +### Breaking Changes +- Using Java 17 for build and runtime. Removing Java 11 variant of docker image. zip/tar.gz distributions will require +Java 17 or above to run Web3Signer. + ### Features Added - Optional Azure bulk loading tags support using cli option `--azure-secrets-tags`. +- Java 17 for build and runtime. --- ## 23.3.1 diff --git a/acceptance-tests/build.gradle b/acceptance-tests/build.gradle index 0259b1ad4..4d7780897 100644 --- a/acceptance-tests/build.gradle +++ b/acceptance-tests/build.gradle @@ -14,7 +14,7 @@ plugins { id "de.undercouch.download" version "4.1.0" id "com.google.osdetector" version "1.6.2" - id "io.gatling.gradle" version "3.7.0-M1" + id "io.gatling.gradle" version "3.9.3.1" } dependencies { diff --git a/build.gradle b/build.gradle index 71d91e804..88ba88548 100644 --- a/build.gradle +++ b/build.gradle @@ -40,8 +40,8 @@ plugins { id 'org.ajoberstar.grgit' version '4.1.1' } -if (!JavaVersion.current().java11Compatible) { - throw new GradleException("Java 11 or later is required to build Web3Signer.\n" + +if (!JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_17)) { + throw new GradleException("Java 17 or later is required to build Web3Signer.\n" + " Detected version ${JavaVersion.current()}") } @@ -109,8 +109,8 @@ allprojects { from javadoc.destinationDir } - sourceCompatibility = 11 - targetCompatibility = 11 + sourceCompatibility = 17 + targetCompatibility = 17 repositories { mavenCentral() @@ -461,7 +461,7 @@ tasks.register("dockerDistUntar") { } def dockerImage = "consensys/web3signer" -def dockerJdkVariants = ["jdk17", "jdk11",] +def dockerJdkVariants = ["jdk17",] def dockerBuildDir = "build/docker-web3signer/" task distDocker { diff --git a/docker/jdk11/Dockerfile b/docker/jdk11/Dockerfile deleted file mode 100644 index 5626216ab..000000000 --- a/docker/jdk11/Dockerfile +++ /dev/null @@ -1,50 +0,0 @@ -FROM eclipse-temurin:11 as jre-build - -# Create a custom Java runtime -RUN JAVA_TOOL_OPTIONS="-Djdk.lang.Process.launchMechanism=vfork" $JAVA_HOME/bin/jlink \ - --add-modules ALL-MODULE-PATH \ - --strip-debug \ - --no-man-pages \ - --no-header-files \ - --compress=2 \ - --output /javaruntime - -FROM ubuntu:latest -ENV JAVA_HOME=/opt/java/openjdk -ENV PATH "${JAVA_HOME}/bin:${PATH}" -COPY --from=jre-build /javaruntime $JAVA_HOME - -RUN apt-get -y update && apt-get -y install libssl3 curl iputils-ping net-tools && rm -rf /var/lib/api/lists/* -RUN adduser --disabled-password --gecos "" --home /opt/web3signer web3signer && \ - chown web3signer:web3signer /opt/web3signer && chmod 755 /opt/web3signer - -USER web3signer -WORKDIR /opt/web3signer - -# copy application (with libraries inside) -COPY --chown=web3signer:web3signer web3signer /opt/web3signer/ - -ENV WEB3SIGNER_HTTP_LISTEN_HOST="0.0.0.0" -ENV WEB3SIGNER_METRICS_HOST="0.0.0.0" - -# List Exposed Ports -# Metrics, Rest API -EXPOSE 9001 9000 9000/udp - -# specify default command -ENTRYPOINT ["/opt/web3signer/bin/web3signer"] - - -# Build-time metadata as defined at http://label-schema.org -ARG BUILD_DATE -ARG VCS_REF -ARG VERSION -LABEL org.label-schema.build-date=$BUILD_DATE \ - org.label-schema.name="Web3Signer" \ - org.label-schema.description="Ethereum 2.0 Signing Service" \ - org.label-schema.url="https://docs.web3signer.consensys.net" \ - org.label-schema.vcs-ref=$VCS_REF \ - org.label-schema.vcs-url="https://github.com/ConsenSys/web3signer.git" \ - org.label-schema.vendor="ConsenSys" \ - org.label-schema.version=$VERSION \ - org.label-schema.schema-version="1.0" diff --git a/gradle/license-report-config/license-normalizer.json b/gradle/license-report-config/license-normalizer.json index 9e6bb5649..829b242d2 100644 --- a/gradle/license-report-config/license-normalizer.json +++ b/gradle/license-report-config/license-normalizer.json @@ -7,6 +7,7 @@ ], "transformationRules" : [ { "bundleName" : "MIT", "licenseNamePattern" : "\"MIT\\sLicense\"" }, + { "bundleName" : "MIT", "licenseNamePattern" : "(.*)SPDX-License-Identifier: MIT(.*)" }, { "bundleName" : "BSD", "licenseNamePattern" : "BSD licence" }, { "bundleName" : "CDDL-1.1", "licenseNamePattern" : "(.*)Dual license consisting of the CDDL v1.1 and GPL v2(.*)" }, { "bundleName" : "Apache-2.0", "licenseNamePattern" : "(.*)Apache-2.0(.*)" }