编译通过版本,很多地方只是简单注释,之后根据TODO 查找进行迁移
This commit is contained in:
parent
1c6d133f4b
commit
b6ba0e0fdb
5
dependencies/.flattened-pom.xml
vendored
5
dependencies/.flattened-pom.xml
vendored
@ -187,6 +187,11 @@
|
||||
<artifactId>module-system-biz</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cd.casic.boot</groupId>
|
||||
<artifactId>module-ci-commons</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cd.casic.boot</groupId>
|
||||
<artifactId>module-ci-process-api</artifactId>
|
||||
|
@ -5,10 +5,11 @@ import cd.casic.ci.commons.bean.engine.postprocess.Postprocess;
|
||||
import cd.casic.ci.commons.bean.process.definition.Variable;
|
||||
import cd.casic.ci.commons.bean.process.setting.Scm;
|
||||
import cd.casic.ci.commons.bean.process.stage.Stage;
|
||||
import cd.casic.ci.commons.bean.work.agent.Agent;
|
||||
import cd.casic.ci.commons.bean.work.agent.model.Agent;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
@ -23,6 +24,7 @@ import java.util.List;
|
||||
@Builder
|
||||
@Accessors(chain = true)
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class PipelineDetails {
|
||||
|
||||
// 应用数据保存地址
|
||||
|
@ -2,7 +2,7 @@ package cd.casic.ci.commons.bean.engine.execute;
|
||||
|
||||
|
||||
import cd.casic.ci.commons.bean.process.definition.Pipeline;
|
||||
import cd.casic.ci.commons.bean.work.agent.Agent;
|
||||
import cd.casic.ci.commons.bean.work.agent.model.Agent;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
@ -0,0 +1,12 @@
|
||||
package cd.casic.ci.commons.bean.order;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class Order implements Serializable {
|
||||
private String name;
|
||||
private OrderTypeEnum orderType;
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package cd.casic.ci.commons.bean.order;
|
||||
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class OrderBuilder implements Serializable {
|
||||
public OrderBuilder() {
|
||||
}
|
||||
|
||||
public static Order asc(String propertyName) {
|
||||
return new Order(propertyName, OrderTypeEnum.asc);
|
||||
}
|
||||
|
||||
public static Order desc(String propertyName) {
|
||||
return new Order(propertyName, OrderTypeEnum.desc);
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package cd.casic.ci.commons.bean.order;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class OrderBuilders implements Serializable {
|
||||
List<Order> orderParams = new ArrayList();
|
||||
|
||||
public OrderBuilders() {
|
||||
}
|
||||
|
||||
public static OrderBuilders instance() {
|
||||
return new OrderBuilders();
|
||||
}
|
||||
|
||||
public OrderBuilders asc(String name) {
|
||||
this.orderParams.add(OrderBuilder.asc(name));
|
||||
return this;
|
||||
}
|
||||
|
||||
public OrderBuilders desc(String name) {
|
||||
this.orderParams.add(OrderBuilder.desc(name));
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<Order> get() {
|
||||
return this.orderParams;
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
package cd.casic.ci.commons.bean.order;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public enum OrderTypeEnum implements Serializable {
|
||||
asc,
|
||||
desc;
|
||||
|
||||
private OrderTypeEnum() {
|
||||
}
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
package cd.casic.ci.commons.bean.process.definition;
|
||||
|
||||
|
||||
import cd.casic.framework.commons.pojo.PageParam;
|
||||
import cn.hutool.db.Page;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cd.casic.ci.commons.bean.process.definition;
|
||||
|
||||
|
||||
import cd.casic.framework.commons.pojo.PageParam;
|
||||
import cn.hutool.db.Page;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
|
@ -1,5 +1,6 @@
|
||||
package cd.casic.ci.commons.bean.process.definition;
|
||||
|
||||
import cd.casic.framework.commons.pojo.PageParam;
|
||||
import cn.hutool.db.Page;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cd.casic.ci.commons.bean.process.instance;
|
||||
|
||||
import cd.casic.ci.commons.bean.process.definition.Pipeline;
|
||||
import cd.casic.framework.commons.pojo.PageParam;
|
||||
import cn.hutool.db.Page;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cd.casic.ci.commons.bean.process.setting;
|
||||
|
||||
|
||||
import cd.casic.framework.commons.pojo.PageParam;
|
||||
import cn.hutool.db.Page;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cd.casic.ci.commons.bean.process.stage;
|
||||
|
||||
|
||||
import cd.casic.framework.commons.pojo.PageParam;
|
||||
import cn.hutool.db.Page;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
|
@ -1,10 +0,0 @@
|
||||
package cd.casic.ci.commons.bean.work.agent;
|
||||
|
||||
/**
|
||||
* @author by mianbin
|
||||
* @Classname Agent
|
||||
* @Description agent 信息,先放着
|
||||
* @Date 2025/4/22 9:05
|
||||
*/
|
||||
public class Agent {
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package cd.casic.ci.commons.bean.work.agent;
|
||||
|
||||
public class AgentMessage {
|
||||
|
||||
private String type;
|
||||
|
||||
private Object message;
|
||||
|
||||
private String pipelineId;
|
||||
|
||||
private String tenantId;
|
||||
|
||||
public String getTenantId() {
|
||||
return tenantId;
|
||||
}
|
||||
|
||||
public void setTenantId(String tenantId) {
|
||||
this.tenantId = tenantId;
|
||||
}
|
||||
|
||||
public String getPipelineId() {
|
||||
return pipelineId;
|
||||
}
|
||||
|
||||
public void setPipelineId(String pipelineId) {
|
||||
this.pipelineId = pipelineId;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public Object getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(Object message) {
|
||||
this.message = message;
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package cd.casic.ci.commons.bean.work.agent;
|
||||
|
||||
|
||||
|
||||
import cd.casic.ci.commons.bean.order.Order;
|
||||
import cd.casic.ci.commons.bean.order.OrderBuilders;
|
||||
import cd.casic.framework.commons.pojo.PageParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class AgentQuery{
|
||||
|
||||
private String name;
|
||||
|
||||
private String ip;
|
||||
|
||||
private String tenantId;
|
||||
|
||||
private String address;
|
||||
|
||||
private String businessType;
|
||||
|
||||
private PageParam pageParam= new PageParam();
|
||||
|
||||
private List<Order> orderParams = OrderBuilders.instance().desc("createTime").get();
|
||||
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package cd.casic.ci.commons.bean.work.agent.model;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author by mianbin
|
||||
* @Classname Agent
|
||||
* @Description agent 信息,先放着
|
||||
* @Date 2025/4/22 9:05
|
||||
*/
|
||||
@Data
|
||||
public class Agent {
|
||||
private String id;
|
||||
|
||||
private String name;
|
||||
|
||||
private String ip;
|
||||
|
||||
private String tenantId;
|
||||
|
||||
private String address;
|
||||
|
||||
private String businessType;
|
||||
|
||||
private String createTime;
|
||||
|
||||
private Boolean isConnect;
|
||||
}
|
@ -18,10 +18,10 @@ public interface ScmConvert {
|
||||
ScmConvert INSTANCE = Mappers.getMapper(ScmConvert.class);
|
||||
|
||||
ScmDo convert(ScmDo scmDo);
|
||||
|
||||
ScmDo convertDo(ScmDo scmDo);
|
||||
// TODO 同下
|
||||
// ScmDo convertDo(ScmDo scmDo);
|
||||
|
||||
List<ScmDo> convertList(List<ScmDo> scmDos);
|
||||
|
||||
List<ScmDo> convertDoList(List<ScmDo> scmDos);
|
||||
// TODO 重复了
|
||||
// List<ScmDo> convertDoList(List<ScmDo> scmDos);
|
||||
}
|
||||
|
@ -17,13 +17,13 @@ public interface PipelineExecService {
|
||||
*/
|
||||
PipelineInstance start(PipelineRunMsg runMsg);
|
||||
|
||||
/**
|
||||
* 回滚构建
|
||||
*
|
||||
* @param runMsg 流水线id
|
||||
* @return 开始构建(true:开始运行 false:正在运行)
|
||||
*/
|
||||
PipelineInstance rollBackStart(PipelineRunMsg runMsg);
|
||||
// /**
|
||||
// * 回滚构建
|
||||
// *
|
||||
// * @param runMsg 流水线id
|
||||
// * @return 开始构建(true:开始运行 false:正在运行)
|
||||
// */
|
||||
// PipelineInstance rollBackStart(PipelineRunMsg runMsg);
|
||||
|
||||
/**
|
||||
* 停止流水线运行
|
||||
|
@ -3,17 +3,21 @@ package cd.casic.module.process.engine.execute.impl;
|
||||
import cd.casic.ci.commons.bean.engine.execute.PipelineDetails;
|
||||
import cd.casic.ci.commons.bean.engine.execute.PipelineRunMsg;
|
||||
import cd.casic.ci.commons.bean.engine.postprocess.Postprocess;
|
||||
import cd.casic.ci.commons.bean.exception.ApplicationException;
|
||||
import cd.casic.ci.commons.bean.exception.SystemException;
|
||||
import cd.casic.ci.commons.bean.process.definition.Pipeline;
|
||||
import cd.casic.ci.commons.bean.process.definition.Variable;
|
||||
import cd.casic.ci.commons.bean.process.instance.PipelineInstance;
|
||||
import cd.casic.ci.commons.bean.process.instance.PipelineInstanceQuery;
|
||||
import cd.casic.ci.commons.bean.process.setting.Scm;
|
||||
import cd.casic.ci.commons.bean.process.stage.Stage;
|
||||
import cd.casic.ci.commons.bean.work.agent.Agent;
|
||||
import cd.casic.ci.commons.bean.work.agent.model.Agent;
|
||||
import cd.casic.ci.commons.bean.work.agent.AgentMessage;
|
||||
import cd.casic.framework.commons.exception.ServiceException;
|
||||
import cd.casic.framework.commons.exception.enums.GlobalErrorCodeConstants;
|
||||
import cd.casic.module.process.engine.execute.PipelineExecService;
|
||||
|
||||
import cd.casic.module.process.engine.postprocess.PostprocessExecService;
|
||||
import cd.casic.module.process.engine.task.TasksExecService;
|
||||
import cd.casic.module.process.pipeline.instance.service.PipelineInstanceServiceImpl;
|
||||
import cd.casic.module.process.process.definition.PipelineService;
|
||||
import cd.casic.module.process.process.definition.VariableService;
|
||||
import cd.casic.module.process.process.instance.PipelineInstanceService;
|
||||
@ -21,6 +25,12 @@ import cd.casic.module.process.process.setting.ResourcesService;
|
||||
import cd.casic.module.process.process.setting.ScmService;
|
||||
import cd.casic.module.process.process.stage.StageExecService;
|
||||
import cd.casic.module.process.process.stage.StageService;
|
||||
import cd.casic.module.process.support.agent.service.AgentService;
|
||||
import cd.casic.module.process.support.disk.service.DiskService;
|
||||
import cd.casic.module.process.support.home.PipelineVersionService;
|
||||
import cd.casic.module.process.support.util.PipelineUtilService;
|
||||
import cd.casic.module.process.support.util.util.PipelineFinal;
|
||||
import cd.casic.module.process.toolkit.join.JoinTemplate;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@ -32,14 +42,12 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
import static cd.casic.ci.commons.bean.commons.PipelineConstants.RUN_HALT;
|
||||
import static cd.casic.ci.commons.bean.commons.PipelineConstants.RUN_RUN;
|
||||
|
||||
|
||||
/**
|
||||
* 流水线运行服务
|
||||
*/
|
||||
@Service
|
||||
// 这个注解含义不明
|
||||
//@Exporter
|
||||
public class PipelineExecServiceImpl implements PipelineExecService {
|
||||
|
||||
@Autowired
|
||||
@ -84,60 +92,41 @@ public class PipelineExecServiceImpl implements PipelineExecService {
|
||||
@Autowired
|
||||
AgentService agentService;
|
||||
|
||||
@Autowired
|
||||
PipelineHomeService homeService;
|
||||
|
||||
@Autowired
|
||||
TaskBuildProductService taskBuildProductService;
|
||||
|
||||
public final Logger logger = LoggerFactory.getLogger(PipelineExecServiceImpl.class);
|
||||
|
||||
//流水线id:流水线实例id
|
||||
public static final Map<String, String> pipelineIdOrInstanceId = new HashMap<>();
|
||||
public static final Map<String,String> pipelineIdOrInstanceId = new HashMap<>();
|
||||
|
||||
//流水线id:agent
|
||||
public static final Map<String, Agent> pipelineIdOrAgentId = new HashMap<>();
|
||||
public static final Map<String , Agent> pipelineIdOrAgentId = new HashMap<>();
|
||||
|
||||
|
||||
/**
|
||||
* 流水线开始运行
|
||||
*
|
||||
* @param runMsg 流水线id
|
||||
* @return 是否正在运行
|
||||
*/
|
||||
@Override
|
||||
public PipelineInstance start(PipelineRunMsg runMsg) {
|
||||
|
||||
Boolean permissions = homeService.findPermissions(runMsg.getPipelineId(), PIPELINE_RUN_KEY);
|
||||
if (!permissions) {
|
||||
throw new ApplicationException("您没有权限执行该流水线,请联系管理员授权!");
|
||||
}
|
||||
|
||||
Agent agent;
|
||||
if (StringUtils.isEmpty(runMsg.getAgentId())) {
|
||||
if (StringUtils.isEmpty(runMsg.getAgentId())){
|
||||
agent = agentService.findDefaultAgent();
|
||||
} else {
|
||||
}else {
|
||||
agent = agentService.findAgent(runMsg.getAgentId());
|
||||
}
|
||||
if (Objects.isNull(agent)) {
|
||||
throw new ApplicationException("无法获取到流水线执行Agent!");
|
||||
if (Objects.isNull(agent)){
|
||||
throw new ServiceException(GlobalErrorCodeConstants.LOCKED.getCode(),"无法获取到流水线执行Agent!");
|
||||
}
|
||||
|
||||
WebSocketSession session = SocketServerHandler.sessionMap.get(agent.getAddress());
|
||||
if (Objects.isNull(session)) {
|
||||
throw new ApplicationException("流水线Agent断开连接,无法执行。");
|
||||
}
|
||||
|
||||
// 判断同一任务是否在运行
|
||||
// TODO 需要引入新依赖,是重写还是直接引入
|
||||
// WebSocketSession session = SocketServerHandler.sessionMap.get(agent.getAddress());
|
||||
// if (Objects.isNull(session)){
|
||||
// throw new ApplicationException("流水线Agent断开连接,无法执行。");
|
||||
// }
|
||||
//
|
||||
// // 判断同一任务是否在运行
|
||||
Pipeline pipeline = validExecPipeline(runMsg);
|
||||
String pipelineId = pipeline.getId();
|
||||
|
||||
List<String> strings = stageService.validStagesMustField(pipelineId);
|
||||
if (!Objects.isNull(strings) && !strings.isEmpty()) {
|
||||
throw new ApplicationException("流水线未配置完成,请完善配置后在执行。");
|
||||
}
|
||||
|
||||
pipelineIdOrAgentId.put(pipelineId, agent);
|
||||
// String pipelineId = pipeline.getId();
|
||||
// pipelineIdOrAgentId.put(pipelineId, agent);
|
||||
|
||||
// 判断磁盘空间是否足够
|
||||
diskService.validationStorageSpace();
|
||||
@ -151,64 +140,17 @@ public class PipelineExecServiceImpl implements PipelineExecService {
|
||||
return beginExecPipeline(runMsg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PipelineInstance rollBackStart(PipelineRunMsg runMsg) {
|
||||
|
||||
Boolean permissions = homeService.findPermissions(runMsg.getPipelineId(), PIPELINE_RUN_KEY);
|
||||
if (!permissions) {
|
||||
throw new ApplicationException("您没有权限执行该流水线,请联系管理员授权!");
|
||||
}
|
||||
|
||||
Agent agent;
|
||||
if (StringUtils.isEmpty(runMsg.getAgentId())) {
|
||||
agent = agentService.findDefaultAgent();
|
||||
} else {
|
||||
agent = agentService.findAgent(runMsg.getAgentId());
|
||||
}
|
||||
if (Objects.isNull(agent)) {
|
||||
throw new ApplicationException("无法获取到流水线执行Agent!");
|
||||
}
|
||||
|
||||
WebSocketSession session = SocketServerHandler.sessionMap.get(agent.getAddress());
|
||||
if (Objects.isNull(session)) {
|
||||
throw new ApplicationException("流水线Agent断开连接,无法执行。");
|
||||
}
|
||||
|
||||
// 判断同一任务是否在运行
|
||||
Pipeline pipeline = validExecPipeline(runMsg);
|
||||
String pipelineId = pipeline.getId();
|
||||
|
||||
List<String> strings = stageService.validStagesMustField(pipelineId);
|
||||
if (!Objects.isNull(strings) && !strings.isEmpty()) {
|
||||
throw new ApplicationException("流水线未配置完成,请完善配置后在执行。");
|
||||
}
|
||||
|
||||
pipelineIdOrAgentId.put(pipelineId, agent);
|
||||
|
||||
// 判断磁盘空间是否足够
|
||||
diskService.validationStorageSpace();
|
||||
|
||||
// 资源限制
|
||||
resourcesService.judgeResources();
|
||||
|
||||
// 进入执行
|
||||
runMsg.setPipeline(pipeline);
|
||||
runMsg.setAgent(agent);
|
||||
return rollBackBeginExecPipeline(runMsg);
|
||||
}
|
||||
|
||||
/**
|
||||
* 放入正在执行的流水线缓存中
|
||||
*
|
||||
* @param runMsg 流水线id
|
||||
* @return 流水线信息
|
||||
*/
|
||||
public Pipeline validExecPipeline(PipelineRunMsg runMsg) {
|
||||
public Pipeline validExecPipeline(PipelineRunMsg runMsg){
|
||||
String pipelineId = runMsg.getPipelineId();
|
||||
|
||||
List<Stage> allMainStage = stageService.findAllMainStage(pipelineId);
|
||||
if (allMainStage.isEmpty()) {
|
||||
throw new ApplicationException(2000, "当前流水线不存在可构建任务!");
|
||||
if (allMainStage.isEmpty()){
|
||||
throw new ServiceException(GlobalErrorCodeConstants.LOCKED.getCode(),"当前流水线不存在可构建任务!");
|
||||
}
|
||||
|
||||
Boolean isVip = versionService.isVip();
|
||||
@ -218,31 +160,31 @@ public class PipelineExecServiceImpl implements PipelineExecService {
|
||||
int size = pipelineIdOrInstanceId.size();
|
||||
|
||||
// 资源限制放入缓存中等待执行
|
||||
if ((!isVip && size >= 2) || (isVip && size >= 4)) {
|
||||
throw new ApplicationException(2000, "并行任务已满,等待执行!");
|
||||
if ((!isVip && size >= 2) || (isVip && size >= 4) ){
|
||||
throw new ServiceException(GlobalErrorCodeConstants.LOCKED.getCode(),"并行任务已满,等待执行!");
|
||||
}
|
||||
return pipeline;
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行流水线
|
||||
*
|
||||
* @param runMsg 流水线信息
|
||||
* @return 流水线实例
|
||||
*/
|
||||
public PipelineInstance beginExecPipeline(PipelineRunMsg runMsg) {
|
||||
public PipelineInstance beginExecPipeline(PipelineRunMsg runMsg){
|
||||
String pipelineId = runMsg.getPipelineId();
|
||||
Pipeline pipeline = pipelineService.findPipelineById(pipelineId);
|
||||
pipeline.setState(2);
|
||||
pipelineService.updatePipeline(pipeline);
|
||||
runMsg.setPipeline(pipeline);
|
||||
|
||||
logger.info("流水线{}开始运行", pipeline.getName());
|
||||
logger.info("流水线{}开始运行",pipeline.getName());
|
||||
PipelineInstance pipelineInstance = pipelineInstanceService.initializeInstance(runMsg);
|
||||
// 添加到缓存
|
||||
String instanceId = pipelineInstance.getInstanceId();
|
||||
pipelineInstanceService.instanceRuntime(pipelineInstance.getInstanceId());
|
||||
joinTemplate.joinQuery(pipelineInstance);
|
||||
|
||||
// 运行实例放入内存中
|
||||
pipelineIdOrInstanceId.put(pipelineId, instanceId);
|
||||
|
||||
@ -267,11 +209,15 @@ public class PipelineExecServiceImpl implements PipelineExecService {
|
||||
pipelineDetails.setPostprocessList(postprocessList);
|
||||
|
||||
// 数据路径,源码,日志保存
|
||||
String sourceDir = utilService.findPipelineDefaultAddress(pipelineId, 1);
|
||||
String logDir = utilService.findPipelineDefaultAddress(pipelineId, 2);
|
||||
String sourceDir = utilService.findPipelineDefaultAddress(pipelineId,1);
|
||||
String logDir = utilService.findPipelineDefaultAddress(pipelineId,2);
|
||||
pipelineDetails.setSourceDir(sourceDir);
|
||||
pipelineDetails.setLogDir(logDir);
|
||||
|
||||
// 环境
|
||||
List<Scm> scmList = scmService.findAllPipelineScm();
|
||||
pipelineDetails.setScmList(scmList);
|
||||
|
||||
// 变量
|
||||
List<Variable> variableList = variableService.findAllVariable(pipelineId);
|
||||
pipelineDetails.setVariableList(variableList);
|
||||
@ -284,133 +230,40 @@ public class PipelineExecServiceImpl implements PipelineExecService {
|
||||
Agent agent = pipelineDetails.getAgent();
|
||||
|
||||
String id = agent.getAddress();
|
||||
|
||||
WebSocketSession session = SocketServerHandler.sessionMap.get(id);
|
||||
if (Objects.isNull(session)) {
|
||||
throw new SystemException("客户端推送消息失败,无法获取客户端连接,客户端信息:" + id);
|
||||
}
|
||||
|
||||
try {
|
||||
logger.info("发送流水线执行信息到客户端......");
|
||||
SocketServerHandler.instance().sendHandleMessage(id, agentMessage);
|
||||
} catch (Exception e) {
|
||||
throw new SystemException("客户端推送消息失败,错误信息:" + e.getMessage());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("流水线执行出错了:{}", e.getMessage());
|
||||
stop(pipelineId);
|
||||
}
|
||||
return pipelineInstance;
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行回滚流水线
|
||||
*
|
||||
* @param runMsg 流水线信息
|
||||
* @return 流水线实例
|
||||
*/
|
||||
public PipelineInstance rollBackBeginExecPipeline(PipelineRunMsg runMsg) {
|
||||
String pipelineId = runMsg.getPipelineId();
|
||||
|
||||
String rollBackInstanceId = runMsg.getInstanceId();
|
||||
TaskBuildProductQuery productQuery = new TaskBuildProductQuery();
|
||||
productQuery.setInstanceId(rollBackInstanceId);
|
||||
List<TaskBuildProduct> buildProductList = taskBuildProductService.findBuildProductList(productQuery);
|
||||
if (buildProductList.isEmpty()) {
|
||||
throw new ApplicationException("无法获取到部署文件,回滚失败!");
|
||||
}
|
||||
|
||||
Pipeline pipeline = pipelineService.findPipelineById(pipelineId);
|
||||
pipeline.setState(2);
|
||||
pipelineService.updatePipeline(pipeline);
|
||||
runMsg.setPipeline(pipeline);
|
||||
|
||||
TaskBuildProduct taskBuildProduct = buildProductList.get(0);
|
||||
|
||||
logger.info("流水线{}开始运行", pipeline.getName());
|
||||
PipelineInstance pipelineInstance = pipelineInstanceService.initializeInstance(runMsg);
|
||||
// 添加到缓存
|
||||
String instanceId = pipelineInstance.getInstanceId();
|
||||
pipelineInstanceService.instanceRuntime(pipelineInstance.getInstanceId());
|
||||
joinTemplate.joinQuery(pipelineInstance);
|
||||
|
||||
// 运行实例放入内存中
|
||||
pipelineIdOrInstanceId.put(pipelineId, instanceId);
|
||||
|
||||
try {
|
||||
// 创建多阶段运行实例
|
||||
List<Stage> stageList = stageExecService.createRollBackStageExecInstance(pipelineId, instanceId);
|
||||
|
||||
List<Postprocess> postprocessList = postExecService.createPipelinePostInstance(pipelineId, instanceId);
|
||||
PipelineDetails pipelineDetails = new PipelineDetails();
|
||||
pipelineDetails.setTaskBuildProduct(taskBuildProduct);
|
||||
|
||||
// 流水线基本运行信息
|
||||
pipelineDetails.setPipelineId(pipelineId);
|
||||
pipelineDetails.setInstanceId(instanceId);
|
||||
pipelineDetails.setRunWay(runMsg.getRunWay());
|
||||
pipelineDetails.setAgent(runMsg.getAgent());
|
||||
|
||||
// 流水线运行任务
|
||||
pipelineDetails.setStageList(stageList);
|
||||
|
||||
// 流水线后置处理
|
||||
pipelineDetails.setPostprocessList(postprocessList);
|
||||
|
||||
// 数据路径,源码,日志保存
|
||||
String sourceDir = utilService.findPipelineDefaultAddress(pipelineId, 1);
|
||||
String logDir = utilService.findPipelineDefaultAddress(pipelineId, 2);
|
||||
pipelineDetails.setSourceDir(sourceDir);
|
||||
pipelineDetails.setLogDir(logDir);
|
||||
|
||||
// 变量
|
||||
List<Variable> variableList = variableService.findAllVariable(pipelineId);
|
||||
pipelineDetails.setVariableList(variableList);
|
||||
|
||||
AgentMessage agentMessage = new AgentMessage();
|
||||
agentMessage.setType("exec");
|
||||
agentMessage.setMessage(pipelineDetails);
|
||||
agentMessage.setPipelineId(pipelineId);
|
||||
|
||||
Agent agent = pipelineDetails.getAgent();
|
||||
|
||||
String id = agent.getAddress();
|
||||
|
||||
WebSocketSession session = SocketServerHandler.sessionMap.get(id);
|
||||
if (Objects.isNull(session)) {
|
||||
throw new SystemException("客户端推送消息失败,无法获取客户端连接,客户端信息:" + id);
|
||||
}
|
||||
|
||||
try {
|
||||
logger.info("发送流水线执行信息到客户端......");
|
||||
SocketServerHandler.instance().sendHandleMessage(id, agentMessage);
|
||||
} catch (Exception e) {
|
||||
throw new SystemException("客户端推送消息失败,错误信息:" + e.getMessage());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("流水线执行出错了:{}", e.getMessage());
|
||||
// TODO 看看是否需要换个实现
|
||||
// WebSocketSession session = SocketServerHandler.sessionMap.get(id);
|
||||
// if (Objects.isNull(session)) {
|
||||
// throw new SystemException("客户端推送消息失败,无法获取客户端连接,客户端信息:"+id);
|
||||
// }
|
||||
//
|
||||
// try {
|
||||
// SocketServerHandler.instance().sendHandleMessage(id,agentMessage);
|
||||
// } catch (Exception e) {
|
||||
// throw new SystemException("客户端推送消息失败,错误信息:" + e.getMessage());
|
||||
// }
|
||||
}catch (Exception e){
|
||||
logger.error("流水线执行出错了:{}",e.getMessage() );
|
||||
stop(pipelineId);
|
||||
}
|
||||
return pipelineInstance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop(String pipelineId) {
|
||||
public void stop(String pipelineId){
|
||||
Pipeline pipeline = pipelineService.findPipelineById(pipelineId);
|
||||
|
||||
Agent agent = pipelineIdOrAgentId.get(pipelineId);
|
||||
if (Objects.isNull(agent)) {
|
||||
if (Objects.isNull(agent)){
|
||||
pipeline.setState(1);
|
||||
pipelineService.updatePipeline(pipeline);
|
||||
|
||||
PipelineInstanceQuery pipelineInstanceQuery = new PipelineInstanceQuery();
|
||||
pipelineInstanceQuery.setState(RUN_RUN);
|
||||
pipelineInstanceQuery.setState(PipelineFinal.RUN_RUN);
|
||||
pipelineInstanceQuery.setPipelineId(pipelineId);
|
||||
List<PipelineInstance> pipelineInstanceList = pipelineInstanceService.findPipelineInstanceList(pipelineInstanceQuery);
|
||||
for (PipelineInstance pipelineInstance : pipelineInstanceList) {
|
||||
String instanceId = pipelineInstance.getInstanceId();
|
||||
pipelineInstance.setRunStatus(RUN_HALT);
|
||||
pipelineInstance.setRunStatus(PipelineFinal.RUN_HALT);
|
||||
int runtime = pipelineInstanceService.findInstanceRuntime(instanceId);
|
||||
pipelineInstance.setRunTime(runtime);
|
||||
pipelineInstanceService.updateInstance(pipelineInstance);
|
||||
@ -424,8 +277,9 @@ public class PipelineExecServiceImpl implements PipelineExecService {
|
||||
agentMessage.setType("stop");
|
||||
agentMessage.setMessage(pipelineId);
|
||||
agentMessage.setPipelineId(pipelineId);
|
||||
SocketServerHandler.instance().sendHandleMessage(agent.getAddress(), agentMessage);
|
||||
} catch (Exception e) {
|
||||
// TODO 先放着
|
||||
// SocketServerHandler.instance().sendHandleMessage(agent.getAddress(),agentMessage);
|
||||
}catch (Exception e){
|
||||
logger.error(e.getMessage());
|
||||
}
|
||||
|
||||
@ -437,20 +291,19 @@ public class PipelineExecServiceImpl implements PipelineExecService {
|
||||
pipelineService.updatePipeline(pipeline);
|
||||
|
||||
PipelineInstanceQuery pipelineInstanceQuery = new PipelineInstanceQuery();
|
||||
pipelineInstanceQuery.setState(RUN_RUN);
|
||||
pipelineInstanceQuery.setState(PipelineFinal.RUN_RUN);
|
||||
pipelineInstanceQuery.setPipelineId(pipelineId);
|
||||
List<PipelineInstance> pipelineInstanceList = pipelineInstanceService.findPipelineInstanceList(pipelineInstanceQuery);
|
||||
for (PipelineInstance pipelineInstance : pipelineInstanceList) {
|
||||
pipelineInstance.setRunStatus(RUN_HALT);
|
||||
pipelineInstance.setRunStatus(PipelineFinal.RUN_HALT);
|
||||
int runtime = pipelineInstanceService.findInstanceRuntime(pipelineInstance.getInstanceId());
|
||||
pipelineInstance.setRunTime(runtime);
|
||||
pipelineInstanceService.updateInstance(pipelineInstance);
|
||||
}
|
||||
removeExecCache(pipelineId);
|
||||
|
||||
}
|
||||
|
||||
public void removeExecCache(String pipelineId) {
|
||||
public void removeExecCache(String pipelineId){
|
||||
String instanceId = pipelineIdOrInstanceId.get(pipelineId);
|
||||
PipelineInstanceServiceImpl.runTimeMap.remove(instanceId);
|
||||
pipelineInstanceService.stopThread(instanceId);
|
||||
@ -458,23 +311,24 @@ public class PipelineExecServiceImpl implements PipelineExecService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keepOn(String pipelineId) {
|
||||
public void keepOn(String pipelineId){
|
||||
Agent agent = pipelineIdOrAgentId.get(pipelineId);
|
||||
String id = agent.getAddress();
|
||||
AgentMessage agentMessage = new AgentMessage();
|
||||
agentMessage.setType("keepOn");
|
||||
agentMessage.setMessage(pipelineId);
|
||||
agentMessage.setPipelineId(pipelineId);
|
||||
WebSocketSession session = SocketServerHandler.sessionMap.get(id);
|
||||
if (Objects.isNull(session)) {
|
||||
throw new SystemException("客户端推送消息失败,无法获取客户端连接,客户端信息:" + id);
|
||||
}
|
||||
|
||||
try {
|
||||
SocketServerHandler.instance().sendHandleMessage(id, agentMessage);
|
||||
} catch (Exception e) {
|
||||
throw new SystemException("客户端推送消息失败,错误信息:" + e.getMessage());
|
||||
}
|
||||
//TODO
|
||||
// WebSocketSession session = SocketServerHandler.sessionMap.get(id);
|
||||
// if (Objects.isNull(session)) {
|
||||
// throw new SystemException("客户端推送消息失败,无法获取客户端连接,客户端信息:"+id);
|
||||
// }
|
||||
//
|
||||
// try {
|
||||
// SocketServerHandler.instance().sendHandleMessage(id,agentMessage);
|
||||
// } catch (Exception e) {
|
||||
// throw new SystemException("客户端推送消息失败,错误信息:" + e.getMessage());
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,55 @@
|
||||
package cd.casic.module.process.home.service;
|
||||
|
||||
|
||||
|
||||
import cd.casic.ci.commons.bean.process.definition.Pipeline;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 流水线首页服务接口
|
||||
*/
|
||||
|
||||
public interface PipelineHomeService {
|
||||
|
||||
/**
|
||||
* 创建日志
|
||||
* @param logType 日志类型 (创建 create,删除 delete,执行 exec,更新 update)
|
||||
* @param map 日志信息
|
||||
*/
|
||||
void log(String logType, Map<String, Object> map);
|
||||
|
||||
|
||||
/**
|
||||
* 配置全局消息
|
||||
* @param templateId 方案id
|
||||
* @param map 信息
|
||||
*/
|
||||
void settingMessage(String templateId, Map<String, Object> map);
|
||||
|
||||
|
||||
/**
|
||||
* 创建消息
|
||||
* @param receiver 接收信息
|
||||
* @param map 信息
|
||||
*/
|
||||
void message(Map<String, Object> map, List<String> receiver);
|
||||
|
||||
/**
|
||||
* 发送短信
|
||||
* @param map 短信内容
|
||||
*/
|
||||
void smsMessage(Map<String,Object> map);
|
||||
|
||||
/**
|
||||
* 初始化消息,日志信息
|
||||
* @param pipeline 流水线
|
||||
* @return 信息
|
||||
*/
|
||||
Map<String,Object> initMap(Pipeline pipeline);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,158 @@
|
||||
package cd.casic.module.process.pipeline.instance.service;
|
||||
|
||||
import cd.casic.ci.commons.bean.engine.execute.PipelineRunMsg;
|
||||
import cd.casic.ci.commons.bean.process.definition.Pipeline;
|
||||
import cd.casic.ci.commons.bean.process.instance.PipelineInstance;
|
||||
import cd.casic.ci.commons.bean.process.instance.PipelineInstanceQuery;
|
||||
import cd.casic.framework.commons.pojo.PageResult;
|
||||
import cd.casic.module.process.engine.task.TasksInstanceService;
|
||||
import cd.casic.module.process.process.instance.PipelineInstanceService;
|
||||
import cd.casic.module.process.process.instance.dao.PipelineInstanceDao;
|
||||
import cd.casic.module.process.process.stage.StageInstanceServer;
|
||||
import cd.casic.module.process.support.util.PipelineUtilService;
|
||||
import cd.casic.module.process.task.build.service.TaskBuildProductService;
|
||||
import cd.casic.module.process.toolkit.join.JoinTemplate;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
/**
|
||||
* 流水线实例服务
|
||||
*/
|
||||
@Service
|
||||
//@Exporter TODO
|
||||
public class PipelineInstanceServiceImpl implements PipelineInstanceService {
|
||||
public static final Map<String,Integer> runTimeMap = new HashMap<>();
|
||||
|
||||
|
||||
@Override
|
||||
public String createInstance(PipelineInstance pipelineInstance) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAllInstance(String pipelineId) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public PipelineInstance initializeInstance(PipelineRunMsg runMsg) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteInstance(String instanceId) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateInstance(PipelineInstance pipelineInstance) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public PipelineInstance findOneInstance(String instanceId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PipelineInstance findLatelyInstance(String pipelineId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PipelineInstance> findAllInstance() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PipelineInstance> findPipelineAllInstance(String pipelineId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PipelineInstance> findUserPipelineInstance(String userId, Integer limit) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String findRunInstanceId(String pipelineId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PipelineInstance> findInstanceList(List<String> idList) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PipelineInstance> findPipelineInstanceList(PipelineInstanceQuery pipelineInstanceQuery) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<PipelineInstance> findUserInstance(PipelineInstanceQuery pipelineInstanceQuery) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<PipelineInstance> findPipelineInstance(PipelineInstanceQuery query) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PipelineInstance> findInstanceByTime(String pipelineId, String[] queryTime) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PipelineInstance> findInstanceByTime(String[] queryTime) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int findInstanceRuntime(String instanceId) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void instanceRuntime(String instanceId) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopThread(String threadName) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -27,8 +27,8 @@ public class ConditionDo extends BaseDO {
|
||||
private String condName;
|
||||
|
||||
private String taskId;
|
||||
|
||||
private String createTime;
|
||||
// todo
|
||||
// private String createTime;
|
||||
|
||||
private int condType;
|
||||
|
||||
|
@ -25,7 +25,9 @@ public class PipelineInstanceDo extends BaseDO {
|
||||
private String instanceId;
|
||||
|
||||
//创建构建时间
|
||||
private String createTime;
|
||||
// todo
|
||||
|
||||
// private String createTime;
|
||||
|
||||
//构建方式
|
||||
private int runWay;
|
||||
|
@ -1,9 +1,17 @@
|
||||
package cd.casic.module.process.process.setting.dao;
|
||||
|
||||
import cd.casic.ci.commons.bean.process.setting.Env;
|
||||
import cd.casic.ci.commons.bean.process.setting.EnvQuery;
|
||||
import cd.casic.framework.commons.pojo.PageResult;
|
||||
import cd.casic.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cd.casic.module.process.process.setting.dataobject.EnvDo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author by mianbin
|
||||
* @Classname EnvDao
|
||||
@ -12,4 +20,28 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
*/
|
||||
@Mapper
|
||||
public interface EnvDao extends BaseMapperX<EnvDo> {
|
||||
public String creatEnv(Env env);
|
||||
|
||||
public void updateEnv(Env env);
|
||||
|
||||
|
||||
public void deleteEnv(String groupId);
|
||||
|
||||
|
||||
public Env findOneEnv(String groupId);
|
||||
|
||||
|
||||
public List<Env> findAllEnv();
|
||||
|
||||
|
||||
public List<Env> findEnvList(EnvQuery envQuery);
|
||||
|
||||
|
||||
public PageResult<Env> findEnvPage(EnvQuery envQuery);
|
||||
|
||||
|
||||
public List<Env> findAllEnvList(List<String> idList);
|
||||
|
||||
|
||||
public Integer findEnvNumber();
|
||||
}
|
@ -75,48 +75,73 @@ public class AuthThirdServiceImpl implements AuthThirdService {
|
||||
|
||||
@Override
|
||||
public List<AuthThird> findAuthServerList(AuthThirdQuery thirdQuery) {
|
||||
List<AuthThirdEntity> authThirdEntityList = authServerDao.findAuthServerList(thirdQuery);
|
||||
List<AuthThird> authThirds = BeanMapper.mapList(authThirdEntityList, AuthThird.class);
|
||||
return authThirds;
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<AuthThird> findAuthServerPage(AuthThirdQuery thirdQuery) {
|
||||
Pagination<AuthThirdEntity> authThirdEntityPage = authServerDao.findAuthServerPage(thirdQuery);
|
||||
|
||||
List<AuthThirdEntity> dataList = authThirdEntityPage.getDataList();
|
||||
if (Objects.isNull(dataList)) {
|
||||
return PaginationBuilder.build(authThirdEntityPage, Collections.emptyList());
|
||||
}
|
||||
List<AuthThird> authThirds = BeanMapper.mapList(dataList, AuthThird.class);
|
||||
return PaginationBuilder.build(authThirdEntityPage, authThirds);
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有流水线授权
|
||||
*
|
||||
* @return 流水线授权列表
|
||||
*/
|
||||
@Override
|
||||
public List<AuthThird> findAllAuthServer() {
|
||||
List<AuthThirdEntity> allAuthServer = authServerDao.findAllAuthServer();
|
||||
if (Objects.isNull(allAuthServer)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<AuthThird> authThirds = BeanMapper.mapList(allAuthServer, AuthThird.class);
|
||||
return authThirds;
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AuthThird> findAllAuthServerList(List<String> idList) {
|
||||
List<AuthThirdEntity> allAuthServerList = authServerDao.findAllAuthServerList(idList);
|
||||
return BeanMapper.mapList(allAuthServerList, AuthThird.class);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer findAuthServerNumber() {
|
||||
return authServerDao.findAuthServerNumber();
|
||||
return null;
|
||||
}
|
||||
//TODO 暂时简单处理
|
||||
// @Override
|
||||
// public List<AuthThird> findAuthServerList(AuthThirdQuery thirdQuery) {
|
||||
// List<AuthThirdEntity> authThirdEntityList = authServerDao.findAuthServerList(thirdQuery);
|
||||
// List<AuthThird> authThirds = BeanMapper.mapList(authThirdEntityList, AuthThird.class);
|
||||
// return authThirds;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public PageResult<AuthThird> findAuthServerPage(AuthThirdQuery thirdQuery) {
|
||||
// Pagination<AuthThirdEntity> authThirdEntityPage = authServerDao.findAuthServerPage(thirdQuery);
|
||||
//
|
||||
// List<AuthThirdEntity> dataList = authThirdEntityPage.getDataList();
|
||||
// if (Objects.isNull(dataList)) {
|
||||
// return PaginationBuilder.build(authThirdEntityPage, Collections.emptyList());
|
||||
// }
|
||||
// List<AuthThird> authThirds = BeanMapper.mapList(dataList, AuthThird.class);
|
||||
// return PaginationBuilder.build(authThirdEntityPage, authThirds);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 查询所有流水线授权
|
||||
// *
|
||||
// * @return 流水线授权列表
|
||||
// */
|
||||
// @Override
|
||||
// public List<AuthThird> findAllAuthServer() {
|
||||
// List<AuthThirdEntity> allAuthServer = authServerDao.findAllAuthServer();
|
||||
// if (Objects.isNull(allAuthServer)) {
|
||||
// return Collections.emptyList();
|
||||
// }
|
||||
// List<AuthThird> authThirds = BeanMapper.mapList(allAuthServer, AuthThird.class);
|
||||
// return authThirds;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public List<AuthThird> findAllAuthServerList(List<String> idList) {
|
||||
// List<AuthThirdEntity> allAuthServerList = authServerDao.findAllAuthServerList(idList);
|
||||
// return BeanMapper.mapList(allAuthServerList, AuthThird.class);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public Integer findAuthServerNumber() {
|
||||
// return authServerDao.findAuthServerNumber();
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ package cd.casic.module.process.process.setting.impl;
|
||||
import cd.casic.ci.commons.bean.process.setting.Cache;
|
||||
import cd.casic.module.process.process.setting.CacheService;
|
||||
import cd.casic.module.process.process.setting.dao.CacheDao;
|
||||
import cd.casic.module.process.support.home.PipelineVersionService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@ -28,8 +29,10 @@ public class CacheServiceImpl implements CacheService {
|
||||
|
||||
@Override
|
||||
public String createCathe(Cache cache){
|
||||
CacheEntity cacheEntity = BeanMapper.map(cache, CacheEntity.class);
|
||||
return cacheDao.createCathe(cacheEntity);
|
||||
// TODO 待迁移
|
||||
// CacheEntity cacheEntity = BeanMapper.map(cache, CacheEntity.class);
|
||||
// return cacheDao.createCathe(cacheEntity);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -43,39 +46,44 @@ public class CacheServiceImpl implements CacheService {
|
||||
if (cache.getLogCache() == 0){
|
||||
cache.setLogCache(oneCathe.getLogCache());
|
||||
}
|
||||
CacheEntity cacheEntity = BeanMapper.map(cache, CacheEntity.class);
|
||||
cacheDao.updateCathe(cacheEntity);
|
||||
// TODO 同上
|
||||
// CacheEntity cacheEntity = BeanMapper.map(cache, CacheEntity.class);
|
||||
// cacheDao.updateCathe(cacheEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteCathe(String cacheId){
|
||||
cacheDao.deleteCathe(cacheId);
|
||||
// TODO
|
||||
// cacheDao.deleteCathe(cacheId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Cache findCathe(String cacheId){
|
||||
CacheEntity cacheEntity = cacheDao.findCathe(cacheId);
|
||||
return BeanMapper.map(cacheEntity, Cache.class);
|
||||
// TODO 待迁移
|
||||
// CacheEntity cacheEntity = cacheDao.findCathe(cacheId);
|
||||
// return BeanMapper.map(cacheEntity, Cache.class);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Cache> findAllCathe(){
|
||||
List<CacheEntity> cacheEntityList = cacheDao.findAllCathe();
|
||||
if (Objects.isNull(cacheEntityList)){
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<Cache> caches = BeanMapper.mapList(cacheEntityList, Cache.class);
|
||||
Cache cache = caches.get(0);
|
||||
if (versionService.isVip()){
|
||||
return caches;
|
||||
}else {
|
||||
cache.setArtifactCache(DEFAULT_CLEAN_CACHE_DAY);
|
||||
cache.setLogCache(DEFAULT_CLEAN_CACHE_DAY);
|
||||
updateCathe(cache);
|
||||
}
|
||||
// TODO
|
||||
// List<CacheEntity> cacheEntityList = cacheDao.findAllCathe();
|
||||
// if (Objects.isNull(cacheEntityList)){
|
||||
// return Collections.emptyList();
|
||||
// }
|
||||
// List<Cache> caches = BeanMapper.mapList(cacheEntityList, Cache.class);
|
||||
// Cache cache = caches.get(0);
|
||||
// if (versionService.isVip()){
|
||||
// return caches;
|
||||
// }else {
|
||||
// cache.setArtifactCache(DEFAULT_CLEAN_CACHE_DAY);
|
||||
// cache.setLogCache(DEFAULT_CLEAN_CACHE_DAY);
|
||||
// updateCathe(cache);
|
||||
// }
|
||||
|
||||
List<Cache> cacheList = new ArrayList<>();
|
||||
cacheList.add(cache);
|
||||
// cacheList.add(cache);
|
||||
return cacheList;
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,7 @@ package cd.casic.module.process.process.setting.impl;
|
||||
import cd.casic.ci.commons.bean.process.setting.Env;
|
||||
import cd.casic.ci.commons.bean.process.setting.EnvQuery;
|
||||
import cd.casic.ci.commons.bean.utils.PipelineUtil;
|
||||
import cd.casic.framework.commons.pojo.PageResult;
|
||||
import cd.casic.module.process.process.setting.EnvService;
|
||||
import cd.casic.module.process.process.setting.dao.EnvDao;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -51,10 +52,11 @@ public class EnvServiceImpl implements EnvService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pagination<Env> findEnvPage(EnvQuery envQuery) {
|
||||
Pagination<Env> envPage = envDao.findEnvPage(envQuery);
|
||||
List<Env> dataList = envPage.getDataList();
|
||||
return PaginationBuilder.build(envPage,dataList);
|
||||
public PageResult<Env> findEnvPage(EnvQuery envQuery) {
|
||||
// Pagination<Env> envPage = envDao.findEnvPage(envQuery);
|
||||
// List<Env> dataList = envPage.getDataList();
|
||||
// return PaginationBuilder.build(envPage,dataList);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -3,6 +3,7 @@ package cd.casic.module.process.process.setting.impl;
|
||||
import cd.casic.ci.commons.bean.process.setting.Group;
|
||||
import cd.casic.ci.commons.bean.process.setting.GroupQuery;
|
||||
import cd.casic.ci.commons.bean.utils.PipelineUtil;
|
||||
import cd.casic.framework.commons.pojo.PageResult;
|
||||
import cd.casic.module.process.process.setting.GroupService;
|
||||
import cd.casic.module.process.process.setting.dao.GroupDao;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -16,57 +17,91 @@ public class GroupServiceImpl implements GroupService {
|
||||
|
||||
@Autowired
|
||||
GroupDao groupDao;
|
||||
// TODO 暂时简单处理
|
||||
// @Override
|
||||
// public String createGroup(Group group) {
|
||||
// group.setCreateTime(PipelineUtil.date(1));
|
||||
// return groupDao.creatGroup(group);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void updateGroup(Group group) {
|
||||
// groupDao.updateGroup(group);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void deleteGroup(String groupId) {
|
||||
// groupDao.deleteGroup(groupId);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public Group findOneGroup(String groupId) {
|
||||
// Group group = groupDao.findOneGroup(groupId);
|
||||
// return group;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public List<Group> findAllGroup() {
|
||||
// return groupDao.findAllGroup();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public List<Group> findGroupList(GroupQuery groupQuery) {
|
||||
// List<Group> groupList = groupDao.findGroupList(groupQuery);
|
||||
// return groupList;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public String createGroup(Group group) {
|
||||
group.setCreateTime(PipelineUtil.date(1));
|
||||
return groupDao.creatGroup(group);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateGroup(Group group) {
|
||||
groupDao.updateGroup(group);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteGroup(String groupId) {
|
||||
groupDao.deleteGroup(groupId);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Group findOneGroup(String groupId) {
|
||||
Group group = groupDao.findOneGroup(groupId);
|
||||
return group;
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Group> findAllGroup() {
|
||||
return groupDao.findAllGroup();
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Group> findGroupList(GroupQuery groupQuery) {
|
||||
List<Group> groupList = groupDao.findGroupList(groupQuery);
|
||||
return groupList;
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pagination<Group> findGroupPage(GroupQuery groupQuery) {
|
||||
Pagination<Group> groupPage = groupDao.findGroupPage(groupQuery);
|
||||
List<Group> dataList = groupPage.getDataList();
|
||||
return PaginationBuilder.build(groupPage,dataList);
|
||||
public PageResult<Group> findGroupPage(GroupQuery groupQuery) {
|
||||
// PageResult<Group> groupPage = groupDao.findGroupPage(groupQuery);
|
||||
// List<Group> dataList = groupPage.getDataList();
|
||||
// return PaginationBuilder.build(groupPage,dataList);
|
||||
//TODO
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Group> findAllGroupList(List<String> idList) {
|
||||
List<Group> groupList = groupDao.findAllGroupList(idList);
|
||||
return groupList;
|
||||
// List<Group> groupList = groupDao.findAllGroupList(idList);
|
||||
// return groupList;
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Integer findGroupNumber() {
|
||||
return groupDao.findGroupNumber();
|
||||
// return groupDao.findGroupNumber();
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
@ -10,6 +10,7 @@ import cd.casic.ci.commons.bean.utils.PipelineUtil;
|
||||
import cd.casic.module.process.process.definition.dao.PipelineDao;
|
||||
import cd.casic.module.process.process.setting.ResourcesService;
|
||||
import cd.casic.module.process.process.setting.dao.ResourcesDao;
|
||||
import cd.casic.module.process.support.util.PipelineUtilService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@ -33,31 +34,31 @@ public class ResourcesServiceImpl implements ResourcesService {
|
||||
|
||||
@Override
|
||||
public void instanceResources(int time){
|
||||
|
||||
if (time == 0){
|
||||
time = 1;
|
||||
}
|
||||
String date = PipelineUtil.date(2);
|
||||
Time dataTime = TimeConfig.findDataTime(date);
|
||||
String beginTime = dataTime.getMonthBeginTime();
|
||||
String endTime = dataTime.getMonthEndTime();
|
||||
Resources resources = resourcesDao.findResources(beginTime,endTime);
|
||||
if (Objects.nonNull(resources)){
|
||||
int structureNumber = resources.getUseSceNumber();
|
||||
resources.setUseSceNumber(structureNumber+time);
|
||||
resources.setMonth(dataTime.getMonth());
|
||||
updateResources(resources);
|
||||
}else {
|
||||
resources = new Resources();
|
||||
resources.setUseSceNumber(time);
|
||||
resources.setMonth(dataTime.getMonth());
|
||||
resources.setBeginTime(beginTime);
|
||||
resources.setEndTime(endTime);
|
||||
String resourcesId = createResources(resources);
|
||||
if (Objects.isNull(resourcesId)){
|
||||
throw new ApplicationException("创建资源信息失败!");
|
||||
}
|
||||
}
|
||||
//TODO
|
||||
// if (time == 0){
|
||||
// time = 1;
|
||||
// }
|
||||
// String date = PipelineUtil.date(2);
|
||||
// Time dataTime = TimeConfig.findDataTime(date);
|
||||
// String beginTime = dataTime.getMonthBeginTime();
|
||||
// String endTime = dataTime.getMonthEndTime();
|
||||
// Resources resources = resourcesDao.findResources(beginTime,endTime);
|
||||
// if (Objects.nonNull(resources)){
|
||||
// int structureNumber = resources.getUseSceNumber();
|
||||
// resources.setUseSceNumber(structureNumber+time);
|
||||
// resources.setMonth(dataTime.getMonth());
|
||||
// updateResources(resources);
|
||||
// }else {
|
||||
// resources = new Resources();
|
||||
// resources.setUseSceNumber(time);
|
||||
// resources.setMonth(dataTime.getMonth());
|
||||
// resources.setBeginTime(beginTime);
|
||||
// resources.setEndTime(endTime);
|
||||
// String resourcesId = createResources(resources);
|
||||
// if (Objects.isNull(resourcesId)){
|
||||
// throw new ApplicationException("创建资源信息失败!");
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -82,43 +83,50 @@ public class ResourcesServiceImpl implements ResourcesService {
|
||||
|
||||
@Override
|
||||
public String createResources(Resources resources){
|
||||
return resourcesDao.createResources(resources);
|
||||
// return resourcesDao.createResources(resources);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateResources(Resources resources){
|
||||
resourcesDao.updateResources(resources);
|
||||
// resourcesDao.updateResources(resources);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteResources(String resourcesId){
|
||||
resourcesDao.deleteResources(resourcesId);
|
||||
// resourcesDao.deleteResources(resourcesId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Resources findOneResources(String resourcesId){
|
||||
return resourcesDao.findOneResources(resourcesId);
|
||||
// return resourcesDao.findOneResources(resourcesId);
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Resources> findAllResources(){
|
||||
List<Resources> allResources = resourcesDao.findAllResources();
|
||||
if (allResources == null || allResources.isEmpty()){
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return resourcesDao.findAllResources();
|
||||
// List<Resources> allResources = resourcesDao.findAllResources();
|
||||
// if (allResources == null || allResources.isEmpty()){
|
||||
// return Collections.emptyList();
|
||||
// }
|
||||
// return resourcesDao.findAllResources();
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Resources findResourcesList(){
|
||||
PipelineQuery pipelineQuery = new PipelineQuery();
|
||||
pipelineQuery.setPipelineState(2);
|
||||
List<PipelineEntity> pipelineList = pipelineDao.findPipelineList(pipelineQuery);
|
||||
int number = pipelineList.size();
|
||||
// PipelineQuery pipelineQuery = new PipelineQuery();
|
||||
// pipelineQuery.setPipelineState(2);
|
||||
// List<PipelineEntity> pipelineList = pipelineDao.findPipelineList(pipelineQuery);
|
||||
// int number = pipelineList.size();
|
||||
//
|
||||
// Resources resources = notVipResources(number);
|
||||
// resources.setVersion(1);
|
||||
// return resources;
|
||||
return null;
|
||||
|
||||
Resources resources = notVipResources(number);
|
||||
resources.setVersion(1);
|
||||
return resources;
|
||||
}
|
||||
|
||||
private static final int notVipExecNumber = 2;
|
||||
@ -169,69 +177,73 @@ public class ResourcesServiceImpl implements ResourcesService {
|
||||
|
||||
@Override
|
||||
public ResourcesDetails findResourcesDetails(String type){
|
||||
ResourcesDetails resourcesDetails = new ResourcesDetails();
|
||||
|
||||
switch(type) {
|
||||
case "disk" ->{
|
||||
String codeAddress = utilService.instanceAddress(1);
|
||||
String logAddress = utilService.instanceAddress(2);
|
||||
resourcesDetails.setArtifactCache(findDirSize(logAddress)+"");
|
||||
resourcesDetails.setSourceCache(findDirSize(codeAddress)+"");
|
||||
}
|
||||
case "run" ->{
|
||||
PipelineQuery pipelineQuery = new PipelineQuery();
|
||||
pipelineQuery.setPipelineState(2);
|
||||
List<String> list = new ArrayList<>();
|
||||
List<PipelineEntity> pipelineList = pipelineDao.findPipelineList(pipelineQuery);
|
||||
if (pipelineList.isEmpty()){
|
||||
resourcesDetails.setList(list);
|
||||
break;
|
||||
}
|
||||
for (PipelineEntity pipelineEntity : pipelineList) {
|
||||
list.add(pipelineEntity.getName());
|
||||
}
|
||||
resourcesDetails.setList(list);
|
||||
}
|
||||
}
|
||||
return resourcesDetails;
|
||||
// ResourcesDetails resourcesDetails = new ResourcesDetails();
|
||||
//
|
||||
// switch(type) {
|
||||
// case "disk" ->{
|
||||
// String codeAddress = utilService.instanceAddress(1);
|
||||
// String logAddress = utilService.instanceAddress(2);
|
||||
// resourcesDetails.setArtifactCache(findDirSize(logAddress)+"");
|
||||
// resourcesDetails.setSourceCache(findDirSize(codeAddress)+"");
|
||||
// }
|
||||
// case "run" ->{
|
||||
// PipelineQuery pipelineQuery = new PipelineQuery();
|
||||
// pipelineQuery.setPipelineState(2);
|
||||
// List<String> list = new ArrayList<>();
|
||||
// List<PipelineEntity> pipelineList = pipelineDao.findPipelineList(pipelineQuery);
|
||||
// if (pipelineList.isEmpty()){
|
||||
// resourcesDetails.setList(list);
|
||||
// break;
|
||||
// }
|
||||
// for (PipelineEntity pipelineEntity : pipelineList) {
|
||||
// list.add(pipelineEntity.getName());
|
||||
// }
|
||||
// resourcesDetails.setList(list);
|
||||
// }
|
||||
// }
|
||||
// return resourcesDetails;
|
||||
return null;
|
||||
}
|
||||
|
||||
public double findDirSize(String dir){
|
||||
File file = new File(dir);
|
||||
if (!file.exists()){
|
||||
return 0;
|
||||
}
|
||||
long bytes = FileUtils.sizeOfDirectory(file);
|
||||
return Math.round((float) (((bytes / 1024) / 1024) * 100) /1024)/100.0 ;
|
||||
public Double findDirSize(String dir){
|
||||
// File file = new File(dir);
|
||||
// if (!file.exists()){
|
||||
// return 0;
|
||||
// }
|
||||
// long bytes = FileUtils.sizeOfDirectory(file);
|
||||
// return Math.round((float) (((bytes / 1024) / 1024) * 100) /1024)/100.0 ;
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文件大小
|
||||
* @return 文件大小,保留两位小数点
|
||||
*/
|
||||
public double getSize() {
|
||||
String codeAddress = utilService.instanceAddress(1);
|
||||
String logAddress = utilService.instanceAddress(2);
|
||||
File codeFile = new File(codeAddress);
|
||||
public Double getSize() {
|
||||
// String codeAddress = utilService.instanceAddress(1);
|
||||
// String logAddress = utilService.instanceAddress(2);
|
||||
// File codeFile = new File(codeAddress);
|
||||
//
|
||||
// if (!codeFile.exists()){
|
||||
// return 0;
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
// long codeBytes = FileUtils.sizeOfDirectory(codeFile);
|
||||
//
|
||||
// double codeSize = Math.round((float) (((codeBytes / 1024) / 1024) * 100) /1024)/100.0 ;
|
||||
//
|
||||
// File logFile = new File(logAddress);
|
||||
// if (!logFile.exists()){
|
||||
// return codeSize;
|
||||
// }
|
||||
//
|
||||
// long logBytes = FileUtils.sizeOfDirectory(logFile);
|
||||
// double logSize = Math.round((float) (((logBytes / 1024) / 1024) * 100) /1024)/100.0 ;
|
||||
// return codeSize + logSize;
|
||||
return null;
|
||||
|
||||
if (!codeFile.exists()){
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
long codeBytes = FileUtils.sizeOfDirectory(codeFile);
|
||||
|
||||
double codeSize = Math.round((float) (((codeBytes / 1024) / 1024) * 100) /1024)/100.0 ;
|
||||
|
||||
File logFile = new File(logAddress);
|
||||
if (!logFile.exists()){
|
||||
return codeSize;
|
||||
}
|
||||
|
||||
long logBytes = FileUtils.sizeOfDirectory(logFile);
|
||||
double logSize = Math.round((float) (((logBytes / 1024) / 1024) * 100) /1024)/100.0 ;
|
||||
return codeSize + logSize;
|
||||
}
|
||||
|
||||
|
||||
|
@ -3,6 +3,7 @@ package cd.casic.module.process.process.setting.impl;
|
||||
|
||||
import cd.casic.ci.commons.bean.process.setting.Scm;
|
||||
import cd.casic.ci.commons.bean.process.setting.ScmQuery;
|
||||
import cd.casic.framework.commons.pojo.PageResult;
|
||||
import cd.casic.module.process.process.setting.ScmService;
|
||||
import cd.casic.module.process.process.setting.dao.ScmDao;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -22,84 +23,91 @@ public class ScmServiceImpl implements ScmService {
|
||||
@Override
|
||||
public String createPipelineScm(Scm scm) {
|
||||
|
||||
String scmType = scm.getScmType();
|
||||
String scmAddress = scm.getScmAddress();
|
||||
String jdkAddress = PipelineUtil.validFile(scmAddress, scmType);
|
||||
|
||||
ScmEntity scmEntity = BeanMapper.map(scm, ScmEntity.class);
|
||||
return scmDao.createPipelineScm(scmEntity);
|
||||
// String scmType = scm.getScmType();
|
||||
// String scmAddress = scm.getScmAddress();
|
||||
// String jdkAddress = PipelineUtil.validFile(scmAddress, scmType);
|
||||
//
|
||||
// ScmEntity scmEntity = BeanMapper.map(scm, ScmEntity.class);
|
||||
// return scmDao.createPipelineScm(scmEntity);
|
||||
return null;
|
||||
}
|
||||
|
||||
//删除
|
||||
@Override
|
||||
public void deletePipelineScm(String pathId) {
|
||||
scmDao.deletePipelineScm(pathId);
|
||||
// scmDao.deletePipelineScm(pathId);
|
||||
}
|
||||
|
||||
//更新
|
||||
@Override
|
||||
public void updatePipelineScm(Scm scm) {
|
||||
|
||||
String scmType = scm.getScmType();
|
||||
String scmAddress = scm.getScmAddress();
|
||||
PipelineUtil.validFile(scmAddress, scmType);
|
||||
if (scmType.equals(TASK_TOOL_TYPE_NODEJS)) {
|
||||
PipelineUtil.validFile(scmAddress, TASK_TOOL_TYPE_NPM);
|
||||
}
|
||||
|
||||
if (scm.getScmId()==null || findOnePipelineScm(scm.getScmId())==null){
|
||||
createPipelineScm(scm);
|
||||
return;
|
||||
}
|
||||
scmDao.updatePipelineScm(BeanMapper.map(scm, ScmEntity.class));
|
||||
// String scmType = scm.getScmType();
|
||||
// String scmAddress = scm.getScmAddress();
|
||||
// PipelineUtil.validFile(scmAddress, scmType);
|
||||
// if (scmType.equals(TASK_TOOL_TYPE_NODEJS)) {
|
||||
// PipelineUtil.validFile(scmAddress, TASK_TOOL_TYPE_NPM);
|
||||
// }
|
||||
//
|
||||
// if (scm.getScmId()==null || findOnePipelineScm(scm.getScmId())==null){
|
||||
// createPipelineScm(scm);
|
||||
// return;
|
||||
// }
|
||||
// scmDao.updatePipelineScm(BeanMapper.map(scm, ScmEntity.class));
|
||||
}
|
||||
|
||||
//查询
|
||||
@Override
|
||||
public Scm findOnePipelineScm(String pathId) {
|
||||
ScmEntity scmEntity = scmDao.findOnePipelineScm(pathId);
|
||||
return BeanMapper.map(scmEntity, Scm.class);
|
||||
// ScmEntity scmEntity = scmDao.findOnePipelineScm(pathId);
|
||||
// return BeanMapper.map(scmEntity, Scm.class);
|
||||
return null;
|
||||
}
|
||||
|
||||
//查询所有
|
||||
@Override
|
||||
public List<Scm> findAllPipelineScm() {
|
||||
List<ScmEntity> scmEntityList = scmDao.findAllPipelineScm();
|
||||
// scmEntityList.sort(Comparator.comparing(ScmEntity::getCreateTime));
|
||||
scmEntityList.sort(Comparator.comparing(ScmEntity::getScmType));
|
||||
return BeanMapper.mapList(scmEntityList, Scm.class);
|
||||
// List<ScmEntity> scmEntityList = scmDao.findAllPipelineScm();
|
||||
// // scmEntityList.sort(Comparator.comparing(ScmEntity::getCreateTime));
|
||||
// scmEntityList.sort(Comparator.comparing(ScmEntity::getScmType));
|
||||
// return BeanMapper.mapList(scmEntityList, Scm.class);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Scm> findPipelineScmList(List<String> idList) {
|
||||
List<ScmEntity> scmEntityList = scmDao.findPipelineScmList(idList);
|
||||
return BeanMapper.mapList(scmEntityList, Scm.class);
|
||||
// List<ScmEntity> scmEntityList = scmDao.findPipelineScmList(idList);
|
||||
// return BeanMapper.mapList(scmEntityList, Scm.class);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Scm> findPipelineScmList(ScmQuery scmQuery) {
|
||||
List<ScmEntity> scmEntityList = scmDao.findPipelineScmList(scmQuery);
|
||||
if (Objects.isNull(scmEntityList) || scmEntityList.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return BeanMapper.mapList(scmEntityList, Scm.class);
|
||||
// List<ScmEntity> scmEntityList = scmDao.findPipelineScmList(scmQuery);
|
||||
// if (Objects.isNull(scmEntityList) || scmEntityList.isEmpty()) {
|
||||
// return Collections.emptyList();
|
||||
// }
|
||||
// return BeanMapper.mapList(scmEntityList, Scm.class);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Pagination<Scm> findPipelineScmPage(ScmQuery scmQuery) {
|
||||
Pagination<ScmEntity> scmEntityPage = scmDao.findPipelineScmPage(scmQuery);
|
||||
List<ScmEntity> scmEntityList = scmEntityPage.getDataList();
|
||||
if (Objects.isNull(scmEntityList) || scmEntityList.isEmpty()) {
|
||||
return PaginationBuilder.build(scmEntityPage, Collections.emptyList());
|
||||
}
|
||||
List<Scm> scmList = BeanMapper.mapList(scmEntityList, Scm.class);
|
||||
return PaginationBuilder.build(scmEntityPage, scmList);
|
||||
// @Override
|
||||
public PageResult<Scm> findPipelineScmPage(ScmQuery scmQuery) {
|
||||
// Pagination<ScmEntity> scmEntityPage = scmDao.findPipelineScmPage(scmQuery);
|
||||
// List<ScmEntity> scmEntityList = scmEntityPage.getDataList();
|
||||
// if (Objects.isNull(scmEntityList) || scmEntityList.isEmpty()) {
|
||||
// return PaginationBuilder.build(scmEntityPage, Collections.emptyList());
|
||||
// }
|
||||
// List<Scm> scmList = BeanMapper.mapList(scmEntityList, Scm.class);
|
||||
// return PaginationBuilder.build(scmEntityPage, scmList);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer findScmNumber() {
|
||||
return scmDao.findScmNumber();
|
||||
// return scmDao.findScmNumber();
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package cd.casic.module.process.process.setting.impl;
|
||||
|
||||
import cd.casic.ci.commons.bean.process.setting.SystemMassage;
|
||||
import cd.casic.module.process.process.setting.SystemMassageService;
|
||||
import cd.casic.module.process.support.util.PipelineUtilService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
@ -27,8 +27,8 @@ public class StageDo extends BaseDO {
|
||||
//阶段名称
|
||||
private String stageName;
|
||||
|
||||
//创建配置时间
|
||||
private String createTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
|
||||
//创建配置时间 TODO 和超类冲突
|
||||
// private String createTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
|
||||
|
||||
//流水线
|
||||
private String pipelineId;
|
||||
|
@ -0,0 +1,76 @@
|
||||
package cd.casic.module.process.support.agent.service;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
import cd.casic.ci.commons.bean.work.agent.model.Agent;
|
||||
import cd.casic.ci.commons.bean.work.agent.AgentQuery;
|
||||
import cd.casic.framework.commons.pojo.PageResult;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface AgentService {
|
||||
|
||||
/**
|
||||
* 初始化默认环境
|
||||
* @param agent 环境
|
||||
*/
|
||||
void initAgent(Agent agent) ;
|
||||
|
||||
/**
|
||||
* 创建环境
|
||||
* @param agent 环境信息
|
||||
* @return ID
|
||||
*/
|
||||
String createAgent(Agent agent) ;
|
||||
|
||||
/**
|
||||
* 更新环境
|
||||
* @param agent 环境信息
|
||||
*/
|
||||
void updateAgent(Agent agent);
|
||||
|
||||
/**
|
||||
* 获取默认执行环境
|
||||
* @return 执行环境
|
||||
*/
|
||||
Agent findDefaultAgent();
|
||||
|
||||
/**
|
||||
* 更新默认的执行环境
|
||||
* @param id 更新ID
|
||||
*/
|
||||
void updateDefaultAgent(String id);
|
||||
|
||||
/**
|
||||
* 删除环境
|
||||
* @param id 环境ID
|
||||
*/
|
||||
void deleteAgent(String id);
|
||||
|
||||
/**
|
||||
* 查询流水线执行环境
|
||||
* @param id 环境ID
|
||||
* @return 环境
|
||||
*/
|
||||
Agent findAgent(String id);
|
||||
|
||||
/**
|
||||
* 条件查询环流水线执行环境
|
||||
* @param agentQuery 条件
|
||||
* @return 执行环境列表
|
||||
*/
|
||||
List<Agent> findAgentList(AgentQuery agentQuery) ;
|
||||
|
||||
/**
|
||||
* 分页条件查询环流水线执行环境
|
||||
* @param agentQuery 条件
|
||||
* @return 执行环境列表
|
||||
*/
|
||||
PageResult<Agent> findAgentPage(AgentQuery agentQuery);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
package cd.casic.module.process.support.disk.model;
|
||||
|
||||
public class Disk {
|
||||
|
||||
private String name;
|
||||
|
||||
private String dirSize;
|
||||
|
||||
private String diskSize;
|
||||
|
||||
private String userSize;
|
||||
|
||||
private String path;
|
||||
|
||||
private String filePath;
|
||||
|
||||
public String getFilePath() {
|
||||
return filePath;
|
||||
}
|
||||
|
||||
public Disk setFilePath(String filePath) {
|
||||
this.filePath = filePath;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getPath() {
|
||||
return path;
|
||||
}
|
||||
|
||||
public Disk setPath(String path) {
|
||||
this.path = path;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public Disk setName(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDirSize() {
|
||||
return dirSize;
|
||||
}
|
||||
|
||||
public Disk setDirSize(String dirSize) {
|
||||
this.dirSize = dirSize;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDiskSize() {
|
||||
return diskSize;
|
||||
}
|
||||
|
||||
public Disk setDiskSize(String diskSize) {
|
||||
this.diskSize = diskSize;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getUserSize() {
|
||||
return userSize;
|
||||
}
|
||||
|
||||
public Disk setUserSize(String userSize) {
|
||||
this.userSize = userSize;
|
||||
return this;
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package cd.casic.module.process.support.disk.service;
|
||||
|
||||
|
||||
|
||||
import cd.casic.module.process.support.disk.model.Disk;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface DiskService {
|
||||
|
||||
|
||||
Boolean deleteDisk(String pipelineId);
|
||||
|
||||
|
||||
void validationStorageSpace();
|
||||
|
||||
|
||||
List<Disk> findDiskList();
|
||||
|
||||
|
||||
void cleanDisk(String fileList);
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package cd.casic.module.process.support.home;
|
||||
|
||||
public interface PipelineVersionService {
|
||||
|
||||
/**
|
||||
* 获取当前系统版本
|
||||
* @return 系统版本 false.免费 true.付费
|
||||
*/
|
||||
Boolean isVip();
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package cd.casic.module.process.support.util;
|
||||
|
||||
import cd.casic.framework.commons.exception.ServiceException;
|
||||
|
||||
|
||||
public interface PipelineUtilService {
|
||||
|
||||
/**
|
||||
* 获取当前用户存储空间地址
|
||||
* @param type 获取类型 1.源文件 2.日志文件
|
||||
* @return 地址
|
||||
*/
|
||||
String instanceAddress(int type);
|
||||
|
||||
|
||||
/**
|
||||
* 获取流水线默认位置
|
||||
* @param pipelineId 流水线id
|
||||
* @param type 获取类型 1.源文件 2.日志文件
|
||||
* @return 地址
|
||||
*/
|
||||
String findPipelineDefaultAddress(String pipelineId,int type);
|
||||
|
||||
/**
|
||||
* 配置指定位置文件
|
||||
* @param pipelineId 流水线id
|
||||
* @param regex 匹配规则
|
||||
* @return 文件地址
|
||||
*/
|
||||
String findFile(String pipelineId,String fileDir, String regex) throws ServiceException;
|
||||
|
||||
|
||||
/**
|
||||
* 获取Java安装位置
|
||||
* @return Java安装位置
|
||||
*/
|
||||
String findJavaPath();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,220 @@
|
||||
package cd.casic.module.process.support.util.util;
|
||||
|
||||
public class PipelineFinal {
|
||||
|
||||
/**
|
||||
* 项目名称
|
||||
*/
|
||||
public static final String appName = "arbess";
|
||||
|
||||
/**
|
||||
* DEFAULT
|
||||
*/
|
||||
public static final String DEFAULT = "default";
|
||||
|
||||
/**
|
||||
* 流水线文件系统
|
||||
*/
|
||||
public static final String MATFLOW_WORKSPACE = "/source";
|
||||
|
||||
public static final String MATFLOW_LOGS = "/artifact";
|
||||
|
||||
|
||||
/**
|
||||
* 流水线运行状态
|
||||
*/
|
||||
//流水线运行状态
|
||||
public static final String RUN_SUCCESS = "success";
|
||||
|
||||
public static final String RUN_ERROR = "error";
|
||||
|
||||
public static final String RUN_WAIT = "wait";
|
||||
|
||||
public static final String RUN_HALT = "halt";
|
||||
|
||||
public static final String RUN_RUN = "run";
|
||||
|
||||
public static final String RUN_SUSPEND = "suspend";
|
||||
|
||||
|
||||
/**
|
||||
* 系统编码
|
||||
*/
|
||||
//字节编码
|
||||
public static final String UTF_8 = "UTF-8";
|
||||
|
||||
public static final String GBK = "GBK";
|
||||
|
||||
|
||||
/**
|
||||
* 消息
|
||||
*/
|
||||
//消息发送类型
|
||||
public static final String MES_PIPELINE_RUN = "PIPELINE_RUN";
|
||||
|
||||
//消息发送方式
|
||||
public static final String MES_SEND_SITE = "site";
|
||||
public static final String MES_SEND_EMAIL = "email";
|
||||
public static final String MES_SEND_DINGDING = "dingding";
|
||||
public static final String MES_SEND_WECHAT = "qywechat";
|
||||
public static final String MES_SEND_SMS = "sms";
|
||||
|
||||
//消息通知方案
|
||||
public static final String MES_UPDATE = "MF_MES_TYPE_UPDATE";
|
||||
public static final String MES_DELETE = "MF_MES_TYPE_DELETE";
|
||||
public static final String MES_CREATE = "MF_MES_TYPE_CREATE";
|
||||
public static final String MES_RUN = "MF_MES_TYPE_RUN";
|
||||
|
||||
|
||||
// 日志类型
|
||||
public static final String LOG_TYPE_CREATE = "MF_LOG_TYPE_CREATE";
|
||||
|
||||
public static final String LOG_TYPE_DELETE = "MF_LOG_TYPE_DELETE";
|
||||
|
||||
public static final String LOG_TYPE_UPDATE = "MF_LOG_TYPE_UPDATE";
|
||||
|
||||
public static final String LOG_TYPE_RUN = "MF_LOG_TYPE_RUN";
|
||||
|
||||
|
||||
public static final String CREATE_LINK = "/pipeline/${pipelineId}/config";
|
||||
|
||||
public static final String DELETE_LINK = "/pipeline/${pipelineId}/delete";
|
||||
|
||||
public static final String UPDATE_LINK = "/pipeline/${pipelineId}/set/info";
|
||||
|
||||
public static final String RUN_LINK = "/pipeline/${pipelineId}/history/${instanceId}";
|
||||
|
||||
|
||||
/**
|
||||
* 构建产物信息
|
||||
*/
|
||||
// 默认制品地址
|
||||
public static final String PROJECT_DEFAULT_ADDRESS = "${PROJECT_DEFAULT_ADDRESS}";
|
||||
|
||||
public static final String DEFAULT_ARTIFACT_ADDRESS = "DEFAULT_ARTIFACT_ADDRESS";
|
||||
|
||||
// 默认制品
|
||||
public static final String DEFAULT_ARTIFACT_NAME = "DEFAULT_ARTIFACT_NAME";
|
||||
|
||||
// Docker制品
|
||||
public static final String DEFAULT_ARTIFACT_DOCKER = "DEFAULT_ARTIFACT_DOCKER";
|
||||
|
||||
// Docker名称
|
||||
public static final String DEFAULT_ARTIFACT_DOCKER_NAME = "DEFAULT_ARTIFACT_DOCKER_NAME";
|
||||
|
||||
|
||||
// 默认源码位置
|
||||
public static final String DEFAULT_CODE_ADDRESS = "${DEFAULT_CODE_ADDRESS}";
|
||||
|
||||
public static final String DEFAULT_TYPE = "string";
|
||||
|
||||
/**
|
||||
* 默认命令
|
||||
*/
|
||||
public static final String TEST_DEFAULT_ORDER = "mvn test";
|
||||
public static final String MAVEN_DEFAULT_ORDER = "mvn clean package";
|
||||
public static final String NODE_DEFAULT_ORDER = "npm install";
|
||||
public static final String DOCKER_DEFAULT_ORDER = "docker image build -t default .";
|
||||
|
||||
/**
|
||||
* 文件信息
|
||||
*/
|
||||
public static final String FILE_TEMP_PREFIX = "temp";
|
||||
public static final String FILE_TYPE_TXT = ".txt";
|
||||
public static final String FILE_TYPE_SH = ".sh";
|
||||
public static final String FILE_TYPE_BAT = ".bat";
|
||||
|
||||
/**
|
||||
* 系统任务类型
|
||||
*/
|
||||
|
||||
// 源码应用类型
|
||||
public static final String TASK_TYPE_CODE = "code";
|
||||
public static final String TASK_CODE_GIT = "git";
|
||||
public static final String TASK_CODE_GITLAB = "gitlab";
|
||||
public static final String TASK_CODE_GITHUB = "github";
|
||||
public static final String TASK_CODE_GITEE = "gitee";
|
||||
public static final String TASK_CODE_SVN = "svn";
|
||||
public static final String TASK_CODE_XCODE = "gitpuk";
|
||||
public static final String TASK_CODE_DEFAULT_BRANCH = "master";
|
||||
|
||||
|
||||
// 构建应用类型
|
||||
public static final String TASK_TYPE_BUILD = "build";
|
||||
public static final String TASK_BUILD_MAVEN = "maven";
|
||||
public static final String TASK_BUILD_NODEJS = "nodejs";
|
||||
|
||||
public static final String TASK_BUILD_DOCKER = "build_docker";
|
||||
|
||||
|
||||
// 测试应用类型
|
||||
public static final String TASK_TYPE_TEST = "test";
|
||||
public static final String TASK_TEST_MAVENTEST = "maventest";
|
||||
public static final String TASK_TEST_TESTON = "testhubo";
|
||||
|
||||
|
||||
// 部署应用类型
|
||||
public static final String TASK_TYPE_DEPLOY = "deploy";
|
||||
public static final String TASK_DEPLOY_LINUX = "liunx";
|
||||
public static final String TASK_DEPLOY_DOCKER = "docker";
|
||||
public static final String TASK_DEPLOY_K8S = "k8s";
|
||||
|
||||
|
||||
// 推送制品应用类型
|
||||
public static final String TASK_TYPE_ARTIFACT = "artifact";
|
||||
public static final String TASK_ARTIFACT_MAVEN = "artifact_maven";
|
||||
public static final String TASK_ARTIFACT_NODEJS = "artifact_nodejs";
|
||||
public static final String TASK_ARTIFACT_DOCKER = "artifact_docker";
|
||||
|
||||
|
||||
// 制品拉取应用类型
|
||||
public static final String TASK_TYPE_PULL = "pull";
|
||||
public static final String TASK_PULL_MAVEN = "pull_maven";
|
||||
public static final String TASK_PULL_NODEJS = "pull_nodejs";
|
||||
public static final String TASK_PULL_DOCKER = "pull_docker";
|
||||
|
||||
// 制品推送应用方式
|
||||
public static final String TASK_ARTIFACT_XPACK = "hadess";
|
||||
public static final String TASK_ARTIFACT_SSH = "ssh";
|
||||
public static final String TASK_ARTIFACT_NEXUS = "nexus";
|
||||
|
||||
// 代码扫描应用类型
|
||||
public static final String TASK_TYPE_CODESCAN = "codescan";
|
||||
public static final String TASK_CODESCAN_SONAR = "sonar";
|
||||
public static final String TASK_CODESCAN_SPOTBUGS = "spotbugs";
|
||||
|
||||
// 消息应用类型
|
||||
public static final String TASK_TYPE_MESSAGE = "message";
|
||||
public static final String TASK_MESSAGE_MSG = "message";
|
||||
|
||||
// 脚本应用类型
|
||||
public static final String TASK_TYPE_SCRIPT = "script";
|
||||
public static final String TASK_SCRIPT_SHELL = "shell";
|
||||
public static final String TASK_SCRIPT_BAT = "bat";
|
||||
|
||||
|
||||
//触发器
|
||||
public static final String TRIGGER_SCHEDULED = "scheduled";
|
||||
|
||||
|
||||
public static final String SIZE_TYPE_MB = "MB";
|
||||
|
||||
public static final int DEFAULT_SIZE = 2;
|
||||
|
||||
|
||||
public static final String SIZE_TYPE_GB = "GB";
|
||||
|
||||
|
||||
public static final Integer DEFAULT_CLEAN_CACHE_DAY = 7;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
package cd.casic.module.process.task.build.model;
|
||||
|
||||
|
||||
|
||||
// TODO
|
||||
//@ApiModel
|
||||
//@Join
|
||||
//@Mapper
|
||||
public class TaskBuildProduct {
|
||||
|
||||
|
||||
//@ApiProperty(name = "taskId",desc = "id")
|
||||
private String id;
|
||||
|
||||
//地址
|
||||
//@ApiProperty(name = "type",desc = "类型")
|
||||
private String type;
|
||||
|
||||
//@ApiProperty(name = "key",desc = "key")
|
||||
private String key;
|
||||
|
||||
//@ApiProperty(name = "value",desc = "值")
|
||||
private String value;
|
||||
|
||||
//分支
|
||||
//@ApiProperty(name = "instanceId",desc = "实例id")
|
||||
private String instanceId;
|
||||
|
||||
public TaskBuildProduct() {
|
||||
}
|
||||
|
||||
public TaskBuildProduct(String instanceId) {
|
||||
this.instanceId = instanceId;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public void setKey(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getInstanceId() {
|
||||
return instanceId;
|
||||
}
|
||||
|
||||
public void setInstanceId(String instanceId) {
|
||||
this.instanceId = instanceId;
|
||||
}
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
package cd.casic.module.process.task.build.model;
|
||||
|
||||
|
||||
|
||||
public class TaskBuildProductQuery {
|
||||
|
||||
//地址
|
||||
//@ApiProperty(name = "type",desc = "类型")
|
||||
private String type;
|
||||
|
||||
//@ApiProperty(name = "key",desc = "key")
|
||||
private String key;
|
||||
|
||||
//@ApiProperty(name = "value",desc = "值")
|
||||
private String value;
|
||||
|
||||
//分支
|
||||
//@ApiProperty(name = "instanceId",desc = "实例id")
|
||||
private String instanceId;
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public TaskBuildProductQuery setType(String type) {
|
||||
this.type = type;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public TaskBuildProductQuery setKey(String key) {
|
||||
this.key = key;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public TaskBuildProductQuery setValue(String value) {
|
||||
this.value = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getInstanceId() {
|
||||
return instanceId;
|
||||
}
|
||||
|
||||
public TaskBuildProductQuery setInstanceId(String instanceId) {
|
||||
this.instanceId = instanceId;
|
||||
return this;
|
||||
}
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package cd.casic.module.process.task.build.service;
|
||||
|
||||
|
||||
|
||||
import cd.casic.module.process.task.build.model.TaskBuildProduct;
|
||||
import cd.casic.module.process.task.build.model.TaskBuildProductQuery;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface TaskBuildProductService {
|
||||
|
||||
|
||||
String createBuildProduct(TaskBuildProduct taskBuildProduct);
|
||||
|
||||
|
||||
void updateBuildProduct(TaskBuildProduct taskBuildProduct);
|
||||
|
||||
|
||||
void deleteBuildProduct(String id);
|
||||
|
||||
|
||||
TaskBuildProduct findOneBuildProduct(String id);
|
||||
|
||||
|
||||
List<TaskBuildProduct> findAllBuildProduct();
|
||||
|
||||
List<TaskBuildProduct> findBuildProductList(TaskBuildProductQuery taskBuildProductQuery);
|
||||
|
||||
|
||||
String replace(String instanceId,String strings);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
package cd.casic.module.process.toolkit.join;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface JoinOperation {
|
||||
<T> void joinQuery(T var1);
|
||||
|
||||
<T> void joinQuery(List<T> var1);
|
||||
|
||||
<T> void joinQuery(List<T> var1, String[] var2);
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
package cd.casic.module.process.toolkit.join;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface JoinTemplate extends JoinOperation{
|
||||
<T> void joinQuery(T data);
|
||||
|
||||
<T> void joinQuery(List<T> dataList);
|
||||
|
||||
<T> void joinQuery(List<T> dataList, String[] includeFields);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user