Merge branch 'master' of http://1.14.125.6:3000/mianbin/ops-pro
This commit is contained in:
commit
4e5676ce4e
@ -63,6 +63,7 @@ public class AflCrashesInfoServiceImpl extends ServiceImpl<AflCrashesInfoDao, Af
|
|||||||
throw new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(),"未找到运行上下文");
|
throw new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(),"未找到运行上下文");
|
||||||
}
|
}
|
||||||
String resourceId = runContext.getGlobalVariables().get(PipelineVariableConstant.AFL_RESOURCE_MANAGER_ID_KEY) instanceof String ? ((String) runContext.getGlobalVariables().get(PipelineVariableConstant.AFL_RESOURCE_MANAGER_ID_KEY)) : null;
|
String resourceId = runContext.getGlobalVariables().get(PipelineVariableConstant.AFL_RESOURCE_MANAGER_ID_KEY) instanceof String ? ((String) runContext.getGlobalVariables().get(PipelineVariableConstant.AFL_RESOURCE_MANAGER_ID_KEY)) : null;
|
||||||
|
// String resourceId = "2";
|
||||||
if (StringUtils.isEmpty(resourceId)){
|
if (StringUtils.isEmpty(resourceId)){
|
||||||
throw new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(),"未找到资源");
|
throw new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(),"未找到资源");
|
||||||
}
|
}
|
||||||
|
@ -3,9 +3,7 @@ package cd.casic.ci.process.process.service.aflManager.impl;
|
|||||||
import cd.casic.ci.process.dto.req.aflManager.AflManagerReq;
|
import cd.casic.ci.process.dto.req.aflManager.AflManagerReq;
|
||||||
import cd.casic.ci.process.dto.resp.aflManager.AflInfoResp;
|
import cd.casic.ci.process.dto.resp.aflManager.AflInfoResp;
|
||||||
import cd.casic.ci.process.dto.resp.resource.ResourceFindResp;
|
import cd.casic.ci.process.dto.resp.resource.ResourceFindResp;
|
||||||
import cd.casic.ci.process.engine.constant.PipelineVariableConstant;
|
|
||||||
import cd.casic.ci.process.engine.manager.RunContextManager;
|
import cd.casic.ci.process.engine.manager.RunContextManager;
|
||||||
import cd.casic.ci.process.engine.runContext.BaseRunContext;
|
|
||||||
import cd.casic.ci.process.process.converter.AflManagerConverter;
|
import cd.casic.ci.process.process.converter.AflManagerConverter;
|
||||||
import cd.casic.ci.process.process.dao.aflManager.AflInfoDao;
|
import cd.casic.ci.process.process.dao.aflManager.AflInfoDao;
|
||||||
import cd.casic.ci.process.process.dataObject.aflManager.AflInfo;
|
import cd.casic.ci.process.process.dataObject.aflManager.AflInfo;
|
||||||
@ -54,12 +52,12 @@ public class AflInfoServiceImpl extends ServiceImpl<AflInfoDao, AflInfo> impleme
|
|||||||
throw new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(),"pipelineId或者taskId不能为空");
|
throw new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(),"pipelineId或者taskId不能为空");
|
||||||
}
|
}
|
||||||
|
|
||||||
BaseRunContext runContext = runContextManager.getContext(req.getPipelineId());
|
// BaseRunContext runContext = runContextManager.getContext(req.getPipelineId());
|
||||||
if (ObjectUtils.isEmpty(runContext)){
|
// if (ObjectUtils.isEmpty(runContext)){
|
||||||
throw new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(),"未找到运行上下文");
|
// throw new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(),"未找到运行上下文");
|
||||||
}
|
// }
|
||||||
String resourceId = runContext.getGlobalVariables().get(PipelineVariableConstant.AFL_RESOURCE_MANAGER_ID_KEY) instanceof String ? ((String) runContext.getGlobalVariables().get(PipelineVariableConstant.AFL_RESOURCE_MANAGER_ID_KEY)) : null;
|
// String resourceId = runContext.getGlobalVariables().get(PipelineVariableConstant.AFL_RESOURCE_MANAGER_ID_KEY) instanceof String ? ((String) runContext.getGlobalVariables().get(PipelineVariableConstant.AFL_RESOURCE_MANAGER_ID_KEY)) : null;
|
||||||
// String resourceId = "1";
|
String resourceId = "2";
|
||||||
if (StringUtils.isEmpty(resourceId)){
|
if (StringUtils.isEmpty(resourceId)){
|
||||||
throw new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(),"未找到资源");
|
throw new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(),"未找到资源");
|
||||||
}
|
}
|
||||||
@ -114,11 +112,12 @@ public class AflInfoServiceImpl extends ServiceImpl<AflInfoDao, AflInfo> impleme
|
|||||||
throw new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(),"pipelineId或者taskId不能为空");
|
throw new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(),"pipelineId或者taskId不能为空");
|
||||||
}
|
}
|
||||||
|
|
||||||
BaseRunContext runContext = runContextManager.getContext(req.getPipelineId());
|
// BaseRunContext runContext = runContextManager.getContext(req.getPipelineId());
|
||||||
if (ObjectUtils.isEmpty(runContext)){
|
// if (ObjectUtils.isEmpty(runContext)){
|
||||||
throw new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(),"未找到运行上下文");
|
// throw new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(),"未找到运行上下文");
|
||||||
}
|
// }
|
||||||
String resourceId = runContext.getGlobalVariables().get(PipelineVariableConstant.AFL_RESOURCE_MANAGER_ID_KEY) instanceof String ? ((String) runContext.getGlobalVariables().get(PipelineVariableConstant.AFL_RESOURCE_MANAGER_ID_KEY)) : null;
|
// String resourceId = runContext.getGlobalVariables().get(PipelineVariableConstant.AFL_RESOURCE_MANAGER_ID_KEY) instanceof String ? ((String) runContext.getGlobalVariables().get(PipelineVariableConstant.AFL_RESOURCE_MANAGER_ID_KEY)) : null;
|
||||||
|
String resourceId = "2";
|
||||||
if (StringUtils.isEmpty(resourceId)){
|
if (StringUtils.isEmpty(resourceId)){
|
||||||
throw new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(),"未找到资源");
|
throw new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(),"未找到资源");
|
||||||
}
|
}
|
||||||
|
@ -59,6 +59,7 @@ public class AflPlotInfoServiceImpl extends ServiceImpl<AflPlotInfoDao, AflPlotI
|
|||||||
throw new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(),"未找到运行上下文");
|
throw new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(),"未找到运行上下文");
|
||||||
}
|
}
|
||||||
String resourceId = runContext.getGlobalVariables().get(PipelineVariableConstant.AFL_RESOURCE_MANAGER_ID_KEY) instanceof String ? ((String) runContext.getGlobalVariables().get(PipelineVariableConstant.AFL_RESOURCE_MANAGER_ID_KEY)) : null;
|
String resourceId = runContext.getGlobalVariables().get(PipelineVariableConstant.AFL_RESOURCE_MANAGER_ID_KEY) instanceof String ? ((String) runContext.getGlobalVariables().get(PipelineVariableConstant.AFL_RESOURCE_MANAGER_ID_KEY)) : null;
|
||||||
|
// String resourceId = "2";
|
||||||
if (StringUtils.isEmpty(resourceId)){
|
if (StringUtils.isEmpty(resourceId)){
|
||||||
throw new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(),"未找到资源");
|
throw new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(),"未找到资源");
|
||||||
}
|
}
|
||||||
@ -119,6 +120,7 @@ public class AflPlotInfoServiceImpl extends ServiceImpl<AflPlotInfoDao, AflPlotI
|
|||||||
throw new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(),"未找到运行上下文");
|
throw new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(),"未找到运行上下文");
|
||||||
}
|
}
|
||||||
String resourceId = runContext.getGlobalVariables().get(PipelineVariableConstant.AFL_RESOURCE_MANAGER_ID_KEY) instanceof String ? ((String) runContext.getGlobalVariables().get(PipelineVariableConstant.AFL_RESOURCE_MANAGER_ID_KEY)) : null;
|
String resourceId = runContext.getGlobalVariables().get(PipelineVariableConstant.AFL_RESOURCE_MANAGER_ID_KEY) instanceof String ? ((String) runContext.getGlobalVariables().get(PipelineVariableConstant.AFL_RESOURCE_MANAGER_ID_KEY)) : null;
|
||||||
|
// String resourceId = "2";
|
||||||
if (StringUtils.isEmpty(resourceId)){
|
if (StringUtils.isEmpty(resourceId)){
|
||||||
throw new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(),"未找到资源");
|
throw new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(),"未找到资源");
|
||||||
}
|
}
|
||||||
|
@ -67,6 +67,7 @@ public class AflSeedInfoServiceImpl extends ServiceImpl<AflSeedInfoDao, AflSeedI
|
|||||||
throw new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(),"未找到pipeline运行上下文");
|
throw new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(),"未找到pipeline运行上下文");
|
||||||
}
|
}
|
||||||
String resourceId = pipelineRunContext.getGlobalVariables().get(PipelineVariableConstant.AFL_RESOURCE_MANAGER_ID_KEY) instanceof String ? ((String) pipelineRunContext.getGlobalVariables().get(PipelineVariableConstant.AFL_RESOURCE_MANAGER_ID_KEY)) : null;
|
String resourceId = pipelineRunContext.getGlobalVariables().get(PipelineVariableConstant.AFL_RESOURCE_MANAGER_ID_KEY) instanceof String ? ((String) pipelineRunContext.getGlobalVariables().get(PipelineVariableConstant.AFL_RESOURCE_MANAGER_ID_KEY)) : null;
|
||||||
|
// String resourceId = "2";
|
||||||
if (StringUtils.isEmpty(resourceId)){
|
if (StringUtils.isEmpty(resourceId)){
|
||||||
throw new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(),"未找到资源");
|
throw new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(),"未找到资源");
|
||||||
}
|
}
|
||||||
@ -102,6 +103,7 @@ public class AflSeedInfoServiceImpl extends ServiceImpl<AflSeedInfoDao, AflSeedI
|
|||||||
// 提取 rep 值
|
// 提取 rep 值
|
||||||
int repValue = 0;
|
int repValue = 0;
|
||||||
String seedId = "";
|
String seedId = "";
|
||||||
|
fileNamePart = fileNamePart.substring(fileNamePart.lastIndexOf("/") + 1);
|
||||||
for (String part : fileNamePart.split(",")) {
|
for (String part : fileNamePart.split(",")) {
|
||||||
if (part.startsWith("rep:")) {
|
if (part.startsWith("rep:")) {
|
||||||
repValue = Integer.parseInt(part.substring(4));
|
repValue = Integer.parseInt(part.substring(4));
|
||||||
@ -109,7 +111,6 @@ public class AflSeedInfoServiceImpl extends ServiceImpl<AflSeedInfoDao, AflSeedI
|
|||||||
}
|
}
|
||||||
if (part.startsWith("id:")) {
|
if (part.startsWith("id:")) {
|
||||||
seedId = part.substring(4);
|
seedId = part.substring(4);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,6 +130,12 @@ public class AflSeedInfoServiceImpl extends ServiceImpl<AflSeedInfoDao, AflSeedI
|
|||||||
}
|
}
|
||||||
LocalDateTime startTime = taskRunContext.getStartTime();
|
LocalDateTime startTime = taskRunContext.getStartTime();
|
||||||
|
|
||||||
|
// //使用支持微秒的格式
|
||||||
|
// DateTimeFormatter formatter1 = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSSSSS");
|
||||||
|
//
|
||||||
|
// 解析为 LocalDateTime
|
||||||
|
// LocalDateTime startTime = LocalDateTime.parse("2025-06-30 11:45:51.875000", formatter1);
|
||||||
|
|
||||||
// 计算时间差(分钟)
|
// 计算时间差(分钟)
|
||||||
Duration duration = Duration.between(startTime, createDateTime);
|
Duration duration = Duration.between(startTime, createDateTime);
|
||||||
int minutesDifference = Math.toIntExact(Math.abs(duration.toMinutes()));
|
int minutesDifference = Math.toIntExact(Math.abs(duration.toMinutes()));
|
||||||
@ -205,7 +212,7 @@ public class AflSeedInfoServiceImpl extends ServiceImpl<AflSeedInfoDao, AflSeedI
|
|||||||
|
|
||||||
List<AflSeedInfo> aflSeedInfos = new ArrayList<>(0);
|
List<AflSeedInfo> aflSeedInfos = new ArrayList<>(0);
|
||||||
if (!CollectionUtils.isEmpty(copiedFiles)){
|
if (!CollectionUtils.isEmpty(copiedFiles)){
|
||||||
//新增数据到crashes表中
|
//新增数据到seed表中
|
||||||
copiedFiles.forEach(o->{
|
copiedFiles.forEach(o->{
|
||||||
AflSeedInfo aflSeedInfo = new AflSeedInfo();
|
AflSeedInfo aflSeedInfo = new AflSeedInfo();
|
||||||
|
|
||||||
|
@ -1069,20 +1069,13 @@ public class SftpUploadUtil {
|
|||||||
session.connect();
|
session.connect();
|
||||||
System.out.println("SFTP Session 连接成功.");
|
System.out.println("SFTP Session 连接成功.");
|
||||||
|
|
||||||
//切换目录
|
// 开始执行 find 命令
|
||||||
ChannelSftp sftpChannel = (ChannelSftp) session.openChannel("sftp");
|
|
||||||
sftpChannel.connect();
|
|
||||||
try {
|
|
||||||
sftpChannel.cd(remoteDir);
|
|
||||||
System.out.println("切换到远程目录: " + remoteDir);
|
|
||||||
} catch (SftpException e) {
|
|
||||||
System.err.println("切换目录失败: " + e.getMessage());
|
|
||||||
}
|
|
||||||
sftpChannel.disconnect();
|
|
||||||
|
|
||||||
// 执行命令打印输出
|
|
||||||
ChannelExec execChannel = (ChannelExec) session.openChannel("exec");
|
ChannelExec execChannel = (ChannelExec) session.openChannel("exec");
|
||||||
execChannel.setCommand("find . -maxdepth 1 -type f -exec stat -c \"%n 创建时间: %w\" {} \\;");
|
|
||||||
|
// 设置要执行的命令
|
||||||
|
String command = "find " + remoteDir + " -maxdepth 1 -type f -exec stat -c \"%n 创建时间: %w\" {} \\;";
|
||||||
|
execChannel.setCommand(command);
|
||||||
|
|
||||||
InputStream in = execChannel.getInputStream();
|
InputStream in = execChannel.getInputStream();
|
||||||
execChannel.connect();
|
execChannel.connect();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user