This is an automated email from the ASF dual-hosted git repository.
kriszu pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-streampark.git
The following commit(s) were added to refs/heads/dev by this push:
new 297867b54 [Improve] project clone openssh higher version improvement
(#3125)
297867b54 is described below
commit 297867b54f36c1369d22b39a475b8ea3886e8998
Author: benjobs <[email protected]>
AuthorDate: Fri Sep 15 09:30:22 2023 -0500
[Improve] project clone openssh higher version improvement (#3125)
---
dist-material/release-docs/LICENSE | 3 +--
.../streampark/common/util/SystemPropertyUtils.scala | 2 ++
streampark-console/streampark-console-service/pom.xml | 13 +++++++++++++
.../apache/streampark/console/base/util/GitUtils.java | 18 +++++++++++++++---
.../src/main/resources/db/data-h2.sql | 2 +-
5 files changed, 32 insertions(+), 6 deletions(-)
diff --git a/dist-material/release-docs/LICENSE
b/dist-material/release-docs/LICENSE
index 6a24b6d2a..b6188637f 100644
--- a/dist-material/release-docs/LICENSE
+++ b/dist-material/release-docs/LICENSE
@@ -592,8 +592,7 @@ The following components are provided under the BSD
License. See project link fo
The text of each license is also included in licenses/LICENSE-[project].txt.
https://mvnrepository.com/artifact/com.thoughtworks.paranamer/paranamer/2.8 BSD
- https://mvnrepository.com/artifact/com.jcraft/jsch/0.1.55 BSD
- https://mvnrepository.com/artifact/com.jcraft/jzlib/1.1.1 BSD
+ https://mvnrepository.com/artifact/com.github.mwiede/jsch/0.2.11 BSD
========================================================================
diff --git
a/streampark-common/src/main/scala/org/apache/streampark/common/util/SystemPropertyUtils.scala
b/streampark-common/src/main/scala/org/apache/streampark/common/util/SystemPropertyUtils.scala
index 864f3aa44..c29aa60bb 100644
---
a/streampark-common/src/main/scala/org/apache/streampark/common/util/SystemPropertyUtils.scala
+++
b/streampark-common/src/main/scala/org/apache/streampark/common/util/SystemPropertyUtils.scala
@@ -24,6 +24,8 @@ import scala.util.{Failure, Success, Try}
object SystemPropertyUtils extends Logger {
+ def getUserHome(): String = System.getProperty("user.home")
+
/**
* Returns {@code true} if and only if the system property with the
specified {@code key} exists.
*/
diff --git a/streampark-console/streampark-console-service/pom.xml
b/streampark-console/streampark-console-service/pom.xml
index a0169b5d2..420ac6fd5 100644
--- a/streampark-console/streampark-console-service/pom.xml
+++ b/streampark-console/streampark-console-service/pom.xml
@@ -46,6 +46,7 @@
<commons-compress.version>1.21</commons-compress.version>
<javax-mail.version>1.4.7</javax-mail.version>
<shiro.version>1.10.0</shiro.version>
+ <jsch.version>0.2.11</jsch.version>
<!-- Pac4j 4.x for jdk 8 -->
<pac4jVersion>4.5.7</pac4jVersion>
@@ -329,6 +330,18 @@
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit.ssh.jsch</artifactId>
<version>${eclipse.jgit.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>com.jcraft</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>com.github.mwiede</groupId>
+ <artifactId>jsch</artifactId>
+ <version>${jsch.version}</version>
</dependency>
<dependency>
diff --git
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/base/util/GitUtils.java
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/base/util/GitUtils.java
index 7ef1a14da..ea00a83cf 100644
---
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/base/util/GitUtils.java
+++
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/base/util/GitUtils.java
@@ -17,6 +17,8 @@
package org.apache.streampark.console.base.util;
+import org.apache.streampark.common.util.FileUtils;
+import org.apache.streampark.common.util.SystemPropertyUtils;
import org.apache.streampark.console.core.entity.Project;
import org.apache.streampark.console.core.enums.GitCredential;
@@ -100,13 +102,23 @@ public class GitUtils {
@Override
protected JSch createDefaultJSch(FS fs) throws
JSchException {
JSch jSch = super.createDefaultJSch(fs);
- if (project.getPrvkeyPath() == null) {
+ String prvkeyPath = project.getPrvkeyPath();
+ if (StringUtils.isBlank(prvkeyPath)) {
+ String userHome = SystemPropertyUtils.getUserHome();
+ if (userHome != null) {
+ String rsaPath = userHome.concat("/.ssh/id_rsa");
+ if (FileUtils.exists(rsaPath)) {
+ prvkeyPath = rsaPath;
+ }
+ }
+ }
+ if (prvkeyPath == null) {
return jSch;
}
if (StringUtils.isEmpty(project.getPassword())) {
- jSch.addIdentity(project.getPrvkeyPath());
+ jSch.addIdentity(prvkeyPath);
} else {
- jSch.addIdentity(project.getPrvkeyPath(),
project.getPassword());
+ jSch.addIdentity(prvkeyPath, project.getPassword());
}
return jSch;
}
diff --git
a/streampark-console/streampark-console-service/src/main/resources/db/data-h2.sql
b/streampark-console/streampark-console-service/src/main/resources/db/data-h2.sql
index c306bf60a..5d486f344 100644
---
a/streampark-console/streampark-console-service/src/main/resources/db/data-h2.sql
+++
b/streampark-console/streampark-console-service/src/main/resources/db/data-h2.sql
@@ -35,7 +35,7 @@ insert into `t_flink_effective` values (100000, 100000, 2,
100000, now());
-- ----------------------------
-- Records of t_flink_project
-- ----------------------------
-insert into `t_flink_project` values (100000, 100000, 'streampark-quickstart',
'1', 'https://github.com/apache/incubator-streampark-quickstart',
'release-2.0.0', null, null, null, null, null, 1, 1, null,
'streampark-quickstart', -1, now(), now());
+insert into `t_flink_project` values (100000, 100000, 'streampark-quickstart',
'1', 'https://github.com/apache/incubator-streampark-quickstart', 'dev', null,
null, null, null, null, 1, 1, null, 'streampark-quickstart', -1, now(), now());
-- ----------------------------
-- Records of t_flink_sql