Compare commits

..

No commits in common. "7b1e8fd9e52a4205eebb2e8e1675c8e6c5972937" and "7a2fa739748f0e8b83c4d94f08a4c592c5043f26" have entirely different histories.

5 changed files with 28 additions and 30 deletions

View File

@ -63,7 +63,6 @@ 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(),"未找到资源");
} }

View File

@ -3,7 +3,9 @@ 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;
@ -52,12 +54,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"; // String resourceId = "1";
if (StringUtils.isEmpty(resourceId)){ if (StringUtils.isEmpty(resourceId)){
throw new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(),"未找到资源"); throw new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(),"未找到资源");
} }
@ -112,12 +114,11 @@ 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(),"未找到资源");
} }

View File

@ -59,7 +59,6 @@ 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(),"未找到资源");
} }
@ -120,7 +119,6 @@ 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(),"未找到资源");
} }

View File

@ -67,7 +67,6 @@ 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(),"未找到资源");
} }
@ -103,7 +102,6 @@ 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));
@ -111,6 +109,7 @@ public class AflSeedInfoServiceImpl extends ServiceImpl<AflSeedInfoDao, AflSeedI
} }
if (part.startsWith("id:")) { if (part.startsWith("id:")) {
seedId = part.substring(4); seedId = part.substring(4);
break;
} }
} }
@ -130,12 +129,6 @@ 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()));
@ -212,7 +205,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)){
//新增数据到seed表中 //新增数据到crashes表中
copiedFiles.forEach(o->{ copiedFiles.forEach(o->{
AflSeedInfo aflSeedInfo = new AflSeedInfo(); AflSeedInfo aflSeedInfo = new AflSeedInfo();

View File

@ -1069,13 +1069,20 @@ 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();