获取状态接口修改
This commit is contained in:
parent
3cf62585ec
commit
5857f215a2
@ -61,6 +61,7 @@ public abstract class BaseWorker implements Runnable{
|
||||
taskRunContext.getLocalVariables().put(EngineRuntimeConstant.LOG_KEY,pipTaskLog);
|
||||
execute(taskRunContext);
|
||||
} catch (Exception e) {
|
||||
log.error("================worker执行报错:",e);
|
||||
taskRunContext.changeContextState(ContextStateEnum.BAD_ENDING);
|
||||
return;
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
*/
|
||||
@Slf4j
|
||||
//@Plugin(taskType = "CUSTOM_IMAGE_EXECUTION_COMMAND")
|
||||
@Plugin(taskType = "test")
|
||||
//@Plugin(taskType = "test")
|
||||
public class DIYImageExecuteCommandWorker extends SshWorker {
|
||||
|
||||
@Override
|
||||
|
@ -39,7 +39,7 @@ import java.util.*;
|
||||
* @Description:
|
||||
*/
|
||||
@Slf4j
|
||||
@Plugin(taskType = "scaSbom")
|
||||
@Plugin(taskType = "test")
|
||||
public class ScaSbomWorker extends HttpWorker{
|
||||
|
||||
private static final int POLLING_INTERVAL = 5000; // 轮询间隔,单位:毫秒
|
||||
@ -98,6 +98,7 @@ public class ScaSbomWorker extends HttpWorker{
|
||||
pipTaskLog.append("==================SCA-SBOM节点执行失败=================");
|
||||
pipTaskLog.append("SCA-SBOM节点执行失败失败,请检查当前节点配置!");
|
||||
pipTaskLog.append(e.getMessage());
|
||||
log.error("==================SCA-SBOM节点执行失败=================",e);
|
||||
throw new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(),"SCA-SBOM节点执行失败");
|
||||
}
|
||||
}
|
||||
@ -135,6 +136,7 @@ public class ScaSbomWorker extends HttpWorker{
|
||||
pollTaskStatus(restTemplate, oldScaTaskId);
|
||||
} else {
|
||||
pipTaskLog.append("==================SCA接口异常,调用失败=================");
|
||||
log.error(message);
|
||||
throw new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(),"SCA-SBOM节点执行失败");
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import cd.casic.ci.common.pipeline.req.pipeline.PipelineQueryReq;
|
||||
import cd.casic.ci.common.pipeline.req.pipeline.PipelineReq;
|
||||
import cd.casic.ci.common.pipeline.req.pipeline.PipelineUpdateReq;
|
||||
import cd.casic.ci.common.pipeline.resp.context.SingletonRunContextResp;
|
||||
import cd.casic.ci.common.pipeline.resp.context.TreeRunContextResp;
|
||||
import cd.casic.ci.common.pipeline.resp.pipeline.PipelineFindResp;
|
||||
import cd.casic.ci.common.pipeline.utils.PageResult;
|
||||
import cd.casic.ci.process.process.dataObject.pipeline.PipPipeline;
|
||||
@ -36,5 +37,5 @@ public interface PipelineService extends IService<PipPipeline> {
|
||||
|
||||
PipelineFindResp findPipelineById(@Valid PipelineQueryReq pipelineQueryReq);
|
||||
|
||||
Map<String, SingletonRunContextResp> getPipelineRunState(String pipelineId);
|
||||
TreeRunContextResp getPipelineRunState(String pipelineId);
|
||||
}
|
||||
|
@ -526,7 +526,7 @@ public class PipelineServiceImpl extends ServiceImpl<PipelineDao, PipPipeline> i
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, SingletonRunContextResp> getPipelineRunState(String pipelineId) {
|
||||
public TreeRunContextResp getPipelineRunState(String pipelineId) {
|
||||
BaseRunContext context = contextManager.getContext(pipelineId);
|
||||
if (context instanceof PipelineRunContext pipelineRunContext) {
|
||||
TreeRunContextResp pipeline = new TreeRunContextResp();
|
||||
@ -554,8 +554,9 @@ public class PipelineServiceImpl extends ServiceImpl<PipelineDao, PipPipeline> i
|
||||
taskStateMap.put(taskId,taskState);
|
||||
}
|
||||
}
|
||||
return pipeline;
|
||||
}
|
||||
|
||||
return new HashMap<>();
|
||||
return new TreeRunContextResp();
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import cd.casic.ci.common.pipeline.req.pipeline.PipelineQueryReq;
|
||||
import cd.casic.ci.common.pipeline.req.pipeline.PipelineReq;
|
||||
import cd.casic.ci.common.pipeline.req.pipeline.PipelineUpdateReq;
|
||||
import cd.casic.ci.common.pipeline.resp.context.SingletonRunContextResp;
|
||||
import cd.casic.ci.common.pipeline.resp.context.TreeRunContextResp;
|
||||
import cd.casic.ci.common.pipeline.resp.pipeline.PipelineFindResp;
|
||||
import cd.casic.ci.common.pipeline.utils.PageResult;
|
||||
import cd.casic.ci.process.engine.executor.PipelineExecutor;
|
||||
@ -105,7 +106,7 @@ public class PipelineController {
|
||||
return CommonResult.success(execute);
|
||||
}
|
||||
@PostMapping("/getStageRunState/{pipelineId}")
|
||||
public CommonResult<Map<String, SingletonRunContextResp>> getPipelineRunState(@PathVariable String pipelineId){
|
||||
public CommonResult<TreeRunContextResp> getPipelineRunState(@PathVariable String pipelineId){
|
||||
return CommonResult.success(pipelineService.getPipelineRunState(pipelineId));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user