Compare commits
4 Commits
a754b6369c
...
4b9c846a7a
Author | SHA1 | Date | |
---|---|---|---|
![]() |
4b9c846a7a | ||
![]() |
1520c8c103 | ||
![]() |
6605dd16e6 | ||
![]() |
01fc6f5637 |
@ -1,6 +1,9 @@
|
||||
package cd.casic.ci.common.pipeline.resp.context;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 单节点上下文状态返回对象
|
||||
* */
|
||||
@ -14,4 +17,6 @@ public class SingletonRunContextResp {
|
||||
* 状态 详见 ContextStateEnum
|
||||
* */
|
||||
private Integer state;
|
||||
private LocalDateTime startTime;
|
||||
private LocalDateTime endTime;
|
||||
}
|
||||
|
@ -3,10 +3,12 @@ package cd.casic.ci.common.pipeline.resp.context;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class TreeRunContextResp extends SingletonRunContextResp{
|
||||
private Map<String,TreeRunContextResp> child;
|
||||
private List<TreeRunContextResp> taskList;
|
||||
}
|
||||
|
@ -105,5 +105,15 @@ public class PipelineFindResp {
|
||||
|
||||
private List<StageResp> stageList;
|
||||
|
||||
/**
|
||||
* 目标id
|
||||
*/
|
||||
private String targetVersionId;
|
||||
|
||||
/**
|
||||
* 目标类型
|
||||
*/
|
||||
private String targetType;
|
||||
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,48 @@
|
||||
package cd.casic.ci.common.pipeline.resp.taskTemplate;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class TaskTemplateResp {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 唯一标示做关联
|
||||
*/
|
||||
private String parentId;
|
||||
|
||||
/**
|
||||
* name
|
||||
*/
|
||||
private String taskType;
|
||||
|
||||
/**
|
||||
* 标签
|
||||
*/
|
||||
private String taskName;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String nodDescription;
|
||||
|
||||
/**
|
||||
* 图标
|
||||
*/
|
||||
private String icon;
|
||||
/**
|
||||
* 是否有执行结果数据
|
||||
*/
|
||||
private int view;
|
||||
|
||||
/**
|
||||
* 节点类型:目录-0or 节点-1
|
||||
*/
|
||||
private Integer type;
|
||||
private List<TaskTemplateResp> children;
|
||||
}
|
@ -61,7 +61,6 @@ public class ParallelDispatcher implements BaseDispatcher{
|
||||
latch.await();
|
||||
// TODO 检查是否全部执行成功 ,目前没有逻辑就是忽略错误
|
||||
}
|
||||
// TODO 入库
|
||||
}
|
||||
@Override
|
||||
public void run() {
|
||||
|
@ -42,6 +42,9 @@ public class DefaultPipelineExecutor implements PipelineExecutor {
|
||||
@Override
|
||||
public PipelineRunContext execute(String pipelineId) {
|
||||
PipPipeline pipeline = pipelineService.getById(pipelineId);
|
||||
if (pipeline==null) {
|
||||
return null;
|
||||
}
|
||||
// TODO 判断状态不能重复运行
|
||||
Integer state = pipeline.getState();
|
||||
// TODO 判断资源是否申请成功是否处于可运行状态
|
||||
|
@ -89,6 +89,9 @@ public class DefaultWorkerManager extends WorkerManager {
|
||||
}
|
||||
String taskType = task.getTaskType();
|
||||
BaseWorker baseWorker = taskTypeWorkerMap.get(taskType);
|
||||
if (baseWorker==null) {
|
||||
throw new ServiceException(GlobalErrorCodeConstants.PIPELINE_ERROR.getCode(),"找不到worker");
|
||||
}
|
||||
baseWorker.setContextKey(task.getId());
|
||||
workerExecutor.execute(baseWorker);
|
||||
}catch (Exception e){
|
||||
|
@ -82,6 +82,7 @@ public abstract class BaseRunContext {
|
||||
return;
|
||||
}
|
||||
if (ContextStateEnum.HAPPY_ENDING.equals(state)||ContextStateEnum.BAD_ENDING.equals(state)) {
|
||||
this.endTime=LocalDateTime.now();
|
||||
parentContext.checkChildEnd();
|
||||
} else if(ContextStateEnum.READY.equals(state)){
|
||||
parentContext.checkChildReady();
|
||||
|
@ -3,6 +3,8 @@ package cd.casic.ci.process.engine.worker;
|
||||
import cd.casic.ci.common.pipeline.annotation.Plugin;
|
||||
import cd.casic.ci.process.engine.constant.EngineRuntimeConstant;
|
||||
import cd.casic.ci.process.engine.context.ConstantContextHolder;
|
||||
import cd.casic.ci.process.engine.runContext.BaseRunContext;
|
||||
import cd.casic.ci.process.engine.runContext.PipelineRunContext;
|
||||
import cd.casic.ci.process.engine.runContext.TaskRunContext;
|
||||
import cd.casic.ci.process.process.dataObject.base.PipBaseElement;
|
||||
import cd.casic.ci.process.process.dataObject.log.PipTaskLog;
|
||||
@ -58,15 +60,15 @@ public class ApplicationWorker extends HttpWorker{
|
||||
PipTaskLog pipTaskLog = (PipTaskLog) localVariables.get(EngineRuntimeConstant.LOG_KEY);
|
||||
|
||||
PipBaseElement contextDef = context.getContextDef();
|
||||
pipTaskLog.append("SCA-应用包审查分析节点开始执行");
|
||||
pipTaskLog.append("SCA-应用包审查分析节点配置:" + contextDef);
|
||||
append(context,"SCA-应用包审查分析节点开始执行");
|
||||
append(context,"SCA-应用包审查分析节点配置:" + contextDef);
|
||||
if (ObjectUtil.isEmpty(contextDef)) {
|
||||
log.error("未查询到节点[application]配置");
|
||||
localVariables.put("statusCode", "-1");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(contextDef)) {
|
||||
log.error("未查询到节点[application]配置");
|
||||
pipTaskLog.append("未查询到节点[application]配置");
|
||||
append(context,"未查询到节点[application]配置");
|
||||
localVariables.put("statusCode", "-1");
|
||||
}
|
||||
|
||||
@ -89,14 +91,14 @@ public class ApplicationWorker extends HttpWorker{
|
||||
if (!file.exists() || !file.canRead()) {
|
||||
log.error("目标文件不存在或不可读");
|
||||
localVariables.put("statusCode", "-1");
|
||||
pipTaskLog.append("目标文件不存在或不可读");
|
||||
append(context,"目标文件不存在或不可读");
|
||||
}
|
||||
|
||||
handleUpload(pipTask.getTaskProperties(), file,pipTaskLog);
|
||||
handleUpload(pipTask.getTaskProperties(), file,context);
|
||||
}catch (Exception e){
|
||||
pipTaskLog.append("==================SCA-应用包审查分析节点执行失败=================");
|
||||
pipTaskLog.append("SCA-应用包审查分析节点执行失败失败,请检查当前节点配置!");
|
||||
pipTaskLog.append(e.getMessage());
|
||||
append(context,"==================SCA-应用包审查分析节点执行失败=================");
|
||||
append(context,"SCA-应用包审查分析节点执行失败失败,请检查当前节点配置!");
|
||||
append(context,e.getMessage());
|
||||
log.error("==================SCA-应用包审查分析节点执行失败=================",e);
|
||||
throw new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(),"SCA-应用包审查分析节点执行失败");
|
||||
}
|
||||
@ -105,7 +107,7 @@ public class ApplicationWorker extends HttpWorker{
|
||||
localVariables.put(EngineRuntimeConstant.LOG_KEY, pipTaskLog);
|
||||
}
|
||||
|
||||
private void handleUpload(Map<String,Object> applicationConfigInfo, File file, PipTaskLog pipTaskLog) throws NoSuchAlgorithmException, KeyStoreException, KeyManagementException {
|
||||
private void handleUpload(Map<String,Object> applicationConfigInfo, File file, BaseRunContext context) throws NoSuchAlgorithmException, KeyStoreException, KeyManagementException {
|
||||
RestTemplate restTemplate = getRestTemplateWithoutSANCheck();
|
||||
String scaUploadUrl = ConstantContextHolder.getScaIp() + "/openapi/v1/app-package/detect-file";
|
||||
MultiValueMap<String, Object> body = buildRequestBody(applicationConfigInfo, file);
|
||||
@ -119,7 +121,7 @@ public class ApplicationWorker extends HttpWorker{
|
||||
String message = response.getString("message");
|
||||
|
||||
if (message.equals("success")) {
|
||||
pipTaskLog.append("===============SCA上传成功=================");
|
||||
append(context,"===============SCA上传成功=================");
|
||||
JSONObject data = response.getJSONObject("data");
|
||||
Integer scaTaskId = data.getInteger("scaTaskId");
|
||||
|
||||
@ -133,7 +135,7 @@ public class ApplicationWorker extends HttpWorker{
|
||||
}
|
||||
pollTaskStatus(restTemplate, oldScaTaskId);
|
||||
} else {
|
||||
pipTaskLog.append("==================SCA接口异常,调用失败=================");
|
||||
append(context,"==================SCA接口异常,调用失败=================");
|
||||
throw new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(),"SCA-应用包审查分析节点执行失败");
|
||||
}
|
||||
Thread.currentThread().interrupt();
|
||||
|
@ -4,6 +4,7 @@ package cd.casic.ci.process.engine.worker;
|
||||
import cd.casic.ci.process.constant.CommandConstant;
|
||||
import cd.casic.ci.process.engine.constant.EngineRuntimeConstant;
|
||||
import cd.casic.ci.process.engine.enums.ContextStateEnum;
|
||||
import cd.casic.ci.process.engine.manager.LoggerManager;
|
||||
import cd.casic.ci.process.engine.manager.RunContextManager;
|
||||
import cd.casic.ci.process.engine.runContext.BaseRunContext;
|
||||
|
||||
@ -25,6 +26,7 @@ import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import javax.swing.text.StringContent;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@ -37,7 +39,10 @@ public abstract class BaseWorker implements Runnable{
|
||||
private RunContextManager contextManager;
|
||||
private String contextKey;
|
||||
@Resource
|
||||
public MachineInfoService machineInfoService;
|
||||
private MachineInfoService machineInfoService;
|
||||
@Resource
|
||||
private LoggerManager loggerManager;
|
||||
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
@ -69,6 +74,11 @@ public abstract class BaseWorker implements Runnable{
|
||||
taskRunContext.changeContextState(ContextStateEnum.HAPPY_ENDING);
|
||||
}
|
||||
}
|
||||
public void append(BaseRunContext context, String content){
|
||||
if (context instanceof TaskRunContext taskRunContext) {
|
||||
loggerManager.append(taskRunContext.getContextDef().getId(),content);
|
||||
}
|
||||
}
|
||||
public abstract void execute(TaskRunContext context);
|
||||
public void toBadEnding(){
|
||||
throw new ServiceException(GlobalErrorCodeConstants.PIPELINE_ERROR.getCode(),"");
|
||||
|
@ -50,15 +50,15 @@ public class CodingWorker extends HttpWorker{
|
||||
PipTaskLog pipTaskLog = (PipTaskLog) localVariables.get(EngineRuntimeConstant.LOG_KEY);
|
||||
|
||||
PipBaseElement contextDef = context.getContextDef();
|
||||
pipTaskLog.append("SCA-代码仓库管理节点开始执行");
|
||||
pipTaskLog.append("SCA-代码仓库管理节点配置:" + contextDef);
|
||||
append(context,"SCA-代码仓库管理节点开始执行");
|
||||
append(context,"SCA-代码仓库管理节点配置:" + contextDef);
|
||||
if (ObjectUtil.isEmpty(contextDef)) {
|
||||
log.error("未查询到节点[coding]配置");
|
||||
localVariables.put("statusCode", "-1");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(contextDef)) {
|
||||
log.error("未查询到节点[coding]配置");
|
||||
pipTaskLog.append("未查询到节点[coding]配置");
|
||||
append(context,"未查询到节点[coding]配置");
|
||||
localVariables.put("statusCode", "-1");
|
||||
}
|
||||
|
||||
@ -100,7 +100,7 @@ public class CodingWorker extends HttpWorker{
|
||||
JSONObject response = restTemplate.postForObject(scaUploadUrl, requestEntity, JSONObject.class);
|
||||
|
||||
if (response.getString("message").equals("success")) {
|
||||
pipTaskLog.append("===============SCA上传成功=================");
|
||||
append(context,"===============SCA上传成功=================");
|
||||
JSONObject data = response.getJSONObject("data");
|
||||
Integer scaTaskId = data.getInteger("scaTaskId");
|
||||
//轮询请求状态
|
||||
@ -116,14 +116,14 @@ public class CodingWorker extends HttpWorker{
|
||||
pollTaskStatus(restTemplate, oldScaTaskId);
|
||||
} else {
|
||||
//基于第三方文档表明500状态基本属于无镜像配置,对比失败,于是打印日志为无法对比镜像
|
||||
pipTaskLog.append("==================SCA校验失败=================");
|
||||
pipTaskLog.append("接口异常调用失败");
|
||||
append(context,"==================SCA校验失败=================");
|
||||
append(context,"接口异常调用失败");
|
||||
localVariables.put("statusCode", "-1");
|
||||
}
|
||||
}catch (Exception e){
|
||||
pipTaskLog.append("==================SCA-CODING节点执行失败=================");
|
||||
pipTaskLog.append("SCA-CODING节点执行失败失败,请检查当前节点配置!");
|
||||
pipTaskLog.append(e.getMessage());
|
||||
append(context,"==================SCA-CODING节点执行失败=================");
|
||||
append(context,"SCA-CODING节点执行失败失败,请检查当前节点配置!");
|
||||
append(context,e.getMessage());
|
||||
log.error("==================SCA-CODING节点执行失败=================",e);
|
||||
throw new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(),"SCA-SBOM节点执行失败");
|
||||
}
|
||||
|
@ -25,8 +25,8 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
* @date 2022-11-08 9:59
|
||||
*/
|
||||
@Slf4j
|
||||
//@Plugin(taskType = "CUSTOM_IMAGE_EXECUTION_COMMAND")
|
||||
@Plugin(taskType = "testSSH")
|
||||
@Plugin(taskType = "CUSTOM_IMAGE_EXECUTION_COMMAND")
|
||||
//@Plugin(taskType = "testSSH")
|
||||
public class DIYImageExecuteCommandWorker extends SshWorker {
|
||||
|
||||
@Override
|
||||
@ -60,14 +60,14 @@ public class DIYImageExecuteCommandWorker extends SshWorker {
|
||||
|
||||
//获取机器
|
||||
MachineInfo machineInfoDO = this.getMachineInfoService().getById(machineId);
|
||||
statusCode = shell(machineInfoDO,"Hnidc@0626cn!@#zyx",taskLog,
|
||||
statusCode = shell(machineInfoDO,"Hnidc@0626cn!@#zyx",context,
|
||||
"echo \"自定义镜像执行命令\"",
|
||||
commandScript
|
||||
);
|
||||
} catch (Exception e) {
|
||||
String errorMessage = "该节点配置信息为空,请先配置该节点信息" + "\r\n";
|
||||
log.error("执行ssh失败:",e);
|
||||
taskLog.append(errorMessage);
|
||||
append(context,errorMessage);
|
||||
toBadEnding();
|
||||
}
|
||||
if (statusCode == 0) {
|
||||
|
@ -3,6 +3,7 @@ package cd.casic.ci.process.engine.worker;
|
||||
import cd.casic.ci.common.pipeline.annotation.Plugin;
|
||||
import cd.casic.ci.process.engine.constant.EngineRuntimeConstant;
|
||||
import cd.casic.ci.process.engine.context.ConstantContextHolder;
|
||||
import cd.casic.ci.process.engine.runContext.BaseRunContext;
|
||||
import cd.casic.ci.process.engine.runContext.TaskRunContext;
|
||||
import cd.casic.ci.process.process.dataObject.base.PipBaseElement;
|
||||
import cd.casic.ci.process.process.dataObject.log.PipTaskLog;
|
||||
@ -55,18 +56,18 @@ public class ScaBinaryWorker extends HttpWorker{
|
||||
public void execute(TaskRunContext context) {
|
||||
int statusCode = 0;
|
||||
Map<String, Object> localVariables = context.getLocalVariables();
|
||||
PipTaskLog pipTaskLog = (PipTaskLog) localVariables.get(EngineRuntimeConstant.LOG_KEY);
|
||||
// PipTaskLog pipTaskLog = (PipTaskLog) localVariables.get(EngineRuntimeConstant.LOG_KEY);
|
||||
|
||||
PipBaseElement contextDef = context.getContextDef();
|
||||
pipTaskLog.append("SCA-BINARY节点开始执行");
|
||||
pipTaskLog.append("SCA-BINARY节点配置:" + contextDef);
|
||||
append(context,"SCA-BINARY节点开始执行");
|
||||
append(context,"SCA-BINARY节点配置:" + contextDef);
|
||||
if (ObjectUtil.isEmpty(contextDef)) {
|
||||
log.error("未查询到节点[ScaBinary]配置");
|
||||
localVariables.put("statusCode", "-1");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(contextDef)) {
|
||||
log.error("未查询到节点[ScaBinary]配置");
|
||||
pipTaskLog.append("未查询到节点[ScaBinary]配置");
|
||||
append(context,"未查询到节点[ScaBinary]配置");
|
||||
localVariables.put("statusCode", "-1");
|
||||
}
|
||||
|
||||
@ -90,24 +91,24 @@ public class ScaBinaryWorker extends HttpWorker{
|
||||
if (!file.exists() || !file.canRead()) {
|
||||
log.error("目标文件不存在或不可读");
|
||||
localVariables.put("statusCode", "-1");
|
||||
pipTaskLog.append("目标文件不存在或不可读");
|
||||
append(context,"目标文件不存在或不可读");
|
||||
}
|
||||
|
||||
handleUpload(pipTask.getTaskProperties(), file,pipTaskLog);
|
||||
handleUpload(pipTask.getTaskProperties(), file,context);
|
||||
}catch (Exception e){
|
||||
pipTaskLog.append("==================SCA-BINARY节点执行失败=================");
|
||||
pipTaskLog.append("SCA-BINARY节点执行失败失败,请检查当前节点配置!");
|
||||
pipTaskLog.append(e.getMessage());
|
||||
append(context,"==================SCA-BINARY节点执行失败=================");
|
||||
append(context,"SCA-BINARY节点执行失败失败,请检查当前节点配置!");
|
||||
append(context,e.getMessage());
|
||||
log.error("==================SCA-BINARY节点执行失败=================",e);
|
||||
throw new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(),"SCA-SBOM节点执行失败");
|
||||
}
|
||||
}
|
||||
|
||||
localVariables.put("statusCode", statusCode + "");
|
||||
localVariables.put(EngineRuntimeConstant.LOG_KEY, pipTaskLog);
|
||||
// localVariables.put(EngineRuntimeConstant.LOG_KEY, pipTaskLog);
|
||||
}
|
||||
|
||||
private void handleUpload(Map<String,Object> scaBinaryConfigInfo, File file, PipTaskLog pipTaskLog) throws NoSuchAlgorithmException, KeyStoreException, KeyManagementException {
|
||||
private void handleUpload(Map<String,Object> scaBinaryConfigInfo, File file, BaseRunContext context) throws NoSuchAlgorithmException, KeyStoreException, KeyManagementException {
|
||||
RestTemplate restTemplate = getRestTemplateWithoutSANCheck();
|
||||
String scaUploadUrl = ConstantContextHolder.getScaIp() + "/openapi/v1/binary/detect-file";
|
||||
MultiValueMap<String, Object> body = buildRequestBody(scaBinaryConfigInfo, file);
|
||||
@ -121,7 +122,7 @@ public class ScaBinaryWorker extends HttpWorker{
|
||||
String message = response.getString("message");
|
||||
|
||||
if (message.equals("success")) {
|
||||
pipTaskLog.append("===============SCA上传成功=================");
|
||||
append(context,"===============SCA上传成功=================");
|
||||
JSONObject data = response.getJSONObject("data");
|
||||
Integer scaTaskId = data.getInteger("scaTaskId");
|
||||
|
||||
@ -135,7 +136,7 @@ public class ScaBinaryWorker extends HttpWorker{
|
||||
}
|
||||
pollTaskStatus(restTemplate, oldScaTaskId);
|
||||
} else {
|
||||
pipTaskLog.append("==================SCA接口异常,调用失败=================");
|
||||
append(context,"==================SCA接口异常,调用失败=================");
|
||||
throw new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(),"SCA-SBOM节点执行失败");
|
||||
}
|
||||
Thread.currentThread().interrupt();
|
||||
|
@ -3,6 +3,7 @@ package cd.casic.ci.process.engine.worker;
|
||||
import cd.casic.ci.common.pipeline.annotation.Plugin;
|
||||
import cd.casic.ci.process.engine.constant.EngineRuntimeConstant;
|
||||
import cd.casic.ci.process.engine.context.ConstantContextHolder;
|
||||
import cd.casic.ci.process.engine.runContext.BaseRunContext;
|
||||
import cd.casic.ci.process.engine.runContext.TaskRunContext;
|
||||
import cd.casic.ci.process.process.dataObject.base.PipBaseElement;
|
||||
import cd.casic.ci.process.process.dataObject.log.PipTaskLog;
|
||||
@ -56,18 +57,18 @@ public class ScaMirrorWorker extends HttpWorker{
|
||||
public void execute(TaskRunContext context) {
|
||||
int statusCode = 0;
|
||||
Map<String, Object> localVariables = context.getLocalVariables();
|
||||
PipTaskLog pipTaskLog = (PipTaskLog) localVariables.get(EngineRuntimeConstant.LOG_KEY);
|
||||
// PipTaskLog pipTaskLog = (PipTaskLog) localVariables.get(EngineRuntimeConstant.LOG_KEY);
|
||||
|
||||
PipBaseElement contextDef = context.getContextDef();
|
||||
pipTaskLog.append("SCA-MIRROR节点开始执行");
|
||||
pipTaskLog.append("SCA-MIRROR节点配置:" + contextDef);
|
||||
append(context,"SCA-MIRROR节点开始执行");
|
||||
append(context,"SCA-MIRROR节点配置:" + contextDef);
|
||||
if (ObjectUtil.isEmpty(contextDef)) {
|
||||
log.error("未查询到节点[ScaMirror]配置");
|
||||
localVariables.put("statusCode", "-1");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(contextDef)) {
|
||||
log.error("未查询到节点[ScaMirror]配置");
|
||||
pipTaskLog.append("未查询到节点[ScaMirror]配置");
|
||||
append(context,"未查询到节点[ScaMirror]配置");
|
||||
localVariables.put("statusCode", "-1");
|
||||
}
|
||||
|
||||
@ -91,24 +92,24 @@ public class ScaMirrorWorker extends HttpWorker{
|
||||
if (!file.exists() || !file.canRead()) {
|
||||
log.error("目标文件不存在或不可读");
|
||||
localVariables.put("statusCode", "-1");
|
||||
pipTaskLog.append("目标文件不存在或不可读");
|
||||
append(context,"目标文件不存在或不可读");
|
||||
}
|
||||
|
||||
handleUpload(pipTask.getTaskProperties(), file,pipTaskLog);
|
||||
handleUpload(pipTask.getTaskProperties(), file,context);
|
||||
}catch (Exception e){
|
||||
pipTaskLog.append("==================SCA-MIRROR节点执行失败=================");
|
||||
pipTaskLog.append("SCA-MIRROR节点执行失败失败,请检查当前节点配置!");
|
||||
pipTaskLog.append(e.getMessage());
|
||||
append(context,"==================SCA-MIRROR节点执行失败=================");
|
||||
append(context,"SCA-MIRROR节点执行失败失败,请检查当前节点配置!");
|
||||
append(context,e.getMessage());
|
||||
log.error("==================SCA-MIRROR节点执行失败=================",e);
|
||||
throw new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(),"SCA-SBOM节点执行失败");
|
||||
}
|
||||
}
|
||||
|
||||
localVariables.put("statusCode", statusCode + "");
|
||||
localVariables.put(EngineRuntimeConstant.LOG_KEY, pipTaskLog);
|
||||
// localVariables.put(EngineRuntimeConstant.LOG_KEY, pipTaskLog);
|
||||
}
|
||||
|
||||
private void handleUpload(Map<String,Object> scaMirrorConfigInfo, File file, PipTaskLog pipTaskLog) throws NoSuchAlgorithmException, KeyStoreException, KeyManagementException {
|
||||
private void handleUpload(Map<String,Object> scaMirrorConfigInfo, File file, BaseRunContext context) throws NoSuchAlgorithmException, KeyStoreException, KeyManagementException {
|
||||
RestTemplate restTemplate = getRestTemplateWithoutSANCheck();
|
||||
String scaUploadUrl = ConstantContextHolder.getScaIp() + "/openapi/v1/image/detect-file";
|
||||
MultiValueMap<String, Object> body = buildRequestBody(scaMirrorConfigInfo, file);
|
||||
@ -122,7 +123,7 @@ public class ScaMirrorWorker extends HttpWorker{
|
||||
String message = response.getString("message");
|
||||
|
||||
if (message.equals("success")) {
|
||||
pipTaskLog.append("===============SCA上传成功=================");
|
||||
append(context,"===============SCA上传成功=================");
|
||||
JSONObject data = response.getJSONObject("data");
|
||||
Integer scaTaskId = data.getInteger("scaTaskId");
|
||||
|
||||
@ -136,7 +137,7 @@ public class ScaMirrorWorker extends HttpWorker{
|
||||
}
|
||||
pollTaskStatus(restTemplate, oldScaTaskId);
|
||||
} else {
|
||||
pipTaskLog.append("==================SCA接口异常,调用失败=================");
|
||||
append(context,"==================SCA接口异常,调用失败=================");
|
||||
throw new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(),"SCA-SBOM节点执行失败");
|
||||
}
|
||||
Thread.currentThread().interrupt();
|
||||
|
@ -3,6 +3,7 @@ package cd.casic.ci.process.engine.worker;
|
||||
import cd.casic.ci.common.pipeline.annotation.Plugin;
|
||||
import cd.casic.ci.process.engine.constant.EngineRuntimeConstant;
|
||||
import cd.casic.ci.process.engine.context.ConstantContextHolder;
|
||||
import cd.casic.ci.process.engine.runContext.BaseRunContext;
|
||||
import cd.casic.ci.process.engine.runContext.TaskRunContext;
|
||||
import cd.casic.ci.process.process.dataObject.base.PipBaseElement;
|
||||
import cd.casic.ci.process.process.dataObject.log.PipTaskLog;
|
||||
@ -39,7 +40,7 @@ import java.util.*;
|
||||
* @Description:
|
||||
*/
|
||||
@Slf4j
|
||||
@Plugin(taskType = "test")
|
||||
@Plugin(taskType = "SCA_S_BOM")
|
||||
public class ScaSbomWorker extends HttpWorker{
|
||||
|
||||
private static final int POLLING_INTERVAL = 5000; // 轮询间隔,单位:毫秒
|
||||
@ -58,15 +59,15 @@ public class ScaSbomWorker extends HttpWorker{
|
||||
PipTaskLog pipTaskLog = (PipTaskLog) localVariables.get(EngineRuntimeConstant.LOG_KEY);
|
||||
|
||||
PipBaseElement contextDef = context.getContextDef();
|
||||
pipTaskLog.append("SCA-SBOM节点开始执行");
|
||||
pipTaskLog.append("SCA-SBOM节点配置:" + contextDef);
|
||||
append(context,"SCA-SBOM节点开始执行");
|
||||
append(context,"SCA-SBOM节点配置:" + contextDef);
|
||||
if (ObjectUtil.isEmpty(contextDef)) {
|
||||
log.error("未查询到节点[ScaSbom]配置");
|
||||
localVariables.put("statusCode", "-1");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(contextDef)) {
|
||||
log.error("未查询到节点[ScaSbom]配置");
|
||||
pipTaskLog.append("未查询到节点[ScaSbom]配置");
|
||||
append(context,"未查询到节点[ScaSbom]配置");
|
||||
localVariables.put("statusCode", "-1");
|
||||
}
|
||||
|
||||
@ -90,14 +91,14 @@ public class ScaSbomWorker extends HttpWorker{
|
||||
if (!file.exists() || !file.canRead()) {
|
||||
log.error("目标文件不存在或不可读");
|
||||
localVariables.put("statusCode", "-1");
|
||||
pipTaskLog.append("目标文件不存在或不可读");
|
||||
append(context,"目标文件不存在或不可读");
|
||||
}
|
||||
|
||||
handleUpload(pipTask.getTaskProperties(), file,pipTaskLog);
|
||||
handleUpload(pipTask.getTaskProperties(), file,context);
|
||||
}catch (Exception e){
|
||||
pipTaskLog.append("==================SCA-SBOM节点执行失败=================");
|
||||
pipTaskLog.append("SCA-SBOM节点执行失败失败,请检查当前节点配置!");
|
||||
pipTaskLog.append(e.getMessage());
|
||||
append(context,"==================SCA-SBOM节点执行失败=================");
|
||||
append(context,"SCA-SBOM节点执行失败失败,请检查当前节点配置!");
|
||||
append(context,e.getMessage());
|
||||
log.error("==================SCA-SBOM节点执行失败=================",e);
|
||||
throw new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(),"SCA-SBOM节点执行失败");
|
||||
}
|
||||
@ -107,7 +108,7 @@ public class ScaSbomWorker extends HttpWorker{
|
||||
localVariables.put(EngineRuntimeConstant.LOG_KEY, pipTaskLog);
|
||||
}
|
||||
|
||||
private void handleUpload(Map<String,Object> scaSbomConfigInfo, File file, PipTaskLog pipTaskLog) throws NoSuchAlgorithmException, KeyStoreException, KeyManagementException {
|
||||
private void handleUpload(Map<String,Object> scaSbomConfigInfo, File file, BaseRunContext context) throws NoSuchAlgorithmException, KeyStoreException, KeyManagementException {
|
||||
RestTemplate restTemplate = getRestTemplateWithoutSANCheck();
|
||||
String scaUploadUrl = ConstantContextHolder.getScaIp() + "/openapi/v1/sbom/detect-file";
|
||||
MultiValueMap<String, Object> body = buildRequestBody(scaSbomConfigInfo, file);
|
||||
@ -121,7 +122,7 @@ public class ScaSbomWorker extends HttpWorker{
|
||||
String message = response.getString("message");
|
||||
|
||||
if (message.equals("success")) {
|
||||
pipTaskLog.append("===============SCA上传成功=================");
|
||||
append(context,"===============SCA上传成功=================");
|
||||
JSONObject data = response.getJSONObject("data");
|
||||
Integer scaTaskId = data.getInteger("scaTaskId");
|
||||
|
||||
@ -135,7 +136,7 @@ public class ScaSbomWorker extends HttpWorker{
|
||||
}
|
||||
pollTaskStatus(restTemplate, oldScaTaskId);
|
||||
} else {
|
||||
pipTaskLog.append("==================SCA接口异常,调用失败=================");
|
||||
append(context,"==================SCA接口异常,调用失败=================");
|
||||
throw new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(),"SCA-SBOM节点执行失败");
|
||||
}
|
||||
Thread.currentThread().interrupt();
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cd.casic.ci.process.engine.worker;
|
||||
|
||||
import cd.casic.ci.process.constant.CommandConstant;
|
||||
import cd.casic.ci.process.engine.runContext.BaseRunContext;
|
||||
import cd.casic.ci.process.enums.MachineSystemEnum;
|
||||
import cd.casic.ci.process.process.dataObject.log.PipTaskLog;
|
||||
import cd.casic.ci.process.process.dataObject.machine.MachineInfo;
|
||||
@ -22,7 +23,7 @@ public abstract class SshWorker extends BaseWorker{
|
||||
* @param commands 命令
|
||||
* @return 0 成功;其他值 失败
|
||||
*/
|
||||
public int shell(MachineInfo machineInfo,String sudoPassword, PipTaskLog taskLog, String... commands) {
|
||||
public int shell(MachineInfo machineInfo, String sudoPassword, BaseRunContext context, String... commands) {
|
||||
List<String> commandList = Arrays.asList(commands);
|
||||
if(MachineSystemEnum.WINDOWS.getSystem().equals(machineInfo.getOsSystem())){
|
||||
return powerShell(machineInfo, commandList);
|
||||
@ -38,14 +39,14 @@ public abstract class SshWorker extends BaseWorker{
|
||||
//执行命令,并且把命令的执行回传到前端
|
||||
// TODO 记录日志
|
||||
// loggerService.sendMessage(key, var);
|
||||
statusCode = ssh.execNew(commandList,sudoPassword, taskLog::append);
|
||||
statusCode = ssh.execNew(commandList,sudoPassword, (content)->append(context,content));
|
||||
log.info("exit-status: " + statusCode);
|
||||
//主动释放当前socket连接
|
||||
// loggerService.close(key);
|
||||
} catch (Exception e) {
|
||||
String errorMessage = "与机器建立SSH连接出错" + CommandConstant.ENTER;
|
||||
// errorHandle(e, errorMessage);
|
||||
taskLog.append(errorMessage);
|
||||
append(context,errorMessage);
|
||||
} finally {
|
||||
if(ssh!=null) {
|
||||
ssh.disconnect();
|
||||
|
@ -0,0 +1,14 @@
|
||||
package cd.casic.ci.process.process.dal.pipeline;
|
||||
|
||||
import cd.casic.ci.process.process.dataObject.node.PipTaskTemplate;
|
||||
import cd.casic.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @author herenbin
|
||||
* @description pipeline_node_templateMapper
|
||||
* @date 2022-09-16
|
||||
*/
|
||||
@Mapper
|
||||
public interface PipTaskTemplateDao extends BaseMapperX<PipTaskTemplate> {
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
package cd.casic.ci.process.process.dataObject.node;
|
||||
|
||||
|
||||
import cd.casic.framework.commons.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* @author herenbin
|
||||
* @description pipeline_node_template
|
||||
* @date 2022-09-16
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("pip_task_template")
|
||||
public class PipTaskTemplate extends BaseDO {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 唯一标示做关联
|
||||
*/
|
||||
private String parentId;
|
||||
|
||||
/**
|
||||
* name
|
||||
*/
|
||||
private String taskType;
|
||||
|
||||
/**
|
||||
* 标签
|
||||
*/
|
||||
private String taskName;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String nodDescription;
|
||||
|
||||
/**
|
||||
* 图标
|
||||
*/
|
||||
private String icon;
|
||||
/**
|
||||
* 是否有执行结果数据
|
||||
*/
|
||||
private int view;
|
||||
|
||||
/**
|
||||
* 节点类型:目录-0or 节点-1
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
public PipTaskTemplate() {
|
||||
}
|
||||
|
||||
}
|
@ -532,9 +532,13 @@ public class PipelineServiceImpl extends ServiceImpl<PipelineDao, PipPipeline> i
|
||||
TreeRunContextResp pipeline = new TreeRunContextResp();
|
||||
pipeline.setId(pipelineRunContext.getContextDef().getId());
|
||||
pipeline.setState(pipelineRunContext.getState().get());
|
||||
pipeline.setStartTime(pipelineRunContext.getStartTime());
|
||||
pipeline.setEndTime(pipelineRunContext.getEndTime());
|
||||
Map<String,TreeRunContextResp> secondStageStateMap = new HashMap<>(pipelineRunContext.getChildContext().size());
|
||||
Map<String, BaseRunContext> childContext = pipelineRunContext.getChildContext();
|
||||
pipeline.setChild(secondStageStateMap);
|
||||
LinkedList<TreeRunContextResp> taskList = new LinkedList<>();
|
||||
pipeline.setTaskList(taskList);
|
||||
for (Map.Entry<String, BaseRunContext> secondEntry : childContext.entrySet()) {
|
||||
BaseRunContext value = secondEntry.getValue();
|
||||
String key = secondEntry.getKey();
|
||||
@ -551,7 +555,10 @@ public class PipelineServiceImpl extends ServiceImpl<PipelineDao, PipPipeline> i
|
||||
TreeRunContextResp taskState = new TreeRunContextResp();
|
||||
taskState.setId(taskId);
|
||||
taskState.setState(taskContext.getState().get());
|
||||
taskState.setStartTime(taskContext.getStartTime());
|
||||
taskState.setEndTime(taskContext.getEndTime());
|
||||
taskStateMap.put(taskId,taskState);
|
||||
taskList.add(taskState);
|
||||
}
|
||||
}
|
||||
return pipeline;
|
||||
|
@ -0,0 +1,25 @@
|
||||
package cd.casic.ci.process.process.service.taskTemplate;
|
||||
|
||||
import cd.casic.ci.common.pipeline.resp.taskTemplate.TaskTemplateResp;
|
||||
import cd.casic.ci.process.process.dataObject.node.PipTaskTemplate;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 流水线节点类型服务
|
||||
*
|
||||
* @author cww
|
||||
* @date 2022/6/17
|
||||
*/
|
||||
public interface TaskTemplateService extends IService<PipTaskTemplate> {
|
||||
// void add(PipelineNodeTemplateParam pipelineNodeTemplateRequest);
|
||||
//
|
||||
// void update(PipelineNodeTemplateParam pipelineNodeTemplateRequest);
|
||||
|
||||
void delete(Long[] ids);
|
||||
|
||||
List<TaskTemplateResp> getList();
|
||||
|
||||
// PageResult<PipelineNodeTemplate> page(PipelineNodeTemplateParam request);
|
||||
}
|
@ -0,0 +1,127 @@
|
||||
package cd.casic.ci.process.process.service.taskTemplate.impl;
|
||||
|
||||
import cd.casic.ci.common.pipeline.resp.taskTemplate.TaskTemplateResp;
|
||||
import cd.casic.ci.process.process.dal.pipeline.PipTaskTemplateDao;
|
||||
import cd.casic.ci.process.process.dataObject.node.PipTaskTemplate;
|
||||
import cd.casic.ci.process.process.service.taskTemplate.TaskTemplateService;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class TaskTemplateServiceImpl extends ServiceImpl<PipTaskTemplateDao, PipTaskTemplate> implements TaskTemplateService {
|
||||
|
||||
|
||||
/**
|
||||
* 新建模板
|
||||
* @param pipelineNodeTemplateRequest 模板信息
|
||||
*/
|
||||
// @Override
|
||||
// public void add(PipelineNodeTemplateParam pipelineNodeTemplateRequest) {
|
||||
// PipelineNodeTemplate pipelineNodeTemplateDTO = new PipelineNodeTemplate();
|
||||
// BeanUtil.copyProperties(pipelineNodeTemplateRequest, pipelineNodeTemplateDTO);
|
||||
// pipelineNodeTemplateDTO.init();
|
||||
// this.save(pipelineNodeTemplateDTO);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 编辑模板
|
||||
// * @param pipelineNodeTemplateRequest 模板信息
|
||||
// */
|
||||
// @Override
|
||||
// public void update(PipelineNodeTemplateParam pipelineNodeTemplateRequest) {
|
||||
// PipelineNodeTemplate pipelineNodeTemplateDTO = new PipelineNodeTemplate();
|
||||
// BeanUtil.copyProperties(pipelineNodeTemplateRequest, pipelineNodeTemplateDTO);
|
||||
// this.updateById(pipelineNodeTemplateDTO);
|
||||
// }
|
||||
|
||||
/**
|
||||
* 删除模板
|
||||
* @param ids 模板ID集合
|
||||
*/
|
||||
@Override
|
||||
public void delete(Long[] ids) {
|
||||
/*
|
||||
* 逻辑删除,0为已删,1为未删,由mybatis-plus配置处理,这里直接调用remove删除
|
||||
*/
|
||||
for (Long id : ids) {
|
||||
PipTaskTemplate pipelineNodeTemplateDO = this.getById(id);
|
||||
if (pipelineNodeTemplateDO != null) {
|
||||
this.removeById(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取模板列表
|
||||
* @return 列表
|
||||
*/
|
||||
@Override
|
||||
public List<TaskTemplateResp> getList() {
|
||||
LambdaQueryWrapper<PipTaskTemplate> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(PipTaskTemplate::getDeleted,"0");
|
||||
List<PipTaskTemplate> pipelineNodeTemplateDOList = this.list(wrapper);
|
||||
// int size = pipelineNodeTemplateDOList.size();
|
||||
|
||||
/**
|
||||
* 构建递归树
|
||||
*/
|
||||
List<TaskTemplateResp> rootNode = getRootNode(pipelineNodeTemplateDOList);
|
||||
rootNode.forEach(v -> setChildren(v, pipelineNodeTemplateDOList));
|
||||
return rootNode;
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 模板分页查询
|
||||
// * @param request 请求数据
|
||||
// * @return 分页
|
||||
// */
|
||||
// @Override
|
||||
// public PageResult<PipelineNodeTemplate> page(PipelineNodeTemplateParam request) {
|
||||
// QueryWrapper<PipelineNodeTemplate> qw = new QueryWrapper<>();
|
||||
// qw.lambda().orderByDesc(PipelineNodeTemplate::getCreateTime);
|
||||
// /*
|
||||
// * 获取一个Page数据,并保存返回
|
||||
// */
|
||||
// return new PageResult<>(this.page(PageFactory.defaultPage(request.getPageNo(), request.getPageSize()), qw));
|
||||
// }
|
||||
|
||||
/**
|
||||
* 获取根节点
|
||||
* @param pipelineNodeDTOList 节点集合
|
||||
* @return 根节点
|
||||
*/
|
||||
private List<TaskTemplateResp> getRootNode(List<PipTaskTemplate> pipelineNodeDTOList) {
|
||||
List<TaskTemplateResp> ret = new ArrayList<>();
|
||||
for (PipTaskTemplate node : pipelineNodeDTOList) {
|
||||
if (node.getType() == 0) {
|
||||
TaskTemplateResp nodeParam = new TaskTemplateResp();
|
||||
BeanUtil.copyProperties(node, nodeParam);
|
||||
ret.add(nodeParam);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置叶子节点
|
||||
* @param node 上级节点
|
||||
* @param pipelineNodeDTOList 节点列表
|
||||
*/
|
||||
private void setChildren(TaskTemplateResp node, List<PipTaskTemplate> pipelineNodeDTOList) {
|
||||
List<TaskTemplateResp> childList = new ArrayList<>();
|
||||
pipelineNodeDTOList.forEach(v -> {
|
||||
if (node.getId().equals(v.getParentId())) {
|
||||
TaskTemplateResp nodeParam = new TaskTemplateResp();
|
||||
BeanUtil.copyProperties(v, nodeParam);
|
||||
childList.add(nodeParam);
|
||||
}
|
||||
});
|
||||
node.setChildren(childList);
|
||||
}
|
||||
}
|
@ -100,8 +100,8 @@ public class PipelineController {
|
||||
|
||||
return CommonResult.success();
|
||||
}
|
||||
@PostMapping("/executePipeline")
|
||||
public CommonResult<PipelineRunContext> executePipeline(String pipelineId){
|
||||
@PostMapping("/executePipeline/{pipelineId}")
|
||||
public CommonResult<PipelineRunContext> executePipeline(@PathVariable String pipelineId){
|
||||
PipelineRunContext execute = pipelineExecutor.execute(pipelineId);
|
||||
return CommonResult.success(execute);
|
||||
}
|
||||
|
@ -0,0 +1,21 @@
|
||||
package cd.casic.server.controller;
|
||||
|
||||
import cd.casic.ci.common.pipeline.resp.taskTemplate.TaskTemplateResp;
|
||||
import cd.casic.ci.process.process.service.taskTemplate.TaskTemplateService;
|
||||
import cd.casic.framework.commons.pojo.CommonResult;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/taskTemplate")
|
||||
public class TaskTemplateController {
|
||||
@Resource
|
||||
private TaskTemplateService nodeTemplateService;
|
||||
@PostMapping("/list")
|
||||
public CommonResult<List<TaskTemplateResp>> list(){
|
||||
List<TaskTemplateResp> list = nodeTemplateService.getList();
|
||||
return CommonResult.success(list);
|
||||
}
|
||||
}
|
@ -5,10 +5,17 @@ import cd.casic.ci.common.pipeline.resp.task.TasksResp;
|
||||
import cd.casic.ci.process.process.dataObject.log.PipTaskLog;
|
||||
import cd.casic.ci.process.process.service.task.TaskService;
|
||||
import cd.casic.framework.commons.pojo.CommonResult;
|
||||
import cd.casic.framework.commons.util.network.IpUtil;
|
||||
import cd.casic.framework.commons.util.redis.core.utils.IPUtils;
|
||||
import cd.casic.framework.commons.util.util.WebFrameworkUtils;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/task")
|
||||
@ -43,4 +50,5 @@ public class TasksController {
|
||||
public CommonResult<PipTaskLog> getLogContentByTaskId(@PathVariable String taskId){
|
||||
return taskService.getLogContentByTaskId(taskId);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -121,6 +121,7 @@ ops:
|
||||
security:
|
||||
permit-all_urls:
|
||||
- /admin-api/mp/open/** # 微信公众号开放平台,微信回调接口,不需要登录
|
||||
- /sse/**
|
||||
websocket:
|
||||
enable: true # websocket的开关
|
||||
path: /infra/ws # 路径
|
||||
|
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user