Compare commits
2 Commits
df1754d820
...
a30646253d
Author | SHA1 | Date | |
---|---|---|---|
![]() |
a30646253d | ||
![]() |
258f1f96ac |
@ -0,0 +1,12 @@
|
||||
package cd.casic.ci.common.pipeline.annotation;
|
||||
|
||||
import org.springframework.stereotype.Indexed;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
@Target({ElementType.TYPE})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
@Indexed
|
||||
public @interface Plugin {
|
||||
}
|
@ -7,6 +7,7 @@ import cd.casic.ci.log.dal.pojo.enums.LogType;
|
||||
import cd.casic.ci.log.jmx.LogStorageBean;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author by mianbin
|
||||
@ -14,6 +15,7 @@ import org.springframework.http.ResponseEntity;
|
||||
* @Description TODO
|
||||
* @Date 2025/3/20 14:59
|
||||
*/
|
||||
@Service
|
||||
public class BuildLogQueryService {
|
||||
|
||||
@Resource
|
||||
|
@ -1,26 +0,0 @@
|
||||
package cd.casic.ci.process.process.dal.engin;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface PipelineTriggerReviewDao {
|
||||
Integer createReviewRecord(
|
||||
@Param("buildId") String buildId,
|
||||
@Param("pipelineId") String pipelineId,
|
||||
@Param("projectId") String projectId,
|
||||
@Param("reviewers") List<String> reviewers
|
||||
);
|
||||
Integer updateOperator(
|
||||
@Param("projectId") String projectId,
|
||||
@Param("pipelineId") String pipelineId,
|
||||
@Param("buildId") String buildId,
|
||||
@Param("userId") String userId
|
||||
);
|
||||
List<String> getTriggerReviewers(
|
||||
@Param("projectId") String projectId,
|
||||
@Param("pipelineId") String pipelineId,
|
||||
@Param("buildId") String buildId
|
||||
);
|
||||
|
||||
}
|
@ -1,192 +0,0 @@
|
||||
/*
|
||||
* Tencent is pleased to support the open source community by making BK-CI 蓝鲸持续集成平台 available.
|
||||
*
|
||||
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
|
||||
*
|
||||
* BK-CI 蓝鲸持续集成平台 is licensed under the MIT license.
|
||||
*
|
||||
* A copy of the MIT License is included in this file.
|
||||
*
|
||||
*
|
||||
* Terms of the MIT License:
|
||||
* ---------------------------------------------------
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
||||
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
|
||||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of
|
||||
* the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
|
||||
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||
* NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package cd.casic.ci.process.process.dal.record;
|
||||
|
||||
import cd.casic.ci.common.pipeline.enums.BuildStatus;
|
||||
import cd.casic.ci.common.pipeline.pojo.time.BuildTimestampType;
|
||||
import cd.casic.ci.process.api.process.pojo.pipeline.record.BuildRecordContainer;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 构建记录容器 Mapper 接口
|
||||
*/
|
||||
@Mapper
|
||||
@Repository
|
||||
public interface BuildRecordContainerDao {
|
||||
|
||||
/**
|
||||
* 批量保存构建记录容器
|
||||
*
|
||||
* @param records 构建记录容器列表
|
||||
*/
|
||||
void batchSave(@Param("records") List<BuildRecordContainer> records);
|
||||
|
||||
/**
|
||||
* 更新构建记录容器
|
||||
*
|
||||
* @param projectId 项目ID
|
||||
* @param pipelineId 流水线ID
|
||||
* @param buildId 构建ID
|
||||
* @param containerId 容器ID
|
||||
* @param executeCount 执行次数
|
||||
* @param containerVar 容器变量
|
||||
* @param buildStatus 构建状态
|
||||
* @param startTime 开始时间
|
||||
* @param endTime 结束时间
|
||||
* @param timestamps 时间戳
|
||||
*/
|
||||
void updateRecord(
|
||||
@Param("projectId") String projectId,
|
||||
@Param("pipelineId") String pipelineId,
|
||||
@Param("buildId") String buildId,
|
||||
@Param("containerId") String containerId,
|
||||
@Param("executeCount") Integer executeCount,
|
||||
@Param("containerVar") Map<String, Object> containerVar,
|
||||
@Param("buildStatus") BuildStatus buildStatus,
|
||||
@Param("startTime") LocalDateTime startTime,
|
||||
@Param("endTime") LocalDateTime endTime,
|
||||
@Param("timestamps") Map<BuildTimestampType, String> timestamps
|
||||
);
|
||||
|
||||
/**
|
||||
* 重试时清空结束时间
|
||||
*
|
||||
* @param projectId 项目ID
|
||||
* @param pipelineId 流水线ID
|
||||
* @param buildId 构建ID
|
||||
* @param containerId 容器ID
|
||||
* @param executeCount 执行次数
|
||||
*/
|
||||
void flushEndTimeWhenRetry(
|
||||
@Param("projectId") String projectId,
|
||||
@Param("pipelineId") String pipelineId,
|
||||
@Param("buildId") String buildId,
|
||||
@Param("containerId") String containerId,
|
||||
@Param("executeCount") Integer executeCount
|
||||
);
|
||||
|
||||
/**
|
||||
* 获取构建记录容器
|
||||
*
|
||||
* @param projectId 项目ID
|
||||
* @param pipelineId 流水线ID
|
||||
* @param buildId 构建ID
|
||||
* @param containerId 容器ID
|
||||
* @param executeCount 执行次数
|
||||
* @return 构建记录容器
|
||||
*/
|
||||
BuildRecordContainer getRecord(
|
||||
@Param("projectId") String projectId,
|
||||
@Param("pipelineId") String pipelineId,
|
||||
@Param("buildId") String buildId,
|
||||
@Param("containerId") String containerId,
|
||||
@Param("executeCount") Integer executeCount
|
||||
);
|
||||
|
||||
/**
|
||||
* 获取构建记录容器列表
|
||||
*
|
||||
* @param projectId 项目ID
|
||||
* @param pipelineId 流水线ID
|
||||
* @param buildId 构建ID
|
||||
* @param executeCount 执行次数
|
||||
* @param stageId 阶段ID
|
||||
* @param matrixGroupId 矩阵组ID
|
||||
* @param buildStatusSet 构建状态集合
|
||||
* @return 构建记录容器列表
|
||||
*/
|
||||
List<BuildRecordContainer> getRecords(
|
||||
@Param("projectId") String projectId,
|
||||
@Param("pipelineId") String pipelineId,
|
||||
@Param("buildId") String buildId,
|
||||
@Param("executeCount") Integer executeCount,
|
||||
@Param("stageId") String stageId,
|
||||
@Param("matrixGroupId") String matrixGroupId,
|
||||
@Param("buildStatusSet") Set<BuildStatus> buildStatusSet
|
||||
);
|
||||
|
||||
/**
|
||||
* 更新构建记录容器状态
|
||||
*
|
||||
* @param projectId 项目ID
|
||||
* @param pipelineId 流水线ID
|
||||
* @param buildId 构建ID
|
||||
* @param executeCount 执行次数
|
||||
* @param buildStatus 构建状态
|
||||
* @param stageId 阶段ID
|
||||
*/
|
||||
void updateRecordStatus(
|
||||
@Param("projectId") String projectId,
|
||||
@Param("pipelineId") String pipelineId,
|
||||
@Param("buildId") String buildId,
|
||||
@Param("executeCount") Integer executeCount,
|
||||
@Param("buildStatus") BuildStatus buildStatus,
|
||||
@Param("stageId") String stageId
|
||||
);
|
||||
|
||||
/**
|
||||
* 获取最新的普通构建记录容器列表
|
||||
*
|
||||
* @param projectId 项目ID
|
||||
* @param pipelineId 流水线ID
|
||||
* @param buildId 构建ID
|
||||
* @param executeCount 执行次数
|
||||
* @param stageId 阶段ID
|
||||
* @return 构建记录容器列表
|
||||
*/
|
||||
List<BuildRecordContainer> getLatestNormalRecords(
|
||||
@Param("projectId") String projectId,
|
||||
@Param("pipelineId") String pipelineId,
|
||||
@Param("buildId") String buildId,
|
||||
@Param("executeCount") Integer executeCount,
|
||||
@Param("stageId") String stageId
|
||||
);
|
||||
|
||||
/**
|
||||
* 获取最新的矩阵构建记录容器列表
|
||||
*
|
||||
* @param projectId 项目ID
|
||||
* @param pipelineId 流水线ID
|
||||
* @param buildId 构建ID
|
||||
* @param executeCount 执行次数
|
||||
* @return 构建记录容器列表
|
||||
*/
|
||||
List<BuildRecordContainer> getLatestMatrixRecords(
|
||||
@Param("projectId") String projectId,
|
||||
@Param("pipelineId") String pipelineId,
|
||||
@Param("buildId") String buildId,
|
||||
@Param("executeCount") Integer executeCount
|
||||
);
|
||||
}
|
@ -1,57 +0,0 @@
|
||||
package cd.casic.ci.process.process.dal.record;
|
||||
|
||||
import cd.casic.ci.common.pipeline.enums.BuildRecordTimeStamp;
|
||||
import cd.casic.ci.common.pipeline.enums.BuildStatus;
|
||||
import cd.casic.ci.common.pipeline.pojo.ErrorInfo;
|
||||
import cd.casic.ci.common.pipeline.pojo.time.BuildTimestampType;
|
||||
import cd.casic.ci.process.api.process.pojo.pipeline.BuildRecordInfo;
|
||||
import cd.casic.ci.process.api.process.pojo.pipeline.record.BuildRecordModel;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 构建记录模型Mapper接口
|
||||
*/
|
||||
@Mapper
|
||||
@Repository
|
||||
public interface BuildRecordModelDao {
|
||||
/**
|
||||
* 创建构建记录模型 * * @param record 记录 * @return 影响行数
|
||||
*/
|
||||
int createBuildRecordModel(@Param("record") BuildRecordModel record);
|
||||
|
||||
/**
|
||||
* 更新构建记录模型 * * @param projectId 项目ID * @param pipelineId 流水线ID * @param buildId 构建ID * @param executeCount 执行次数 * @param buildStatus 构建状<EFBFBD>? * @param modelVar 模型变量 * @param startTime 开始时<EFBFBD>? * @param endTime 结束时间 * @param errorInfoList 错误信息列表 * @param cancelUser 取消用户 * @param timestamps 时间<EFBFBD>? * @return 影响行数
|
||||
*/
|
||||
int updateBuildRecordModel(@Param("projectId") String projectId, @Param("pipelineId") String pipelineId, @Param("buildId") String buildId, @Param("executeCount") int executeCount, @Param("buildStatus") BuildStatus buildStatus, @Param("modelVar") Map<String, Object> modelVar, @Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime, @Param("errorInfoList") List<ErrorInfo> errorInfoList, @Param("cancelUser") String cancelUser, @Param("timestamps") Map<BuildTimestampType, BuildRecordTimeStamp> timestamps);
|
||||
|
||||
/**
|
||||
* 更新构建记录模型状<EFBFBD>? * * @param projectId 项目ID * @param buildId 构建ID * @param buildStatus 构建状<EFBFBD>? * @param executeCount 执行次数 * @return 影响行数
|
||||
*/
|
||||
int updateBuildRecordModelStatus(@Param("projectId") String projectId, @Param("buildId") String buildId, @Param("buildStatus") BuildStatus buildStatus, @Param("executeCount") int executeCount);
|
||||
|
||||
/**
|
||||
* 获取构建记录模型 * * @param projectId 项目ID * @param pipelineId 流水线ID * @param buildId 构建ID * @param executeCount 执行次数 * @return 记录
|
||||
*/
|
||||
BuildRecordModel getBuildRecordModel(@Param("projectId") String projectId, @Param("pipelineId") String pipelineId, @Param("buildId") String buildId, @Param("executeCount") int executeCount);
|
||||
|
||||
/**
|
||||
* 获取构建记录信息列表 * * @param projectId 项目ID * @param pipelineId 流水线ID * @param buildId 构建ID * @return 记录信息列表
|
||||
*/
|
||||
List<BuildRecordInfo> getBuildRecordInfoList(@Param("projectId") String projectId, @Param("pipelineId") String pipelineId, @Param("buildId") String buildId);
|
||||
|
||||
/**
|
||||
* 更新构建取消用户 * * @param projectId 项目ID * @param buildId 构建ID * @param executeCount 执行次数 * @param cancelUser 取消用户 * @return 影响行数
|
||||
*/
|
||||
int updateBuildCancelUser(@Param("projectId") String projectId, @Param("buildId") String buildId, @Param("executeCount") int executeCount, @Param("cancelUser") String cancelUser);
|
||||
|
||||
/**
|
||||
* 获取构建取消用户 * * @param projectId 项目ID * @param buildId 构建ID * @param executeCount 执行次数 * @return 取消用户
|
||||
*/
|
||||
String getBuildCancelUser(@Param("projectId") String projectId, @Param("buildId") String buildId, @Param("executeCount") int executeCount);
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
/* * Tencent is pleased to support the open source community by making BK-CI 蓝鲸持续集成平台 available. * * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * * BK-CI 蓝鲸持续集成平台 is licensed under the MIT license. * * A copy of the MIT License is included in this file. * * * Terms of the MIT License: * --------------------------------------------------- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated * documentation files (the "Software"), to deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all copies or substantial portions of * the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT * LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN * NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
package cd.casic.ci.process.process.dal.record;
|
||||
|
||||
import cd.casic.ci.common.pipeline.enums.BuildRecordTimeStamp;
|
||||
import cd.casic.ci.common.pipeline.enums.BuildStatus;
|
||||
import cd.casic.ci.common.pipeline.pojo.time.BuildTimestampType;
|
||||
import cd.casic.ci.process.api.process.pojo.pipeline.record.BuildRecordStage;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 构建记录阶段 Dao 接口
|
||||
*/
|
||||
@Repository
|
||||
public interface BuildRecordStageDao {
|
||||
/**
|
||||
* 批量保存记录 * * @param records 记录列表 * @return 影响的行<EFBFBD>?
|
||||
*/
|
||||
int batchSave(@Param("records") List<BuildRecordStage> records);
|
||||
|
||||
/**
|
||||
* 更新记录 * * @param projectId 项目ID * @param pipelineId 流水线ID * @param buildId 构建ID * @param stageId 阶段ID * @param executeCount 执行次数 * @param stageVar 阶段变量 * @param buildStatus 构建状<EFBFBD>? * @param startTime 开始时<EFBFBD>? * @param endTime 结束时间 * @param timestamps 时间<EFBFBD>? * @return 影响的行<EFBFBD>?
|
||||
*/
|
||||
int updateRecord(@Param("projectId") String projectId, @Param("pipelineId") String pipelineId, @Param("buildId") String buildId, @Param("stageId") String stageId, @Param("executeCount") int executeCount, @Param("stageVar") Map<String, Object> stageVar, @Param("buildStatus") BuildStatus buildStatus, @Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime, @Param("timestamps") Map<BuildTimestampType, BuildRecordTimeStamp> timestamps);
|
||||
|
||||
/**
|
||||
* 获取记录列表 * * @param projectId 项目ID * @param pipelineId 流水线ID * @param buildId 构建ID * @param executeCount 执行次数 * @param buildStatusSet 构建状态集<EFBFBD>? * @return 构建记录阶段列表
|
||||
*/
|
||||
List<BuildRecordStage> getRecords(@Param("projectId") String projectId, @Param("pipelineId") String pipelineId, @Param("buildId") String buildId, @Param("executeCount") int executeCount, @Param("buildStatusSet") Set<BuildStatus> buildStatusSet);
|
||||
|
||||
/**
|
||||
* 获取最新的记录 * * @param projectId 项目ID * @param pipelineId 流水线ID * @param buildId 构建ID * @param executeCount 执行次数 * @return 构建记录阶段列表
|
||||
*/
|
||||
List<BuildRecordStage> getLatestRecords(@Param("projectId") String projectId, @Param("pipelineId") String pipelineId, @Param("buildId") String buildId, @Param("executeCount") int executeCount);
|
||||
}
|
@ -1,67 +0,0 @@
|
||||
/* * Tencent is pleased to support the open source community by making BK-CI 蓝鲸持续集成平台 available. * * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * * BK-CI 蓝鲸持续集成平台 is licensed under the MIT license. * * A copy of the MIT License is included in this file. * * * Terms of the MIT License: * --------------------------------------------------- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated * documentation files (the "Software"), to deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all copies or substantial portions of * the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT * LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN * NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
package cd.casic.ci.process.process.dal.record;
|
||||
|
||||
import cd.casic.ci.common.pipeline.enums.BuildRecordTimeStamp;
|
||||
import cd.casic.ci.common.pipeline.enums.BuildStatus;
|
||||
import cd.casic.ci.common.pipeline.pojo.time.BuildTimestampType;
|
||||
import cd.casic.ci.process.api.process.pojo.pipeline.record.BuildRecordTask;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 构建记录任务 Dao 接口
|
||||
*/
|
||||
@Mapper
|
||||
@Repository
|
||||
public interface BuildRecordTaskDao {
|
||||
/**
|
||||
* 批量保存构建记录任务 * * @param records 构建记录任务列表
|
||||
*/
|
||||
void batchSave(@Param("records") List<BuildRecordTask> records);
|
||||
|
||||
/**
|
||||
* 更新构建记录 * * @param projectId 项目ID * @param pipelineId 流水线ID * @param buildId 构建ID * @param taskId 任务ID * @param executeCount 执行次数 * @param taskVar 任务变量 * @param buildStatus 构建状<EFBFBD>? * @param startTime 开始时<EFBFBD>? * @param endTime 结束时间 * @param timestamps 时间<EFBFBD>?
|
||||
*/
|
||||
void updateRecord(@Param("projectId") String projectId, @Param("pipelineId") String pipelineId, @Param("buildId") String buildId, @Param("taskId") String taskId, @Param("executeCount") int executeCount, @Param("taskVar") Map<String, Object> taskVar, @Param("buildStatus") BuildStatus buildStatus, @Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime, @Param("timestamps") Map<BuildTimestampType, BuildRecordTimeStamp> timestamps);
|
||||
|
||||
/**
|
||||
* 更新构建记录状<EFBFBD>? * * @param projectId 项目ID * @param pipelineId 流水线ID * @param buildId 构建ID * @param executeCount 执行次数 * @param buildStatus 构建状<EFBFBD>? * @param stageId 阶段ID * @param containerId 容器ID
|
||||
*/
|
||||
void updateRecordStatus(@Param("projectId") String projectId, @Param("pipelineId") String pipelineId, @Param("buildId") String buildId, @Param("executeCount") int executeCount, @Param("buildStatus") BuildStatus buildStatus, @Param("stageId") String stageId, @Param("containerId") String containerId);
|
||||
|
||||
/**
|
||||
* 获取构建记录列表 * * @param projectId 项目ID * @param pipelineId 流水线ID * @param buildId 构建ID * @param executeCount 执行次数 * @param containerId 容器ID * @param buildStatusSet 构建状态集<EFBFBD>? * @return 构建记录任务列表
|
||||
*/
|
||||
List<BuildRecordTask> getRecords(@Param("projectId") String projectId, @Param("pipelineId") String pipelineId, @Param("buildId") String buildId, @Param("executeCount") int executeCount, @Param("containerId") String containerId, @Param("buildStatusSet") Set<BuildStatus> buildStatusSet);
|
||||
|
||||
/**
|
||||
* 获取最新的普通构建记录列<EFBFBD>? * * @param projectId 项目ID * @param buildId 构建ID * @param executeCount 执行次数 * @param matrixContainerIds 矩阵容器ID列表 * @param stageId 阶段ID * @return 构建记录任务列表
|
||||
*/
|
||||
List<BuildRecordTask> getLatestNormalRecords(@Param("projectId") String projectId, @Param("buildId") String buildId, @Param("executeCount") int executeCount, @Param("matrixContainerIds") List<String> matrixContainerIds, @Param("stageId") String stageId);
|
||||
|
||||
/**
|
||||
* 获取最新的矩阵构建记录列表 * * @param projectId 项目ID * @param buildId 构建ID * @param executeCount 执行次数 * @param matrixContainerIds 矩阵容器ID列表 * @return 构建记录任务列表
|
||||
*/
|
||||
List<BuildRecordTask> getLatestMatrixRecords(@Param("projectId") String projectId, @Param("buildId") String buildId, @Param("executeCount") int executeCount, @Param("matrixContainerIds") List<String> matrixContainerIds);
|
||||
|
||||
/**
|
||||
* 获取构建记录 * * @param projectId 项目ID * @param pipelineId 流水线ID * @param buildId 构建ID * @param taskId 任务ID * @param executeCount 执行次数 * @return 构建记录任务
|
||||
*/
|
||||
BuildRecordTask getRecord(@Param("projectId") String projectId, @Param("pipelineId") String pipelineId, @Param("buildId") String buildId, @Param("taskId") String taskId, @Param("executeCount") int executeCount);
|
||||
|
||||
/**
|
||||
* 更新异步状<EFBFBD>? * * @param projectId 项目ID * @param pipelineId 流水线ID * @param buildId 构建ID * @param taskId 任务ID * @param executeCount 执行次数 * @param asyncStatus 异步状<EFBFBD>?
|
||||
*/
|
||||
void updateAsyncStatus(@Param("projectId") String projectId, @Param("pipelineId") String pipelineId, @Param("buildId") String buildId, @Param("taskId") String taskId, @Param("executeCount") int executeCount, @Param("asyncStatus") String asyncStatus);
|
||||
|
||||
/**
|
||||
* 重试时清空结束时<EFBFBD>? * * @param projectId 项目ID * @param pipelineId 流水线ID * @param buildId 构建ID * @param taskId 任务ID * @param executeCount 执行次数
|
||||
*/
|
||||
void flushEndTimeWhenRetry(@Param("projectId") String projectId, @Param("pipelineId") String pipelineId, @Param("buildId") String buildId, @Param("taskId") String taskId, @Param("executeCount") int executeCount);
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
/* * Tencent is pleased to support the open source community by making BK-CI 蓝鲸持续集成平台 available. * * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * * BK-CI 蓝鲸持续集成平台 is licensed under the MIT license. * * A copy of the MIT License is included in this file. * * * Terms of the MIT License: * --------------------------------------------------- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated * documentation files (the "Software"), to deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all copies or substantial portions of * the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT * LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN * NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
package cd.casic.ci.process.process.dal.report;
|
||||
|
||||
import cd.casic.ci.process.api.process.pojo.Report;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 报告 Dao 接口
|
||||
*/
|
||||
@Mapper
|
||||
@Repository
|
||||
public interface ReportDao {
|
||||
/**
|
||||
* 获取原子信息 * * @param buildId 构建ID * @param taskId 任务ID * @return 原子信息
|
||||
*/
|
||||
Map<String, String> getAtomInfo(@Param("buildId") String buildId, @Param("taskId") String taskId);
|
||||
|
||||
/**
|
||||
* 创建报告 * * @param projectId 项目ID * @param pipelineId 流水线ID * @param buildId 构建ID * @param elementId 元素ID * @param indexFile 索引文件 * @param name 名称 * @param type 类型 * @param atomCode 原子代码 * @param taskName 任务名称 * @param id 记录ID * @return 记录ID
|
||||
*/
|
||||
long createReport(@Param("projectId") String projectId, @Param("pipelineId") String pipelineId, @Param("buildId") String buildId, @Param("elementId") String elementId, @Param("indexFile") String indexFile, @Param("name") String name, @Param("type") String type, @Param("atomCode") String atomCode, @Param("taskName") String taskName, @Param("id") Long id);
|
||||
|
||||
/**
|
||||
* 获取报告 * * @param projectId 项目ID * @param pipelineId 流水线ID * @param buildId 构建ID * @param elementId 元素ID * @return 报告
|
||||
*/
|
||||
Report getReport(@Param("projectId") String projectId, @Param("pipelineId") String pipelineId, @Param("buildId") String buildId, @Param("elementId") String elementId);
|
||||
|
||||
/**
|
||||
* 获取报告列表 * * @param projectId 项目ID * @param pipelineId 流水线ID * @param buildId 构建ID * @return 报告列表
|
||||
*/
|
||||
List<Report> getReportList(@Param("projectId") String projectId, @Param("pipelineId") String pipelineId, @Param("buildId") String buildId);
|
||||
|
||||
/**
|
||||
* 删除报告 * * @param projectId 项目ID * @param pipelineId 流水线ID * @param buildId 构建ID * @param elementId 元素ID * @return 影响的行<EFBFBD>?
|
||||
*/
|
||||
int deleteReport(@Param("projectId") String projectId, @Param("pipelineId") String pipelineId, @Param("buildId") String buildId, @Param("elementId") String elementId);
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
/* * Tencent is pleased to support the open source community by making BK-CI 蓝鲸持续集成平台 available. * * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * * BK-CI 蓝鲸持续集成平台 is licensed under the MIT license. * * A copy of the MIT License is included in this file. * * * Terms of the MIT License: * --------------------------------------------------- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated * documentation files (the "Software"), to deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all copies or substantial portions of * the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT * LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN * NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
package cd.casic.ci.process.process.dal.template;
|
||||
|
||||
import cd.casic.ci.process.api.process.pojo.template.TemplateInstanceUpdate;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 模板实例<EFBFBD>?Dao 接口
|
||||
*/
|
||||
@Mapper
|
||||
@Repository
|
||||
public interface TemplateInstanceItemDao {
|
||||
/**
|
||||
* 创建模板实例<EFBFBD>? * * @param projectId 项目ID * @param baseId 基础ID * @param instances 实例列表 * @param status 状<EFBFBD>? * @param userId 用户ID
|
||||
*/
|
||||
void createTemplateInstanceItem(@Param("projectId") String projectId, @Param("baseId") String baseId, @Param("instances") List<TemplateInstanceUpdate> instances, @Param("status") String status, @Param("userId") String userId);
|
||||
|
||||
/**
|
||||
* 获取模板实例项列<EFBFBD>? * * @param status 状<EFBFBD>? * @param descFlag 是否降序 * @param page 页码 * @param pageSize 每页大小 * @return 模板实例项列<EFBFBD>?
|
||||
*/
|
||||
List<TemplateInstanceUpdate> getTemplateInstanceItemList(@Param("status") String status, @Param("descFlag") boolean descFlag, @Param("page") int page, @Param("pageSize") int pageSize);
|
||||
|
||||
/**
|
||||
* 根据基础ID获取模板实例项列<EFBFBD>? * * @param projectId 项目ID * @param baseId 基础ID * @param descFlag 是否降序 * @param page 页码 * @param pageSize 每页大小 * @return 模板实例项列<EFBFBD>?
|
||||
*/
|
||||
List<TemplateInstanceUpdate> getTemplateInstanceItemListByBaseId(@Param("projectId") String projectId, @Param("baseId") String baseId, @Param("descFlag") boolean descFlag, @Param("page") int page, @Param("pageSize") int pageSize);
|
||||
|
||||
/**
|
||||
* 根据基础ID获取模板实例项数<EFBFBD>? * * @param projectId 项目ID * @param baseId 基础ID * @return 数量
|
||||
*/
|
||||
long getTemplateInstanceItemCountByBaseId(@Param("projectId") String projectId, @Param("baseId") String baseId);
|
||||
|
||||
/**
|
||||
* 根据流水线ID列表获取模板实例项列<EFBFBD>? * * @param projectId 项目ID * @param pipelineIds 流水线ID列表 * @return 模板实例项列<EFBFBD>?
|
||||
*/
|
||||
List<TemplateInstanceUpdate> getTemplateInstanceItemListByPipelineIds(@Param("projectId") String projectId, @Param("pipelineIds") Collection<String> pipelineIds);
|
||||
|
||||
/**
|
||||
* 根据基础ID删除模板实例<EFBFBD>? * * @param projectId 项目ID * @param baseId 基础ID
|
||||
*/
|
||||
void deleteByBaseId(@Param("projectId") String projectId, @Param("baseId") String baseId);
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
package cd.casic.ci.process.process.dataObject.stage;
|
||||
|
||||
import cd.casic.ci.process.process.dataObject.task.PipTask;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
@Data
|
||||
public class PipStage {
|
||||
//@ApiProperty(name = "stageId",desc="id")
|
||||
private String stageId;
|
||||
|
||||
//@ApiProperty(name = "stageName",desc="名称")
|
||||
private String stageName;
|
||||
|
||||
//@ApiProperty(name = "createTime",desc="创建时间")
|
||||
private String createTime;
|
||||
|
||||
//@ApiProperty(name="pipelineId",desc="流水线id")
|
||||
private String pipelineId;
|
||||
|
||||
//@ApiProperty(name="stageSort",desc="阶段顺序")
|
||||
private int stageSort;
|
||||
|
||||
//@ApiProperty(name = "parentId",desc="主阶段")
|
||||
private String parentId;
|
||||
|
||||
//@ApiProperty(name = "code",desc="是否是源码")
|
||||
private boolean code = false;
|
||||
|
||||
//@ApiProperty(name = "taskValues",desc="阶段任务")
|
||||
private List<PipTask> taskValues;
|
||||
|
||||
//@ApiProperty(name = "stageList",desc="阶段")
|
||||
private List<PipStage> stageList;
|
||||
|
||||
//@ApiProperty(name = "taskType",desc="任务类型")
|
||||
private String taskType;
|
||||
|
||||
//@ApiProperty(name = "taskId",desc="任务id")
|
||||
private String taskId;
|
||||
|
||||
//@ApiProperty(name = "values",desc="更新内容")
|
||||
private Object values;
|
||||
|
||||
//@ApiProperty(name = "taskSort",desc="任务顺序")
|
||||
private int taskSort;
|
||||
|
||||
//@ApiProperty(name = "parallelName",desc="并行阶段名称")
|
||||
private String parallelName;
|
||||
|
||||
// 执行实例id
|
||||
private String instanceId;
|
||||
}
|
@ -1,38 +1,46 @@
|
||||
package cd.casic.ci.process.process.service.stage.impl;
|
||||
|
||||
import cd.casic.ci.common.pipeline.constant.PipelineDateUtilConstant;
|
||||
import cd.casic.ci.common.pipeline.container.Stage;
|
||||
import cd.casic.ci.common.pipeline.req.stage.StageReq;
|
||||
import cd.casic.ci.common.pipeline.resp.stage.StageResp;
|
||||
import cd.casic.ci.common.pipeline.utils.PipelineDateUtil;
|
||||
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.stage.StageService;
|
||||
import cd.casic.ci.process.process.service.task.TaskService;
|
||||
import cd.casic.framework.commons.exception.ServiceException;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.core.task.VirtualThreadTaskExecutor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class StageServiceImpl implements StageService {
|
||||
@Resource
|
||||
private TaskService taskService;
|
||||
|
||||
@Override
|
||||
public String createStagesOrTask(StageReq stage) {
|
||||
String stagesId = stage.getStageId();
|
||||
String pipelineId = stage.getPipelineId();
|
||||
|
||||
String taskType = stage.getTaskType();
|
||||
int stageSort = stage.getStageSort();
|
||||
|
||||
stage.setCreateTime(PipelineDateUtil.nowDateString(PipelineDateUtilConstant.yyyy_MM_dd_HH_mm_ss));
|
||||
|
||||
PipTask tasks = new PipTask();
|
||||
tasks.setTaskType(taskType);
|
||||
tasks.setTaskSort(1);
|
||||
// TODO 查询是否为已知worker
|
||||
taskService.taskTypeExist(taskType);
|
||||
return null;
|
||||
// String stagesId = stage.getStageId();
|
||||
// String pipelineId = stage.getPipelineId();
|
||||
//
|
||||
// String taskType = stage.getTaskType();
|
||||
// int stageSort = stage.getStageSort();
|
||||
//
|
||||
// stage.setCreateTime(PipelineDateUtil.nowDateString(PipelineDateUtilConstant.yyyy_MM_dd_HH_mm_ss));
|
||||
//
|
||||
// Tasks tasks = new Tasks();
|
||||
// tasks.setTaskType(taskType);
|
||||
// tasks.setTaskSort(1);
|
||||
//
|
||||
// String type = tasksService.findTaskType(taskType);
|
||||
//
|
||||
// //是否为源码
|
||||
// if (type.equals(PipelineFinal.TASK_TYPE_CODE)){
|
||||
// //判断是否存在代码源
|
||||
// findTypeTasks(pipelineId);
|
||||
// if (taskType.equals(PipelineFinal.TASK_TYPE_CODE)){
|
||||
// //判断是否存在代码源(目标)节点
|
||||
// findTargetTasks(pipelineId);
|
||||
//
|
||||
// //创建根节点
|
||||
// int initStage = initStage(pipelineId,1);
|
||||
@ -179,4 +187,19 @@ public class StageServiceImpl implements StageService {
|
||||
public List<StageResp> findAllStagesList(List<String> idList) {
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* 判断任务是否存在代码源
|
||||
* @param pipelineId 流水线id
|
||||
*/
|
||||
private void findTargetTasks(String pipelineId) {
|
||||
List<StageResp> allStage = findAllMainStage(pipelineId);
|
||||
if (allStage.isEmpty()){
|
||||
return;
|
||||
}
|
||||
for (StageResp stage : allStage) {
|
||||
if (stage.isCode()){
|
||||
throw new ServiceException(50001,"代码源已存在,无法再次创建。");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,8 @@
|
||||
package cd.casic.ci.process.process.service.task;
|
||||
|
||||
public interface TaskService {
|
||||
/**
|
||||
* 查询taskType是否存在(原项目的各种worker)
|
||||
* */
|
||||
public void taskTypeExist(String taskType);
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package cd.casic.ci.process.process.service.task.impl;
|
||||
|
||||
import cd.casic.ci.common.pipeline.annotation.Plugin;
|
||||
import cd.casic.ci.process.process.service.task.TaskService;
|
||||
import cd.casic.framework.commons.util.util.WebFrameworkUtils;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider;
|
||||
import org.springframework.core.type.filter.AnnotationTypeFilter;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Set;
|
||||
@Service
|
||||
public class TaskServiceImpl implements TaskService {
|
||||
private static final String basePackage = "cd.casic.ci.process.process.service";
|
||||
private Set<BeanDefinition> candidates;
|
||||
|
||||
public TaskServiceImpl() {
|
||||
System.out.println("");
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
public void init(){
|
||||
ClassPathScanningCandidateComponentProvider provider =
|
||||
new ClassPathScanningCandidateComponentProvider(false);
|
||||
provider.addIncludeFilter(new AnnotationTypeFilter(Plugin.class));
|
||||
candidates = provider.findCandidateComponents(basePackage);
|
||||
}
|
||||
@Override
|
||||
public void taskTypeExist(String taskType) {
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package cd.casic.ci.process.process.service.worker;
|
||||
|
||||
import cd.casic.ci.common.pipeline.annotation.Plugin;
|
||||
|
||||
@Plugin
|
||||
public class TestWorker {
|
||||
}
|
@ -6,7 +6,7 @@ import cd.casic.ci.project.dal.pojo.ProjectCreateInfo;
|
||||
import cd.casic.ci.project.service.ProjectExtService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service("projectExtService")
|
||||
//@Service("projectExtService")
|
||||
public class ProjectExtServiceImpl implements ProjectExtService {
|
||||
@Override
|
||||
public void createExtProjectInfo(Long userId, String projectId, String accessToken, ProjectCreateInfo projectCreateInfo, ProjectCreateExtInfo createExtInfo, String logoAddress) {
|
||||
|
@ -27,7 +27,7 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Service("projectService")
|
||||
//@Service("projectService")
|
||||
@Slf4j
|
||||
public class ProjectServiceImpl {
|
||||
|
||||
|
@ -12,6 +12,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
|
||||
@Service("userProjectResourceService")
|
||||
//@Service
|
||||
public class UserProjectResourceServiceImpl implements UserProjectResourceService {
|
||||
|
||||
@Resource
|
||||
|
@ -50,7 +50,7 @@ public interface ServiceCredentialApi {
|
||||
);
|
||||
|
||||
@Operation(summary = "检查凭据是否存在")
|
||||
@GetMapping("/{projectId}/{credentialId}/")
|
||||
@PutMapping("/{projectId}/{credentialId}/")
|
||||
CommonResult<Boolean> check(
|
||||
@Parameter(description = "Project ID", required = true)
|
||||
@RequestParam("projectId")
|
||||
|
@ -1,5 +1,6 @@
|
||||
package cd.casic.server;
|
||||
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
@ -13,6 +14,7 @@ import org.springframework.context.annotation.ComponentScans;
|
||||
|
||||
@SuppressWarnings("SpringComponentScan")
|
||||
@ComponentScan({"cd.casic"})
|
||||
@MapperScan(basePackages = "cd.casic.ci.**.dal")
|
||||
@SpringBootApplication(scanBasePackages = {"${ops.info.base-package}.server", "${ops.info.base-package}.module"})
|
||||
public class OpsServerApplication {
|
||||
|
||||
|
@ -2,10 +2,12 @@ package cd.casic.server.controller;
|
||||
|
||||
import cd.casic.ci.common.pipeline.req.stage.StageReq;
|
||||
import cd.casic.ci.common.pipeline.resp.stage.StageResp;
|
||||
import cd.casic.ci.process.process.service.stage.StageService;
|
||||
import cd.casic.framework.commons.pojo.CommonResult;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.annotation.security.PermitAll;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
@ -28,8 +30,8 @@ import java.util.List;
|
||||
@RequestMapping("/stage")
|
||||
public class StageController {
|
||||
|
||||
// @Autowired
|
||||
// StageService stageService;
|
||||
@Resource
|
||||
private StageService stageService;
|
||||
|
||||
/**
|
||||
* @pi.name:创建流水线阶段及任务
|
||||
|
Loading…
x
Reference in New Issue
Block a user