feat(deploy): 新增SIT环境部署自动化测试脚本
- 实现基于SSH连接的远程文件传输和命令执行功能 - 支持判断远程文件是否存在及MD5校验避免重复上传 - 完成jar包及lib目录自动上传处理 - 执行远程脚本重启服务 - 增加详细日志打印,支持时间戳和颜色区分信息与错误 - 封装SSH会话及SFTP操作工具类,提高复用性和可维护性
This commit is contained in:
parent
383fbed6b4
commit
03808c145c
|
|
@ -18,10 +18,10 @@ import java.util.List;
|
|||
@Slf4j
|
||||
public class DeploySitTest {
|
||||
|
||||
private static final String serviceName = "admin";
|
||||
private static final String serviceName = "qms";
|
||||
private static final String localPath = System.getProperty("user.dir") + "//target//";
|
||||
private static final String remotePath = "/mnt/app/qms/" + serviceName + "/";
|
||||
private static final String jarName = "nflg-qms-" + serviceName + "-1.0.0-SNAPSHOT.jar";
|
||||
private static final String remotePath = "/mnt/app/" + serviceName + "/admin/";
|
||||
private static final String jarName = "nflg-" + serviceName + "-admin-1.0.0-SNAPSHOT.jar";
|
||||
|
||||
@Test
|
||||
public void DeployToSit() throws Exception {
|
||||
|
|
@ -32,7 +32,7 @@ public class DeploySitTest {
|
|||
//处理字体目录
|
||||
// handleDir(sshUtil, localPath, remotePath, "fonts");
|
||||
//处理lib目录
|
||||
// handleDir(sshUtil, localPath, remotePath, "lib");
|
||||
handleDir(sshUtil, localPath, remotePath, "lib");
|
||||
//执行脚本启动服务
|
||||
sshUtil.exec("cd " + remotePath + " && ./restart.sh");
|
||||
sshUtil.disconnect();
|
||||
|
|
|
|||
Loading…
Reference in New Issue