Skip to content

Commit

Permalink
feat:支持针对构建重放事件 #11232
Browse files Browse the repository at this point in the history
  • Loading branch information
hejieehe committed Jan 9, 2025
1 parent 6f0b7fa commit dd3aad8
Showing 1 changed file with 50 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ import com.tencent.devops.process.service.pipeline.PipelineBuildService
import com.tencent.devops.process.strategy.context.UserPipelinePermissionCheckContext
import com.tencent.devops.process.strategy.factory.UserPipelinePermissionCheckStrategyFactory
import com.tencent.devops.process.util.TaskUtils
import com.tencent.devops.process.utils.BK_CI_MATERIAL_ID
import com.tencent.devops.process.utils.BK_CI_MATERIAL_NAME
import com.tencent.devops.process.utils.BK_CI_MATERIAL_URL
import com.tencent.devops.process.utils.PIPELINE_BUILD_MSG
import com.tencent.devops.process.utils.PIPELINE_NAME
import com.tencent.devops.process.utils.PIPELINE_RETRY_ALL_FAILED_CONTAINER
Expand Down Expand Up @@ -2752,10 +2755,28 @@ class PipelineBuildFacadeService(
}

StartType.MANUAL, StartType.SERVICE -> {
// 自定义触发源材料信息
startParameters.putAll(
buildVariableService.getAllVariable(
projectId = projectId,
pipelineId = pipelineId,
buildId = buildId,
keys = setOf(BK_CI_MATERIAL_ID, BK_CI_MATERIAL_NAME, BK_CI_MATERIAL_URL)
)
)
triggerContainer.elements.find { it is ManualTriggerElement }
}

StartType.REMOTE -> {
startParameters.putAll(
// 自定义触发源材料参数
buildVariableService.getAllVariable(
projectId = projectId,
pipelineId = pipelineId,
buildId = buildId,
keys = setOf(BK_CI_MATERIAL_ID, BK_CI_MATERIAL_NAME, BK_CI_MATERIAL_URL)
)
)
triggerContainer.elements.find { it is RemoteTriggerElement }
}

Expand All @@ -2764,6 +2785,22 @@ class PipelineBuildFacadeService(
}

StartType.PIPELINE -> {
// 父子流水线核心参数
startParameters.putAll(
buildVariableService.getAllVariable(
projectId = projectId,
pipelineId = pipelineId,
buildId = buildId,
keys = setOf(
PIPELINE_START_PARENT_PROJECT_ID,
PIPELINE_START_PARENT_PIPELINE_ID,
PIPELINE_START_PARENT_BUILD_ID,
PIPELINE_START_PARENT_BUILD_TASK_ID,
PIPELINE_START_SUB_RUN_MODE,
PIPELINE_START_PARENT_EXECUTE_COUNT
)
)
)
buildVariableService.getAllVariable(
projectId = projectId,
pipelineId = pipelineId,
Expand Down Expand Up @@ -2814,7 +2851,7 @@ class PipelineBuildFacadeService(
)
}

StartType.MANUAL, StartType.SERVICE, StartType.REMOTE, StartType.TIME_TRIGGER -> {
StartType.MANUAL, StartType.SERVICE, StartType.REMOTE -> {
buildManualStartup(
userId = userId,
projectId = projectId,
Expand All @@ -2825,6 +2862,18 @@ class PipelineBuildFacadeService(
)
}

StartType.TIME_TRIGGER -> {
BuildId(
timerTriggerPipelineBuild(
userId = userId,
projectId = projectId,
pipelineId = pipelineId,
parameters = startParameters,
checkPermission = false
) ?: ""
)
}

StartType.PIPELINE -> {
BuildId(
subPipelineStartUpService.callPipelineStartup(
Expand Down

0 comments on commit dd3aad8

Please sign in to comment.