fix 构建 SSH 发布命令支持 SSH_RELEASE_PATH 环境变量

This commit is contained in:
bwcx_jzy 2023-04-12 19:23:29 +08:00
parent 686e402600
commit ca6a6e5b1a
No known key found for this signature in database
GPG Key ID: E187D6E9DDDE8C53
2 changed files with 10 additions and 2 deletions

View File

@ -1,6 +1,13 @@
# 🚀 版本日志 # 🚀 版本日志
### 2.10.40.5-beta ### 2.10.40.6-beta
### 🐞 解决BUG、优化功能
1. 【server】优化 构建 SSH 发布命令支持 `SSH_RELEASE_PATH` 环境变量(感谢@定格)
------
### 2.10.40.5-beta (2023-04-12)
### 🐞 解决BUG、优化功能 ### 🐞 解决BUG、优化功能

View File

@ -394,6 +394,8 @@ public class ReleaseManage {
session = sshService.getSessionByModel(machineSshModel); session = sshService.getSessionByModel(machineSshModel);
Charset charset = machineSshModel.charset(); Charset charset = machineSshModel.charset();
int timeout = machineSshModel.timeout(); int timeout = machineSshModel.timeout();
String releasePath = this.buildExtraModule.getReleasePath();
envFileMap.put("SSH_RELEASE_PATH", releasePath);
// 执行发布前命令 // 执行发布前命令
if (StrUtil.isNotEmpty(this.buildExtraModule.getReleaseBeforeCommand())) { if (StrUtil.isNotEmpty(this.buildExtraModule.getReleaseBeforeCommand())) {
// //
@ -401,7 +403,6 @@ public class ReleaseManage {
JschUtils.execCallbackLine(session, charset, timeout, this.buildExtraModule.getReleaseBeforeCommand(), StrUtil.EMPTY, envFileMap, logRecorder::info); JschUtils.execCallbackLine(session, charset, timeout, this.buildExtraModule.getReleaseBeforeCommand(), StrUtil.EMPTY, envFileMap, logRecorder::info);
} }
String releasePath = this.buildExtraModule.getReleasePath();
if (StrUtil.isEmpty(releasePath)) { if (StrUtil.isEmpty(releasePath)) {
logRecorder.systemWarning("发布目录为空"); logRecorder.systemWarning("发布目录为空");
} else { } else {