Skip to content

Commit

Permalink
Merge pull request #11351 from royalhuang/issue_11186
Browse files Browse the repository at this point in the history
bug: 模板推荐版本号重置当前值不生效问题 #11350
  • Loading branch information
mingshewhe authored Dec 26, 2024
2 parents 346ca8c + 99705c4 commit da091cd
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,7 @@ data class TemplateInstanceUpdate(
@get:Schema(title = "构建版本号", required = false)
val buildNo: BuildNo?,
@get:Schema(title = "流水线变量列表, 建议先通过v4_app_template_get获取,再按需修改。", required = false)
val param: List<BuildFormProperty>?
val param: List<BuildFormProperty>?,
@get:Schema(title = "重置实例推荐版本为基准值", required = false)
val resetBuildNo: Boolean? = null
)
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ class UserPipelineVersionResourceImpl @Autowired constructor(
userId = userId,
projectId = projectId,
pipelineId = pipelineId,
buildNo = buildNo
targetBuildNo = buildNo.currentBuildNo
)
return Result(true)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ import com.tencent.devops.common.pipeline.enums.VersionStatus
import com.tencent.devops.common.pipeline.extend.ModelCheckPlugin
import com.tencent.devops.common.pipeline.pojo.BuildFormProperty
import com.tencent.devops.common.pipeline.pojo.BuildNo
import com.tencent.devops.common.pipeline.pojo.BuildNoUpdateReq
import com.tencent.devops.common.pipeline.pojo.PipelineModelAndSetting
import com.tencent.devops.common.pipeline.pojo.element.atom.BeforeDeleteParam
import com.tencent.devops.common.pipeline.pojo.setting.PipelineSetting
Expand Down Expand Up @@ -1170,22 +1169,22 @@ class PipelineInfoFacadeService @Autowired constructor(
userId: String,
projectId: String,
pipelineId: String,
buildNo: BuildNoUpdateReq
targetBuildNo: Int
) {
operationLogService.addOperationLog(
userId = userId,
projectId = projectId,
pipelineId = pipelineId,
version = 0,
operationLogType = OperationLogType.RESET_RECOMMENDED_VERSION_BUILD_NO,
params = buildNo.currentBuildNo.toString(),
params = targetBuildNo.toString(),
description = null
)
pipelineBuildSummaryDao.updateBuildNo(
dslContext = dslContext,
projectId = projectId,
pipelineId = pipelineId,
buildNo = buildNo.currentBuildNo,
buildNo = targetBuildNo,
debug = false
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1876,6 +1876,16 @@ class TemplateFacadeService @Autowired constructor(
checkPermission = true,
checkTemplate = false
)
templateInstanceUpdate.buildNo?.let {
if (templateInstanceUpdate.resetBuildNo == true) {
pipelineInfoFacadeService.updateBuildNo(
userId = userId,
projectId = projectId,
pipelineId = templateInstanceUpdate.pipelineId,
targetBuildNo = it.buildNo
)
}
}
}
}

Expand Down

0 comments on commit da091cd

Please sign in to comment.