This is an automated email from the ASF dual-hosted git repository.
zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new d74a71433a5 Refactor : refactor the distribution for E2E metrics
(#23639) (#23649)
d74a71433a5 is described below
commit d74a71433a51f4be25b508091d5f0925ab48885b
Author: 孙念君 Nianjun Sun <[email protected]>
AuthorDate: Thu Jan 19 18:17:12 2023 +0800
Refactor : refactor the distribution for E2E metrics (#23639) (#23649)
* Refactor : refactor the distribution for E2E metrics (#23639)
* Add : temporarily add the -Prelease profile, will remove when all E2E
plugins refactored (#23639)
---
.github/workflows/e2e-agent.yml | 4 +-
.../shardingsphere-agent-binary-distribution.xml | 2 +-
.../shardingsphere-proxy-binary-distribution.xml | 3 +
test/e2e/agent/plugins/metrics/Dockerfile | 5 +-
test/e2e/agent/plugins/metrics/pom.xml | 25 ++++---
.../plugins/metrics/src/test/assembly/bin/start.sh | 75 --------------------
.../plugins/metrics/src/test/assembly/bin/stop.sh | 51 --------------
...shardingsphere-proxy-agent-metrics-assembly.xml | 79 ----------------------
.../src/test/resources/docker/docker-compose.yml | 4 +-
9 files changed, 26 insertions(+), 222 deletions(-)
diff --git a/.github/workflows/e2e-agent.yml b/.github/workflows/e2e-agent.yml
index 353f6617abc..997a2a7ceea 100644
--- a/.github/workflows/e2e-agent.yml
+++ b/.github/workflows/e2e-agent.yml
@@ -78,7 +78,9 @@ jobs:
restore-keys: |
${{ env.REPOSITORY_NAME }}-maven-third-party-
- name: Build Project
- run: ./mvnw -B clean install -DskipITs -DskipTests
+ run: |
+ ./mvnw -B clean install -DskipITs -DskipTests
+ ./mvnw -B clean install -DskipITs -DskipTests -Prelease
- name: Run E2E Test
run: |
./mvnw -B clean install -f test/e2e/agent/plugins/${{ matrix.plugin
}}/pom.xml -Dspotless.apply.skip=true -Pit.env.${{ matrix.plugin }}
diff --git
a/agent/distribution/src/main/assembly/shardingsphere-agent-binary-distribution.xml
b/agent/distribution/src/main/assembly/shardingsphere-agent-binary-distribution.xml
index 6ba61d88863..0e0a0179c73 100644
---
a/agent/distribution/src/main/assembly/shardingsphere-agent-binary-distribution.xml
+++
b/agent/distribution/src/main/assembly/shardingsphere-agent-binary-distribution.xml
@@ -20,8 +20,8 @@
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.1.0
http://maven.apache.org/xsd/assembly-2.1.0.xsd">
<id>shardingsphere-agent-bin</id>
<formats>
- <format>dir</format>
<format>tar.gz</format>
+ <format>dir</format>
</formats>
<includeBaseDirectory>true</includeBaseDirectory>
<baseDirectory>agent</baseDirectory>
diff --git
a/distribution/proxy/src/main/assembly/shardingsphere-proxy-binary-distribution.xml
b/distribution/proxy/src/main/assembly/shardingsphere-proxy-binary-distribution.xml
index 4c7513498e2..e6595ad5865 100644
---
a/distribution/proxy/src/main/assembly/shardingsphere-proxy-binary-distribution.xml
+++
b/distribution/proxy/src/main/assembly/shardingsphere-proxy-binary-distribution.xml
@@ -76,6 +76,9 @@
<dependencySet>
<outputDirectory>lib</outputDirectory>
<fileMode>0644</fileMode>
+ <excludes>
+
<exclude>org.apache.shardingsphere:shardingsphere-agent*</exclude>
+ </excludes>
</dependencySet>
</dependencySets>
</assembly>
diff --git a/test/e2e/agent/plugins/metrics/Dockerfile
b/test/e2e/agent/plugins/metrics/Dockerfile
index e1b447abbf3..8019795ff49 100644
--- a/test/e2e/agent/plugins/metrics/Dockerfile
+++ b/test/e2e/agent/plugins/metrics/Dockerfile
@@ -23,5 +23,6 @@ ENV WAIT_VERSION 2.7.2
ADD target/${APP_NAME}.tar.gz /opt
ADD
https://github.com/ufoscout/docker-compose-wait/releases/download/$WAIT_VERSION/wait
/wait
RUN chmod +x /wait
-RUN mv /opt/${APP_NAME} /opt/shardingsphere-proxy-agent-metrics
-ENTRYPOINT /wait && /opt/shardingsphere-proxy-agent-metrics/bin/start.sh &&
tail -f /opt/shardingsphere-proxy-agent-metrics/logs/stdout.log
+RUN mv /opt/${APP_NAME} /opt/shardingsphere-proxy
+RUN wget
https://repo1.maven.org/maven2/mysql/mysql-connector-java/5.1.47/mysql-connector-java-5.1.47.jar
-P /opt/shardingsphere-proxy/lib
+ENTRYPOINT /wait && /opt/shardingsphere-proxy/bin/start.sh -g && tail -f
/opt/shardingsphere-proxy/logs/stdout.log
diff --git a/test/e2e/agent/plugins/metrics/pom.xml
b/test/e2e/agent/plugins/metrics/pom.xml
index e37e995311b..606bc07fc9d 100644
--- a/test/e2e/agent/plugins/metrics/pom.xml
+++ b/test/e2e/agent/plugins/metrics/pom.xml
@@ -29,6 +29,7 @@
<properties>
<maven.deploy.skip>true</maven.deploy.skip>
+
<docker.app.name>apache-shardingsphere-${project.version}-shardingsphere-proxy-bin</docker.app.name>
</properties>
<dependencies>
@@ -96,20 +97,22 @@
<build>
<plugins>
<plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <configuration>
- <appendAssemblyId>false</appendAssemblyId>
- <descriptors>
-
<descriptor>src/test/assembly/shardingsphere-proxy-agent-metrics-assembly.xml</descriptor>
- </descriptors>
- </configuration>
+ <artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
- <id>assembly</id>
+ <id>copy-resources</id>
<goals>
- <goal>single</goal>
+ <goal>copy-resources</goal>
</goals>
- <phase>package</phase>
+ <phase>validate</phase>
+ <configuration>
+ <outputDirectory>target/</outputDirectory>
+ <resources>
+ <resource>
+
<directory>${project.basedir}/../../../../../distribution/proxy/target/</directory>
+ </resource>
+ </resources>
+ </configuration>
</execution>
</executions>
</plugin>
@@ -121,7 +124,7 @@
<tag>${project.version}</tag>
<tag>latest</tag>
<buildArgs>
- <APP_NAME>${project.build.finalName}</APP_NAME>
+ <APP_NAME>${docker.app.name}</APP_NAME>
</buildArgs>
</configuration>
<executions>
diff --git a/test/e2e/agent/plugins/metrics/src/test/assembly/bin/start.sh
b/test/e2e/agent/plugins/metrics/src/test/assembly/bin/start.sh
deleted file mode 100644
index 3d08f97ee16..00000000000
--- a/test/e2e/agent/plugins/metrics/src/test/assembly/bin/start.sh
+++ /dev/null
@@ -1,75 +0,0 @@
-#!/bin/sh
-#
-# 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.
-#
-
-SERVER_NAME=ShardingSphere-Proxy-Metrics
-
-cd `dirname $0`
-cd ..
-DEPLOY_DIR=`pwd`
-
-LOGS_DIR=${DEPLOY_DIR}/logs
-if [ ! -d ${LOGS_DIR} ]; then
- mkdir ${LOGS_DIR}
-fi
-
-STDOUT_FILE=${LOGS_DIR}/stdout.log
-EXT_LIB=${DEPLOY_DIR}/ext-lib
-
-CLASS_PATH=.:${DEPLOY_DIR}/lib/*:${EXT_LIB}/*
-
-JAVA_OPTS=" -Djava.awt.headless=true -Xdebug
-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=3308"
-
-JAVA_MEM_OPTS=" -server -Xmx2g -Xms2g -Xmn1g -Xss1m -XX:+DisableExplicitGC
-XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled
-XX:LargePageSizeInBytes=128m -XX:+UseFastAccessorMethods
-XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70 "
-
-MAIN_CLASS=org.apache.shardingsphere.proxy.Bootstrap
-
-print_usage() {
- echo "usage: start.sh [port] [config_dir]"
- echo " port: proxy listen port, default is 3307"
- echo " config_dir: proxy config directory, default is conf"
- exit 0
-}
-
-if [ "$1" == "-h" ] || [ "$1" == "--help" ] ; then
- print_usage
-fi
-
-echo "Starting the $SERVER_NAME ..."
-
-if [ $# == 0 ]; then
- CLASS_PATH=${DEPLOY_DIR}/conf:${CLASS_PATH}
-fi
-
-if [ $# == 1 ]; then
- MAIN_CLASS=${MAIN_CLASS}" "$1
- echo "The port is $1"
- CLASS_PATH=${DEPLOY_DIR}/conf:${CLASS_PATH}
-fi
-
-if [ $# == 2 ]; then
- MAIN_CLASS=${MAIN_CLASS}" "$1" "$2
- echo "The port is $1"
- echo "The configuration path is $DEPLOY_DIR/$2"
- CLASS_PATH=${DEPLOY_DIR}/$2:${CLASS_PATH}
-fi
-
-echo "The classpath is ${CLASS_PATH}"
-
-nohup java ${JAVA_OPTS} ${JAVA_MEM_OPTS}
-javaagent:/opt/shardingsphere-proxy-agent-metrics/agent/shardingsphere-agent.jar
-classpath ${CLASS_PATH} ${MAIN_CLASS} >> ${STDOUT_FILE} 2>&1 &
-sleep 1
-echo "Please check the STDOUT file: $STDOUT_FILE"
diff --git a/test/e2e/agent/plugins/metrics/src/test/assembly/bin/stop.sh
b/test/e2e/agent/plugins/metrics/src/test/assembly/bin/stop.sh
deleted file mode 100644
index da8909ea406..00000000000
--- a/test/e2e/agent/plugins/metrics/src/test/assembly/bin/stop.sh
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/bin/sh
-#
-# 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.
-#
-
-SERVER_NAME=ShardingSphere-Proxy
-
-cd `dirname $0`
-cd ..
-DEPLOY_DIR=`pwd`
-
-PIDS=`ps -ef | grep java | grep "$DEPLOY_DIR" | grep -v grep |awk '{print $2}'`
-if [ -z "$PIDS" ]; then
- echo "ERROR: The $SERVER_NAME does not started!"
- exit 1
-fi
-
-echo -e "Stopping the $SERVER_NAME ...\c"
-for PID in ${PIDS} ; do
- kill ${PID} > /dev/null 2>&1
-done
-
-COUNT=0
-while [ ${COUNT} -lt 1 ]; do
- echo -e ".\c"
- sleep 1
- COUNT=1
- for PID in ${PIDS} ; do
- PID_EXIST=`ps -f -p ${PID} | grep java`
- if [ -n "$PID_EXIST" ]; then
- COUNT=0
- break
- fi
- done
-done
-
-echo "OK!"
-echo "PID: $PIDS"
diff --git
a/test/e2e/agent/plugins/metrics/src/test/assembly/shardingsphere-proxy-agent-metrics-assembly.xml
b/test/e2e/agent/plugins/metrics/src/test/assembly/shardingsphere-proxy-agent-metrics-assembly.xml
deleted file mode 100644
index b150e56e378..00000000000
---
a/test/e2e/agent/plugins/metrics/src/test/assembly/shardingsphere-proxy-agent-metrics-assembly.xml
+++ /dev/null
@@ -1,79 +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.
- -->
-
-<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0
http://maven.apache.org/xsd/assembly-2.0.0.xsd">
- <id>shardingsphere-proxy-bin</id>
- <formats>
- <format>tar.gz</format>
- </formats>
- <includeBaseDirectory>true</includeBaseDirectory>
-
- <fileSets>
- <fileSet>
-
<directory>${project.basedir}/../../../../../agent/plugins/metrics/type/target/plugins</directory>
- <outputDirectory>./agent/plugins</outputDirectory>
- <includes>
- <include>**.jar</include>
- </includes>
- </fileSet>
- <fileSet>
-
<directory>${project.basedir}/../../../../../agent/core/target</directory>
- <outputDirectory>./agent</outputDirectory>
- <includes>
- <include>shardingsphere-agent.jar</include>
- </includes>
- </fileSet>
- <fileSet>
-
<directory>${project.basedir}/../../../../../agent/plugins/metrics/core/target/lib</directory>
- <outputDirectory>./agent/plugins/lib</outputDirectory>
- <includes>
- <include>**.jar</include>
- </includes>
- </fileSet>
- <fileSet>
-
<directory>${project.basedir}/../../../../../agent/plugins/core/target/lib</directory>
- <outputDirectory>./agent/plugins/lib</outputDirectory>
- <includes>
- <include>**.jar</include>
- </includes>
- </fileSet>
- <fileSet>
- <directory>src/test/assembly/bin</directory>
- <lineEnding>unix</lineEnding>
- <includes>
- <include>*.sh</include>
- </includes>
- <outputDirectory>bin</outputDirectory>
- <fileMode>0755</fileMode>
- </fileSet>
- </fileSets>
-
- <dependencySets>
- <dependencySet>
- <outputDirectory>lib</outputDirectory>
- <fileMode>0644</fileMode>
- </dependencySet>
- <dependencySet>
- <outputDirectory>./agent/lib</outputDirectory>
- <includes>
- <include>org.slf4j:slf4j-api</include>
- <include>ch.qos.logback:*</include>
- </includes>
- </dependencySet>
- </dependencySets>
-</assembly>
diff --git
a/test/e2e/agent/plugins/metrics/src/test/resources/docker/docker-compose.yml
b/test/e2e/agent/plugins/metrics/src/test/resources/docker/docker-compose.yml
index e07cf877698..2198002ec8e 100644
---
a/test/e2e/agent/plugins/metrics/src/test/resources/docker/docker-compose.yml
+++
b/test/e2e/agent/plugins/metrics/src/test/resources/docker/docker-compose.yml
@@ -53,8 +53,8 @@ services:
links:
- "mysql:mysql.agent.metrics.host"
volumes:
- - ./proxy/conf:/opt/shardingsphere-proxy-agent-metrics/conf
- - ./agent/conf:/opt/shardingsphere-proxy-agent-metrics/agent/conf
+ - ./proxy/conf:/opt/shardingsphere-proxy/conf
+ - ./agent/conf:/opt/shardingsphere-proxy/agent/conf
depends_on:
- mysql
environment: