Skip to content

Commit

Permalink
feat:保存流水线时,校验是否有子流水线循环依赖 TencentBlueKing#10479
Browse files Browse the repository at this point in the history
  • Loading branch information
hejieehe committed Aug 7, 2024
1 parent 33cafbc commit b4612b0
Showing 1 changed file with 19 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,25 +159,25 @@ class SubPipelineStartUpService @Autowired constructor(
}
val existPipelines = HashSet<String>()
existPipelines.add(parentPipelineId)
try {
// 检查循环调用
val rootPipelineKey = "${projectId}_$parentPipelineId"
val subPipelineRef = SubPipelineRef(
projectId = projectId,
pipelineId = parentPipelineId,
subPipelineId = callPipelineId,
subProjectId = callProjectId
)
subPipelineRefService.checkCircularDependency(
subPipelineRef = subPipelineRef,
rootPipelineKey = rootPipelineKey,
existsPipeline = HashMap(mapOf(rootPipelineKey to subPipelineRef))
)
} catch (e: OperationException) {
return I18nUtil.generateResponseDataObject(
messageCode = ProcessMessageCode.ERROR_SUBPIPELINE_CYCLE_CALL,
language = I18nUtil.getLanguage(userId)
)
// 检查循环调用
val rootPipelineKey = "${projectId}_$parentPipelineId"
val subPipelineRef = SubPipelineRef(
projectId = projectId,
pipelineId = parentPipelineId,
subPipelineId = callPipelineId,
subProjectId = callProjectId
)
subPipelineRefService.checkCircularDependency(
subPipelineRef = subPipelineRef,
rootPipelineKey = rootPipelineKey,
existsPipeline = HashMap(mapOf(rootPipelineKey to subPipelineRef))
).let {
if (!it.result) {
return Result(
status = ProcessMessageCode.ERROR_SUBPIPELINE_CYCLE_CALL.toInt(),
message = it.errorMessage ?: ""
)
}
}

val subBuildId = subPipelineStartup(
Expand Down

0 comments on commit b4612b0

Please sign in to comment.