This commit is contained in:
even 2025-06-07 15:37:32 +08:00
commit 80b9d2ed99
5 changed files with 11 additions and 7 deletions

View File

@ -2,13 +2,11 @@ package cd.casic.ci.process.engine.worker;
import cd.casic.ci.process.common.WorkAtom; import cd.casic.ci.process.common.WorkAtom;
import cd.casic.ci.process.engine.constant.EngineRuntimeConstant;
import cd.casic.ci.process.engine.context.ConstantContextHolder; import cd.casic.ci.process.engine.context.ConstantContextHolder;
import cd.casic.ci.process.engine.runContext.BaseRunContext; import cd.casic.ci.process.engine.runContext.BaseRunContext;
import cd.casic.ci.process.engine.runContext.TaskRunContext; import cd.casic.ci.process.engine.runContext.TaskRunContext;
import cd.casic.ci.process.engine.worker.base.HttpWorker; import cd.casic.ci.process.engine.worker.base.HttpWorker;
import cd.casic.ci.process.process.dataObject.base.PipBaseElement; import cd.casic.ci.process.process.dataObject.base.PipBaseElement;
import cd.casic.ci.process.process.dataObject.log.PipTaskLog;
import cd.casic.ci.process.process.dataObject.pipeline.PipPipeline; import cd.casic.ci.process.process.dataObject.pipeline.PipPipeline;
import cd.casic.ci.process.process.dataObject.target.TargetVersion; import cd.casic.ci.process.process.dataObject.target.TargetVersion;
import cd.casic.ci.process.process.dataObject.task.PipTask; import cd.casic.ci.process.process.dataObject.task.PipTask;
@ -126,6 +124,7 @@ public class ApplicationWorker extends HttpWorker {
pollTaskStatus(restTemplate, scaTaskId); pollTaskStatus(restTemplate, scaTaskId);
} else if (message.equals("应用已经存在")) { } else if (message.equals("应用已经存在")) {
append(context,message);
Integer oldScaTaskId = (Integer) applicationConfigInfo.get("taskId"); Integer oldScaTaskId = (Integer) applicationConfigInfo.get("taskId");
Integer oldApplicationId = (Integer) applicationConfigInfo.get("applicationId"); Integer oldApplicationId = (Integer) applicationConfigInfo.get("applicationId");
int restartResult = reStartTask(restTemplate, oldApplicationId); int restartResult = reStartTask(restTemplate, oldApplicationId);
@ -135,6 +134,7 @@ public class ApplicationWorker extends HttpWorker {
pollTaskStatus(restTemplate, oldScaTaskId); pollTaskStatus(restTemplate, oldScaTaskId);
} else { } else {
append(context,"==================SCA接口异常调用失败================="); append(context,"==================SCA接口异常调用失败=================");
append(context,message);
throw new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(),"SCA-应用包审查分析节点执行失败"); throw new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(),"SCA-应用包审查分析节点执行失败");
} }
Thread.currentThread().interrupt(); Thread.currentThread().interrupt();

View File

@ -2,12 +2,10 @@ package cd.casic.ci.process.engine.worker;
import cd.casic.ci.process.common.WorkAtom; import cd.casic.ci.process.common.WorkAtom;
import cd.casic.ci.process.engine.constant.EngineRuntimeConstant;
import cd.casic.ci.process.engine.context.ConstantContextHolder; import cd.casic.ci.process.engine.context.ConstantContextHolder;
import cd.casic.ci.process.engine.runContext.TaskRunContext; import cd.casic.ci.process.engine.runContext.TaskRunContext;
import cd.casic.ci.process.engine.worker.base.HttpWorker; import cd.casic.ci.process.engine.worker.base.HttpWorker;
import cd.casic.ci.process.process.dataObject.base.PipBaseElement; import cd.casic.ci.process.process.dataObject.base.PipBaseElement;
import cd.casic.ci.process.process.dataObject.log.PipTaskLog;
import cd.casic.ci.process.process.dataObject.task.PipTask; import cd.casic.ci.process.process.dataObject.task.PipTask;
import cd.casic.ci.process.process.service.pipeline.PipelineService; import cd.casic.ci.process.process.service.pipeline.PipelineService;
import cd.casic.ci.process.process.service.target.impl.TargetVersionServiceImpl; import cd.casic.ci.process.process.service.target.impl.TargetVersionServiceImpl;
@ -78,7 +76,7 @@ public class CodingWorker extends HttpWorker {
body.put("applicationDescription", codingConfigInfo.get("applicationDescription")); // 应用描述可选 body.put("applicationDescription", codingConfigInfo.get("applicationDescription")); // 应用描述可选
Map<String,Object> vcsRepo = new HashMap<>(); Map<String,Object> vcsRepo = new HashMap<>();
body.put("vcsRepo",vcsRepo); body.put("vcsRepo",vcsRepo);
Integer type = (Integer) codingConfigInfo.get("type"); Integer type = Integer.valueOf((String) codingConfigInfo.get("type"));
vcsRepo.put("type", type); vcsRepo.put("type", type);
if (REPO_TYPE_GIT.equals(type)) { if (REPO_TYPE_GIT.equals(type)) {
HashMap<String,String> gitVCSAssetRepo = new HashMap<>(); HashMap<String,String> gitVCSAssetRepo = new HashMap<>();
@ -107,6 +105,7 @@ public class CodingWorker extends HttpWorker {
//轮询请求状态 //轮询请求状态
pollTaskStatus(restTemplate, scaTaskId); pollTaskStatus(restTemplate, scaTaskId);
} else if (response.getString("message").equals("应用已经存在")){ } else if (response.getString("message").equals("应用已经存在")){
append(context,response.getString("message"));
Integer oldScaTaskId = (Integer) codingConfigInfo.get("taskId"); Integer oldScaTaskId = (Integer) codingConfigInfo.get("taskId");
Integer oldApplicationId = (Integer) codingConfigInfo.get("applicationId"); Integer oldApplicationId = (Integer) codingConfigInfo.get("applicationId");
int restartResult = reStartTask(restTemplate, oldApplicationId); int restartResult = reStartTask(restTemplate, oldApplicationId);
@ -119,6 +118,7 @@ public class CodingWorker extends HttpWorker {
//基于第三方文档表明500状态基本属于无镜像配置对比失败于是打印日志为无法对比镜像 //基于第三方文档表明500状态基本属于无镜像配置对比失败于是打印日志为无法对比镜像
append(context,"==================SCA校验失败================="); append(context,"==================SCA校验失败=================");
append(context,"接口异常调用失败"); append(context,"接口异常调用失败");
append(context,response.getString("message"));
localVariables.put("statusCode", "-1"); localVariables.put("statusCode", "-1");
} }
}catch (Exception e){ }catch (Exception e){

View File

@ -131,6 +131,7 @@ public class ScaBinaryWorker extends HttpWorker {
pollTaskStatus(restTemplate, scaTaskId); pollTaskStatus(restTemplate, scaTaskId);
} else if (message.equals("应用已经存在")) { } else if (message.equals("应用已经存在")) {
append(context,message);
Integer oldScaTaskId = (Integer) scaBinaryConfigInfo.get("taskId"); Integer oldScaTaskId = (Integer) scaBinaryConfigInfo.get("taskId");
Integer oldApplicationId = (Integer) scaBinaryConfigInfo.get("applicationId"); Integer oldApplicationId = (Integer) scaBinaryConfigInfo.get("applicationId");
int restartResult = reStartTask(restTemplate, oldApplicationId); int restartResult = reStartTask(restTemplate, oldApplicationId);
@ -140,6 +141,7 @@ public class ScaBinaryWorker extends HttpWorker {
pollTaskStatus(restTemplate, oldScaTaskId); pollTaskStatus(restTemplate, oldScaTaskId);
} else { } else {
append(context,"==================SCA接口异常调用失败================="); append(context,"==================SCA接口异常调用失败=================");
append(context,message);
throw new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(),"SCA-SBOM节点执行失败"); throw new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(),"SCA-SBOM节点执行失败");
} }
Thread.currentThread().interrupt(); Thread.currentThread().interrupt();

View File

@ -129,6 +129,7 @@ public class ScaMirrorWorker extends HttpWorker {
pollTaskStatus(restTemplate, scaTaskId); pollTaskStatus(restTemplate, scaTaskId);
} else if (message.equals("应用已经存在")) { } else if (message.equals("应用已经存在")) {
append(context,message);
Integer oldScaTaskId = (Integer) scaMirrorConfigInfo.get("taskId"); Integer oldScaTaskId = (Integer) scaMirrorConfigInfo.get("taskId");
Integer oldApplicationId = (Integer) scaMirrorConfigInfo.get("applicationId"); Integer oldApplicationId = (Integer) scaMirrorConfigInfo.get("applicationId");
int restartResult = reStartTask(restTemplate, oldApplicationId); int restartResult = reStartTask(restTemplate, oldApplicationId);
@ -138,6 +139,7 @@ public class ScaMirrorWorker extends HttpWorker {
pollTaskStatus(restTemplate, oldScaTaskId); pollTaskStatus(restTemplate, oldScaTaskId);
} else { } else {
append(context,"==================SCA接口异常调用失败================="); append(context,"==================SCA接口异常调用失败=================");
append(context,message);
throw new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(),"SCA-SBOM节点执行失败"); throw new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(),"SCA-SBOM节点执行失败");
} }
Thread.currentThread().interrupt(); Thread.currentThread().interrupt();

View File

@ -2,13 +2,11 @@ package cd.casic.ci.process.engine.worker;
import cd.casic.ci.process.common.WorkAtom; import cd.casic.ci.process.common.WorkAtom;
import cd.casic.ci.process.engine.constant.EngineRuntimeConstant;
import cd.casic.ci.process.engine.context.ConstantContextHolder; import cd.casic.ci.process.engine.context.ConstantContextHolder;
import cd.casic.ci.process.engine.runContext.BaseRunContext; import cd.casic.ci.process.engine.runContext.BaseRunContext;
import cd.casic.ci.process.engine.runContext.TaskRunContext; import cd.casic.ci.process.engine.runContext.TaskRunContext;
import cd.casic.ci.process.engine.worker.base.HttpWorker; import cd.casic.ci.process.engine.worker.base.HttpWorker;
import cd.casic.ci.process.process.dataObject.base.PipBaseElement; import cd.casic.ci.process.process.dataObject.base.PipBaseElement;
import cd.casic.ci.process.process.dataObject.log.PipTaskLog;
import cd.casic.ci.process.process.dataObject.pipeline.PipPipeline; import cd.casic.ci.process.process.dataObject.pipeline.PipPipeline;
import cd.casic.ci.process.process.dataObject.target.TargetVersion; import cd.casic.ci.process.process.dataObject.target.TargetVersion;
import cd.casic.ci.process.process.dataObject.task.PipTask; import cd.casic.ci.process.process.dataObject.task.PipTask;
@ -128,6 +126,7 @@ public class ScaSbomWorker extends HttpWorker {
pollTaskStatus(restTemplate, scaTaskId); pollTaskStatus(restTemplate, scaTaskId);
} else if (message.equals("应用已经存在")) { } else if (message.equals("应用已经存在")) {
append(context,message);
Integer oldScaTaskId = (Integer) scaSbomConfigInfo.get("taskId"); Integer oldScaTaskId = (Integer) scaSbomConfigInfo.get("taskId");
Integer oldApplicationId = (Integer) scaSbomConfigInfo.get("applicationId"); Integer oldApplicationId = (Integer) scaSbomConfigInfo.get("applicationId");
int restartResult = reStartTask(restTemplate, oldApplicationId); int restartResult = reStartTask(restTemplate, oldApplicationId);
@ -137,6 +136,7 @@ public class ScaSbomWorker extends HttpWorker {
pollTaskStatus(restTemplate, oldScaTaskId); pollTaskStatus(restTemplate, oldScaTaskId);
} else { } else {
append(context,"==================SCA接口异常调用失败================="); append(context,"==================SCA接口异常调用失败=================");
append(context,message);
throw new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(),"SCA-SBOM节点执行失败"); throw new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(),"SCA-SBOM节点执行失败");
} }
Thread.currentThread().interrupt(); Thread.currentThread().interrupt();