-
Notifications
You must be signed in to change notification settings - Fork 52
HBASE-29225 [hbase-thirdparty] Add module for Jetty 12 with EE8 and add support for toolchain based JDK selection #142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
b89aaa8
cbcf523
f1b5d2f
7d7b2ef
86ed68c
f729cc4
53eb62d
f566a92
a684c37
681e54d
39fac5c
1500c1d
0eb4072
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,3 +8,4 @@ hbase-shaded-protobuf/src/main/resources | |
| .idea | ||
| *.iml | ||
| .flattened-pom.xml | ||
| toolchains.xml | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| #!/usr/bin/env bash | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| # Script to generate toolchains.xml with configurable Java paths | ||
|
|
||
| # Set default paths if environment variables are not set | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is great.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi @stoty yes you are absolutely right, release script would need some patching to understanding toolchains. Will take this up as part of release process. Thanks for highlighting.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Created HBASE-29490 |
||
| if [ -z "$JAVA8_HOME" ]; then | ||
| echo "Trying to detect Java 8 installation (Jenkins/CI standard path)" | ||
| if [ -d "/usr/lib/jvm/java-8" ]; then | ||
| JAVA8_HOME="/usr/lib/jvm/java-8" | ||
| else | ||
| echo "Warning: JAVA8_HOME not set and Java 8 not found at /usr/lib/jvm/java-8" | ||
| echo "For local development, please set JAVA8_HOME environment variable" | ||
| JAVA8_HOME="/usr/lib/jvm/java-8" | ||
| fi | ||
| fi | ||
|
|
||
| if [ -z "$JAVA17_HOME" ]; then | ||
| echo "Trying to detect Java 17 installation (Jenkins/CI standard path)" | ||
| if [ -d "/usr/lib/jvm/java-17" ]; then | ||
| JAVA17_HOME="/usr/lib/jvm/java-17" | ||
| else | ||
| echo "Warning: JAVA17_HOME not set and Java 17 not found at /usr/lib/jvm/java-17" | ||
| echo "For local development, please set JAVA17_HOME environment variable" | ||
| JAVA17_HOME="/usr/lib/jvm/java-17" | ||
| fi | ||
| fi | ||
|
|
||
| TEMPLATE_FILE="./dev-support/toolchains-jenkins.xml" | ||
| OUTPUT_FILE="toolchains.xml" | ||
|
|
||
| if [ ! -f "$TEMPLATE_FILE" ]; then | ||
| echo "Template file $TEMPLATE_FILE not found!" | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "Generating toolchains.xml with:" | ||
| echo " JAVA8_HOME: $JAVA8_HOME" | ||
| echo " JAVA17_HOME: $JAVA17_HOME" | ||
|
|
||
| # Substitute placeholders and write output | ||
| sed \ | ||
| -e "s|/usr/lib/jvm/java-8|$JAVA8_HOME|g" \ | ||
| -e "s|/usr/lib/jvm/java-17|$JAVA17_HOME|g" \ | ||
| "$TEMPLATE_FILE" > "$OUTPUT_FILE" | ||
|
|
||
| echo "toolchains.xml generated successfully!" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,21 +14,112 @@ | |
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| # Dockerfile for hbase-operator-tools pre-commit build. | ||
| # https://builds.apache.org/job/PreCommit-HBASE-OPERATOR-TOOLS-Build | ||
|
|
||
| FROM maven:3.9-eclipse-temurin-8 | ||
|
|
||
| # hadolint ignore=DL3008 | ||
| RUN apt-get -q update && apt-get -q install --no-install-recommends -y \ | ||
| binutils \ | ||
| git \ | ||
| rsync \ | ||
| shellcheck \ | ||
| patch \ | ||
| wget && \ | ||
| # Dockerfile for hbase-thirdparty pre-commit build. | ||
| # | ||
| # | ||
| # Built in multiple stages so as to avoid re-downloading large binaries when | ||
| # tweaking unrelated aspects of the image. | ||
| FROM ubuntu:22.04 AS base_image | ||
NihalJain marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| SHELL ["/bin/bash", "-o", "pipefail", "-c"] | ||
|
|
||
| RUN DEBIAN_FRONTEND=noninteractive apt-get -qq update && \ | ||
| DEBIAN_FRONTEND=noninteractive apt-get -qq install --no-install-recommends -y \ | ||
| ca-certificates=20211016 \ | ||
| curl='7.81.0-*' \ | ||
| locales='2.35-*' \ | ||
| bash='5.1-*' \ | ||
| binutils='2.38-*' \ | ||
| build-essential=12.9ubuntu3 \ | ||
| git='1:2.34.1-*' \ | ||
| rsync='3.2.3-*' \ | ||
| tar='1.34+dfsg-*' \ | ||
| wget='1.21.2-*' \ | ||
| shellcheck='0.8.0-*' \ | ||
| patch='2.7.6-*' \ | ||
| && \ | ||
| apt-get clean && \ | ||
| rm -rf /var/lib/apt/lists/* | ||
| rm -rf /var/lib/apt/lists/* \ | ||
| && \ | ||
| locale-gen en_US.UTF-8 | ||
| ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8 | ||
|
|
||
| ## | ||
| # download sundry dependencies | ||
| # | ||
|
|
||
| FROM base_image AS maven_download_image | ||
| ENV MAVEN_VERSION='3.9.8' | ||
| ENV MAVEN_URL="https://archive.apache.org/dist/maven/maven-3/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.tar.gz" | ||
| ENV MAVEN_SHA512='7d171def9b85846bf757a2cec94b7529371068a0670df14682447224e57983528e97a6d1b850327e4ca02b139abaab7fcb93c4315119e6f0ffb3f0cbc0d0b9a2' | ||
| SHELL ["/bin/bash", "-o", "pipefail", "-c"] | ||
| RUN curl --location --fail --silent --show-error --output /tmp/maven.tar.gz "${MAVEN_URL}" && \ | ||
| echo "${MAVEN_SHA512} */tmp/maven.tar.gz" | sha512sum -c - | ||
|
|
||
| FROM base_image AS openjdk8_download_image | ||
| ENV OPENJDK8_URL='https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u412-b08/OpenJDK8U-jdk_x64_linux_hotspot_8u412b08.tar.gz' | ||
| ENV OPENJDK8_SHA256='b9884a96f78543276a6399c3eb8c2fd8a80e6b432ea50e87d3d12d495d1d2808' | ||
| SHELL ["/bin/bash", "-o", "pipefail", "-c"] | ||
| RUN curl --location --fail --silent --show-error --output /tmp/adoptopenjdk8.tar.gz "${OPENJDK8_URL}" && \ | ||
| echo "${OPENJDK8_SHA256} */tmp/adoptopenjdk8.tar.gz" | sha256sum -c - | ||
|
|
||
| FROM base_image AS openjdk17_download_image | ||
| ENV OPENJDK17_URL='https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.11%2B9/OpenJDK17U-jdk_x64_linux_hotspot_17.0.11_9.tar.gz' | ||
| ENV OPENJDK17_SHA256='aa7fb6bb342319d227a838af5c363bfa1b4a670c209372f9e6585bd79da6220c' | ||
| SHELL ["/bin/bash", "-o", "pipefail", "-c"] | ||
| RUN curl --location --fail --silent --show-error --output /tmp/adoptopenjdk17.tar.gz "${OPENJDK17_URL}" && \ | ||
| echo "${OPENJDK17_SHA256} */tmp/adoptopenjdk17.tar.gz" | sha256sum -c - | ||
|
|
||
| ## | ||
| # build the final image | ||
| # | ||
|
|
||
| FROM base_image | ||
| SHELL ["/bin/bash", "-o", "pipefail", "-c"] | ||
|
|
||
| # hadolint ignore=DL3010 | ||
| COPY --from=maven_download_image /tmp/maven.tar.gz /tmp/maven.tar.gz | ||
| RUN tar xzf /tmp/maven.tar.gz -C /opt && \ | ||
| ln -s "/opt/$(dirname "$(tar -tf /tmp/maven.tar.gz | head -n1)")" /opt/maven && \ | ||
| rm /tmp/maven.tar.gz | ||
|
|
||
| ## | ||
| # ensure JVMs are available under `/usr/lib/jvm` and prefix each installation | ||
| # as `java-` so as to conform with Yetus's assumptions. | ||
| # | ||
|
|
||
| # hadolint ignore=DL3010 | ||
| COPY --from=openjdk8_download_image /tmp/adoptopenjdk8.tar.gz /tmp/adoptopenjdk8.tar.gz | ||
| RUN mkdir -p /usr/lib/jvm && \ | ||
| tar xzf /tmp/adoptopenjdk8.tar.gz -C /usr/lib/jvm && \ | ||
| ln -s "/usr/lib/jvm/$(basename "$(tar -tf /tmp/adoptopenjdk8.tar.gz | head -n1)")" /usr/lib/jvm/java-8-adoptopenjdk && \ | ||
| ln -s /usr/lib/jvm/java-8-adoptopenjdk /usr/lib/jvm/java-8 && \ | ||
| rm /tmp/adoptopenjdk8.tar.gz | ||
|
|
||
| # hadolint ignore=DL3010 | ||
| COPY --from=openjdk17_download_image /tmp/adoptopenjdk17.tar.gz /tmp/adoptopenjdk17.tar.gz | ||
| RUN mkdir -p /usr/lib/jvm && \ | ||
| tar xzf /tmp/adoptopenjdk17.tar.gz -C /usr/lib/jvm && \ | ||
| ln -s "/usr/lib/jvm/$(basename "$(tar -tf /tmp/adoptopenjdk17.tar.gz | head -n1)")" /usr/lib/jvm/java-17-adoptopenjdk && \ | ||
| ln -s /usr/lib/jvm/java-17-adoptopenjdk /usr/lib/jvm/java-17 && \ | ||
| rm /tmp/adoptopenjdk17.tar.gz | ||
|
|
||
| # configure default environment for Yetus | ||
| ENV MAVEN_HOME='/opt/maven' | ||
|
|
||
| # create a wrapper for mvn to always pass the toolchains.xml file | ||
| RUN mv /opt/maven/bin/mvn /opt/maven/bin/mvn-original && \ | ||
| cat > /opt/maven/bin/mvn <<'EOF' | ||
| #!/bin/bash | ||
| TOOLCHAIN="${BASEDIR}/dev-support/toolchains-jenkins.xml" | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. DISCUSS: Should I call new command as mvn_wrap and pass this as command to yetus? Not sure if this would work though. |
||
| if [ -f "$TOOLCHAIN" ]; then | ||
| echo "Added: -t ${TOOLCHAIN} to mvn flags!" | ||
| exec ${MAVEN_HOME}/bin/mvn-original "$@" -t "$TOOLCHAIN" | ||
| else | ||
| echo "Unexpected: ${TOOLCHAIN} file is missing!" | ||
| exec ${MAVEN_HOME}/bin/mvn-original "$@" | ||
| fi | ||
| EOF | ||
| RUN chmod +x /opt/maven/bin/mvn && cat /opt/maven/bin/mvn | ||
NihalJain marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| CMD ["/bin/bash"] | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <toolchains xmlns="http://maven.apache.org/TOOLCHAINS/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| xsi:schemaLocation="http://maven.apache.org/TOOLCHAINS/1.1.0 http://maven.apache.org/xsd/toolchains-1.1.0.xsd"> | ||
| <!-- | ||
| /** | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| --> | ||
| <toolchain> | ||
| <type>jdk</type> | ||
| <provides> | ||
| <version>1.8</version> | ||
| </provides> | ||
| <configuration> | ||
| <jdkHome>/usr/lib/jvm/java-8</jdkHome> | ||
| </configuration> | ||
| </toolchain> | ||
| <toolchain> | ||
| <type>jdk</type> | ||
| <provides> | ||
| <version>17</version> | ||
| </provides> | ||
| <configuration> | ||
| <jdkHome>/usr/lib/jvm/java-17</jdkHome> | ||
| </configuration> | ||
| </toolchain> | ||
| </toolchains> |
Uh oh!
There was an error while loading. Please reload this page.