Compare commits
No commits in common. "b6d4eaf89df2cb84fcea4cfe59b19884be968e85" and "7c4442a30e2c0f9ccf95a949f6cb8a184a648ebc" have entirely different histories.
b6d4eaf89d
...
7c4442a30e
@ -1,10 +0,0 @@
|
||||
package cd.casic.ci.common.pipeline.resp.context;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
@Data
|
||||
public class RunContextResp {
|
||||
private String id;
|
||||
private Integer state;
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
package cd.casic.ci.process.engine.constant;
|
||||
|
||||
public class EngineRuntimeConstant {
|
||||
public static final String LOG_KEY = "logContent";
|
||||
}
|
@ -35,7 +35,7 @@ public abstract class BaseRunContext {
|
||||
* */
|
||||
private LocalDateTime endTime;
|
||||
private String resourceId;
|
||||
private String targetVersionId;
|
||||
private String targetId;
|
||||
private String targetType;
|
||||
/**
|
||||
* 整个流水线全局的变量
|
||||
@ -47,14 +47,14 @@ public abstract class BaseRunContext {
|
||||
private Map<String,Object> localVariables;
|
||||
private Map<String,BaseRunContext> childContext;
|
||||
|
||||
public BaseRunContext(PipBaseElement contextDef,Integer childCount,BaseRunContext parentContext, LocalDateTime startTime, String resourceId, String targetVersionId, String targetType, Map<String, Object> globalVariables, Map<String, Object> localVariables, Map<String, BaseRunContext> childContext) {
|
||||
public BaseRunContext(PipBaseElement contextDef,Integer childCount,BaseRunContext parentContext, LocalDateTime startTime, String resourceId, String targetId, String targetType, Map<String, Object> globalVariables, Map<String, Object> localVariables, Map<String, BaseRunContext> childContext) {
|
||||
this.contextDef = contextDef;
|
||||
this.childCount = childCount;
|
||||
this.parentContext = parentContext;
|
||||
this.state = new AtomicInteger(ContextStateEnum.INIT.getCode());
|
||||
this.startTime = startTime;
|
||||
this.resourceId = resourceId;
|
||||
this.targetVersionId = targetVersionId;
|
||||
this.targetId = targetId;
|
||||
this.targetType = targetType;
|
||||
this.globalVariables = globalVariables;
|
||||
this.localVariables = localVariables;
|
||||
|
@ -17,16 +17,16 @@ public class PipelineRunContext extends BaseRunContext{
|
||||
}
|
||||
|
||||
public PipelineRunContext(PipPipeline pipeline,Integer childCount,BaseRunContext parentContext, Map<String, Object> globalVariables, Map<String, Object> localVariables) {
|
||||
this(pipeline,childCount,parentContext,LocalDateTime.now(),pipeline.getResourceId(),pipeline.getTargetVersionId(),pipeline.getTargetType(),globalVariables,localVariables,new ConcurrentHashMap<>());
|
||||
this(pipeline,childCount,parentContext,LocalDateTime.now(),pipeline.getResourceId(),pipeline.getTargetId(),pipeline.getTargetType(),globalVariables,localVariables,new ConcurrentHashMap<>());
|
||||
}
|
||||
|
||||
private PipelineRunContext(PipBaseElement contextDef,Integer childCount, BaseRunContext parentContext, LocalDateTime startTime, String resourceId, String targetVersionId, String targetType, Map<String, Object> globalVariables, Map<String, Object> localVariables, Map<String, BaseRunContext> childContext) {
|
||||
private PipelineRunContext(PipBaseElement contextDef,Integer childCount, BaseRunContext parentContext, LocalDateTime startTime, String resourceId, String targetId, String targetType, Map<String, Object> globalVariables, Map<String, Object> localVariables, Map<String, BaseRunContext> childContext) {
|
||||
super( contextDef
|
||||
,childCount
|
||||
,parentContext
|
||||
,startTime
|
||||
, resourceId
|
||||
, targetVersionId
|
||||
, targetId
|
||||
, targetType
|
||||
, globalVariables
|
||||
, localVariables
|
||||
|
@ -12,7 +12,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class SecondStageRunContext extends BaseRunContext{
|
||||
public SecondStageRunContext(PipStage contextDef,Integer childCount, PipelineRunContext parentContext, Map<String, Object> localVariables) {
|
||||
super(contextDef,childCount, parentContext, LocalDateTime.now(), parentContext.getResourceId(), parentContext.getTargetVersionId(), parentContext.getTargetType(), parentContext.getGlobalVariables(), localVariables, new ConcurrentHashMap<>());
|
||||
super(contextDef,childCount, parentContext, LocalDateTime.now(), parentContext.getResourceId(), parentContext.getTargetId(), parentContext.getTargetType(), parentContext.getGlobalVariables(), localVariables, new ConcurrentHashMap<>());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -12,7 +12,7 @@ import java.util.Map;
|
||||
|
||||
public class TaskRunContext extends BaseRunContext{
|
||||
public TaskRunContext(PipTask contextDef, SecondStageRunContext parentContext,Map<String,Object> localVariable) {
|
||||
super(contextDef,0, parentContext, LocalDateTime.now(), parentContext.getResourceId(), parentContext.getTargetVersionId(), parentContext.getTargetType(), parentContext.getGlobalVariables(),localVariable, new HashMap<>());
|
||||
super(contextDef,0, parentContext, LocalDateTime.now(), parentContext.getResourceId(), parentContext.getTargetId(), parentContext.getTargetType(), parentContext.getGlobalVariables(),localVariable, new HashMap<>());
|
||||
}
|
||||
private TaskRunContext(PipBaseElement contextDef, BaseRunContext parentContext, LocalDateTime startTime, String resourceId, String targetId, String targetType, Map<String, Object> globalVariables, Map<String, Object> localVariables, Map<String, BaseRunContext> childContext) {
|
||||
super(contextDef,0, parentContext, startTime, resourceId, targetId, targetType, globalVariables, localVariables, childContext);
|
||||
|
@ -1,13 +0,0 @@
|
||||
package cd.casic.ci.process.process.dataObject.log;
|
||||
|
||||
import cd.casic.framework.commons.dataobject.BaseDO;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class PipPipelineTaskLog extends BaseDO {
|
||||
private String taskId;
|
||||
private String content;
|
||||
private String id;
|
||||
}
|
@ -2,15 +2,12 @@ package cd.casic.ci.process.process.service.stage;
|
||||
|
||||
import cd.casic.ci.common.pipeline.req.stage.StageCreateReq;
|
||||
import cd.casic.ci.common.pipeline.req.stage.StageUpdateReq;
|
||||
import cd.casic.ci.common.pipeline.resp.context.RunContextResp;
|
||||
import cd.casic.ci.common.pipeline.resp.stage.StageResp;
|
||||
import cd.casic.ci.process.process.dataObject.stage.PipStage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface StageService extends IService<PipStage> {
|
||||
/**
|
||||
@ -85,5 +82,4 @@ public interface StageService extends IService<PipStage> {
|
||||
|
||||
void copyStage(@NotEmpty String stageId);
|
||||
void deleteFirstStage(String stageId);
|
||||
Map<String, RunContextResp> getStageRunState(@PathVariable String stageId);
|
||||
}
|
||||
|
@ -4,10 +4,7 @@ package cd.casic.ci.process.process.service.stage.impl;
|
||||
import cd.casic.ci.common.pipeline.req.stage.StageCreateReq;
|
||||
import cd.casic.ci.common.pipeline.req.stage.StageUpdateReq;
|
||||
import cd.casic.ci.common.pipeline.req.task.TaskCreateReq;
|
||||
import cd.casic.ci.common.pipeline.resp.context.RunContextResp;
|
||||
import cd.casic.ci.common.pipeline.resp.stage.StageResp;
|
||||
import cd.casic.ci.process.engine.manager.RunContextManager;
|
||||
import cd.casic.ci.process.engine.runContext.BaseRunContext;
|
||||
import cd.casic.ci.process.process.dal.pipeline.PipStageDao;
|
||||
import cd.casic.ci.process.process.dataObject.stage.PipStage;
|
||||
import cd.casic.ci.process.process.dataObject.task.PipTask;
|
||||
@ -37,8 +34,6 @@ public class StageServiceImpl extends ServiceImpl<PipStageDao, PipStage> impleme
|
||||
private TaskService taskService;
|
||||
@Resource
|
||||
private PipStageDao stageDao;
|
||||
@Resource
|
||||
private RunContextManager contextManager;
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public String createStagesOrTask(StageCreateReq stageReq) {
|
||||
@ -408,35 +403,6 @@ public class StageServiceImpl extends ServiceImpl<PipStageDao, PipStage> impleme
|
||||
stageDao.deleteById(stageId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, RunContextResp> getStageRunState(String stageId) {
|
||||
PipStage byId = getById(stageId);
|
||||
Map<String, RunContextResp> result = new HashMap<>();
|
||||
if (byId==null||"-1".equals(byId.getParentId())) {
|
||||
log.error("传入stageId非阶段id");
|
||||
return result;
|
||||
}
|
||||
List<PipStage> secondStage = findSecondStageAndTask(stageId);
|
||||
|
||||
for (PipStage stage : secondStage) {
|
||||
String id = stage.getId();
|
||||
List<PipTask> taskValues = stage.getTaskValues();
|
||||
for (PipTask taskValue : taskValues) {
|
||||
BaseRunContext context = contextManager.getContext(taskValue.getId());
|
||||
if (context==null) {
|
||||
break;
|
||||
}
|
||||
String taskId = taskValue.getId();
|
||||
int state = context.getState().get();
|
||||
RunContextResp runContextResp = new RunContextResp();
|
||||
runContextResp.setState(state);
|
||||
runContextResp.setId(taskId);
|
||||
result.put(taskId,runContextResp);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<PipStage> findSecondStageAndTask(String stagesId){
|
||||
List<PipStage> otherStage = findSecondStage(stagesId);
|
||||
List<PipStage> list = new ArrayList<>();
|
||||
|
@ -6,7 +6,6 @@ import cd.casic.ci.common.pipeline.resp.task.TasksResp;
|
||||
import cd.casic.ci.process.process.dataObject.task.PipTask;
|
||||
import cd.casic.framework.commons.pojo.CommonResult;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.util.List;
|
||||
@ -22,5 +21,4 @@ public interface TaskService extends IService<PipTask> {
|
||||
|
||||
void copyTask(String taskId);
|
||||
Boolean updateTask(@RequestBody TaskUpdateReq req);
|
||||
CommonResult<String> getLogContentByTaskId(@PathVariable String taskId);
|
||||
}
|
||||
|
@ -1,9 +1,7 @@
|
||||
package cd.casic.server.controller;
|
||||
|
||||
import cd.casic.ci.common.pipeline.container.Stage;
|
||||
import cd.casic.ci.common.pipeline.req.stage.StageCreateReq;
|
||||
import cd.casic.ci.common.pipeline.req.stage.StageUpdateReq;
|
||||
import cd.casic.ci.common.pipeline.resp.context.RunContextResp;
|
||||
import cd.casic.ci.common.pipeline.resp.stage.StageResp;
|
||||
import cd.casic.ci.process.process.service.stage.StageService;
|
||||
import cd.casic.framework.commons.pojo.CommonResult;
|
||||
@ -18,7 +16,6 @@ import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @pi.protocol: http
|
||||
@ -96,10 +93,7 @@ public class StageController {
|
||||
stageService.deleteFirstStage(stageId);
|
||||
return CommonResult.success();
|
||||
}
|
||||
@PostMapping("/getStageRunState/{stageId}")
|
||||
public CommonResult<Map<String, RunContextResp> > getStageRunState(@PathVariable String stageId){
|
||||
return CommonResult.success(stageService.getStageRunState(stageId));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -3,7 +3,6 @@ package cd.casic.server.controller;
|
||||
import cd.casic.ci.common.pipeline.req.task.TaskCreateReq;
|
||||
import cd.casic.ci.common.pipeline.req.task.TaskUpdateReq;
|
||||
import cd.casic.ci.common.pipeline.resp.task.TasksResp;
|
||||
import cd.casic.ci.process.process.dataObject.log.PipPipelineTaskLog;
|
||||
import cd.casic.ci.process.process.dataObject.task.PipTask;
|
||||
import cd.casic.ci.process.process.service.task.TaskService;
|
||||
import cd.casic.framework.commons.pojo.CommonResult;
|
||||
@ -44,8 +43,4 @@ public class TasksController {
|
||||
Boolean b = taskService.updateTask(req);
|
||||
return CommonResult.success(b);
|
||||
}
|
||||
@PostMapping("/getLogContentByTaskId/{taskId}")
|
||||
public CommonResult<PipPipelineTaskLog> getLogContentByTaskId(@PathVariable String taskId){
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user