From 331c088f8905f513ad6ed1e8c001f55578ffe695 Mon Sep 17 00:00:00 2001 From: royalhuang Date: Mon, 18 Nov 2024 20:48:52 +0800 Subject: [PATCH 1/6] =?UTF-8?q?feat=EF=BC=9A=E6=8E=A8=E8=8D=90=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E5=8F=B7=E6=A8=A1=E7=89=88=E4=BC=98=E5=8C=96=20#11186?= =?UTF-8?q?=20=E6=96=B0=E5=A2=9Ecurrent=E5=80=BC=E8=80=8C=E4=B8=8D?= =?UTF-8?q?=E8=A6=86=E7=9B=96=E5=9F=BA=E5=87=86=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../devops/process/service/template/TemplateFacadeService.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/backend/ci/core/process/biz-process/src/main/kotlin/com/tencent/devops/process/service/template/TemplateFacadeService.kt b/src/backend/ci/core/process/biz-process/src/main/kotlin/com/tencent/devops/process/service/template/TemplateFacadeService.kt index e1e5fca0e24..a1aea050395 100644 --- a/src/backend/ci/core/process/biz-process/src/main/kotlin/com/tencent/devops/process/service/template/TemplateFacadeService.kt +++ b/src/backend/ci/core/process/biz-process/src/main/kotlin/com/tencent/devops/process/service/template/TemplateFacadeService.kt @@ -1526,11 +1526,13 @@ class TemplateFacadeService @Autowired constructor( logger.info("[$userId|$projectId|$templateId|$version] Get the param ($instanceParams)") // 模板中的buildNo存在才需要回显 + // 将实例自己维护的当前值一起返回 val instanceBuildNoObj = templateTriggerContainer.buildNo?.let { no -> BuildNo( buildNoType = no.buildNoType, required = no.required ?: instanceTriggerContainer.buildNo?.required, - buildNo = buildNos[pipelineId] ?: no.buildNo + buildNo = no.buildNo, + currentBuildNo = buildNos[pipelineId] ) } From 43412e3c5bc47184d7260a2a5575b6806525fd2d Mon Sep 17 00:00:00 2001 From: royalhuang Date: Tue, 19 Nov 2024 17:03:54 +0800 Subject: [PATCH 2/6] =?UTF-8?q?feat=EF=BC=9A=E6=8E=A8=E8=8D=90=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E5=8F=B7=E6=A8=A1=E7=89=88=E4=BC=98=E5=8C=96=20#11186?= =?UTF-8?q?=20=E6=96=B0=E5=A2=9Ecurrent=E5=80=BC=E8=80=8C=E4=B8=8D?= =?UTF-8?q?=E8=A6=86=E7=9B=96=E5=9F=BA=E5=87=86=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../devops/process/pojo/pipeline/DeployPipelineResult.kt | 2 +- .../devops/process/pojo/template/TemplateInstanceParams.kt | 4 +++- .../devops/process/service/template/TemplateFacadeService.kt | 5 ++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/backend/ci/core/process/api-process/src/main/kotlin/com/tencent/devops/process/pojo/pipeline/DeployPipelineResult.kt b/src/backend/ci/core/process/api-process/src/main/kotlin/com/tencent/devops/process/pojo/pipeline/DeployPipelineResult.kt index 7549ea701dd..3a72f191379 100644 --- a/src/backend/ci/core/process/api-process/src/main/kotlin/com/tencent/devops/process/pojo/pipeline/DeployPipelineResult.kt +++ b/src/backend/ci/core/process/api-process/src/main/kotlin/com/tencent/devops/process/pojo/pipeline/DeployPipelineResult.kt @@ -45,6 +45,6 @@ data class DeployPipelineResult( val targetUrl: String? = null, @get:Schema(title = "yaml信息", required = false) val yamlInfo: PipelineYamlVo? = null, - @get:Schema(title = "是否更新了推荐版本号", required = false) + @get:Schema(title = "是否更新了推荐版本号基准值", required = false) val updateBuildNo: Boolean? = null ) diff --git a/src/backend/ci/core/process/api-process/src/main/kotlin/com/tencent/devops/process/pojo/template/TemplateInstanceParams.kt b/src/backend/ci/core/process/api-process/src/main/kotlin/com/tencent/devops/process/pojo/template/TemplateInstanceParams.kt index 6eefebbcc51..68d134af030 100644 --- a/src/backend/ci/core/process/api-process/src/main/kotlin/com/tencent/devops/process/pojo/template/TemplateInstanceParams.kt +++ b/src/backend/ci/core/process/api-process/src/main/kotlin/com/tencent/devops/process/pojo/template/TemplateInstanceParams.kt @@ -44,5 +44,7 @@ data class TemplateInstanceParams( @get:Schema(title = "构建号,不建议使用", required = false) val buildNo: BuildNo?, @get:Schema(title = "流水线变量列表", required = false) - val param: List + val param: List, + @get:Schema(title = "是否更新了推荐版本号基准值", required = false) + val updateBuildNo: Boolean? = null ) diff --git a/src/backend/ci/core/process/biz-process/src/main/kotlin/com/tencent/devops/process/service/template/TemplateFacadeService.kt b/src/backend/ci/core/process/biz-process/src/main/kotlin/com/tencent/devops/process/service/template/TemplateFacadeService.kt index a1aea050395..0a2606abfda 100644 --- a/src/backend/ci/core/process/biz-process/src/main/kotlin/com/tencent/devops/process/service/template/TemplateFacadeService.kt +++ b/src/backend/ci/core/process/biz-process/src/main/kotlin/com/tencent/devops/process/service/template/TemplateFacadeService.kt @@ -1540,7 +1540,10 @@ class TemplateFacadeService @Autowired constructor( pipelineId = pipelineId, pipelineName = getPipelineName(settings, pipelineId) ?: templateModel.name, buildNo = instanceBuildNoObj, - param = instanceParams + param = instanceParams, + updateBuildNo = instanceTriggerContainer.buildNo?.let { ino -> + ino.buildNo != templateModel.getTriggerContainer().buildNo?.buildNo + } ) }.toMap() } catch (ignored: Throwable) { From 1b5d91f6e88c267e1f7b79ac615924119ba2e573 Mon Sep 17 00:00:00 2001 From: royalhuang Date: Thu, 21 Nov 2024 19:55:03 +0800 Subject: [PATCH 3/6] =?UTF-8?q?feat=EF=BC=9A=E6=8E=A8=E8=8D=90=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E5=8F=B7=E6=A8=A1=E7=89=88=E4=BC=98=E5=8C=96=20#11186?= =?UTF-8?q?=20=E5=A2=9E=E5=8A=A0=E6=A8=A1=E6=9D=BF=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E7=9A=84=E5=8F=82=E6=95=B0=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../process/pojo/template/TemplateInstanceUpdate.kt | 4 +++- .../process/api/UserPipelineVersionResourceImpl.kt | 2 +- .../process/service/PipelineInfoFacadeService.kt | 6 +++--- .../process/service/template/TemplateFacadeService.kt | 10 ++++++++++ 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/backend/ci/core/process/api-process/src/main/kotlin/com/tencent/devops/process/pojo/template/TemplateInstanceUpdate.kt b/src/backend/ci/core/process/api-process/src/main/kotlin/com/tencent/devops/process/pojo/template/TemplateInstanceUpdate.kt index 3aca9ab5828..f1b2b388602 100644 --- a/src/backend/ci/core/process/api-process/src/main/kotlin/com/tencent/devops/process/pojo/template/TemplateInstanceUpdate.kt +++ b/src/backend/ci/core/process/api-process/src/main/kotlin/com/tencent/devops/process/pojo/template/TemplateInstanceUpdate.kt @@ -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? + val param: List?, + @get:Schema(title = "重置实例推荐版本为基准值", required = false) + val resetBuildNo: Boolean? = null ) diff --git a/src/backend/ci/core/process/biz-process/src/main/kotlin/com/tencent/devops/process/api/UserPipelineVersionResourceImpl.kt b/src/backend/ci/core/process/biz-process/src/main/kotlin/com/tencent/devops/process/api/UserPipelineVersionResourceImpl.kt index 8941a67fc84..6689df2ffd2 100644 --- a/src/backend/ci/core/process/biz-process/src/main/kotlin/com/tencent/devops/process/api/UserPipelineVersionResourceImpl.kt +++ b/src/backend/ci/core/process/biz-process/src/main/kotlin/com/tencent/devops/process/api/UserPipelineVersionResourceImpl.kt @@ -497,7 +497,7 @@ class UserPipelineVersionResourceImpl @Autowired constructor( userId = userId, projectId = projectId, pipelineId = pipelineId, - buildNo = buildNo + targetBuildNo = buildNo.currentBuildNo ) return Result(true) } diff --git a/src/backend/ci/core/process/biz-process/src/main/kotlin/com/tencent/devops/process/service/PipelineInfoFacadeService.kt b/src/backend/ci/core/process/biz-process/src/main/kotlin/com/tencent/devops/process/service/PipelineInfoFacadeService.kt index 42ebeaddb49..19f6997d415 100644 --- a/src/backend/ci/core/process/biz-process/src/main/kotlin/com/tencent/devops/process/service/PipelineInfoFacadeService.kt +++ b/src/backend/ci/core/process/biz-process/src/main/kotlin/com/tencent/devops/process/service/PipelineInfoFacadeService.kt @@ -1216,7 +1216,7 @@ class PipelineInfoFacadeService @Autowired constructor( userId: String, projectId: String, pipelineId: String, - buildNo: BuildNoUpdateReq + targetBuildNo: Int ) { operationLogService.addOperationLog( userId = userId, @@ -1224,14 +1224,14 @@ class PipelineInfoFacadeService @Autowired constructor( 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 ) } diff --git a/src/backend/ci/core/process/biz-process/src/main/kotlin/com/tencent/devops/process/service/template/TemplateFacadeService.kt b/src/backend/ci/core/process/biz-process/src/main/kotlin/com/tencent/devops/process/service/template/TemplateFacadeService.kt index 0a2606abfda..2fd03cf06ef 100644 --- a/src/backend/ci/core/process/biz-process/src/main/kotlin/com/tencent/devops/process/service/template/TemplateFacadeService.kt +++ b/src/backend/ci/core/process/biz-process/src/main/kotlin/com/tencent/devops/process/service/template/TemplateFacadeService.kt @@ -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 + ) + } + } } } From 2207dd09d18e61008f4e7f71db5766f6c78cfd17 Mon Sep 17 00:00:00 2001 From: royalhuang Date: Thu, 21 Nov 2024 20:59:35 +0800 Subject: [PATCH 4/6] =?UTF-8?q?feat=EF=BC=9A=E6=8E=A8=E8=8D=90=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E5=8F=B7=E6=A8=A1=E7=89=88=E4=BC=98=E5=8C=96=20#11186?= =?UTF-8?q?=20=E5=A2=9E=E5=8A=A0=E6=A8=A1=E6=9D=BF=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E7=9A=84=E5=8F=82=E6=95=B0=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tencent/devops/process/service/PipelineInfoFacadeService.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/src/backend/ci/core/process/biz-process/src/main/kotlin/com/tencent/devops/process/service/PipelineInfoFacadeService.kt b/src/backend/ci/core/process/biz-process/src/main/kotlin/com/tencent/devops/process/service/PipelineInfoFacadeService.kt index 19f6997d415..709fc3d6c34 100644 --- a/src/backend/ci/core/process/biz-process/src/main/kotlin/com/tencent/devops/process/service/PipelineInfoFacadeService.kt +++ b/src/backend/ci/core/process/biz-process/src/main/kotlin/com/tencent/devops/process/service/PipelineInfoFacadeService.kt @@ -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 From da9df5ecaba9e9d9b5206eb126d9e25aa7c32109 Mon Sep 17 00:00:00 2001 From: royalhuang Date: Tue, 3 Dec 2024 16:50:36 +0800 Subject: [PATCH 5/6] =?UTF-8?q?Revert=20"feat=EF=BC=9A=E6=8E=A8=E8=8D=90?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=8F=B7=E6=A8=A1=E7=89=88=E4=BC=98=E5=8C=96?= =?UTF-8?q?=20#11186=20=E5=A2=9E=E5=8A=A0=E6=A8=A1=E6=9D=BF=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E7=9A=84=E5=8F=82=E6=95=B0=E6=8E=A7=E5=88=B6"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 2207dd09d18e61008f4e7f71db5766f6c78cfd17. --- .../tencent/devops/process/service/PipelineInfoFacadeService.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/backend/ci/core/process/biz-process/src/main/kotlin/com/tencent/devops/process/service/PipelineInfoFacadeService.kt b/src/backend/ci/core/process/biz-process/src/main/kotlin/com/tencent/devops/process/service/PipelineInfoFacadeService.kt index 709fc3d6c34..19f6997d415 100644 --- a/src/backend/ci/core/process/biz-process/src/main/kotlin/com/tencent/devops/process/service/PipelineInfoFacadeService.kt +++ b/src/backend/ci/core/process/biz-process/src/main/kotlin/com/tencent/devops/process/service/PipelineInfoFacadeService.kt @@ -62,6 +62,7 @@ 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 From a3a81a48e03d37e55445f5056502f9ba0d0c743c Mon Sep 17 00:00:00 2001 From: royalhuang Date: Tue, 3 Dec 2024 16:50:37 +0800 Subject: [PATCH 6/6] =?UTF-8?q?Revert=20"feat=EF=BC=9A=E6=8E=A8=E8=8D=90?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=8F=B7=E6=A8=A1=E7=89=88=E4=BC=98=E5=8C=96?= =?UTF-8?q?=20#11186=20=E5=A2=9E=E5=8A=A0=E6=A8=A1=E6=9D=BF=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E7=9A=84=E5=8F=82=E6=95=B0=E6=8E=A7=E5=88=B6"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 1b5d91f6e88c267e1f7b79ac615924119ba2e573. --- .../process/pojo/template/TemplateInstanceUpdate.kt | 4 +--- .../process/api/UserPipelineVersionResourceImpl.kt | 2 +- .../process/service/PipelineInfoFacadeService.kt | 6 +++--- .../process/service/template/TemplateFacadeService.kt | 10 ---------- 4 files changed, 5 insertions(+), 17 deletions(-) diff --git a/src/backend/ci/core/process/api-process/src/main/kotlin/com/tencent/devops/process/pojo/template/TemplateInstanceUpdate.kt b/src/backend/ci/core/process/api-process/src/main/kotlin/com/tencent/devops/process/pojo/template/TemplateInstanceUpdate.kt index f1b2b388602..3aca9ab5828 100644 --- a/src/backend/ci/core/process/api-process/src/main/kotlin/com/tencent/devops/process/pojo/template/TemplateInstanceUpdate.kt +++ b/src/backend/ci/core/process/api-process/src/main/kotlin/com/tencent/devops/process/pojo/template/TemplateInstanceUpdate.kt @@ -44,7 +44,5 @@ data class TemplateInstanceUpdate( @get:Schema(title = "构建版本号", required = false) val buildNo: BuildNo?, @get:Schema(title = "流水线变量列表, 建议先通过v4_app_template_get获取,再按需修改。", required = false) - val param: List?, - @get:Schema(title = "重置实例推荐版本为基准值", required = false) - val resetBuildNo: Boolean? = null + val param: List? ) diff --git a/src/backend/ci/core/process/biz-process/src/main/kotlin/com/tencent/devops/process/api/UserPipelineVersionResourceImpl.kt b/src/backend/ci/core/process/biz-process/src/main/kotlin/com/tencent/devops/process/api/UserPipelineVersionResourceImpl.kt index 6689df2ffd2..8941a67fc84 100644 --- a/src/backend/ci/core/process/biz-process/src/main/kotlin/com/tencent/devops/process/api/UserPipelineVersionResourceImpl.kt +++ b/src/backend/ci/core/process/biz-process/src/main/kotlin/com/tencent/devops/process/api/UserPipelineVersionResourceImpl.kt @@ -497,7 +497,7 @@ class UserPipelineVersionResourceImpl @Autowired constructor( userId = userId, projectId = projectId, pipelineId = pipelineId, - targetBuildNo = buildNo.currentBuildNo + buildNo = buildNo ) return Result(true) } diff --git a/src/backend/ci/core/process/biz-process/src/main/kotlin/com/tencent/devops/process/service/PipelineInfoFacadeService.kt b/src/backend/ci/core/process/biz-process/src/main/kotlin/com/tencent/devops/process/service/PipelineInfoFacadeService.kt index 19f6997d415..42ebeaddb49 100644 --- a/src/backend/ci/core/process/biz-process/src/main/kotlin/com/tencent/devops/process/service/PipelineInfoFacadeService.kt +++ b/src/backend/ci/core/process/biz-process/src/main/kotlin/com/tencent/devops/process/service/PipelineInfoFacadeService.kt @@ -1216,7 +1216,7 @@ class PipelineInfoFacadeService @Autowired constructor( userId: String, projectId: String, pipelineId: String, - targetBuildNo: Int + buildNo: BuildNoUpdateReq ) { operationLogService.addOperationLog( userId = userId, @@ -1224,14 +1224,14 @@ class PipelineInfoFacadeService @Autowired constructor( pipelineId = pipelineId, version = 0, operationLogType = OperationLogType.RESET_RECOMMENDED_VERSION_BUILD_NO, - params = targetBuildNo.toString(), + params = buildNo.currentBuildNo.toString(), description = null ) pipelineBuildSummaryDao.updateBuildNo( dslContext = dslContext, projectId = projectId, pipelineId = pipelineId, - buildNo = targetBuildNo, + buildNo = buildNo.currentBuildNo, debug = false ) } diff --git a/src/backend/ci/core/process/biz-process/src/main/kotlin/com/tencent/devops/process/service/template/TemplateFacadeService.kt b/src/backend/ci/core/process/biz-process/src/main/kotlin/com/tencent/devops/process/service/template/TemplateFacadeService.kt index 2fd03cf06ef..0a2606abfda 100644 --- a/src/backend/ci/core/process/biz-process/src/main/kotlin/com/tencent/devops/process/service/template/TemplateFacadeService.kt +++ b/src/backend/ci/core/process/biz-process/src/main/kotlin/com/tencent/devops/process/service/template/TemplateFacadeService.kt @@ -1876,16 +1876,6 @@ 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 - ) - } - } } }