This is an automated email from the ASF dual-hosted git repository.
cancai pushed a commit to branch dev-2.1.5
in repository https://gitbox.apache.org/repos/asf/incubator-streampark.git
The following commit(s) were added to refs/heads/dev-2.1.5 by this push:
new 2f85d807d [Bug] Dingtalk alert bug fixed (#3730)
2f85d807d is described below
commit 2f85d807d7cb99a1ad7571e63e5424f545e46329
Author: benjobs <[email protected]>
AuthorDate: Sat Jun 1 15:19:12 2024 +0800
[Bug] Dingtalk alert bug fixed (#3730)
* [Bug] Dingtalk alert bug fixed
* [Improve] mvnw minor improvement
---------
Co-authored-by: benjobs <[email protected]>
---
mvnw | 8 ++------
.../src/main/assembly/bin/streampark.sh | 8 ++++----
.../streampark/console/base/util/BashJavaUtils.java | 15 +++++++++++++--
.../alert/impl/DingTalkAlertNotifyServiceImpl.java | 14 +++++---------
.../service/alert/impl/LarkAlertNotifyServiceImpl.java | 1 +
.../streampark-console-webapp/vite.config.ts | 2 +-
6 files changed, 26 insertions(+), 22 deletions(-)
diff --git a/mvnw b/mvnw
index 7aca23b4c..9afad3b76 100755
--- a/mvnw
+++ b/mvnw
@@ -189,12 +189,10 @@ log "$MAVEN_PROJECTBASEDIR"
##########################################################################################
wrapperJarPath="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar"
javaSource="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperHelper.java"
-javaClass="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperHelper.class"
wrapperProperties="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties"
# For Cygwin, switch paths to Windows format before running javac
if $cygwin; then
javaSource=$(cygpath --path --windows "$javaSource")
- javaClass=$(cygpath --path --windows "$javaClass")
fi
if [ ! -e "$javaSource" ]; then
@@ -202,10 +200,8 @@ if [ ! -e "$javaSource" ]; then
exit 1
fi
-if [ ! -e "$javaClass" ]; then
- log " - Compiling $javaClass starting ..."
- ("$JAVA_HOME/bin/javac" "$javaSource")
-fi
+log " - Compiling $javaSource starting ..."
+"$JAVA_HOME/bin/javac" "$javaSource"
if [ -r "$wrapperJarPath" ]; then
log "Found $wrapperJarPath"
diff --git
a/streampark-console/streampark-console-service/src/main/assembly/bin/streampark.sh
b/streampark-console/streampark-console-service/src/main/assembly/bin/streampark.sh
index f28ff76b3..81af07693 100755
---
a/streampark-console/streampark-console-service/src/main/assembly/bin/streampark.sh
+++
b/streampark-console/streampark-console-service/src/main/assembly/bin/streampark.sh
@@ -313,15 +313,15 @@ get_pid() {
fi
# shellcheck disable=SC2006
- local serverPort=`$_RUNJAVA -cp "$APP_LIB/*" $BASH_UTIL --yaml "server.port"
"$CONFIG"`
+ local serverPort=`$_RUNJAVA -cp "$APP_LIB/*" $BASH_UTIL --get_yaml
"server.port" "$CONFIG"`
if [[ x"${serverPort}" == x"" ]]; then
echo_r "server.port is required, please check $CONFIG"
exit 1;
else
# shellcheck disable=SC2006
# shellcheck disable=SC2155
- local used=`lsof -i:"$serverPort" | wc -l`
- if [[ "$used" -gt 0 ]]; then
+ local used=`$_RUNJAVA -cp "$APP_LIB/*" $BASH_UTIL --check_port
"$serverPort"`
+ if [[ x"${used}" == x"used" ]]; then
# shellcheck disable=SC2006
local PID=`jps -l | grep "$APP_MAIN" | awk '{print $1}'`
if [[ ! -z $PID ]]; then
@@ -359,7 +359,7 @@ start() {
fi
# shellcheck disable=SC2006
- local workspace=`$_RUNJAVA -cp "$APP_LIB/*" $BASH_UTIL --yaml
"streampark.workspace.local" "$CONFIG"`
+ local workspace=`$_RUNJAVA -cp "$APP_LIB/*" $BASH_UTIL --get_yaml
"streampark.workspace.local" "$CONFIG"`
if [[ ! -d $workspace ]]; then
echo_r "ERROR: streampark.workspace.local: \"$workspace\" is invalid
path, Please reconfigure in $CONFIG"
echo_r "NOTE: \"streampark.workspace.local\" Do not set under
APP_HOME($APP_HOME). Set it to a secure directory outside of APP_HOME. "
diff --git
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/base/util/BashJavaUtils.java
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/base/util/BashJavaUtils.java
index ec6120cae..faf8b8ead 100644
---
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/base/util/BashJavaUtils.java
+++
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/base/util/BashJavaUtils.java
@@ -19,23 +19,34 @@ package org.apache.streampark.console.base.util;
import org.apache.streampark.common.util.PropertiesUtils;
+import java.io.IOException;
+import java.net.ServerSocket;
import java.util.Arrays;
import java.util.Map;
public class BashJavaUtils {
- public static void main(String[] args) {
+ public static void main(String[] args) throws IOException {
String action = args[0].toLowerCase();
String[] actionArgs = Arrays.copyOfRange(args, 1, args.length);
switch (action) {
- case "--yaml":
+ case "--get_yaml":
String key = actionArgs[0];
String conf = actionArgs[1];
Map<String, String> confMap = PropertiesUtils.fromYamlFileAsJava(conf);
String value = confMap.get(key);
System.out.println(value);
break;
+ case "--check_port":
+ Integer port = Integer.parseInt(actionArgs[0]);
+ try {
+ new ServerSocket(port);
+ System.out.println("free");
+ } catch (Exception e) {
+ System.out.println("used");
+ }
+ break;
default:
break;
}
diff --git
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/alert/impl/DingTalkAlertNotifyServiceImpl.java
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/alert/impl/DingTalkAlertNotifyServiceImpl.java
index e7c0452e1..0a456b59e 100644
---
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/alert/impl/DingTalkAlertNotifyServiceImpl.java
+++
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/alert/impl/DingTalkAlertNotifyServiceImpl.java
@@ -146,23 +146,19 @@ public class DingTalkAlertNotifyServiceImpl implements
AlertNotifyService {
* @return the webhook
*/
private String getWebhook(AlertDingTalkParams params) {
- String urlPef = "https://oapi.dingtalk.com/robot/send";
+ String urlPrefix = "https://oapi.dingtalk.com/robot/send";
if (StringUtils.hasLength(params.getAlertDingURL())) {
- urlPef = params.getAlertDingURL();
+ urlPrefix = params.getAlertDingURL().replaceFirst("\\?.*", "");
}
- if (!urlPef.endsWith("access_token=")) {
- urlPef += "?access_token=";
- }
-
String url;
if (params.getSecretEnable()) {
Long timestamp = System.currentTimeMillis();
url =
String.format(
- "%s%s×tamp=%d&sign=%s",
- urlPef, params.getToken(), timestamp,
getSign(params.getSecretToken(), timestamp));
+ "%s?access_token=%s×tamp=%d&sign=%s",
+ urlPrefix, params.getToken(), timestamp,
getSign(params.getSecretToken(), timestamp));
} else {
- url = String.format("%s%s", urlPef, params.getToken());
+ url = String.format("%s?access_token=%s", urlPrefix, params.getToken());
}
if (log.isDebugEnabled()) {
log.debug("The alarm robot url of DingTalk contains signature is {}",
url);
diff --git
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/alert/impl/LarkAlertNotifyServiceImpl.java
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/alert/impl/LarkAlertNotifyServiceImpl.java
index 971c23b6d..c6d6e1bd9 100644
---
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/alert/impl/LarkAlertNotifyServiceImpl.java
+++
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/alert/impl/LarkAlertNotifyServiceImpl.java
@@ -135,6 +135,7 @@ public class LarkAlertNotifyServiceImpl implements
AlertNotifyService {
* @return the webhook
*/
private String getWebhook(AlertLarkParams params) {
+ larkProxyUrl = larkProxyUrl.replaceFirst("/open-apis/bot/v2/hook/(.*)",
"");
String url = String.format(larkProxyUrl + "/open-apis/bot/v2/hook/%s",
params.getToken());
if (log.isDebugEnabled()) {
log.debug("The alarm robot url of Lark is {}", url);
diff --git a/streampark-console/streampark-console-webapp/vite.config.ts
b/streampark-console/streampark-console-webapp/vite.config.ts
index edb6b6a4c..441ccf089 100644
--- a/streampark-console/streampark-console-webapp/vite.config.ts
+++ b/streampark-console/streampark-console-webapp/vite.config.ts
@@ -80,7 +80,7 @@ export default ({ command, mode }: ConfigEnv): UserConfig => {
pure: VITE_DROP_CONSOLE ? ['console.log', 'debugger'] : [],
},
build: {
- target: 'es2015',
+ target: 'es2018',
cssTarget: 'chrome80',
outDir: OUTPUT_DIR,
// minify: 'terser',