From 47cfce70d9aafef81547683bbabeb25454d32b82 Mon Sep 17 00:00:00 2001 From: bwcx_jzy Date: Fri, 21 Jan 2022 15:43:16 +0800 Subject: [PATCH] update ssh upload --- PLANS.md | 1 + README.md | 4 +++ .../java/io/jpom/build/ReleaseManage.java | 36 +++++++++++-------- web-vue/src/pages/node/node-layout/index.vue | 10 +++--- 4 files changed, 31 insertions(+), 20 deletions(-) diff --git a/PLANS.md b/PLANS.md index 222237364..61c363219 100644 --- a/PLANS.md +++ b/PLANS.md @@ -15,6 +15,7 @@ 9. 容器构建 10. docker ui 11. 节点大屏 +12. 实时阅读日志文件 # 2.7.x diff --git a/README.md b/README.md index 3abc4a884..94bf313e7 100644 --- a/README.md +++ b/README.md @@ -315,6 +315,10 @@ Agent.sh create 创建Jpom插件端的应用服务(jpom-agent) [名词解释](https://jpom.io/docs/index.html#/FQA/%E5%90%8D%E8%AF%8D%E8%A7%A3%E9%87%8A) +## 整体架构 + +![jpom-func-arch](https://cdn.jsdelivr.net/gh/jiangzeyin/Jpom-site/images/jpom-func-arch.jpg) + ### 交流讨论 、提供bug反馈或建议 1. 微信群二维码(添加小助手:备注Jpom 进群) diff --git a/modules/server/src/main/java/io/jpom/build/ReleaseManage.java b/modules/server/src/main/java/io/jpom/build/ReleaseManage.java index 485ac05ea..dfa7d5bc5 100644 --- a/modules/server/src/main/java/io/jpom/build/ReleaseManage.java +++ b/modules/server/src/main/java/io/jpom/build/ReleaseManage.java @@ -251,24 +251,30 @@ public class ReleaseManage extends BaseBuild { } Session session = SshService.getSessionByModel(item); try { - try (Sftp sftp = new Sftp(session, item.getCharsetT())) { - if (this.buildExtraModule.isClearOld() && StrUtil.isNotEmpty(this.buildExtraModule.getReleasePath())) { - try { - sftp.delDir(this.buildExtraModule.getReleasePath()); - } catch (Exception e) { - if (!StrUtil.startWithIgnoreCase(e.getMessage(), "No such file")) { - this.pubLog("清除构建产物失败", e); + String releasePath = this.buildExtraModule.getReleasePath(); + if (StrUtil.isEmpty(releasePath)) { + this.log("发布目录为空"); + } else { + try (Sftp sftp = new Sftp(session, item.getCharsetT())) { + String prefix = ""; + if (!StrUtil.startWith(releasePath, StrUtil.SLASH)) { + prefix = sftp.pwd(); + } + String normalizePath = FileUtil.normalize(prefix + StrUtil.SLASH + releasePath); + if (this.buildExtraModule.isClearOld()) { + try { + sftp.delDir(normalizePath); + } catch (Exception e) { + if (!StrUtil.startWithIgnoreCase(e.getMessage(), "No such file")) { + this.pubLog("清除构建产物失败", e); + } } } + sftp.syncUpload(this.resultFile, normalizePath); + this.log("ssh ftp upload done"); + } catch (Exception e) { + this.pubLog("执行ssh发布异常", e); } - String prefix = ""; - if (!StrUtil.startWith(this.buildExtraModule.getReleasePath(), StrUtil.SLASH)) { - prefix = sftp.pwd(); - } - String normalizePath = FileUtil.normalize(prefix + StrUtil.SLASH + this.buildExtraModule.getReleasePath()); - sftp.syncUpload(this.resultFile, normalizePath); - } catch (Exception e) { - this.pubLog("执行ssh发布异常", e); } } finally { JschUtil.close(session); diff --git a/web-vue/src/pages/node/node-layout/index.vue b/web-vue/src/pages/node/node-layout/index.vue index 8f6b0c6aa..ca2f7e106 100644 --- a/web-vue/src/pages/node/node-layout/index.vue +++ b/web-vue/src/pages/node/node-layout/index.vue @@ -166,15 +166,15 @@ export default { }, }; -