Merge branch 'temp' of http://1.14.125.6:3000/mianbin/ops-pro into temp
# Conflicts: # modules/module-ci-process-biz/src/main/java/cd/casic/ci/process/process/service/stage/impl/StageServiceImpl.java # modules/module-ci-process-biz/src/main/java/cd/casic/ci/process/process/service/task/impl/TaskServiceImpl.java
This commit is contained in:
commit
b01ea03838
@ -0,0 +1,143 @@
|
|||||||
|
package cd.casic.ci.common.pipeline.req.pipeline;
|
||||||
|
|
||||||
|
import cd.casic.ci.common.pipeline.req.resource.ResourceReq;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName PipelineReq
|
||||||
|
* @Author hopeli
|
||||||
|
* @Date 2025/5/10 10:53
|
||||||
|
* @Version 1.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class PipelineCreateReq {
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
private String userId;
|
||||||
|
|
||||||
|
private String envId;
|
||||||
|
|
||||||
|
private String groupId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @pi.name:createTime
|
||||||
|
* @pi.dataType:string
|
||||||
|
* @pi.desc:流水线创建时间
|
||||||
|
* @pi.value:createTime
|
||||||
|
*/
|
||||||
|
private String createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @pi.name:type
|
||||||
|
* @pi.dataType:Integer
|
||||||
|
* @pi.desc:流水线类型 1.多任务 2.多阶段
|
||||||
|
* @pi.value: 1
|
||||||
|
*/
|
||||||
|
private int type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @pi.name:state
|
||||||
|
* @pi.dataType:Integer
|
||||||
|
* @pi.desc:运行状态 1.未运行 2.运行中
|
||||||
|
* @pi.value:1
|
||||||
|
*/
|
||||||
|
private int state;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @pi.name:power
|
||||||
|
* @pi.dataType:Integer
|
||||||
|
* @pi.desc:项目作用域 1.全局 2.项目
|
||||||
|
* @pi.value:1
|
||||||
|
*/
|
||||||
|
private int power;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @pi.name:color
|
||||||
|
* @pi.dataType:Integer
|
||||||
|
* @pi.desc:颜色 1~5随机生成
|
||||||
|
* @pi.value:2
|
||||||
|
*/
|
||||||
|
private int color;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @pi.name:template
|
||||||
|
* @pi.dataType:string
|
||||||
|
* @pi.desc:流水线模板
|
||||||
|
* @pi.value:template
|
||||||
|
*/
|
||||||
|
private String templateId;
|
||||||
|
|
||||||
|
private String targetId;
|
||||||
|
|
||||||
|
private String targetType;
|
||||||
|
|
||||||
|
private String pipelineTag;
|
||||||
|
|
||||||
|
private String resourceId;
|
||||||
|
|
||||||
|
private String remake;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @pi.name:collect
|
||||||
|
* @pi.dataType:Integer
|
||||||
|
* @pi.desc:收藏 0.未收藏 1.收藏
|
||||||
|
* @pi.value:2
|
||||||
|
*/
|
||||||
|
private int collect;
|
||||||
|
|
||||||
|
|
||||||
|
// // 以下为统计信息
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * @pi.model:execUser
|
||||||
|
// * @pi.desc:用户(执行人)
|
||||||
|
// */
|
||||||
|
// private User execUser;
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * @pi.name:number
|
||||||
|
// * @pi.dataType:Integer
|
||||||
|
// * @pi.desc:执行次数
|
||||||
|
// * @pi.value:2
|
||||||
|
// */
|
||||||
|
// private Integer number;
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * @pi.name:instanceId
|
||||||
|
// * @pi.dataType:string
|
||||||
|
// * @pi.desc:实例id
|
||||||
|
// * @pi.value:instanceId
|
||||||
|
// */
|
||||||
|
// private String instanceId;
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * @pi.name:buildStatus
|
||||||
|
// * @pi.dataType:string
|
||||||
|
// * @pi.desc:最近构建状态
|
||||||
|
// * @pi.value:buildStatus
|
||||||
|
// */
|
||||||
|
// private String buildStatus;
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * @pi.name:lastBuildTime
|
||||||
|
// * @pi.dataType:string
|
||||||
|
// * @pi.desc:最近构建时间
|
||||||
|
// * @pi.value:lastBuildTime
|
||||||
|
// */
|
||||||
|
// private String lastBuildTime;
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * @pi.name:isExec
|
||||||
|
// * @pi.dataType:boolean
|
||||||
|
// * @pi.desc:是否可以执行
|
||||||
|
// * @pi.value:true
|
||||||
|
// */
|
||||||
|
// private Boolean isExec;
|
||||||
|
private ResourceReq resourceReq;
|
||||||
|
}
|
@ -1,7 +1,5 @@
|
|||||||
package cd.casic.ci.common.pipeline.req.pipeline;
|
package cd.casic.ci.common.pipeline.req.pipeline;
|
||||||
|
|
||||||
import cd.casic.framework.commons.dataobject.Group;
|
|
||||||
import cd.casic.framework.commons.dataobject.User;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -14,32 +12,13 @@ import lombok.Data;
|
|||||||
public class PipelineReq {
|
public class PipelineReq {
|
||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
/**
|
|
||||||
* @pi.name:name
|
|
||||||
* @pi.dataType:string
|
|
||||||
* @pi.desc:流水线名称
|
|
||||||
* @pi.value:name
|
|
||||||
*/
|
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
/**
|
|
||||||
* @pi.model:User
|
|
||||||
* @pi.desc:用户
|
|
||||||
*/
|
|
||||||
private String userId;
|
private String userId;
|
||||||
|
|
||||||
|
private String envId;
|
||||||
|
|
||||||
/**
|
private String groupId;
|
||||||
* @pi.model:Env
|
|
||||||
* @pi.desc:流水线环境
|
|
||||||
*/
|
|
||||||
private String env;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @pi.model:Env
|
|
||||||
* @pi.desc:流水线组
|
|
||||||
*/
|
|
||||||
private Group group;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @pi.name:createTime
|
* @pi.name:createTime
|
||||||
@ -87,7 +66,17 @@ public class PipelineReq {
|
|||||||
* @pi.desc:流水线模板
|
* @pi.desc:流水线模板
|
||||||
* @pi.value:template
|
* @pi.value:template
|
||||||
*/
|
*/
|
||||||
private String template;
|
private String templateId;
|
||||||
|
|
||||||
|
private String targetId;
|
||||||
|
|
||||||
|
private String targetType;
|
||||||
|
|
||||||
|
private String pipelineTag;
|
||||||
|
|
||||||
|
private String resourceId;
|
||||||
|
|
||||||
|
private String remake;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @pi.name:collect
|
* @pi.name:collect
|
||||||
@ -98,55 +87,55 @@ public class PipelineReq {
|
|||||||
private int collect;
|
private int collect;
|
||||||
|
|
||||||
|
|
||||||
// 以下为统计信息
|
// // 以下为统计信息
|
||||||
|
//
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* @pi.model:execUser
|
// * @pi.model:execUser
|
||||||
* @pi.desc:用户(执行人)
|
// * @pi.desc:用户(执行人)
|
||||||
*/
|
// */
|
||||||
private User execUser;
|
// private User execUser;
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* @pi.name:number
|
// * @pi.name:number
|
||||||
* @pi.dataType:Integer
|
// * @pi.dataType:Integer
|
||||||
* @pi.desc:执行次数
|
// * @pi.desc:执行次数
|
||||||
* @pi.value:2
|
// * @pi.value:2
|
||||||
*/
|
// */
|
||||||
private Integer number;
|
// private Integer number;
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* @pi.name:instanceId
|
// * @pi.name:instanceId
|
||||||
* @pi.dataType:string
|
// * @pi.dataType:string
|
||||||
* @pi.desc:实例id
|
// * @pi.desc:实例id
|
||||||
* @pi.value:instanceId
|
// * @pi.value:instanceId
|
||||||
*/
|
// */
|
||||||
private String instanceId;
|
// private String instanceId;
|
||||||
|
//
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* @pi.name:buildStatus
|
// * @pi.name:buildStatus
|
||||||
* @pi.dataType:string
|
// * @pi.dataType:string
|
||||||
* @pi.desc:最近构建状态
|
// * @pi.desc:最近构建状态
|
||||||
* @pi.value:buildStatus
|
// * @pi.value:buildStatus
|
||||||
*/
|
// */
|
||||||
private String buildStatus;
|
// private String buildStatus;
|
||||||
|
//
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* @pi.name:lastBuildTime
|
// * @pi.name:lastBuildTime
|
||||||
* @pi.dataType:string
|
// * @pi.dataType:string
|
||||||
* @pi.desc:最近构建时间
|
// * @pi.desc:最近构建时间
|
||||||
* @pi.value:lastBuildTime
|
// * @pi.value:lastBuildTime
|
||||||
*/
|
// */
|
||||||
private String lastBuildTime;
|
// private String lastBuildTime;
|
||||||
|
//
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* @pi.name:isExec
|
// * @pi.name:isExec
|
||||||
* @pi.dataType:boolean
|
// * @pi.dataType:boolean
|
||||||
* @pi.desc:是否可以执行
|
// * @pi.desc:是否可以执行
|
||||||
* @pi.value:true
|
// * @pi.value:true
|
||||||
*/
|
// */
|
||||||
private Boolean isExec;
|
// private Boolean isExec;
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,111 @@
|
|||||||
|
package cd.casic.ci.common.pipeline.req.resource;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ResourceQueryReq {
|
||||||
|
/**
|
||||||
|
* 主键id
|
||||||
|
*/
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 虚拟机类型
|
||||||
|
*/
|
||||||
|
private String vmType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 虚拟机名称
|
||||||
|
*/
|
||||||
|
private String vmName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 到期释放时间
|
||||||
|
*/
|
||||||
|
private String expirationTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数量
|
||||||
|
*/
|
||||||
|
private String sum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 平台
|
||||||
|
*/
|
||||||
|
private String platform;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cpu架构
|
||||||
|
*/
|
||||||
|
private String cpuFramework;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GPU配置状态
|
||||||
|
*/
|
||||||
|
private String gpuStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cpu内核数量
|
||||||
|
*/
|
||||||
|
private String cpuCoreSum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 内存
|
||||||
|
*/
|
||||||
|
private String internalStorage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作系统
|
||||||
|
*/
|
||||||
|
private String os;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系统盘类型
|
||||||
|
*/
|
||||||
|
private String systemDiskType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系统盘内存大小
|
||||||
|
*/
|
||||||
|
private String systemDiskInternalStorage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 管理员账号
|
||||||
|
*/
|
||||||
|
private String managerAccount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 管理员密码
|
||||||
|
*/
|
||||||
|
private String managerPassword;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 安全组
|
||||||
|
*/
|
||||||
|
private String securityGroup;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 调度策略
|
||||||
|
*/
|
||||||
|
private String schedulingPolicy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 引导方式
|
||||||
|
*/
|
||||||
|
private String bootMethod;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备份机
|
||||||
|
*/
|
||||||
|
private String backup;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 反亲和组
|
||||||
|
*/
|
||||||
|
private String antiAffinityGroup;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 流水线id
|
||||||
|
*/
|
||||||
|
private String pipelineId;
|
||||||
|
}
|
@ -0,0 +1,111 @@
|
|||||||
|
package cd.casic.ci.common.pipeline.req.resource;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ResourceReq {
|
||||||
|
/**
|
||||||
|
* 主键id
|
||||||
|
*/
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 虚拟机类型
|
||||||
|
*/
|
||||||
|
private String vmType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 虚拟机名称
|
||||||
|
*/
|
||||||
|
private String vmName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 到期释放时间
|
||||||
|
*/
|
||||||
|
private String expirationTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数量
|
||||||
|
*/
|
||||||
|
private String sum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 平台
|
||||||
|
*/
|
||||||
|
private String platform;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cpu架构
|
||||||
|
*/
|
||||||
|
private String cpuFramework;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GPU配置状态
|
||||||
|
*/
|
||||||
|
private String gpuStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cpu内核数量
|
||||||
|
*/
|
||||||
|
private String cpuCoreSum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 内存
|
||||||
|
*/
|
||||||
|
private String internalStorage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作系统
|
||||||
|
*/
|
||||||
|
private String os;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系统盘类型
|
||||||
|
*/
|
||||||
|
private String systemDiskType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系统盘内存大小
|
||||||
|
*/
|
||||||
|
private String systemDiskInternalStorage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 管理员账号
|
||||||
|
*/
|
||||||
|
private String managerAccount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 管理员密码
|
||||||
|
*/
|
||||||
|
private String managerPassword;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 安全组
|
||||||
|
*/
|
||||||
|
private String securityGroup;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 调度策略
|
||||||
|
*/
|
||||||
|
private String schedulingPolicy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 引导方式
|
||||||
|
*/
|
||||||
|
private String bootMethod;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备份机
|
||||||
|
*/
|
||||||
|
private String backup;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 反亲和组
|
||||||
|
*/
|
||||||
|
private String antiAffinityGroup;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 流水线id
|
||||||
|
*/
|
||||||
|
private String pipelineId;
|
||||||
|
}
|
@ -1,8 +1,9 @@
|
|||||||
package cd.casic.ci.common.pipeline.req.stage;
|
package cd.casic.ci.common.pipeline.req.stage;
|
||||||
|
|
||||||
import cd.casic.ci.common.pipeline.resp.task.TasksResp;
|
import cd.casic.ci.common.pipeline.req.task.TasksReq;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@ -14,7 +15,7 @@ public class StageReq {
|
|||||||
private String stageName;
|
private String stageName;
|
||||||
|
|
||||||
//@ApiProperty(name = "createTime",desc="创建时间")
|
//@ApiProperty(name = "createTime",desc="创建时间")
|
||||||
private String createTime;
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
//@ApiProperty(name="pipelineId",desc="流水线id")
|
//@ApiProperty(name="pipelineId",desc="流水线id")
|
||||||
private String pipelineId;
|
private String pipelineId;
|
||||||
@ -29,7 +30,7 @@ public class StageReq {
|
|||||||
private boolean code = false;
|
private boolean code = false;
|
||||||
|
|
||||||
//@ApiProperty(name = "taskValues",desc="阶段任务")
|
//@ApiProperty(name = "taskValues",desc="阶段任务")
|
||||||
private List<TasksResp> taskValues;
|
private List<TasksReq> taskValues;
|
||||||
|
|
||||||
//@ApiProperty(name = "stageList",desc="阶段")
|
//@ApiProperty(name = "stageList",desc="阶段")
|
||||||
private List<StageReq> stageList;
|
private List<StageReq> stageList;
|
||||||
|
@ -0,0 +1,41 @@
|
|||||||
|
package cd.casic.ci.common.pipeline.req.task;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class TasksReq {
|
||||||
|
//@ApiProperty(name="taskId",desc="配置id")
|
||||||
|
private String taskId;
|
||||||
|
|
||||||
|
//@ApiProperty(name="createTime",desc="创建时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
//@ApiProperty(name="taskType",desc= "类型1-10:源码,10-20:测试,20-30:构建,30-40:部署,40-50:代码扫描,50-60:推送制品")
|
||||||
|
private String taskType;
|
||||||
|
|
||||||
|
//@ApiProperty(name="taskSort",desc="顺序")
|
||||||
|
private int taskSort;
|
||||||
|
|
||||||
|
//@ApiProperty(name="taskName",desc="顺序")
|
||||||
|
private String taskName;
|
||||||
|
|
||||||
|
//@ApiProperty(name="values",desc="任务")
|
||||||
|
private JSONObject taskProperties;
|
||||||
|
|
||||||
|
//@ApiProperty(name="pipeline",desc="流水线id",eg="@selectOne")
|
||||||
|
private String pipelineId;
|
||||||
|
|
||||||
|
//@ApiProperty(name="postprocessId",desc="后置处理id",eg="@selectOne")
|
||||||
|
private String postprocessId;;
|
||||||
|
|
||||||
|
//@ApiProperty(name="stageId",desc="阶段",eg="@selectOne")
|
||||||
|
private String stageId;
|
||||||
|
|
||||||
|
//@ApiProperty(name="task",desc="任务",eg="@selectOne")
|
||||||
|
|
||||||
|
// 执行实例id
|
||||||
|
private String instanceId;
|
||||||
|
}
|
@ -0,0 +1,111 @@
|
|||||||
|
package cd.casic.ci.common.pipeline.resp.resource;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ResourceResp {
|
||||||
|
/**
|
||||||
|
* 主键id
|
||||||
|
*/
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 虚拟机类型
|
||||||
|
*/
|
||||||
|
private String vmType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 虚拟机名称
|
||||||
|
*/
|
||||||
|
private String vmName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 到期释放时间
|
||||||
|
*/
|
||||||
|
private String expirationTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数量
|
||||||
|
*/
|
||||||
|
private String sum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 平台
|
||||||
|
*/
|
||||||
|
private String platform;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cpu架构
|
||||||
|
*/
|
||||||
|
private String cpuFramework;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GPU配置状态
|
||||||
|
*/
|
||||||
|
private String gpuStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cpu内核数量
|
||||||
|
*/
|
||||||
|
private String cpuCoreSum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 内存
|
||||||
|
*/
|
||||||
|
private String internalStorage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作系统
|
||||||
|
*/
|
||||||
|
private String os;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系统盘类型
|
||||||
|
*/
|
||||||
|
private String systemDiskType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系统盘内存大小
|
||||||
|
*/
|
||||||
|
private String systemDiskInternalStorage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 管理员账号
|
||||||
|
*/
|
||||||
|
private String managerAccount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 管理员密码
|
||||||
|
*/
|
||||||
|
private String managerPassword;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 安全组
|
||||||
|
*/
|
||||||
|
private String securityGroup;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 调度策略
|
||||||
|
*/
|
||||||
|
private String schedulingPolicy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 引导方式
|
||||||
|
*/
|
||||||
|
private String bootMethod;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备份机
|
||||||
|
*/
|
||||||
|
private String backup;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 反亲和组
|
||||||
|
*/
|
||||||
|
private String antiAffinityGroup;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 流水线id
|
||||||
|
*/
|
||||||
|
private String pipelineId;
|
||||||
|
}
|
@ -1,16 +1,17 @@
|
|||||||
package cd.casic.ci.common.pipeline.resp.task;
|
package cd.casic.ci.common.pipeline.resp.task;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class TasksResp {
|
public class TasksResp {
|
||||||
//@ApiProperty(name="taskId",desc="配置id")
|
//@ApiProperty(name="taskId",desc="配置id")
|
||||||
private String taskId;
|
private String taskId;
|
||||||
|
|
||||||
//@ApiProperty(name="createTime",desc="创建时间")
|
//@ApiProperty(name="createTime",desc="创建时间")
|
||||||
private String createTime;
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
//@ApiProperty(name="taskType",desc= "类型1-10:源码,10-20:测试,20-30:构建,30-40:部署,40-50:代码扫描,50-60:推送制品")
|
//@ApiProperty(name="taskType",desc= "类型1-10:源码,10-20:测试,20-30:构建,30-40:部署,40-50:代码扫描,50-60:推送制品")
|
||||||
private String taskType;
|
private String taskType;
|
||||||
|
@ -0,0 +1,14 @@
|
|||||||
|
package cd.casic.ci.process.process.dal.pipeline;
|
||||||
|
|
||||||
|
import cd.casic.ci.process.process.dataObject.resource.PipResource;
|
||||||
|
import cd.casic.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author HopeLi
|
||||||
|
* @version v1.0
|
||||||
|
* @ClassName PipResourceDao
|
||||||
|
* @Date: 2025/5/13 14:39
|
||||||
|
* @Description:
|
||||||
|
*/
|
||||||
|
public interface PipResourceDao extends BaseMapperX<PipResource> {
|
||||||
|
}
|
@ -2,14 +2,87 @@ package cd.casic.ci.process.process.dataObject.pipeline;
|
|||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class PipPipeline {
|
public class PipPipeline {
|
||||||
|
/**
|
||||||
|
* 主键id
|
||||||
|
*/
|
||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 流水线名称
|
||||||
|
*/
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户id
|
||||||
|
*/
|
||||||
private String userId;
|
private String userId;
|
||||||
private String createTime;
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 流水线类型 1.多任务 2.多阶段
|
||||||
|
*/
|
||||||
private Integer type;
|
private Integer type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 运行状态 1.未运行 2.运行中
|
||||||
|
*/
|
||||||
private Integer state;
|
private Integer state;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目作用域 1.全局 2.项目
|
||||||
|
*/
|
||||||
private Integer power;
|
private Integer power;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 颜色 1~5随机生成
|
||||||
|
*/
|
||||||
private Integer color;
|
private Integer color;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 流水线模板id
|
||||||
|
*/
|
||||||
|
private String templateId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否收藏 0.未收藏/1.收藏
|
||||||
|
*/
|
||||||
|
private Integer collect;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 目标id
|
||||||
|
*/
|
||||||
|
private String targetId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 目标类型
|
||||||
|
*/
|
||||||
|
private String targetType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 流水线组id
|
||||||
|
*/
|
||||||
|
private String groupId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 资源id
|
||||||
|
*/
|
||||||
|
private String resourceId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remake;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 流水线环境
|
||||||
|
*/
|
||||||
|
private String envId;
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,111 @@
|
|||||||
|
package cd.casic.ci.process.process.dataObject.resource;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class PipResource {
|
||||||
|
/**
|
||||||
|
* 主键id
|
||||||
|
*/
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 虚拟机类型
|
||||||
|
*/
|
||||||
|
private String vmType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 虚拟机名称
|
||||||
|
*/
|
||||||
|
private String vmName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 到期释放时间
|
||||||
|
*/
|
||||||
|
private String expirationTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数量
|
||||||
|
*/
|
||||||
|
private String sum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 平台
|
||||||
|
*/
|
||||||
|
private String platform;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cpu架构
|
||||||
|
*/
|
||||||
|
private String cpuFramework;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GPU配置状态
|
||||||
|
*/
|
||||||
|
private String gpuStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cpu内核数量
|
||||||
|
*/
|
||||||
|
private String cpuCoreSum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 内存
|
||||||
|
*/
|
||||||
|
private String internalStorage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作系统
|
||||||
|
*/
|
||||||
|
private String os;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系统盘类型
|
||||||
|
*/
|
||||||
|
private String systemDiskType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系统盘内存大小
|
||||||
|
*/
|
||||||
|
private String systemDiskInternalStorage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 管理员账号
|
||||||
|
*/
|
||||||
|
private String managerAccount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 管理员密码
|
||||||
|
*/
|
||||||
|
private String managerPassword;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 安全组
|
||||||
|
*/
|
||||||
|
private String securityGroup;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 调度策略
|
||||||
|
*/
|
||||||
|
private String schedulingPolicy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 引导方式
|
||||||
|
*/
|
||||||
|
private String bootMethod;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备份机
|
||||||
|
*/
|
||||||
|
private String backup;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 反亲和组
|
||||||
|
*/
|
||||||
|
private String antiAffinityGroup;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 流水线id
|
||||||
|
*/
|
||||||
|
private String pipelineId;
|
||||||
|
}
|
@ -3,6 +3,7 @@ package cd.casic.ci.process.process.dataObject.stage;
|
|||||||
import cd.casic.ci.process.process.dataObject.task.PipTask;
|
import cd.casic.ci.process.process.dataObject.task.PipTask;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@Data
|
@Data
|
||||||
public class PipStage {
|
public class PipStage {
|
||||||
@ -13,7 +14,7 @@ public class PipStage {
|
|||||||
private String stageName;
|
private String stageName;
|
||||||
|
|
||||||
//@ApiProperty(name = "createTime",desc="创建时间")
|
//@ApiProperty(name = "createTime",desc="创建时间")
|
||||||
private String createTime;
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
//@ApiProperty(name="pipelineId",desc="流水线id")
|
//@ApiProperty(name="pipelineId",desc="流水线id")
|
||||||
private String pipelineId;
|
private String pipelineId;
|
||||||
|
@ -3,13 +3,15 @@ package cd.casic.ci.process.process.dataObject.task;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class PipTask {
|
public class PipTask {
|
||||||
//@ApiProperty(name="taskId",desc="配置id")
|
//@ApiProperty(name="taskId",desc="配置id")
|
||||||
private String taskId;
|
private String taskId;
|
||||||
|
|
||||||
//@ApiProperty(name="createTime",desc="创建时间")
|
//@ApiProperty(name="createTime",desc="创建时间")
|
||||||
private String createTime;
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
//@ApiProperty(name="taskType",desc= "类型1-10:源码,10-20:测试,20-30:构建,30-40:部署,40-50:代码扫描,50-60:推送制品")
|
//@ApiProperty(name="taskType",desc= "类型1-10:源码,10-20:测试,20-30:构建,30-40:部署,40-50:代码扫描,50-60:推送制品")
|
||||||
private String taskType;
|
private String taskType;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package cd.casic.ci.process.process.service.pipeline;
|
package cd.casic.ci.process.process.service.pipeline;
|
||||||
|
|
||||||
import cd.casic.ci.common.pipeline.req.pipeline.PipelineReq;
|
import cd.casic.ci.common.pipeline.req.pipeline.PipelineCreateReq;
|
||||||
import cd.casic.ci.process.process.dataObject.pipeline.PipPipeline;
|
import cd.casic.ci.process.process.dataObject.pipeline.PipPipeline;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
@ -12,5 +12,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||||||
* @Description:
|
* @Description:
|
||||||
*/
|
*/
|
||||||
public interface PipelineService extends IService<PipPipeline> {
|
public interface PipelineService extends IService<PipPipeline> {
|
||||||
String createPipeline(PipelineReq pipelineReq);
|
String createPipeline(PipelineCreateReq pipelineReq);
|
||||||
}
|
}
|
||||||
|
@ -1,17 +1,25 @@
|
|||||||
package cd.casic.ci.process.process.service.pipeline.impl;
|
package cd.casic.ci.process.process.service.pipeline.impl;
|
||||||
|
|
||||||
import cd.casic.ci.common.pipeline.constant.PipelineDateUtilConstant;
|
import cd.casic.ci.common.pipeline.req.pipeline.PipelineCreateReq;
|
||||||
import cd.casic.ci.common.pipeline.req.pipeline.PipelineReq;
|
|
||||||
import cd.casic.ci.common.pipeline.utils.PipelineDateUtil;
|
|
||||||
import cd.casic.ci.process.process.dal.pipeline.PipelineDao;
|
import cd.casic.ci.process.process.dal.pipeline.PipelineDao;
|
||||||
import cd.casic.ci.process.process.dataObject.pipeline.PipPipeline;
|
import cd.casic.ci.process.process.dataObject.pipeline.PipPipeline;
|
||||||
|
import cd.casic.ci.process.process.dataObject.resource.PipResource;
|
||||||
|
import cd.casic.ci.process.process.dataObject.stage.PipStage;
|
||||||
|
import cd.casic.ci.process.process.dataObject.task.PipTask;
|
||||||
import cd.casic.ci.process.process.service.pipeline.PipelineService;
|
import cd.casic.ci.process.process.service.pipeline.PipelineService;
|
||||||
|
import cd.casic.ci.process.process.service.resource.impl.ResourceServiceImpl;
|
||||||
|
import cd.casic.ci.process.process.service.stage.impl.StageServiceImpl;
|
||||||
|
import cd.casic.ci.process.process.service.task.impl.TaskServiceImpl;
|
||||||
import cd.casic.framework.commons.util.object.BeanUtils;
|
import cd.casic.framework.commons.util.object.BeanUtils;
|
||||||
import cd.casic.framework.commons.util.util.WebFrameworkUtils;
|
import cd.casic.framework.commons.util.util.WebFrameworkUtils;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.util.ObjectUtils;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -24,8 +32,18 @@ import java.util.Objects;
|
|||||||
@Service
|
@Service
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class PipelineServiceImpl extends ServiceImpl<PipelineDao, PipPipeline> implements PipelineService {
|
public class PipelineServiceImpl extends ServiceImpl<PipelineDao, PipPipeline> implements PipelineService {
|
||||||
|
@Resource
|
||||||
|
private StageServiceImpl stageService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private TaskServiceImpl taskService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ResourceServiceImpl resourceService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String createPipeline(PipelineReq pipelineReq) {
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public String createPipeline(PipelineCreateReq pipelineReq) {
|
||||||
|
|
||||||
PipPipeline pipeline = new PipPipeline();
|
PipPipeline pipeline = new PipPipeline();
|
||||||
BeanUtils.copyProperties(pipelineReq, pipeline);
|
BeanUtils.copyProperties(pipelineReq, pipeline);
|
||||||
@ -33,7 +51,7 @@ public class PipelineServiceImpl extends ServiceImpl<PipelineDao, PipPipeline> i
|
|||||||
int randomNumber = (int)(Math.random() * 5) + 1;
|
int randomNumber = (int)(Math.random() * 5) + 1;
|
||||||
pipeline.setColor(randomNumber);
|
pipeline.setColor(randomNumber);
|
||||||
|
|
||||||
pipeline.setCreateTime(PipelineDateUtil.nowDateString(PipelineDateUtilConstant.yyyy_MM_dd_HH_mm_ss));
|
pipeline.setCreateTime(LocalDateTime.now());
|
||||||
if (Objects.isNull(pipeline.getUserId())){
|
if (Objects.isNull(pipeline.getUserId())){
|
||||||
String loginUserId = String.valueOf(WebFrameworkUtils.getLoginUserId());
|
String loginUserId = String.valueOf(WebFrameworkUtils.getLoginUserId());
|
||||||
pipeline.setUserId(loginUserId);
|
pipeline.setUserId(loginUserId);
|
||||||
@ -42,9 +60,136 @@ public class PipelineServiceImpl extends ServiceImpl<PipelineDao, PipPipeline> i
|
|||||||
pipeline.setState(1);
|
pipeline.setState(1);
|
||||||
this.save(pipeline);
|
this.save(pipeline);
|
||||||
|
|
||||||
//TODO 创建关联的流水线模板
|
//TODO 根据模板覆写对应的阶段信息以及节点信息
|
||||||
|
// List<StageReq> stageReqList = templateService.findStageById(pipelineReq.getTemplateId());
|
||||||
|
// stageReqList.forEach(o->{
|
||||||
|
// o.setPipelineId(pipeline.getId());
|
||||||
|
// });
|
||||||
|
//新增初始阶段,无串行并行任务
|
||||||
|
PipStage stageReq1 = new PipStage();
|
||||||
|
stageReq1.setPipelineId(pipeline.getId());
|
||||||
|
stageReq1.setStageName("阶段-1");
|
||||||
|
stageReq1.setCreateTime(LocalDateTime.now());
|
||||||
|
stageReq1.setStageSort(1);
|
||||||
|
stageReq1.setParentId("-1");
|
||||||
|
stageReq1.setCode(true);
|
||||||
|
stageService.save(stageReq1);
|
||||||
|
|
||||||
|
PipStage childStage1 = new PipStage();
|
||||||
|
childStage1.setStageName("源码");
|
||||||
|
childStage1.setCreateTime(LocalDateTime.now());
|
||||||
|
childStage1.setStageSort(1);
|
||||||
|
childStage1.setCode(false);
|
||||||
|
childStage1.setParentId(stageReq1.getStageId());
|
||||||
|
stageService.save(childStage1);
|
||||||
|
|
||||||
|
//新增第二个阶段,包含串行和并行任务
|
||||||
|
PipStage stageReq2 = new PipStage();
|
||||||
|
stageReq2.setPipelineId(pipeline.getId());
|
||||||
|
stageReq2.setStageName("阶段-2");
|
||||||
|
stageReq2.setCreateTime(LocalDateTime.now());
|
||||||
|
stageReq2.setStageSort(2);
|
||||||
|
stageReq2.setParentId("-1");
|
||||||
|
stageReq2.setCode(true);
|
||||||
|
stageService.save(stageReq2);
|
||||||
|
|
||||||
|
//新增并行阶段
|
||||||
|
PipStage childStage21 = new PipStage();
|
||||||
|
childStage21.setStageName("并行阶段-2-1");
|
||||||
|
childStage21.setCreateTime(LocalDateTime.now());
|
||||||
|
childStage21.setStageSort(1);
|
||||||
|
childStage21.setCode(false);
|
||||||
|
childStage21.setParentId(stageReq2.getStageId());
|
||||||
|
stageService.save(childStage21);
|
||||||
|
|
||||||
|
//新增串行阶段
|
||||||
|
PipTask childTask21 = new PipTask();
|
||||||
|
childTask21.setCreateTime(LocalDateTime.now());
|
||||||
|
childTask21.setTaskName("串行任务-2-1");
|
||||||
|
childTask21.setTaskType("test");
|
||||||
|
childTask21.setTaskSort(1);
|
||||||
|
childTask21.setStageId(childStage21.getStageId());
|
||||||
|
taskService.save(childTask21);
|
||||||
|
|
||||||
|
//------------------------------------------------------------------
|
||||||
|
PipStage childStage22 = new PipStage();
|
||||||
|
childStage22.setStageName("并行阶段-2-2");
|
||||||
|
childStage22.setCreateTime(LocalDateTime.now());
|
||||||
|
childStage22.setStageSort(2);
|
||||||
|
childStage22.setCode(false);
|
||||||
|
childStage22.setParentId(stageReq2.getStageId());
|
||||||
|
stageService.save(childStage22);
|
||||||
|
|
||||||
|
PipTask childTask22 = new PipTask();
|
||||||
|
childTask22.setCreateTime(LocalDateTime.now());
|
||||||
|
childTask22.setTaskName("串行任务-2-2");
|
||||||
|
childTask22.setTaskType("test");
|
||||||
|
childTask22.setTaskSort(2);
|
||||||
|
childTask22.setStageId(childStage22.getStageId());
|
||||||
|
taskService.save(childTask22);
|
||||||
|
|
||||||
|
//创建第三个阶段
|
||||||
|
PipStage stageReq3 = new PipStage();
|
||||||
|
stageReq3.setPipelineId(pipeline.getId());
|
||||||
|
stageReq3.setStageName("阶段-3");
|
||||||
|
stageReq3.setCreateTime(LocalDateTime.now());
|
||||||
|
stageReq3.setStageSort(3);
|
||||||
|
stageReq3.setParentId("-1");
|
||||||
|
stageReq3.setCode(true);
|
||||||
|
stageService.save(stageReq3);
|
||||||
|
|
||||||
|
PipStage childStage3 = new PipStage();
|
||||||
|
childStage3.setStageName("");
|
||||||
|
childStage3.setCreateTime(LocalDateTime.now());
|
||||||
|
childStage3.setStageSort(1);
|
||||||
|
childStage3.setCode(false);
|
||||||
|
childStage3.setParentId(stageReq3.getStageId());
|
||||||
|
stageService.save(childStage3);
|
||||||
|
|
||||||
|
PipTask childTask31 = new PipTask();
|
||||||
|
childTask31.setCreateTime(LocalDateTime.now());
|
||||||
|
childTask31.setTaskName("串行任务-3-1");
|
||||||
|
childTask31.setTaskType("test");
|
||||||
|
childTask31.setTaskSort(1);
|
||||||
|
childTask31.setStageId(childStage3.getStageId());
|
||||||
|
taskService.save(childTask31);
|
||||||
|
|
||||||
|
//创建第四个阶段
|
||||||
|
PipStage stageReq4 = new PipStage();
|
||||||
|
stageReq4.setPipelineId(pipeline.getId());
|
||||||
|
stageReq4.setStageName("阶段-4");
|
||||||
|
stageReq4.setCreateTime(LocalDateTime.now());
|
||||||
|
stageReq4.setStageSort(4);
|
||||||
|
stageReq4.setParentId("-1");
|
||||||
|
stageReq4.setCode(true);
|
||||||
|
stageService.save(stageReq4);
|
||||||
|
|
||||||
|
PipStage childStage4 = new PipStage();
|
||||||
|
childStage4.setStageName("");
|
||||||
|
childStage4.setCreateTime(LocalDateTime.now());
|
||||||
|
childStage4.setStageSort(1);
|
||||||
|
childStage4.setCode(false);
|
||||||
|
childStage4.setParentId(stageReq4.getStageId());
|
||||||
|
stageService.save(childStage4);
|
||||||
|
|
||||||
|
PipTask childTask41 = new PipTask();
|
||||||
|
childTask41.setCreateTime(LocalDateTime.now());
|
||||||
|
childTask41.setTaskName("串行任务-4-1");
|
||||||
|
childTask41.setTaskType("test");
|
||||||
|
childTask41.setTaskSort(1);
|
||||||
|
childTask41.setStageId(childStage4.getStageId());
|
||||||
|
taskService.save(childTask41);
|
||||||
|
|
||||||
//TODO 创建对应的鉴权关系
|
//TODO 创建对应的鉴权关系
|
||||||
//TODO 创建对应的消息分发
|
//TODO 创建对应的消息分发
|
||||||
|
|
||||||
|
//新增对应的配置类数据
|
||||||
|
if (!ObjectUtils.isEmpty(pipelineReq.getResourceReq())){
|
||||||
|
PipResource resource = new PipResource();
|
||||||
|
BeanUtils.copyProperties(pipelineReq.getResourceReq(),resource);
|
||||||
|
resource.setPipelineId(pipeline.getId());
|
||||||
|
resourceService.save(resource);
|
||||||
|
}
|
||||||
return pipeline.getId();
|
return pipeline.getId();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,14 @@
|
|||||||
|
package cd.casic.ci.process.process.service.resource;
|
||||||
|
|
||||||
|
import cd.casic.ci.process.process.dataObject.resource.PipResource;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author HopeLi
|
||||||
|
* @version v1.0
|
||||||
|
* @ClassName ResourceService
|
||||||
|
* @Date: 2025/5/13 10:27
|
||||||
|
* @Description:
|
||||||
|
*/
|
||||||
|
public interface ResourceService extends IService<PipResource> {
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
package cd.casic.ci.process.process.service.resource.impl;
|
||||||
|
|
||||||
|
import cd.casic.ci.process.process.dal.pipeline.PipResourceDao;
|
||||||
|
import cd.casic.ci.process.process.dataObject.resource.PipResource;
|
||||||
|
import cd.casic.ci.process.process.service.resource.ResourceService;
|
||||||
|
import cd.casic.ci.process.process.service.stage.impl.StageServiceImpl;
|
||||||
|
import cd.casic.ci.process.process.service.task.impl.TaskServiceImpl;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author HopeLi
|
||||||
|
* @version v1.0
|
||||||
|
* @ClassName ResourceServiceImpl
|
||||||
|
* @Date: 2025/5/13 10:31
|
||||||
|
* @Description:
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class ResourceServiceImpl extends ServiceImpl<PipResourceDao, PipResource> implements ResourceService {
|
||||||
|
@Resource
|
||||||
|
private StageServiceImpl stageService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private TaskServiceImpl taskService;
|
||||||
|
|
||||||
|
}
|
@ -3,10 +3,13 @@ package cd.casic.ci.process.process.service.stage;
|
|||||||
import cd.casic.ci.common.pipeline.req.stage.StageReq;
|
import cd.casic.ci.common.pipeline.req.stage.StageReq;
|
||||||
import cd.casic.ci.common.pipeline.resp.stage.StageResp;
|
import cd.casic.ci.common.pipeline.resp.stage.StageResp;
|
||||||
import cd.casic.ci.process.process.dataObject.stage.PipStage;
|
import cd.casic.ci.process.process.dataObject.stage.PipStage;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public interface StageService {
|
public interface StageService extends IService<PipStage> {
|
||||||
/**
|
/**
|
||||||
* 创建阶段及关联任务
|
* 创建阶段及关联任务
|
||||||
* @param stage 阶段信息
|
* @param stage 阶段信息
|
||||||
@ -125,4 +128,6 @@ public interface StageService {
|
|||||||
List<StageResp> findAllStagesList(List<String> idList);
|
List<StageResp> findAllStagesList(List<String> idList);
|
||||||
|
|
||||||
|
|
||||||
|
void createStagesOrTaskList(@Valid @NotNull List<StageReq> stageList);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,6 @@ import org.apache.commons.lang3.StringUtils;
|
|||||||
import org.jsoup.helper.W3CDom;
|
import org.jsoup.helper.W3CDom;
|
||||||
import org.springframework.core.task.VirtualThreadTaskExecutor;
|
import org.springframework.core.task.VirtualThreadTaskExecutor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.CollectionUtils;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@ -31,7 +30,7 @@ import java.util.stream.Collectors;
|
|||||||
import static cd.casic.ci.process.constant.PipelineFinalConstant.TASK_TYPE_CODE;
|
import static cd.casic.ci.process.constant.PipelineFinalConstant.TASK_TYPE_CODE;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class StageServiceImpl implements StageService {
|
public class StageServiceImpl extends ServiceImpl<PipStageDao, PipStage> implements StageService {
|
||||||
@Resource
|
@Resource
|
||||||
private TaskService taskService;
|
private TaskService taskService;
|
||||||
@Resource
|
@Resource
|
||||||
@ -39,7 +38,6 @@ public class StageServiceImpl implements StageService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String createStagesOrTask(StageReq stageReq) {
|
public String createStagesOrTask(StageReq stageReq) {
|
||||||
// TODO 需要重写
|
|
||||||
PipStage stage = new PipStage();
|
PipStage stage = new PipStage();
|
||||||
BeanUtils.copyProperties(stageReq,stage);
|
BeanUtils.copyProperties(stageReq,stage);
|
||||||
String stagesId = stage.getStageId();
|
String stagesId = stage.getStageId();
|
||||||
@ -48,7 +46,7 @@ public class StageServiceImpl implements StageService {
|
|||||||
String taskType = stage.getTaskType();
|
String taskType = stage.getTaskType();
|
||||||
int stageSort = stage.getStageSort();
|
int stageSort = stage.getStageSort();
|
||||||
|
|
||||||
stage.setCreateTime(PipelineDateUtil.nowDateString(PipelineDateUtilConstant.yyyy_MM_dd_HH_mm_ss));
|
stage.setCreateTime(LocalDateTime.now());
|
||||||
|
|
||||||
PipTask tasks = new PipTask();
|
PipTask tasks = new PipTask();
|
||||||
tasks.setTaskType(taskType);
|
tasks.setTaskType(taskType);
|
||||||
@ -234,7 +232,6 @@ public class StageServiceImpl implements StageService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteAllStagesOrTask(String pipelineId) {
|
public void deleteAllStagesOrTask(String pipelineId) {
|
||||||
|
|
||||||
@ -307,6 +304,16 @@ public class StageServiceImpl implements StageService {
|
|||||||
public List<StageResp> findAllStagesList(List<String> idList) {
|
public List<StageResp> findAllStagesList(List<String> idList) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void createStagesOrTaskList(List<StageReq> stageList) {
|
||||||
|
if (!ObjectUtils.isEmpty(stageList)){
|
||||||
|
stageList.forEach(o->{
|
||||||
|
this.createStagesOrTask(o);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 判断任务是否存在代码源
|
* 判断任务是否存在代码源
|
||||||
* @param pipelineId 流水线id
|
* @param pipelineId 流水线id
|
||||||
|
@ -1,12 +1,11 @@
|
|||||||
package cd.casic.ci.process.process.service.task;
|
package cd.casic.ci.process.process.service.task;
|
||||||
|
|
||||||
import cd.casic.ci.common.pipeline.resp.task.TasksResp;
|
|
||||||
import cd.casic.ci.process.process.dataObject.task.PipTask;
|
import cd.casic.ci.process.process.dataObject.task.PipTask;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
public interface TaskService {
|
public interface TaskService extends IService<PipTask> {
|
||||||
/**
|
/**
|
||||||
* 查询taskType是否存在(原项目的各种worker)
|
* 查询taskType是否存在(原项目的各种worker)
|
||||||
* */
|
* */
|
||||||
|
@ -2,7 +2,6 @@ package cd.casic.ci.process.process.service.task.impl;
|
|||||||
|
|
||||||
import cd.casic.ci.common.pipeline.annotation.Plugin;
|
import cd.casic.ci.common.pipeline.annotation.Plugin;
|
||||||
import cd.casic.ci.common.pipeline.constant.PipelineDateUtilConstant;
|
import cd.casic.ci.common.pipeline.constant.PipelineDateUtilConstant;
|
||||||
import cd.casic.ci.common.pipeline.resp.task.TasksResp;
|
|
||||||
import cd.casic.ci.common.pipeline.utils.PipelineDateUtil;
|
import cd.casic.ci.common.pipeline.utils.PipelineDateUtil;
|
||||||
import cd.casic.ci.process.process.dal.pipeline.PipStageDao;
|
import cd.casic.ci.process.process.dal.pipeline.PipStageDao;
|
||||||
import cd.casic.ci.process.process.dal.pipeline.PipTaskDao;
|
import cd.casic.ci.process.process.dal.pipeline.PipTaskDao;
|
||||||
@ -15,12 +14,10 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||||||
import jakarta.annotation.PostConstruct;
|
import jakarta.annotation.PostConstruct;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.BeanUtils;
|
|
||||||
import org.springframework.beans.factory.config.BeanDefinition;
|
import org.springframework.beans.factory.config.BeanDefinition;
|
||||||
import org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider;
|
import org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider;
|
||||||
import org.springframework.core.type.filter.AnnotationTypeFilter;
|
import org.springframework.core.type.filter.AnnotationTypeFilter;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.CollectionUtils;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -30,7 +27,7 @@ import java.util.Set;
|
|||||||
import static cd.casic.ci.process.constant.PipelineFinalConstant.TASK_TYPE_CODE;
|
import static cd.casic.ci.process.constant.PipelineFinalConstant.TASK_TYPE_CODE;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class TaskServiceImpl implements TaskService {
|
public class TaskServiceImpl extends ServiceImpl<PipTaskDao, PipTask> implements TaskService {
|
||||||
private static final String basePackage = "cd.casic.ci.process.process.service";
|
private static final String basePackage = "cd.casic.ci.process.process.service";
|
||||||
private Set<BeanDefinition> candidates;
|
private Set<BeanDefinition> candidates;
|
||||||
@Resource
|
@Resource
|
||||||
@ -93,7 +90,7 @@ public class TaskServiceImpl implements TaskService {
|
|||||||
tasks.setTaskName(taskName);
|
tasks.setTaskName(taskName);
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.setCreateTime(PipelineDateUtil.nowDateString(PipelineDateUtilConstant.yyyy_MM_dd_HH_mm_ss));
|
tasks.setCreateTime(LocalDateTime.now());
|
||||||
|
|
||||||
String tasksId = createTasks(tasks);
|
String tasksId = createTasks(tasks);
|
||||||
//创建任务
|
//创建任务
|
||||||
|
@ -45,7 +45,7 @@ public class EnvController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping(path="/findEnvList")
|
@PostMapping(path="/findEnvList")
|
||||||
public CommonResult<List<EnvResp>> findOnePipeline(@NotNull EnvQueryReq query){
|
public CommonResult<List<EnvResp>> findEnvList(@NotNull EnvQueryReq query){
|
||||||
|
|
||||||
// List<Env> envList = envService.findEnvList(envQuery);
|
// List<Env> envList = envService.findEnvList(envQuery);
|
||||||
List<EnvResp> envRespList = new ArrayList<>(0);
|
List<EnvResp> envRespList = new ArrayList<>(0);
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package cd.casic.server.controller;
|
package cd.casic.server.controller;
|
||||||
|
|
||||||
|
import cd.casic.ci.common.pipeline.req.pipeline.PipelineCreateReq;
|
||||||
import cd.casic.ci.common.pipeline.req.pipeline.PipelineQueryReq;
|
import cd.casic.ci.common.pipeline.req.pipeline.PipelineQueryReq;
|
||||||
import cd.casic.ci.common.pipeline.req.pipeline.PipelineReq;
|
import cd.casic.ci.common.pipeline.req.pipeline.PipelineReq;
|
||||||
import cd.casic.ci.common.pipeline.resp.pipeline.PipelineResp;
|
import cd.casic.ci.common.pipeline.resp.pipeline.PipelineResp;
|
||||||
@ -35,7 +36,7 @@ public class PipelineController {
|
|||||||
|
|
||||||
@PermitAll
|
@PermitAll
|
||||||
@PostMapping(path="/createPipeline")
|
@PostMapping(path="/createPipeline")
|
||||||
public CommonResult<String> createPipeline(@RequestBody @Valid PipelineReq pipelineReq){
|
public CommonResult<String> createPipeline(@RequestBody @Valid PipelineCreateReq pipelineReq){
|
||||||
|
|
||||||
String pipelineId = pipelineService.createPipeline(pipelineReq);
|
String pipelineId = pipelineService.createPipeline(pipelineReq);
|
||||||
|
|
||||||
|
@ -0,0 +1,82 @@
|
|||||||
|
package cd.casic.server.controller;
|
||||||
|
|
||||||
|
import cd.casic.ci.common.pipeline.req.resource.ResourceQueryReq;
|
||||||
|
import cd.casic.ci.common.pipeline.req.resource.ResourceReq;
|
||||||
|
import cd.casic.ci.common.pipeline.resp.resource.ResourceResp;
|
||||||
|
import cd.casic.framework.commons.pojo.CommonResult;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName ResourceController
|
||||||
|
* @Author hopeli
|
||||||
|
* @Date 2025/5/10 10:57
|
||||||
|
* @Version 1.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/resource")
|
||||||
|
public class ResourceController {
|
||||||
|
|
||||||
|
@PostMapping(path="/createResource")
|
||||||
|
public CommonResult<String> createResource(@RequestBody @NotNull @Valid ResourceReq resourceReq){
|
||||||
|
|
||||||
|
// String pipelineAuthHostId = envService.createEnv(env);
|
||||||
|
|
||||||
|
String resourceId = "1";
|
||||||
|
return CommonResult.success(resourceId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping(path="/deleteResource")
|
||||||
|
public CommonResult<Void> deleteResource(@NotNull String resourceId){
|
||||||
|
|
||||||
|
// envService.deleteEnv(envId);
|
||||||
|
|
||||||
|
return CommonResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping(path="/findResourceList")
|
||||||
|
public CommonResult<List<ResourceResp>> findResourceList(@NotNull ResourceQueryReq query){
|
||||||
|
|
||||||
|
// List<Env> envList = envService.findEnvList(envQuery);
|
||||||
|
List<ResourceResp> resourceRespList = new ArrayList<>(0);
|
||||||
|
ResourceResp resourceResp = new ResourceResp();
|
||||||
|
resourceRespList.add(resourceResp);
|
||||||
|
|
||||||
|
return CommonResult.success(resourceRespList);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping(path="/updateResource")
|
||||||
|
public CommonResult<Void> updateResource(@RequestBody @NotNull @Valid ResourceReq resourceReq){
|
||||||
|
|
||||||
|
// this.envService.updateEnv(env);
|
||||||
|
|
||||||
|
return CommonResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping(path="/findResourcePage")
|
||||||
|
public CommonResult<Page<ResourceResp>> findResourcePage(@RequestBody @NotNull @Valid ResourceQueryReq query){
|
||||||
|
|
||||||
|
// Pagination<Env> envPage = envService.findEnvPage(envQuery);
|
||||||
|
Page<ResourceResp> respPage = new Page<>();
|
||||||
|
List<ResourceResp> resourceRespList = new ArrayList<>(0);
|
||||||
|
ResourceResp resourceResp = new ResourceResp();
|
||||||
|
resourceResp.setId("1");
|
||||||
|
resourceRespList.add(resourceResp);
|
||||||
|
respPage.setRecords(resourceRespList);
|
||||||
|
return CommonResult.success(respPage);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -46,6 +46,13 @@ public class StageController {
|
|||||||
return CommonResult.success(taskId);
|
return CommonResult.success(taskId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@RequestMapping(path="/createStageList",method = RequestMethod.POST)
|
||||||
|
public CommonResult<String> createStagesOrTaskList(@RequestBody @Valid @NotNull List<StageReq> stageList){
|
||||||
|
stageService.createStagesOrTaskList(stageList);
|
||||||
|
return CommonResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @pi.name:查询流水线阶段信息
|
* @pi.name:查询流水线阶段信息
|
||||||
* @pi.path:/stage/finAllStage
|
* @pi.path:/stage/finAllStage
|
||||||
|
Loading…
x
Reference in New Issue
Block a user