Compare commits
No commits in common. "19858ca9277b3e54cad4e76a46936578dbba97c1" and "e4dc4f6181511c4e087ac8ffe5309a5407a1b9d9" have entirely different histories.
19858ca927
...
e4dc4f6181
1
.gitignore
vendored
1
.gitignore
vendored
@ -40,4 +40,3 @@ target/
|
|||||||
### VS Code ###
|
### VS Code ###
|
||||||
.vscode/!/.xcodemap/
|
.vscode/!/.xcodemap/
|
||||||
!/.idea/
|
!/.idea/
|
||||||
/.idea/
|
|
||||||
|
@ -19,10 +19,6 @@
|
|||||||
<groupId>cd.casic.boot</groupId>
|
<groupId>cd.casic.boot</groupId>
|
||||||
<artifactId>module-ci-common-pipeline</artifactId>
|
<artifactId>module-ci-common-pipeline</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>cd.casic.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-mq</artifactId>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
@ -1,6 +1,5 @@
|
|||||||
package cd.casic.ci.event.pojo;
|
package cd.casic.ci.event.pojo;
|
||||||
|
|
||||||
import cd.casic.framework.mq.redis.core.stream.AbstractRedisStreamMessage;
|
|
||||||
import com.mysql.cj.MessageBuilder;
|
import com.mysql.cj.MessageBuilder;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@ -20,7 +19,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class IEvent extends AbstractRedisStreamMessage {
|
public class IEvent {
|
||||||
|
|
||||||
private int delayMills = 0;
|
private int delayMills = 0;
|
||||||
private int retryTime = 1;
|
private int retryTime = 1;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package cd.casic.ci.process.process.engine.control;
|
package cd.casic.ci.process.engine.control;
|
||||||
|
|
||||||
|
|
||||||
import cd.casic.ci.common.pipeline.Model;
|
import cd.casic.ci.common.pipeline.Model;
|
||||||
@ -15,10 +15,10 @@ import cd.casic.ci.common.pipeline.pojo.event.ProjectPipelineCallBack;
|
|||||||
|
|
||||||
import cd.casic.ci.common.pipeline.service.utils.LogUtils;
|
import cd.casic.ci.common.pipeline.service.utils.LogUtils;
|
||||||
import cd.casic.ci.process.api.engine.pojo.PipelineInfo;
|
import cd.casic.ci.process.api.engine.pojo.PipelineInfo;
|
||||||
|
import cd.casic.ci.process.api.engine.pojo.event.PipelineStreamEnabledEvent;
|
||||||
import cd.casic.ci.process.api.process.pojo.ProjectPipelineCallBackHistory;
|
import cd.casic.ci.process.api.process.pojo.ProjectPipelineCallBackHistory;
|
||||||
import cd.casic.ci.process.api.process.pojo.pipeline.ModelDetail;
|
import cd.casic.ci.process.api.process.pojo.pipeline.ModelDetail;
|
||||||
import cd.casic.ci.process.process.constant.AllocIdGenerateConstant;
|
import cd.casic.ci.process.process.constant.AllocIdGenerateConstant;
|
||||||
import cd.casic.ci.process.process.engine.pojo.event.PipelineStreamEnabledEvent;
|
|
||||||
import cd.casic.ci.process.process.service.base.PipelineBuildDetailServiceImpl;
|
import cd.casic.ci.process.process.service.base.PipelineBuildDetailServiceImpl;
|
||||||
import cd.casic.ci.process.process.service.base.engin.service.PipelineRepositoryService;
|
import cd.casic.ci.process.process.service.base.engin.service.PipelineRepositoryService;
|
||||||
import cd.casic.ci.process.process.service.base.engin.service.ProjectPipelineCallBackService;
|
import cd.casic.ci.process.process.service.base.engin.service.ProjectPipelineCallBackService;
|
||||||
@ -184,7 +184,7 @@ public class CallBackControl {
|
|||||||
event.getUserId(),
|
event.getUserId(),
|
||||||
event.getGitProjectId(),
|
event.getGitProjectId(),
|
||||||
event.getGitProjectUrl(),
|
event.getGitProjectUrl(),
|
||||||
event.getEnable()
|
event.isEnable()
|
||||||
);
|
);
|
||||||
sendToCallBack(new CallBackData<StreamEnabledEvent>(CallBackEvent.STREAM_ENABLED, streamEnabledEvent), list);
|
sendToCallBack(new CallBackData<StreamEnabledEvent>(CallBackEvent.STREAM_ENABLED, streamEnabledEvent), list);
|
||||||
}
|
}
|
@ -1,7 +1,7 @@
|
|||||||
package cd.casic.ci.process.process.callback.listener;
|
package cd.casic.ci.process.process.callback.listener;
|
||||||
|
|
||||||
|
|
||||||
import cd.casic.ci.process.process.engine.control.CallBackControl;
|
import cd.casic.ci.process.engine.control.CallBackControl;
|
||||||
import cd.casic.ci.project.dal.pojo.ProjectCreateInfo;
|
import cd.casic.ci.project.dal.pojo.ProjectCreateInfo;
|
||||||
import cd.casic.ci.project.dal.pojo.ProjectVO;
|
import cd.casic.ci.project.dal.pojo.ProjectVO;
|
||||||
import cd.casic.ci.project.pojo.ProjectUpdateInfo;
|
import cd.casic.ci.project.pojo.ProjectUpdateInfo;
|
||||||
@ -14,6 +14,7 @@ import cd.casic.framework.mq.redis.core.stream.AbstractRedisStreamMessageListene
|
|||||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
|
@ -1,66 +0,0 @@
|
|||||||
package cd.casic.ci.process.process.engine.listener;
|
|
||||||
|
|
||||||
import cd.casic.ci.common.pipeline.service.utils.LogUtils;
|
|
||||||
import cd.casic.ci.process.process.engine.control.CallBackControl;
|
|
||||||
import cd.casic.ci.process.process.engine.pojo.event.PipelineCreateEvent;
|
|
||||||
import cd.casic.ci.process.process.engine.service.AgentPipelineRefService;
|
|
||||||
import cd.casic.ci.process.process.engine.service.PipelineAtomStatisticsService;
|
|
||||||
import cd.casic.ci.process.process.engine.service.PipelineWebhookService;
|
|
||||||
import cd.casic.ci.process.process.engine.service.RepoPipelineRefService;
|
|
||||||
import cd.casic.framework.commons.util.watcher.Watcher;
|
|
||||||
import cd.casic.framework.mq.redis.core.stream.AbstractRedisStreamMessageListener;
|
|
||||||
import com.github.fppt.jedismock.operations.transactions.Watch;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
/**
|
|
||||||
* MQ实现的流水线创建事件
|
|
||||||
*
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class MQPipelineCreateListener extends AbstractRedisStreamMessageListener<PipelineCreateEvent> {
|
|
||||||
private PipelineWebhookService pipelineWebhookService;
|
|
||||||
private PipelineAtomStatisticsService pipelineAtomStatisticsService;
|
|
||||||
private CallBackControl callBackControl;
|
|
||||||
private AgentPipelineRefService agentPipelineRefService;
|
|
||||||
private RepoPipelineRefService repoPipelineRefService;
|
|
||||||
@Override
|
|
||||||
public void onMessage(PipelineCreateEvent event) {
|
|
||||||
String id = String.format("%s|CreatePipeline#%s|%s",
|
|
||||||
event.getTraceId(),event.getPipelineId(),event.getUserId()
|
|
||||||
);
|
|
||||||
Watcher watcher = new Watcher(id);
|
|
||||||
|
|
||||||
watcher.safeAround("callback",()-> {
|
|
||||||
callBackControl.pipelineCreateEvent(event.getProjectId(), event.getPipelineId());
|
|
||||||
});
|
|
||||||
|
|
||||||
watcher.safeAround("updateAtomPipelineNum",()->{
|
|
||||||
pipelineAtomStatisticsService.updateAtomPipelineNum(
|
|
||||||
event.getProjectId(),
|
|
||||||
event.getPipelineId(),
|
|
||||||
event.getVersion()!=null ?event.getVersion(): 1,
|
|
||||||
false,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
watcher.safeAround("updateAgentPipelineRef",()->{
|
|
||||||
agentPipelineRefService.updateAgentPipelineRef(event.getUserId(), "create_pipeline", event.getProjectId(), event.getPipelineId());
|
|
||||||
});
|
|
||||||
|
|
||||||
watcher.safeAround("addWebhook",()-> {
|
|
||||||
pipelineWebhookService.addWebhook(
|
|
||||||
event.getProjectId(),
|
|
||||||
event.getPipelineId(),
|
|
||||||
event.getVersion(),
|
|
||||||
event.getUserId()
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
watcher.safeAround("savePipelineRefRepository",()->{
|
|
||||||
repoPipelineRefService.updateRepoPipelineRef(event.getUserId(), "create_pipeline", event.getProjectId(), event.getPipelineId());
|
|
||||||
}) ;
|
|
||||||
|
|
||||||
LogUtils.printCostTimeWE(watcher);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,84 +0,0 @@
|
|||||||
package cd.casic.ci.process.process.engine.listener;
|
|
||||||
|
|
||||||
import cd.casic.ci.common.pipeline.service.utils.LogUtils;
|
|
||||||
import cd.casic.ci.process.process.engine.control.CallBackControl;
|
|
||||||
import cd.casic.ci.process.process.engine.pojo.event.PipelineCreateEvent;
|
|
||||||
import cd.casic.ci.process.process.engine.pojo.event.PipelineDeleteEvent;
|
|
||||||
import cd.casic.ci.process.process.engine.service.*;
|
|
||||||
import cd.casic.framework.commons.util.watcher.Watcher;
|
|
||||||
import cd.casic.framework.mq.redis.core.stream.AbstractRedisStreamMessageListener;
|
|
||||||
import jakarta.annotation.Resource;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
/**
|
|
||||||
* MQ实现的流水线删除事件
|
|
||||||
*
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class MQPipelineDeleteListener extends AbstractRedisStreamMessageListener<PipelineDeleteEvent> {
|
|
||||||
@Resource
|
|
||||||
private PipelineRuntimeService pipelineRuntimeService;
|
|
||||||
@Resource
|
|
||||||
private PipelineWebhookService pipelineWebhookService;
|
|
||||||
@Resource
|
|
||||||
private PipelineGroupService pipelineGroupService;
|
|
||||||
@Resource
|
|
||||||
private PipelineAtomStatisticsService pipelineAtomStatisticsService;
|
|
||||||
@Resource
|
|
||||||
private CallBackControl callBackControl;
|
|
||||||
@Resource
|
|
||||||
private AgentPipelineRefService agentPipelineRefService;
|
|
||||||
@Resource
|
|
||||||
private RepoPipelineRefService repoPipelineRefService;
|
|
||||||
@Override
|
|
||||||
public void onMessage(PipelineDeleteEvent event) {
|
|
||||||
String id = String.format("%s|DeletePipeline#%s|%s}",
|
|
||||||
event.getTraceId(),
|
|
||||||
event.getPipelineId(),
|
|
||||||
event.isClearUpModel());
|
|
||||||
Watcher watcher = new Watcher(id);
|
|
||||||
final String projectId = event.getProjectId();
|
|
||||||
final String pipelineId = event.getPipelineId();
|
|
||||||
final String userId = event.getUserId();
|
|
||||||
|
|
||||||
watcher.safeAround("cancelPendingTask",()->{
|
|
||||||
pipelineRuntimeService.cancelPendingTask(projectId, pipelineId, userId);
|
|
||||||
});
|
|
||||||
|
|
||||||
if (event.isClearUpModel()) {
|
|
||||||
watcher.safeAround("deleteExt",()-> {
|
|
||||||
pipelineGroupService.deleteAllUserFavorByPipeline(userId, projectId, pipelineId); // 删除收藏该流水线上所有记录
|
|
||||||
pipelineGroupService.deletePipelineLabel(userId, projectId, pipelineId);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
watcher.safeAround("deleteWebhook",()->{
|
|
||||||
pipelineWebhookService.deleteWebhook(projectId, pipelineId, userId);
|
|
||||||
});
|
|
||||||
|
|
||||||
watcher.safeAround("updateAgentPipelineRef",()->{
|
|
||||||
agentPipelineRefService.updateAgentPipelineRef(userId, "delete_pipeline", projectId, pipelineId);
|
|
||||||
});
|
|
||||||
|
|
||||||
watcher.safeAround("updateAtomPipelineNum",()->{
|
|
||||||
pipelineAtomStatisticsService.updateAtomPipelineNum(
|
|
||||||
event.getProjectId(),
|
|
||||||
event.getPipelineId(),
|
|
||||||
null,
|
|
||||||
true,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
watcher.safeAround("updateAgentPipelineRef",()->{
|
|
||||||
repoPipelineRefService.updateRepoPipelineRef(userId, "delete_pipeline", projectId, pipelineId);
|
|
||||||
});
|
|
||||||
|
|
||||||
watcher.safeAround("callback",
|
|
||||||
()->{
|
|
||||||
callBackControl.pipelineDeleteEvent(event.getProjectId(), event.getPipelineId());
|
|
||||||
});
|
|
||||||
|
|
||||||
LogUtils.printCostTimeWE(watcher);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,66 +0,0 @@
|
|||||||
package cd.casic.ci.process.process.engine.listener;
|
|
||||||
|
|
||||||
import cd.casic.ci.common.pipeline.service.utils.LogUtils;
|
|
||||||
import cd.casic.ci.process.process.engine.control.CallBackControl;
|
|
||||||
import cd.casic.ci.process.process.engine.pojo.event.PipelineDeleteEvent;
|
|
||||||
import cd.casic.ci.process.process.engine.pojo.event.PipelineRestoreEvent;
|
|
||||||
import cd.casic.ci.process.process.engine.service.AgentPipelineRefService;
|
|
||||||
import cd.casic.ci.process.process.engine.service.PipelineAtomStatisticsService;
|
|
||||||
import cd.casic.ci.process.process.engine.service.RepoPipelineRefService;
|
|
||||||
import cd.casic.framework.commons.util.watcher.Watcher;
|
|
||||||
import cd.casic.framework.mq.redis.core.stream.AbstractRedisStreamMessageListener;
|
|
||||||
import jakarta.annotation.Resource;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* MQ实现的流水线恢复事件
|
|
||||||
*
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class MQPipelineRestoreListener extends AbstractRedisStreamMessageListener<PipelineRestoreEvent> {
|
|
||||||
@Resource
|
|
||||||
private AgentPipelineRefService agentPipelineRefService;
|
|
||||||
@Resource
|
|
||||||
private PipelineAtomStatisticsService pipelineAtomStatisticsService;
|
|
||||||
@Resource
|
|
||||||
private CallBackControl callBackControl;
|
|
||||||
@Resource
|
|
||||||
private RepoPipelineRefService repoPipelineRefService;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onMessage(PipelineRestoreEvent event) {
|
|
||||||
String id = String.format("%s|RestorePipeline#%s|%s}",
|
|
||||||
event.getTraceId(),
|
|
||||||
event.getPipelineId(),
|
|
||||||
event.getUserId()
|
|
||||||
) ;
|
|
||||||
Watcher watcher = new Watcher(id);
|
|
||||||
try {
|
|
||||||
watcher.start("updateAgentPipelineRef");
|
|
||||||
String userId = event.getUserId();
|
|
||||||
String projectId = event.getProjectId();
|
|
||||||
String pipelineId = event.getPipelineId();
|
|
||||||
Integer version = event.getVersion();
|
|
||||||
agentPipelineRefService.updateAgentPipelineRef(userId, "restore_pipeline", projectId, pipelineId);
|
|
||||||
|
|
||||||
watcher.stop();
|
|
||||||
watcher.start("updateAtomPipelineNum");
|
|
||||||
pipelineAtomStatisticsService.updateAtomPipelineNum(
|
|
||||||
projectId,
|
|
||||||
pipelineId,
|
|
||||||
version,
|
|
||||||
false,
|
|
||||||
true
|
|
||||||
);
|
|
||||||
watcher.stop();
|
|
||||||
watcher.start("callback");
|
|
||||||
callBackControl.pipelineRestoreEvent(projectId, pipelineId);
|
|
||||||
repoPipelineRefService.updateRepoPipelineRef(userId, "restore_pipeline", projectId, pipelineId);
|
|
||||||
|
|
||||||
} finally {
|
|
||||||
watcher.stop();
|
|
||||||
LogUtils.printCostTimeWE(watcher);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,41 +0,0 @@
|
|||||||
package cd.casic.ci.process.process.engine.listener;
|
|
||||||
|
|
||||||
import cd.casic.ci.common.pipeline.service.utils.LogUtils;
|
|
||||||
import cd.casic.ci.process.process.engine.control.CallBackControl;
|
|
||||||
import cd.casic.ci.process.process.engine.pojo.event.PipelineRestoreEvent;
|
|
||||||
import cd.casic.ci.process.process.engine.pojo.event.PipelineStreamEnabledEvent;
|
|
||||||
import cd.casic.framework.commons.util.watcher.Watcher;
|
|
||||||
import cd.casic.framework.mq.redis.core.stream.AbstractRedisStreamMessageListener;
|
|
||||||
import jakarta.annotation.Resource;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* MQ实现的流水线开启Stream事件
|
|
||||||
*
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class MQPipelineStreamEnabledListener extends AbstractRedisStreamMessageListener<PipelineStreamEnabledEvent> {
|
|
||||||
@Resource
|
|
||||||
private CallBackControl callBackControl;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onMessage(PipelineStreamEnabledEvent event) {
|
|
||||||
String id = String.format("%s|RestorePipeline#%s|%s}",
|
|
||||||
event.getTraceId(),
|
|
||||||
event.getPipelineId(),
|
|
||||||
event.getUserId()
|
|
||||||
) ;
|
|
||||||
Watcher watcher =new Watcher(id);
|
|
||||||
try {
|
|
||||||
watcher.start("callback");
|
|
||||||
callBackControl.pipelineStreamEnabledEvent(
|
|
||||||
event
|
|
||||||
);
|
|
||||||
watcher.stop();
|
|
||||||
} finally {
|
|
||||||
watcher.stop();
|
|
||||||
LogUtils.printCostTimeWE(watcher);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,69 +0,0 @@
|
|||||||
package cd.casic.ci.process.process.engine.listener;
|
|
||||||
|
|
||||||
import cd.casic.ci.common.pipeline.service.utils.LogUtils;
|
|
||||||
import cd.casic.ci.process.process.engine.control.CallBackControl;
|
|
||||||
import cd.casic.ci.process.process.engine.pojo.event.PipelineUpdateEvent;
|
|
||||||
import cd.casic.ci.process.process.engine.service.AgentPipelineRefService;
|
|
||||||
import cd.casic.ci.process.process.engine.service.PipelineAtomStatisticsService;
|
|
||||||
import cd.casic.ci.process.process.engine.service.PipelineWebhookService;
|
|
||||||
import cd.casic.ci.process.process.engine.service.RepoPipelineRefService;
|
|
||||||
import cd.casic.framework.commons.util.watcher.Watcher;
|
|
||||||
import cd.casic.framework.mq.redis.core.stream.AbstractRedisStreamMessageListener;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* MQ实现的流水线更新事件
|
|
||||||
*
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class MQPipelineUpdateListener extends AbstractRedisStreamMessageListener<PipelineUpdateEvent> {
|
|
||||||
private PipelineAtomStatisticsService pipelineAtomStatisticsService;
|
|
||||||
private CallBackControl callBackControl;
|
|
||||||
private AgentPipelineRefService agentPipelineRefService;
|
|
||||||
private PipelineWebhookService pipelineWebhookService;
|
|
||||||
private RepoPipelineRefService repoPipelineRefService;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onMessage(PipelineUpdateEvent event) {
|
|
||||||
String id = String.format("%s|RestorePipeline#%s|%s}",
|
|
||||||
event.getTraceId(),
|
|
||||||
event.getPipelineId(),
|
|
||||||
event.getUserId()
|
|
||||||
) ;
|
|
||||||
Watcher watcher = new Watcher(id);
|
|
||||||
final String projectId = event.getProjectId();
|
|
||||||
final String pipelineId = event.getPipelineId();
|
|
||||||
final String userId = event.getUserId();
|
|
||||||
final Integer version = event.getVersion();
|
|
||||||
|
|
||||||
watcher.safeAround("callback",()->{
|
|
||||||
callBackControl.pipelineUpdateEvent(projectId, pipelineId);
|
|
||||||
});
|
|
||||||
|
|
||||||
watcher.safeAround("updateAgentPipelineRef",()->{
|
|
||||||
agentPipelineRefService.updateAgentPipelineRef(userId, "update_pipeline", projectId, pipelineId);
|
|
||||||
});
|
|
||||||
|
|
||||||
watcher.safeAround("updateAtomPipelineNum",()->{
|
|
||||||
pipelineAtomStatisticsService.updateAtomPipelineNum(projectId,pipelineId, version,false,false);
|
|
||||||
});
|
|
||||||
|
|
||||||
watcher.safeAround("addWebhook",()->{
|
|
||||||
pipelineWebhookService.addWebhook(
|
|
||||||
projectId ,
|
|
||||||
pipelineId ,
|
|
||||||
version ,
|
|
||||||
userId
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
watcher.safeAround("updateAgentPipelineRef",()->{
|
|
||||||
|
|
||||||
repoPipelineRefService.updateRepoPipelineRef(userId, "update_pipeline", projectId, pipelineId);
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
LogUtils.printCostTimeWE(watcher);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,58 +0,0 @@
|
|||||||
package cd.casic.ci.process.process.engine.pojo.event;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import cd.casic.ci.common.pipeline.pojo.BuildNo;
|
|
||||||
import cd.casic.ci.common.pipeline.pojo.element.Element;
|
|
||||||
import cd.casic.ci.event.enums.ActionType;
|
|
||||||
import cd.casic.ci.event.pojo.pipeline.IPipelineEvent;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建流水线事件
|
|
||||||
*
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
public class PipelineCreateEvent extends IPipelineEvent {
|
|
||||||
|
|
||||||
private BuildNo buildNo;
|
|
||||||
private String pipelineName;
|
|
||||||
private Element element;
|
|
||||||
private Integer version;
|
|
||||||
private Map<String, Object> variables;
|
|
||||||
|
|
||||||
public PipelineCreateEvent(
|
|
||||||
String source,
|
|
||||||
String projectId,
|
|
||||||
String pipelineId,
|
|
||||||
String userId,
|
|
||||||
BuildNo buildNo,
|
|
||||||
String pipelineName,
|
|
||||||
Element element,
|
|
||||||
Integer version,
|
|
||||||
Map<String, Object> variables,
|
|
||||||
ActionType actionType,
|
|
||||||
int delayMills
|
|
||||||
) {
|
|
||||||
super(actionType, source, projectId, pipelineId, userId, delayMills);
|
|
||||||
this.buildNo = buildNo;
|
|
||||||
this.pipelineName = pipelineName;
|
|
||||||
this.element = element;
|
|
||||||
this.version = version;
|
|
||||||
this.variables = variables;
|
|
||||||
}
|
|
||||||
|
|
||||||
public PipelineCreateEvent(
|
|
||||||
String source,
|
|
||||||
String projectId,
|
|
||||||
String pipelineId,
|
|
||||||
String userId
|
|
||||||
) {
|
|
||||||
this(source, projectId, pipelineId, userId, null, null, null, 1, null, ActionType.START, 0);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,56 +0,0 @@
|
|||||||
package cd.casic.ci.process.process.engine.pojo.event;
|
|
||||||
|
|
||||||
|
|
||||||
import cd.casic.ci.common.pipeline.pojo.BuildNo;
|
|
||||||
import cd.casic.ci.common.pipeline.pojo.element.Element;
|
|
||||||
import cd.casic.ci.event.enums.ActionType;
|
|
||||||
import cd.casic.ci.event.pojo.pipeline.IPipelineEvent;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建流水线事件
|
|
||||||
*
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.ToString;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除流水线事件
|
|
||||||
*
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
@ToString(callSuper = true)
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
//@Event(StreamBinding.PIPELINE_DELETE)
|
|
||||||
public class PipelineDeleteEvent extends IPipelineEvent {
|
|
||||||
|
|
||||||
private final boolean clearUpModel;
|
|
||||||
|
|
||||||
public PipelineDeleteEvent(
|
|
||||||
String source,
|
|
||||||
String projectId,
|
|
||||||
String pipelineId,
|
|
||||||
String userId,
|
|
||||||
boolean clearUpModel
|
|
||||||
) {
|
|
||||||
this(source, projectId, pipelineId, userId, clearUpModel, ActionType.START, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public PipelineDeleteEvent(
|
|
||||||
String source,
|
|
||||||
String projectId,
|
|
||||||
String pipelineId,
|
|
||||||
String userId,
|
|
||||||
boolean clearUpModel,
|
|
||||||
ActionType actionType,
|
|
||||||
int delayMills
|
|
||||||
) {
|
|
||||||
super(actionType, source, projectId, pipelineId, userId, delayMills);
|
|
||||||
this.clearUpModel = clearUpModel;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
package cd.casic.ci.process.process.engine.pojo.event;
|
|
||||||
|
|
||||||
import cd.casic.ci.event.pojo.pipeline.IPipelineEvent;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@Data
|
|
||||||
public class PipelineRestoreEvent extends IPipelineEvent {
|
|
||||||
private Integer version;
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
package cd.casic.ci.process.process.engine.pojo.event;
|
|
||||||
|
|
||||||
import cd.casic.ci.event.pojo.pipeline.IPipelineEvent;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@Data
|
|
||||||
public class PipelineStreamEnabledEvent extends IPipelineEvent {
|
|
||||||
private Long gitProjectId;
|
|
||||||
private String gitProjectUrl;
|
|
||||||
private Boolean enable;
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
package cd.casic.ci.process.process.engine.pojo.event;
|
|
||||||
|
|
||||||
import cd.casic.ci.common.pipeline.pojo.BuildNo;
|
|
||||||
import cd.casic.ci.event.pojo.pipeline.IPipelineEvent;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
/**
|
|
||||||
* 更新流水线事件
|
|
||||||
*
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@Data
|
|
||||||
public class PipelineUpdateEvent extends IPipelineEvent {
|
|
||||||
private Integer version;
|
|
||||||
private BuildNo buildNo;
|
|
||||||
}
|
|
@ -1,46 +0,0 @@
|
|||||||
package cd.casic.ci.process.process.engine.service;
|
|
||||||
|
|
||||||
|
|
||||||
import cd.casic.ci.common.pipeline.Model;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 构建机流水线引用服务接口
|
|
||||||
*/
|
|
||||||
public interface AgentPipelineRefService {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新构建机流水线引用
|
|
||||||
*
|
|
||||||
* @param userId 用户ID
|
|
||||||
* @param action 操作类型
|
|
||||||
* @param projectId 项目ID
|
|
||||||
* @param pipelineId 流水线ID
|
|
||||||
*/
|
|
||||||
void updateAgentPipelineRef(String userId, String action, String projectId, String pipelineId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分析流水线引用并保存
|
|
||||||
*
|
|
||||||
* @param userId 用户ID
|
|
||||||
* @param action 操作类型
|
|
||||||
* @param projectId 项目ID
|
|
||||||
* @param pipelineId 流水线ID
|
|
||||||
* @param pipelineModel 流水线模型
|
|
||||||
*/
|
|
||||||
void analysisPipelineRefAndSave(
|
|
||||||
String userId,
|
|
||||||
String action,
|
|
||||||
String projectId,
|
|
||||||
String pipelineId,
|
|
||||||
Model pipelineModel
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新流水线引用
|
|
||||||
*
|
|
||||||
* @param userId 用户ID
|
|
||||||
* @param projectId 项目ID
|
|
||||||
* @param pipelineId 流水线ID
|
|
||||||
*/
|
|
||||||
void updatePipelineRef(String userId, String projectId, String pipelineId);
|
|
||||||
}
|
|
@ -1,39 +0,0 @@
|
|||||||
package cd.casic.ci.process.process.engine.service;
|
|
||||||
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 流水线插件统计相关的服务
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
public interface PipelineAtomStatisticsService {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新插件对应的流水线数量
|
|
||||||
*/
|
|
||||||
void updateAtomPipelineNum(
|
|
||||||
String projectId,
|
|
||||||
String pipelineId,
|
|
||||||
Integer version,
|
|
||||||
Boolean deleteFlag,
|
|
||||||
Boolean restoreFlag
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 添加流水线数量更新
|
|
||||||
*/
|
|
||||||
void addPipelineNumUpdate(
|
|
||||||
Set<String> modelVersionAtomSet,
|
|
||||||
// List<StoreStatisticPipelineNumUpdate> pipelineNumUpdateList,
|
|
||||||
Boolean incrementFlag
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取版本模型字符串
|
|
||||||
*/
|
|
||||||
String getVersionModelString(
|
|
||||||
String projectId,
|
|
||||||
String pipelineId,
|
|
||||||
Integer version
|
|
||||||
);
|
|
||||||
}
|
|
@ -1,114 +0,0 @@
|
|||||||
package cd.casic.ci.process.process.engine.service;
|
|
||||||
|
|
||||||
import cd.casic.ci.process.api.process.pojo.classify.*;
|
|
||||||
import cd.casic.ci.process.process.dataObject.TPipelineFavorRecord;
|
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 流水线分组服务接口
|
|
||||||
*/
|
|
||||||
public interface PipelineGroupService {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取分组列表
|
|
||||||
*/
|
|
||||||
List<PipelineGroup> getGroups(String userId, String projectId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取指定流水线的分组列表
|
|
||||||
*/
|
|
||||||
List<PipelineGroupWithLabels> getGroups(String userId, String projectId, String pipelineId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 添加分组
|
|
||||||
*/
|
|
||||||
Boolean addGroup(String userId, PipelineGroupCreate pipelineGroup);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新分组
|
|
||||||
*/
|
|
||||||
Boolean updateGroup(String userId, PipelineGroupUpdate pipelineGroup);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除分组
|
|
||||||
*/
|
|
||||||
Boolean deleteGroup(String userId, String projectId, String groupId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 添加标签
|
|
||||||
*/
|
|
||||||
Boolean addLabel(String userId, String projectId, PipelineLabelCreate pipelineLabel);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除标签
|
|
||||||
*/
|
|
||||||
Boolean deleteLabel(String userId, String projectId, String labelId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新标签
|
|
||||||
*/
|
|
||||||
Boolean updateLabel(String userId, String projectId, PipelineLabelUpdate pipelineLabel);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除流水线标签
|
|
||||||
*/
|
|
||||||
void deletePipelineLabel(String userId, String projectId, String pipelineId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 添加流水线标签
|
|
||||||
*/
|
|
||||||
void addPipelineLabel(String userId, String projectId, String pipelineId, List<String> labelIds);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新流水线标签
|
|
||||||
*/
|
|
||||||
void updatePipelineLabel(String userId, String projectId, String pipelineId, List<String> labelIds);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取视图标签到流水线的映射
|
|
||||||
*/
|
|
||||||
Map<String, List<String>> getViewLabelToPipelinesMap(
|
|
||||||
String projectId,
|
|
||||||
List<String> labels
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取分组到标签的映射
|
|
||||||
*/
|
|
||||||
Map<String, List<String>> getGroupToLabelsMap(String projectId, List<String> labels);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 收藏流水线
|
|
||||||
*/
|
|
||||||
Boolean favorPipeline(String userId, String projectId, String pipelineId, Boolean favor);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除流水线相关的所有收藏
|
|
||||||
*/
|
|
||||||
Integer deleteAllUserFavorByPipeline(String userId, String projectId, String pipelineId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取收藏的流水线列表
|
|
||||||
*/
|
|
||||||
List<String> getFavorPipelines(String userId, String projectId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取流水线分组标签
|
|
||||||
*/
|
|
||||||
Map<String, List<PipelineGroupLabels>> getPipelinesGroupLabel(
|
|
||||||
Collection<String> pipelineIds,
|
|
||||||
String projectId
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分页获取收藏的流水线
|
|
||||||
*/
|
|
||||||
TPipelineFavorRecord getFavorPipelinesPage(
|
|
||||||
String userId,
|
|
||||||
Integer page,
|
|
||||||
Integer pageSize
|
|
||||||
);
|
|
||||||
}
|
|
@ -1,425 +0,0 @@
|
|||||||
package cd.casic.ci.process.process.engine.service;
|
|
||||||
|
|
||||||
import cd.casic.ci.common.pipeline.Model;
|
|
||||||
import cd.casic.ci.common.pipeline.enums.BuildStatus;
|
|
||||||
import cd.casic.ci.common.pipeline.enums.ChannelCode;
|
|
||||||
import cd.casic.ci.common.pipeline.enums.StartType;
|
|
||||||
import cd.casic.ci.common.pipeline.pojo.BuildParameters;
|
|
||||||
import cd.casic.ci.common.pipeline.pojo.ErrorInfo;
|
|
||||||
import cd.casic.ci.common.pipeline.pojo.time.BuildRecordTimeCost;
|
|
||||||
import cd.casic.ci.process.api.engine.pojo.BuildInfo;
|
|
||||||
import cd.casic.ci.process.api.process.enums.HistorySearchType;
|
|
||||||
import cd.casic.ci.process.api.process.pojo.*;
|
|
||||||
import cd.casic.ci.process.api.process.pojo.app.StartBuildContext;
|
|
||||||
import cd.casic.ci.process.api.process.pojo.pipeline.PipelineLatestBuild;
|
|
||||||
import cd.casic.ci.process.process.dataObject.TPipelineBuildSummaryRecord;
|
|
||||||
import cd.casic.ci.process.process.dataObject.TPipelineInfoRecord;
|
|
||||||
import cd.casic.ci.process.process.pojo.LatestRunningBuild;
|
|
||||||
import cd.casic.ci.process.process.pojo.PipelineFilterParam;
|
|
||||||
import org.apache.commons.lang3.tuple.Pair;
|
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 流水线运行时相关的服务接口
|
|
||||||
*/
|
|
||||||
public interface PipelineRuntimeService {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 取消待处理的任务
|
|
||||||
*/
|
|
||||||
void cancelPendingTask(String projectId, String pipelineId, String userId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取构建信息
|
|
||||||
*/
|
|
||||||
BuildInfo getBuildInfo(String projectId, String buildId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取构建信息
|
|
||||||
*/
|
|
||||||
BuildInfo getBuildInfo(String projectId, String pipelineId, String buildId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取运行中的构建数量
|
|
||||||
*/
|
|
||||||
int getRunningBuildCount(String projectId, String pipelineId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据并发组获取构建列表
|
|
||||||
*/
|
|
||||||
List<Pair<String, String>> getBuildInfoListByConcurrencyGroup(
|
|
||||||
String projectId,
|
|
||||||
String concurrencyGroup,
|
|
||||||
List<BuildStatus> status
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取构建号
|
|
||||||
*/
|
|
||||||
Map<String, String> getBuildNoByByPair(Set<String> buildIds, String projectId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取构建摘要记录
|
|
||||||
*/
|
|
||||||
TPipelineBuildSummaryRecord getBuildSummaryRecord(String projectId, String pipelineId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取流水线构建记录
|
|
||||||
*/
|
|
||||||
TPipelineInfoRecord getBuildPipelineRecords(
|
|
||||||
String projectId,
|
|
||||||
ChannelCode channelCode,
|
|
||||||
Collection<String> pipelineIds,
|
|
||||||
PipelineSortType sortType,
|
|
||||||
List<String> favorPipelines,
|
|
||||||
List<String> authPipelines,
|
|
||||||
String viewId,
|
|
||||||
List<PipelineFilterParam> pipelineFilterParamList,
|
|
||||||
Boolean permissionFlag,
|
|
||||||
Integer page,
|
|
||||||
Integer pageSize
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取最新构建
|
|
||||||
*/
|
|
||||||
Map<String, PipelineLatestBuild> getLatestBuild(String projectId, List<String> pipelineIds);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取流水线构建历史
|
|
||||||
*/
|
|
||||||
List<BuildHistory> listPipelineBuildHistory(
|
|
||||||
String projectId,
|
|
||||||
String pipelineId,
|
|
||||||
int offset,
|
|
||||||
int limit,
|
|
||||||
Boolean updateTimeDesc
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取流水线构建历史
|
|
||||||
*/
|
|
||||||
List<BuildHistory> listPipelineBuildHistory(
|
|
||||||
String projectId,
|
|
||||||
String pipelineId,
|
|
||||||
int offset,
|
|
||||||
int limit,
|
|
||||||
List<String> materialAlias,
|
|
||||||
String materialUrl,
|
|
||||||
List<String> materialBranch,
|
|
||||||
String materialCommitId,
|
|
||||||
String materialCommitMessage,
|
|
||||||
List<BuildStatus> status,
|
|
||||||
List<StartType> trigger,
|
|
||||||
Long queueTimeStartTime,
|
|
||||||
Long queueTimeEndTime,
|
|
||||||
Long startTimeStartTime,
|
|
||||||
Long startTimeEndTime,
|
|
||||||
Long endTimeStartTime,
|
|
||||||
Long endTimeEndTime,
|
|
||||||
Long totalTimeMin,
|
|
||||||
Long totalTimeMax,
|
|
||||||
String remark,
|
|
||||||
Integer buildNoStart,
|
|
||||||
Integer buildNoEnd,
|
|
||||||
String buildMsg,
|
|
||||||
List<String> startUser,
|
|
||||||
Boolean updateTimeDesc,
|
|
||||||
Boolean debug,
|
|
||||||
List<String> triggerAlias,
|
|
||||||
List<String> triggerBranch,
|
|
||||||
List<String> triggerUser
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新构建备注
|
|
||||||
*/
|
|
||||||
void updateBuildRemark(String projectId, String pipelineId, String buildId, String remark);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取历史条件仓库
|
|
||||||
*/
|
|
||||||
List<String> getHistoryConditionRepo(
|
|
||||||
String projectId,
|
|
||||||
String pipelineId,
|
|
||||||
Integer debugVersion,
|
|
||||||
String search,
|
|
||||||
HistorySearchType type
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取历史条件分支
|
|
||||||
*/
|
|
||||||
List<String> getHistoryConditionBranch(
|
|
||||||
String projectId,
|
|
||||||
String pipelineId,
|
|
||||||
List<String> aliasList,
|
|
||||||
Integer debugVersion,
|
|
||||||
String search,
|
|
||||||
HistorySearchType type
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取构建历史
|
|
||||||
*/
|
|
||||||
BuildHistory getBuildHistoryByBuildNum(
|
|
||||||
String projectId,
|
|
||||||
String pipelineId,
|
|
||||||
Integer buildNum,
|
|
||||||
Set<BuildStatus> statusSet,
|
|
||||||
Boolean debug
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取构建基本信息
|
|
||||||
*/
|
|
||||||
Map<String, BuildBasicInfo> getBuildBasicInfoByIds(Set<String> buildIds);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取构建历史
|
|
||||||
*/
|
|
||||||
BuildHistory getBuildHistoryById(String projectId, String buildId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取启动用户
|
|
||||||
*/
|
|
||||||
String getStartUser(String projectId, String buildId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取构建历史
|
|
||||||
*/
|
|
||||||
List<BuildHistory> getBuildHistoryByIds(
|
|
||||||
Set<String> buildIds,
|
|
||||||
String startBeginTime,
|
|
||||||
String endBeginTime,
|
|
||||||
String projectId
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 取消构建
|
|
||||||
*/
|
|
||||||
Boolean cancelBuild(
|
|
||||||
String projectId,
|
|
||||||
String pipelineId,
|
|
||||||
String buildId,
|
|
||||||
String userId,
|
|
||||||
int executeCount,
|
|
||||||
BuildStatus buildStatus,
|
|
||||||
Boolean terminateFlag
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 开始构建
|
|
||||||
*/
|
|
||||||
BuildId startBuild(Model fullModel, StartBuildContext context);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新构建号
|
|
||||||
*/
|
|
||||||
void updateBuildNo(String projectId, String pipelineId, int buildNo, Boolean debug);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新执行次数
|
|
||||||
*/
|
|
||||||
void updateExecuteCount(String projectId, String buildId, int executeCount);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 开始最新运行构建
|
|
||||||
*/
|
|
||||||
void startLatestRunningBuild(LatestRunningBuild latestRunningBuild);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 完成最新运行构建
|
|
||||||
*/
|
|
||||||
void finishLatestRunningBuild(
|
|
||||||
LatestRunningBuild latestRunningBuild,
|
|
||||||
BuildStatus currentBuildStatus,
|
|
||||||
List<ErrorInfo> errorInfoList,
|
|
||||||
BuildRecordTimeCost timeCost
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取构建参数
|
|
||||||
*/
|
|
||||||
List<BuildParameters> getBuildParametersFromStartup(
|
|
||||||
String projectId,
|
|
||||||
String buildId
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取执行时间
|
|
||||||
*/
|
|
||||||
Long getExecuteTime(String projectId, String buildId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取上次构建
|
|
||||||
*/
|
|
||||||
BuildInfo getLastTimeBuild(String projectId, String pipelineId, Boolean debug);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取流水线构建历史数量
|
|
||||||
*/
|
|
||||||
int getPipelineBuildHistoryCount(String projectId, String pipelineId, Integer debugVersion);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取构建
|
|
||||||
*/
|
|
||||||
List<String> getBuilds(
|
|
||||||
String projectId,
|
|
||||||
String pipelineId,
|
|
||||||
Set<BuildStatus> buildStatus,
|
|
||||||
Integer debugVersion
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取流水线构建历史数量
|
|
||||||
*/
|
|
||||||
int getPipelineBuildHistoryCount(
|
|
||||||
String projectId,
|
|
||||||
String pipelineId,
|
|
||||||
List<String> materialAlias,
|
|
||||||
String materialUrl,
|
|
||||||
List<String> materialBranch,
|
|
||||||
String materialCommitId,
|
|
||||||
String materialCommitMessage,
|
|
||||||
List<BuildStatus> status,
|
|
||||||
List<StartType> trigger,
|
|
||||||
Long queueTimeStartTime,
|
|
||||||
Long queueTimeEndTime,
|
|
||||||
Long startTimeStartTime,
|
|
||||||
Long startTimeEndTime,
|
|
||||||
Long endTimeStartTime,
|
|
||||||
Long endTimeEndTime,
|
|
||||||
Long totalTimeMin,
|
|
||||||
Long totalTimeMax,
|
|
||||||
String remark,
|
|
||||||
Integer buildNoStart,
|
|
||||||
Integer buildNoEnd,
|
|
||||||
String buildMsg,
|
|
||||||
List<String> startUser,
|
|
||||||
Boolean debug,
|
|
||||||
List<String> triggerAlias,
|
|
||||||
List<String> triggerBranch,
|
|
||||||
List<String> triggerUser
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取总构建历史数量
|
|
||||||
*/
|
|
||||||
int getTotalBuildHistoryCount(
|
|
||||||
String projectId,
|
|
||||||
String pipelineId,
|
|
||||||
List<BuildStatus> status,
|
|
||||||
Long startTimeEndTime
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取所有构建号
|
|
||||||
*/
|
|
||||||
Collection<Integer> getAllBuildNum(String projectId, String pipelineId, Integer debugVersion);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取最新构建ID
|
|
||||||
*/
|
|
||||||
String getLatestBuildId(String projectId, String pipelineId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取最新完成构建ID
|
|
||||||
*/
|
|
||||||
String getLatestFinishedBuildId(String projectId, String pipelineId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取最新成功构建ID
|
|
||||||
*/
|
|
||||||
String getLatestSucceededBuildId(String projectId, String pipelineId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取最新失败构建ID
|
|
||||||
*/
|
|
||||||
String getLatestFailedBuildId(String projectId, String pipelineId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据构建号获取构建ID
|
|
||||||
*/
|
|
||||||
String getBuildIdByBuildNum(
|
|
||||||
String projectId,
|
|
||||||
String pipelineId,
|
|
||||||
int buildNum,
|
|
||||||
Integer debugVersion
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新构建信息状态为排队
|
|
||||||
*/
|
|
||||||
void updateBuildInfoStatus2Queue(String projectId, String buildId, BuildStatus oldStatus, String showMsg);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新制品列表
|
|
||||||
*/
|
|
||||||
Boolean updateArtifactList(
|
|
||||||
String projectId,
|
|
||||||
String pipelineId,
|
|
||||||
String buildId,
|
|
||||||
String artifactListJsonString
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新构建历史阶段状态
|
|
||||||
*/
|
|
||||||
void updateBuildHistoryStageState(String projectId, String buildId, List<BuildStageStatus> allStageStatus);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新推荐版本
|
|
||||||
*/
|
|
||||||
void updateRecommendVersion(String projectId, String buildId, String recommendVersion);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新构建参数
|
|
||||||
*/
|
|
||||||
Boolean updateBuildParameters(
|
|
||||||
String projectId,
|
|
||||||
String pipelineId,
|
|
||||||
String buildId,
|
|
||||||
Collection<BuildParameters> buildParameters,
|
|
||||||
Boolean debug
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 并发取消构建流水线
|
|
||||||
*/
|
|
||||||
void concurrencyCancelBuildPipeline(
|
|
||||||
String projectId,
|
|
||||||
String pipelineId,
|
|
||||||
String buildId,
|
|
||||||
String userId,
|
|
||||||
String groupName,
|
|
||||||
String detailUrl
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新异步状态
|
|
||||||
*/
|
|
||||||
void updateAsyncStatus(
|
|
||||||
String projectId,
|
|
||||||
String pipelineId,
|
|
||||||
String buildId,
|
|
||||||
String taskId,
|
|
||||||
int executeCount,
|
|
||||||
String asyncStatus
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取构建变量服务
|
|
||||||
*/
|
|
||||||
Map<String, String> getBuildVariableService(
|
|
||||||
String projectId,
|
|
||||||
String pipelineId,
|
|
||||||
String buildId,
|
|
||||||
Set<String> keys
|
|
||||||
);
|
|
||||||
}
|
|
@ -1,118 +0,0 @@
|
|||||||
package cd.casic.ci.process.process.engine.service;
|
|
||||||
|
|
||||||
|
|
||||||
import cd.casic.ci.common.pipeline.Model;
|
|
||||||
import cd.casic.ci.common.pipeline.enums.RepositoryConfig;
|
|
||||||
import cd.casic.ci.common.pipeline.enums.ScmType;
|
|
||||||
import cd.casic.ci.common.pipeline.pojo.element.trigger.enums.CodeEventType;
|
|
||||||
import cd.casic.ci.log.scm.dal.pojo.Repository;
|
|
||||||
import cd.casic.ci.process.api.process.pojo.webhook.PipelineWebhook;
|
|
||||||
import cd.casic.ci.process.api.process.pojo.webhook.WebhookTriggerPipeline;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 流水线Webhook服务接口
|
|
||||||
*/
|
|
||||||
public interface PipelineWebhookService {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 添加Webhook
|
|
||||||
*/
|
|
||||||
void addWebhook(
|
|
||||||
String projectId,
|
|
||||||
String pipelineId,
|
|
||||||
Integer version,
|
|
||||||
String userId
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 注册Webhook
|
|
||||||
*/
|
|
||||||
Repository registerWebhook(
|
|
||||||
String projectId,
|
|
||||||
ScmType scmType,
|
|
||||||
RepositoryConfig repositoryConfig,
|
|
||||||
CodeEventType codeEventType,
|
|
||||||
String elementVersion
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除Webhook
|
|
||||||
*/
|
|
||||||
Boolean deleteWebhook(
|
|
||||||
String projectId,
|
|
||||||
String pipelineId,
|
|
||||||
String userId
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除指定任务的Webhook
|
|
||||||
*/
|
|
||||||
Boolean deleteWebhook(
|
|
||||||
String projectId,
|
|
||||||
String pipelineId,
|
|
||||||
String taskId,
|
|
||||||
String userId
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取模型
|
|
||||||
*/
|
|
||||||
Model getModel(
|
|
||||||
String projectId,
|
|
||||||
String pipelineId,
|
|
||||||
Integer version
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取触发流水线列表
|
|
||||||
*/
|
|
||||||
List<WebhookTriggerPipeline> getTriggerPipelines(
|
|
||||||
String name,
|
|
||||||
ScmType repositoryType,
|
|
||||||
List<String> yamlPipelineIds
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 列出触发流水线
|
|
||||||
*/
|
|
||||||
List<WebhookTriggerPipeline> listTriggerPipeline(
|
|
||||||
String projectId,
|
|
||||||
String repositoryHashId,
|
|
||||||
String eventType
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取项目名称
|
|
||||||
*/
|
|
||||||
String getProjectName(String projectName);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取外部名称
|
|
||||||
*/
|
|
||||||
String getExternalName(ScmType scmType, String projectName);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 列出Webhook
|
|
||||||
*/
|
|
||||||
List<PipelineWebhook> listWebhook(
|
|
||||||
String userId,
|
|
||||||
String projectId,
|
|
||||||
String pipelineId,
|
|
||||||
Integer page,
|
|
||||||
Integer pageSize
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取Webhook
|
|
||||||
*/
|
|
||||||
PipelineWebhook get(
|
|
||||||
String projectId,
|
|
||||||
String pipelineId,
|
|
||||||
String repositoryHashId,
|
|
||||||
String eventType
|
|
||||||
);
|
|
||||||
}
|
|
@ -1,78 +0,0 @@
|
|||||||
package cd.casic.ci.process.process.engine.service;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import cd.casic.ci.common.pipeline.Model;
|
|
||||||
import cd.casic.ci.common.pipeline.enums.RepositoryConfig;
|
|
||||||
import cd.casic.ci.common.pipeline.pojo.element.Element;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 流水线代码库使用服务接口
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
public interface RepoPipelineRefService {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新代码库流水线引用
|
|
||||||
*
|
|
||||||
* @param userId 用户ID
|
|
||||||
* @param action 操作类型
|
|
||||||
* @param projectId 项目ID
|
|
||||||
* @param pipelineId 流水线ID
|
|
||||||
*/
|
|
||||||
void updateRepoPipelineRef(String userId, String action, String projectId, String pipelineId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新流水线引用
|
|
||||||
*
|
|
||||||
* @param userId 用户ID
|
|
||||||
* @param projectId 项目ID
|
|
||||||
* @param pipelineId 流水线ID
|
|
||||||
*/
|
|
||||||
void updatePipelineRef(String userId, String projectId, String pipelineId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新所有流水线引用
|
|
||||||
*
|
|
||||||
* @param projectId 项目ID,可为空
|
|
||||||
*/
|
|
||||||
void updateAllPipelineRef(String projectId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分析流水线引用并保存
|
|
||||||
*
|
|
||||||
* @param userId 用户ID
|
|
||||||
* @param action 操作类型
|
|
||||||
* @param projectId 项目ID
|
|
||||||
* @param pipelineId 流水线ID
|
|
||||||
* @param model 流水线模型
|
|
||||||
* @param channel 渠道
|
|
||||||
*/
|
|
||||||
void analysisPipelineRefAndSave(
|
|
||||||
String userId,
|
|
||||||
String action,
|
|
||||||
String projectId,
|
|
||||||
String pipelineId,
|
|
||||||
Model model,
|
|
||||||
String channel
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取任务参数
|
|
||||||
*
|
|
||||||
* @param element 元素
|
|
||||||
* @return 任务参数Map
|
|
||||||
*/
|
|
||||||
Map<String, Object> getTaskParams(Element element);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取市场构建代码库配置
|
|
||||||
*
|
|
||||||
* @param input 输入参数
|
|
||||||
* @param variables 变量Map
|
|
||||||
* @return 代码库配置
|
|
||||||
*/
|
|
||||||
RepositoryConfig getMarketBuildRepoConfig(Map<?, ?> input, Map<String, String> variables);
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user