Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat:子流水线插件支持输出触发的子流水线 build_num #11373 #11374

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,7 @@ data class ProjectBuildId(
@get:Schema(title = "构建ID", required = true)
val id: String,
@get:Schema(title = "项目ID", required = true)
val projectId: String
val projectId: String,
@get:Schema(title = "构建序号", required = false)
val buildNum: Int? = null
)
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ import com.tencent.devops.process.engine.service.PipelineRepositoryService
import com.tencent.devops.process.engine.service.PipelineRuntimeService
import com.tencent.devops.process.engine.service.PipelineTaskService
import com.tencent.devops.process.permission.PipelinePermissionService
import com.tencent.devops.process.pojo.BuildId
import com.tencent.devops.process.pojo.PipelineId
import com.tencent.devops.process.pojo.pipeline.ProjectBuildId
import com.tencent.devops.process.pojo.pipeline.StartUpInfo
Expand Down Expand Up @@ -185,17 +186,18 @@ class SubPipelineStartUpService @Autowired constructor(
projectId = projectId,
buildId = buildId,
taskId = taskId,
subBuildId = subBuildId,
subBuildId = subBuildId.id,
subProjectId = fixProjectId
)
if (runMode == SYNC_RUN_MODE) {
subPipelineStatusService.onStart(subBuildId)
subPipelineStatusService.onStart(subBuildId.id)
}

return Result(
ProjectBuildId(
id = subBuildId,
projectId = fixProjectId
id = subBuildId.id,
projectId = fixProjectId,
buildNum = subBuildId.num
)
)
}
Expand All @@ -214,7 +216,7 @@ class SubPipelineStartUpService @Autowired constructor(
triggerUser: String? = null,
runMode: String,
parentExecuteCount: Int?
): String {
): BuildId {

val readyToBuildPipelineInfo = pipelineRepositoryService.getPipelineInfo(projectId, pipelineId, channelCode)
?: throw ErrorCodeException(
Expand Down Expand Up @@ -330,13 +332,13 @@ class SubPipelineStartUpService @Autowired constructor(
frequencyLimit = false,
versionName = resource.versionName,
yamlVersion = resource.yamlVersion
).id
)
// 更新父流水线关联子流水线构建id
pipelineTaskService.updateSubBuildId(
projectId = parentProjectId,
buildId = parentBuildId,
taskId = parentTaskId,
subBuildId = subBuildId,
subBuildId = subBuildId.id,
subProjectId = readyToBuildPipelineInfo.projectId
)
return subBuildId
Expand Down