This is an automated email from the ASF dual-hosted git repository.

kezhenxu94 pushed a commit to branch test/oap-jdk
in repository https://gitbox.apache.org/repos/asf/skywalking.git

commit cf4e988bba8bcdaf5e75f066c87bc6da61ecee0a
Author: kezhenxu94 <[email protected]>
AuthorDate: Sun Apr 19 23:20:17 2020 +0800

    Add multiple Java version to backend tests
---
 .github/workflows/e2e.jdk-versions.yaml |  2 ++
 Makefile                                | 20 +++++++++-----
 docker/oap-es7/Dockerfile.oap           | 42 ------------------------------
 docker/oap-es7/docker-entrypoint.sh     | 46 ---------------------------------
 docker/oap-es7/log4j2.xml               | 36 --------------------------
 docker/oap/Dockerfile.oap               | 11 +++++---
 docker/oap/docker-entrypoint.sh         | 13 +++++++---
 7 files changed, 31 insertions(+), 139 deletions(-)

diff --git a/.github/workflows/e2e.jdk-versions.yaml 
b/.github/workflows/e2e.jdk-versions.yaml
index 4eb5be5..8152b02 100644
--- a/.github/workflows/e2e.jdk-versions.yaml
+++ b/.github/workflows/e2e.jdk-versions.yaml
@@ -47,6 +47,8 @@ jobs:
           git submodule sync --recursive
           git -c protocol.version=2 submodule update --init --force 
--recursive --depth=1
       - name: Build Docker Image
+        env:
+          JAVA_VERSION: ${{ matrix.jdk }}
         run: make docker
       - name: Copy dist package
         run: cp -R dist test/e2e/
diff --git a/Makefile b/Makefile
index 8838aef..f42075b 100644
--- a/Makefile
+++ b/Makefile
@@ -20,6 +20,8 @@ export SW_ROOT := $(shell dirname $(realpath $(lastword 
$(MAKEFILE_LIST))))
 
 export SW_OUT:=${SW_ROOT}/dist
 
+export DIST_NAME
+
 SKIP_TEST?=false
 
 init:
@@ -58,18 +60,22 @@ DOCKER_TARGETS:=docker.oap docker.ui
 docker.all: $(DOCKER_TARGETS)
 
 ifeq ($(ES_VERSION),es7)
-docker.oap: $(SW_OUT)/apache-skywalking-apm-bin-es7.tar.gz
-docker.oap: $(SW_ROOT)/docker/oap-es7/Dockerfile.oap
-docker.oap: $(SW_ROOT)/docker/oap-es7/docker-entrypoint.sh
-docker.oap: $(SW_ROOT)/docker/oap-es7/log4j2.xml
-               $(DOCKER_RULE)
+  DIST_NAME := apache-skywalking-apm-bin-es7
 else
-docker.oap: $(SW_OUT)/apache-skywalking-apm-bin.tar.gz
+  DIST_NAME := apache-skywalking-apm-bin
+endif
+
+ifneq ($(JAVA_VERSION),)
+  BUILD_ARGS := $(BUILD_ARGS) --build-arg JAVA_VERSION=$(JAVA_VERSION)
+endif
+
+BUILD_ARGS := $(BUILD_ARGS) --build-arg DIST_NAME=$(DIST_NAME)
+
+docker.oap: $(SW_OUT)/$(DIST_NAME).tar.gz
 docker.oap: $(SW_ROOT)/docker/oap/Dockerfile.oap
 docker.oap: $(SW_ROOT)/docker/oap/docker-entrypoint.sh
 docker.oap: $(SW_ROOT)/docker/oap/log4j2.xml
                $(DOCKER_RULE)
-endif
 
 docker.ui: $(SW_OUT)/apache-skywalking-apm-bin.tar.gz
 docker.ui: $(SW_ROOT)/docker/ui/Dockerfile.ui
diff --git a/docker/oap-es7/Dockerfile.oap b/docker/oap-es7/Dockerfile.oap
deleted file mode 100644
index 8ced58a..0000000
--- a/docker/oap-es7/Dockerfile.oap
+++ /dev/null
@@ -1,42 +0,0 @@
-# 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.
-
-FROM openjdk:8u181-jdk-stretch
-
-ENV DIST_NAME=apache-skywalking-apm-bin-es7 \
-    JAVA_OPTS=" -Xms256M " \
-    SW_CLUSTER="standalone" \
-    SW_STORAGE="h2"
-
-COPY "$DIST_NAME.tar.gz" /
-
-RUN set -ex; \
-    tar -xzf "$DIST_NAME.tar.gz"; \
-    rm -rf "$DIST_NAME.tar.gz"; \
-    rm -rf "$DIST_NAME/config/log4j2.xml"; \
-    rm -rf "$DIST_NAME/bin"; rm -rf "$DIST_NAME/webapp"; rm -rf 
"$DIST_NAME/agent"; \
-    mv "$DIST_NAME" skywalking;
-
-WORKDIR skywalking
-
-COPY log4j2.xml config/
-COPY docker-entrypoint.sh .
-RUN mkdir ext-config; \
-    mkdir ext-libs;
-
-EXPOSE 12800 11800 1234
-
-ENTRYPOINT ["bash", "docker-entrypoint.sh"]
\ No newline at end of file
diff --git a/docker/oap-es7/docker-entrypoint.sh 
b/docker/oap-es7/docker-entrypoint.sh
deleted file mode 100755
index ae6a44b..0000000
--- a/docker/oap-es7/docker-entrypoint.sh
+++ /dev/null
@@ -1,46 +0,0 @@
-# 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.
-
-#!/bin/bash
-
-set -e
-
-echo "[Entrypoint] Apache SkyWalking Docker Image"
-
-if [[ "$SW_TELEMETRY" = "so11y" ]]; then
-    export SW_RECEIVER_SO11Y=default
-    echo "Set SW_RECEIVER_SO11Y to ${SW_RECEIVER_SO11Y}"
-fi
-
-EXT_LIB_DIR=/skywalking/ext-libs
-EXT_CONFIG_DIR=/skywalking/ext-config
-
-# Override configuration files
-cp -vfR ${EXT_CONFIG_DIR}/ config/
-
-CLASSPATH="config:$CLASSPATH"
-for i in oap-libs/*.jar
-do
-    CLASSPATH="$i:$CLASSPATH"
-done
-for i in ${EXT_LIB_DIR}/*.jar
-do
-    CLASSPATH="$i:$CLASSPATH"
-done
-
-set -ex
-exec java -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap \
-     ${JAVA_OPTS} -classpath ${CLASSPATH} 
org.apache.skywalking.oap.server.starter.OAPServerStartUp "$@"
diff --git a/docker/oap-es7/log4j2.xml b/docker/oap-es7/log4j2.xml
deleted file mode 100644
index eb69a89..0000000
--- a/docker/oap-es7/log4j2.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  ~ 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.
-  ~
-  -->
-
-<Configuration status="INFO">
-    <Appenders>
-        <Console name="Console" target="SYSTEM_OUT">
-            <PatternLayout charset="UTF-8" pattern="%d - %c -%-4r [%t] %-5p %x 
- %m%n"/>
-        </Console>
-    </Appenders>
-    <Loggers>
-        <logger name="org.eclipse.jetty" level="INFO"/>
-        <logger name="org.apache.zookeeper" level="INFO"/>
-        <logger name="org.elasticsearch.common.network.IfConfig" level="INFO"/>
-        <logger name="io.grpc.netty" level="INFO"/>
-        <logger 
name="org.apache.skywalking.oap.server.receiver.istio.telemetry" level="DEBUG"/>
-        <Root level="INFO">
-            <AppenderRef ref="Console"/>
-        </Root>
-    </Loggers>
-</Configuration>
diff --git a/docker/oap/Dockerfile.oap b/docker/oap/Dockerfile.oap
index a94490e..79b89b0 100644
--- a/docker/oap/Dockerfile.oap
+++ b/docker/oap/Dockerfile.oap
@@ -14,13 +14,16 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-FROM openjdk:8u181-jdk-stretch
+ARG JAVA_VERSION=8
 
-ENV DIST_NAME=apache-skywalking-apm-bin \
-    JAVA_OPTS=" -Xms256M " \
+FROM adoptopenjdk/openjdk$JAVA_VERSION:jre
+
+ENV JAVA_OPTS=" -Xms256M " \
     SW_CLUSTER="standalone" \
     SW_STORAGE="h2"
 
+ARG DIST_NAME
+
 COPY "$DIST_NAME.tar.gz" /
 
 RUN set -ex; \
@@ -39,4 +42,4 @@ RUN mkdir ext-config; \
 
 EXPOSE 12800 11800 1234
 
-ENTRYPOINT ["bash", "docker-entrypoint.sh"]
\ No newline at end of file
+ENTRYPOINT ["bash", "docker-entrypoint.sh"]
diff --git a/docker/oap/docker-entrypoint.sh b/docker/oap/docker-entrypoint.sh
index ae6a44b..9a80bdd 100755
--- a/docker/oap/docker-entrypoint.sh
+++ b/docker/oap/docker-entrypoint.sh
@@ -1,3 +1,4 @@
+#!/bin/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
@@ -14,8 +15,6 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-#!/bin/bash
-
 set -e
 
 echo "[Entrypoint] Apache SkyWalking Docker Image"
@@ -41,6 +40,12 @@ do
     CLASSPATH="$i:$CLASSPATH"
 done
 
+set +e
+
+if java -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap 
-version; then
+  JAVA_OPTS="${JAVA_OPTS} -XX:+UnlockExperimentalVMOptions 
-XX:+UseCGroupMemoryLimitForHeap"
+fi
+
 set -ex
-exec java -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap \
-     ${JAVA_OPTS} -classpath ${CLASSPATH} 
org.apache.skywalking.oap.server.starter.OAPServerStartUp "$@"
+
+exec java "${JAVA_OPTS}" -classpath "${CLASSPATH}" 
org.apache.skywalking.oap.server.starter.OAPServerStartUp "$@"

Reply via email to