From 487732e65413fe1bfb44d7feed2ba52ac351aace Mon Sep 17 00:00:00 2001 From: irwinsun Date: Fri, 2 Jul 2021 12:26:20 +0800 Subject: [PATCH 01/30] =?UTF-8?q?--task=3D858839607=20EPC=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=E8=80=97=E6=97=B6=20=E7=BB=9F=E4=B8=80=E8=A7=84?= =?UTF-8?q?=E8=8C=83=EF=BC=8C=E5=90=8E=E7=BB=AD=E5=AD=98=E5=82=A8=E9=83=BD?= =?UTF-8?q?=E4=B8=BA=E6=AF=AB=E7=A7=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tencent/devops/process/engine/dao/PipelineBuildTaskDao.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/ci/core/process/biz-base/src/main/kotlin/com/tencent/devops/process/engine/dao/PipelineBuildTaskDao.kt b/src/backend/ci/core/process/biz-base/src/main/kotlin/com/tencent/devops/process/engine/dao/PipelineBuildTaskDao.kt index 19e97a17301..b5e8bed07f9 100644 --- a/src/backend/ci/core/process/biz-base/src/main/kotlin/com/tencent/devops/process/engine/dao/PipelineBuildTaskDao.kt +++ b/src/backend/ci/core/process/biz-base/src/main/kotlin/com/tencent/devops/process/engine/dao/PipelineBuildTaskDao.kt @@ -311,7 +311,7 @@ class PipelineBuildTaskDao @Autowired constructor(private val objectMapper: Obje val totalTime = if (record.startTime == null || record.endTime == null) { 0 } else { - Duration.between(record.startTime, record.endTime).toMillis() / 1000 + Duration.between(record.startTime, record.endTime).toMillis() } dslContext.update(this) .set(TOTAL_TIME, totalTime) From b39a21a1d58ed7ec430570d5a4527c0695a4f921 Mon Sep 17 00:00:00 2001 From: lockiechen Date: Fri, 2 Jul 2021 17:05:00 +0800 Subject: [PATCH 02/30] =?UTF-8?q?feat:=20=E6=B5=81=E6=B0=B4=E7=BA=BF?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E6=96=B0=E5=A2=9E=E2=80=9C=E5=A4=B1=E8=B4=A5?= =?UTF-8?q?=E6=97=B6=E5=8F=AF=E8=B7=B3=E8=BF=87=E2=80=9D=E7=9A=84=E9=80=89?= =?UTF-8?q?=E9=A1=B9=20issue=20#4245?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/AtomPropertyPanel/AtomOption.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/frontend/devops-pipeline/src/components/AtomPropertyPanel/AtomOption.vue b/src/frontend/devops-pipeline/src/components/AtomPropertyPanel/AtomOption.vue index 15988ac7c42..2da30837a04 100755 --- a/src/frontend/devops-pipeline/src/components/AtomPropertyPanel/AtomOption.vue +++ b/src/frontend/devops-pipeline/src/components/AtomPropertyPanel/AtomOption.vue @@ -88,7 +88,8 @@ Vue.set(this.element.additionalOptions, name, value) } - const currentfailControl = name === 'failControl' ? value : this.atomOption['failControl'] + const currentfailControl = [...new Set(name === 'failControl' ? value : this.atomOption['failControl'])] // 去重 + const includeManualRetry = currentfailControl.includes('MANUAL_RETRY') const continueable = currentfailControl.includes('continueWhenFailed') const isAutoSkip = continueable && (this.atomOption['manualSkip'] === false || (name === 'manualSkip' && value === false)) @@ -98,7 +99,6 @@ console.log(currentfailControl, isAutoSkip, this.atomOption['failControl'], value) const failControl = isAutoSkip ? currentfailControl.filter(item => item !== 'MANUAL_RETRY') : [...currentfailControl] - console.log(failControl) this.setPipelineEditing(true) this.handleUpdateElement('additionalOptions', { From 46102a9a1d2a8b9fc83926558b41531df7b56be3 Mon Sep 17 00:00:00 2001 From: lockiechen Date: Fri, 2 Jul 2021 17:16:16 +0800 Subject: [PATCH 03/30] =?UTF-8?q?feat:=20=E6=B5=81=E6=B0=B4=E7=BA=BF?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E6=96=B0=E5=A2=9E=E2=80=9C=E5=A4=B1=E8=B4=A5?= =?UTF-8?q?=E6=97=B6=E5=8F=AF=E8=B7=B3=E8=BF=87=E2=80=9D=E7=9A=84=E9=80=89?= =?UTF-8?q?=E9=A1=B9=20issue=20#4245?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../devops-pipeline/src/views/list/ImportPipelineEdit.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/src/frontend/devops-pipeline/src/views/list/ImportPipelineEdit.vue b/src/frontend/devops-pipeline/src/views/list/ImportPipelineEdit.vue index cdc01f4af5c..9e9a225264f 100644 --- a/src/frontend/devops-pipeline/src/views/list/ImportPipelineEdit.vue +++ b/src/frontend/devops-pipeline/src/views/list/ImportPipelineEdit.vue @@ -131,6 +131,7 @@ } .bk-tab-header { background: transparent; + background-image: none !important; .bk-tab-label-wrapper .bk-tab-label-list .bk-tab-label-item { min-width: auto; padding: 0; From e0a9d6547a080ba95183192dc614afe4514dfeca Mon Sep 17 00:00:00 2001 From: lockiechen Date: Fri, 2 Jul 2021 17:37:54 +0800 Subject: [PATCH 04/30] =?UTF-8?q?feat:=20=E6=B5=81=E6=B0=B4=E7=BA=BF?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E6=96=B0=E5=A2=9E=E2=80=9C=E5=A4=B1=E8=B4=A5?= =?UTF-8?q?=E6=97=B6=E5=8F=AF=E8=B7=B3=E8=BF=87=E2=80=9D=E7=9A=84=E9=80=89?= =?UTF-8?q?=E9=A1=B9=20issue=20#4245?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/atomFormField/AtomCheckboxList/index.vue | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/frontend/devops-pipeline/src/components/atomFormField/AtomCheckboxList/index.vue b/src/frontend/devops-pipeline/src/components/atomFormField/AtomCheckboxList/index.vue index 79e139e8f5e..880ea12c1b1 100755 --- a/src/frontend/devops-pipeline/src/components/atomFormField/AtomCheckboxList/index.vue +++ b/src/frontend/devops-pipeline/src/components/atomFormField/AtomCheckboxList/index.vue @@ -1,5 +1,5 @@ -

+

{{ containerSerialNum }} @@ -98,6 +98,12 @@ 'getAllContainers' ]), + containerCls () { + if (this.container.jobControlOption && this.container.jobControlOption.enable === false) { + return 'DISABLED' + } + return this.cotnainer.status || '' + }, showCheckedToatal () { const { isTriggerContainer, container, $route } = this return $route.path.indexOf('preview') > 0 && !isTriggerContainer(container) diff --git a/src/frontend/devops-pipeline/src/scss/pipelineStatus.scss b/src/frontend/devops-pipeline/src/scss/pipelineStatus.scss index 4ca1eca4a06..b2db3018cf9 100755 --- a/src/frontend/devops-pipeline/src/scss/pipelineStatus.scss +++ b/src/frontend/devops-pipeline/src/scss/pipelineStatus.scss @@ -17,23 +17,23 @@ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -.QUEUE { - color: $loadingColor; -} +.QUEUE, .RUNNING, -.REVIEWING { - color: $loadingColor; -} +.REVIEWING, .PREPARE_ENV, .LOOP_WAITING, .CALL_WAITING { color: $loadingColor; } + +.UNEXEC { + background-color: $fontWeightColor; +} + .CANCELED, .REVIEW_ABORT, .TRY_FINALLY, .QUEUE_CACHE, -.UNEXEC, .SKIP { color: $cancelColor; } From 020095b1604417f9b319be092948064a1e3c38e9 Mon Sep 17 00:00:00 2001 From: lockiechen Date: Tue, 6 Jul 2021 12:31:26 +0800 Subject: [PATCH 10/30] =?UTF-8?q?feat:=20=E6=B5=81=E6=B0=B4=E7=BA=BF?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E6=96=B0=E5=A2=9E=E2=80=9C=E5=A4=B1=E8=B4=A5?= =?UTF-8?q?=E6=97=B6=E5=8F=AF=E8=B7=B3=E8=BF=87=E2=80=9D=E7=9A=84=E9=80=89?= =?UTF-8?q?=E9=A1=B9=20job=E6=98=BE=E7=A4=BA=E7=8A=B6=E6=80=81=E6=95=B4?= =?UTF-8?q?=E7=90=86=20issue=20#4245?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/Stages/AtomList.vue | 25 +++++++++++++++---- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/src/frontend/devops-pipeline/src/components/Stages/AtomList.vue b/src/frontend/devops-pipeline/src/components/Stages/AtomList.vue index 9ed875db3a1..f35e2110ee7 100755 --- a/src/frontend/devops-pipeline/src/components/Stages/AtomList.vue +++ b/src/frontend/devops-pipeline/src/components/Stages/AtomList.vue @@ -2,7 +2,7 @@
  • -
    Date: Wed, 7 Jul 2021 16:54:38 +0800 Subject: [PATCH 14/30] =?UTF-8?q?feat:=20=E5=AF=B9=E4=BA=8E=E6=B5=81?= =?UTF-8?q?=E6=B0=B4=E7=BA=BFTASK=E6=89=A7=E8=A1=8C=E5=89=8D=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E8=87=AA=E5=8A=A8=E6=9A=82=E5=81=9C=EF=BC=8C=E5=B8=8C?= =?UTF-8?q?=E6=9C=9B=E8=83=BD=E5=BC=80=E6=94=BE=E5=BA=94=E7=94=A8=E6=80=81?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=EF=BC=8C=E4=BD=BF=E6=8F=92=E4=BB=B6=E7=BB=A7?= =?UTF-8?q?=E7=BB=AD=E6=89=A7=E8=A1=8C=E6=88=96=E8=80=85=E4=B8=AD=E6=AD=A2?= =?UTF-8?q?=20#4132?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/apigw/v3/ApigwBuildResourceV3.kt | 24 ++++++ .../apigw/v3/ApigwBuildResourceV3Impl.kt | 19 +++++ .../api/service/ServiceBuildResource.kt | 21 ++++++ .../process/api/user/UserBuildResource.kt | 4 +- .../devops/process/pojo/BuildTaskPauseInfo.kt | 48 ++++++++++++ .../process/api/ServiceBuildResourceImpl.kt | 30 +++++++- .../process/api/UserBuildResourceImpl.kt | 2 +- .../builds/PipelinePauseBuildFacadeService.kt | 74 ++++++++++++------- 8 files changed, 191 insertions(+), 31 deletions(-) create mode 100644 src/backend/ci/core/process/api-process/src/main/kotlin/com/tencent/devops/process/pojo/BuildTaskPauseInfo.kt diff --git a/src/backend/ci/core/openapi/api-openapi/src/main/kotlin/com/tencent/devops/openapi/api/apigw/v3/ApigwBuildResourceV3.kt b/src/backend/ci/core/openapi/api-openapi/src/main/kotlin/com/tencent/devops/openapi/api/apigw/v3/ApigwBuildResourceV3.kt index 19aa1422ede..559592970e1 100644 --- a/src/backend/ci/core/openapi/api-openapi/src/main/kotlin/com/tencent/devops/openapi/api/apigw/v3/ApigwBuildResourceV3.kt +++ b/src/backend/ci/core/openapi/api-openapi/src/main/kotlin/com/tencent/devops/openapi/api/apigw/v3/ApigwBuildResourceV3.kt @@ -30,13 +30,17 @@ import com.tencent.devops.common.api.auth.AUTH_HEADER_DEVOPS_APP_CODE import com.tencent.devops.common.api.auth.AUTH_HEADER_DEVOPS_APP_CODE_DEFAULT_VALUE import com.tencent.devops.common.api.auth.AUTH_HEADER_DEVOPS_USER_ID import com.tencent.devops.common.api.auth.AUTH_HEADER_DEVOPS_USER_ID_DEFAULT_VALUE +import com.tencent.devops.common.api.auth.AUTH_HEADER_USER_ID +import com.tencent.devops.common.api.auth.AUTH_HEADER_USER_ID_DEFAULT_VALUE import com.tencent.devops.common.api.pojo.BuildHistoryPage import com.tencent.devops.common.api.pojo.Result import com.tencent.devops.common.pipeline.pojo.StageReviewRequest +import com.tencent.devops.common.pipeline.pojo.element.Element import com.tencent.devops.process.pojo.BuildHistory import com.tencent.devops.process.pojo.BuildHistoryWithVars import com.tencent.devops.process.pojo.BuildId import com.tencent.devops.process.pojo.BuildManualStartupInfo +import com.tencent.devops.process.pojo.BuildTaskPauseInfo import com.tencent.devops.process.pojo.pipeline.ModelDetail import io.swagger.annotations.Api import io.swagger.annotations.ApiOperation @@ -294,4 +298,24 @@ interface ApigwBuildResourceV3 { @ApiParam("变量名列表", required = true) variableNames: List ): Result> + + + @ApiOperation("操作暂停插件") + @POST + @Path("/builds/{buildId}/taskIds/{taskId}/execution/pause") + fun executionPauseAtom( + @ApiParam(value = "用户ID", required = true, defaultValue = AUTH_HEADER_USER_ID_DEFAULT_VALUE) + @HeaderParam(AUTH_HEADER_USER_ID) + userId: String, + @ApiParam("项目ID", required = true) + @PathParam("projectId") + projectId: String, + @ApiParam("流水线ID", required = true) + @PathParam("pipelineId") + pipelineId: String, + @ApiParam("构建ID", required = true) + @PathParam("buildId") + buildId: String, + taskPauseExecute: BuildTaskPauseInfo + ): Result } diff --git a/src/backend/ci/core/openapi/biz-openapi/src/main/kotlin/com/tencent/devops/openapi/resources/apigw/v3/ApigwBuildResourceV3Impl.kt b/src/backend/ci/core/openapi/biz-openapi/src/main/kotlin/com/tencent/devops/openapi/resources/apigw/v3/ApigwBuildResourceV3Impl.kt index 820eb839af8..a39be32f837 100644 --- a/src/backend/ci/core/openapi/biz-openapi/src/main/kotlin/com/tencent/devops/openapi/resources/apigw/v3/ApigwBuildResourceV3Impl.kt +++ b/src/backend/ci/core/openapi/biz-openapi/src/main/kotlin/com/tencent/devops/openapi/resources/apigw/v3/ApigwBuildResourceV3Impl.kt @@ -31,6 +31,7 @@ import com.tencent.devops.common.api.pojo.Result import com.tencent.devops.common.client.Client import com.tencent.devops.common.pipeline.enums.ChannelCode import com.tencent.devops.common.pipeline.pojo.StageReviewRequest +import com.tencent.devops.common.pipeline.pojo.element.Element import com.tencent.devops.common.web.RestResource import com.tencent.devops.openapi.api.apigw.v3.ApigwBuildResourceV3 import com.tencent.devops.process.api.service.ServiceBuildResource @@ -38,6 +39,7 @@ import com.tencent.devops.process.pojo.BuildHistory import com.tencent.devops.process.pojo.BuildHistoryWithVars import com.tencent.devops.process.pojo.BuildId import com.tencent.devops.process.pojo.BuildManualStartupInfo +import com.tencent.devops.process.pojo.BuildTaskPauseInfo import com.tencent.devops.process.pojo.pipeline.ModelDetail import org.slf4j.LoggerFactory import org.springframework.beans.factory.annotation.Autowired @@ -222,6 +224,23 @@ class ApigwBuildResourceV3Impl @Autowired constructor( ) } + override fun executionPauseAtom( + userId: String, + projectId: String, + pipelineId: String, + buildId: String, + taskPauseExecute: BuildTaskPauseInfo + ): Result { + logger.info("$pipelineId| $buildId| $userId |executionPauseAtom $taskPauseExecute") + return client.get(ServiceBuildResource::class).executionPauseAtom( + userId = userId, + projectId = projectId, + pipelineId = pipelineId, + buildId = buildId, + taskPauseExecute = taskPauseExecute + ) + } + companion object { private val logger = LoggerFactory.getLogger(ApigwBuildResourceV3Impl::class.java) } diff --git a/src/backend/ci/core/process/api-process/src/main/kotlin/com/tencent/devops/process/api/service/ServiceBuildResource.kt b/src/backend/ci/core/process/api-process/src/main/kotlin/com/tencent/devops/process/api/service/ServiceBuildResource.kt index c75c6250f2c..27b34a79ca3 100644 --- a/src/backend/ci/core/process/api-process/src/main/kotlin/com/tencent/devops/process/api/service/ServiceBuildResource.kt +++ b/src/backend/ci/core/process/api-process/src/main/kotlin/com/tencent/devops/process/api/service/ServiceBuildResource.kt @@ -36,12 +36,14 @@ import com.tencent.devops.common.api.pojo.SimpleResult import com.tencent.devops.common.pipeline.enums.BuildStatus import com.tencent.devops.common.pipeline.enums.ChannelCode import com.tencent.devops.common.pipeline.pojo.StageReviewRequest +import com.tencent.devops.common.pipeline.pojo.element.Element import com.tencent.devops.process.pojo.BuildBasicInfo import com.tencent.devops.process.pojo.BuildHistory import com.tencent.devops.process.pojo.BuildHistoryVariables import com.tencent.devops.process.pojo.BuildHistoryWithVars import com.tencent.devops.process.pojo.BuildId import com.tencent.devops.process.pojo.BuildManualStartupInfo +import com.tencent.devops.process.pojo.BuildTaskPauseInfo import com.tencent.devops.process.pojo.ReviewParam import com.tencent.devops.process.pojo.VmInfo import com.tencent.devops.process.pojo.pipeline.ModelDetail @@ -550,4 +552,23 @@ interface ServiceBuildResource { @ApiParam("审核请求体", required = false) reviewRequest: StageReviewRequest? = null ): Result + + @ApiOperation("操作暂停插件") + @POST + @Path("/projects/{projectId}/pipelines/{pipelineId}/builds/{buildId}/execution/pause") + fun executionPauseAtom( + @ApiParam(value = "用户ID", required = true, defaultValue = AUTH_HEADER_USER_ID_DEFAULT_VALUE) + @HeaderParam(AUTH_HEADER_USER_ID) + userId: String, + @ApiParam("项目ID", required = true) + @PathParam("projectId") + projectId: String, + @ApiParam("流水线ID", required = true) + @PathParam("pipelineId") + pipelineId: String, + @ApiParam("构建ID", required = true) + @PathParam("buildId") + buildId: String, + taskPauseExecute: BuildTaskPauseInfo + ): Result } diff --git a/src/backend/ci/core/process/api-process/src/main/kotlin/com/tencent/devops/process/api/user/UserBuildResource.kt b/src/backend/ci/core/process/api-process/src/main/kotlin/com/tencent/devops/process/api/user/UserBuildResource.kt index 47f90dc3723..91009ebc05f 100644 --- a/src/backend/ci/core/process/api-process/src/main/kotlin/com/tencent/devops/process/api/user/UserBuildResource.kt +++ b/src/backend/ci/core/process/api-process/src/main/kotlin/com/tencent/devops/process/api/user/UserBuildResource.kt @@ -505,8 +505,8 @@ interface UserBuildResource { @ApiParam("任务ID", required = true) @PathParam("taskId") taskId: String, - @ApiParam("待执行插件元素", required = true) - element: Element, + @ApiParam("待执行插件元素", required = false) + element: Element?, @ApiParam("执行类型, true 继续, false 停止", required = true) @QueryParam("isContinue") isContinue: Boolean, diff --git a/src/backend/ci/core/process/api-process/src/main/kotlin/com/tencent/devops/process/pojo/BuildTaskPauseInfo.kt b/src/backend/ci/core/process/api-process/src/main/kotlin/com/tencent/devops/process/pojo/BuildTaskPauseInfo.kt new file mode 100644 index 00000000000..6960a2fbedf --- /dev/null +++ b/src/backend/ci/core/process/api-process/src/main/kotlin/com/tencent/devops/process/pojo/BuildTaskPauseInfo.kt @@ -0,0 +1,48 @@ +/* + * + * * Tencent is pleased to support the open source community by making BK-CI 蓝鲸持续集成平台 available. + * * + * * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. + * * + * * BK-CI 蓝鲸持续集成平台 is licensed under the MIT license. + * * + * * A copy of the MIT License is included in this file. + * * + * * + * * Terms of the MIT License: + * * --------------------------------------------------- + * * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated + * * documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + * * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to + * * permit persons to whom the Software is furnished to do so, subject to the following conditions: + * * + * * The above copyright notice and this permission notice shall be included in all copies or substantial portions of + * * the Software. + * * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT + * * LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + * * NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + +package com.tencent.devops.process.pojo + +import com.tencent.devops.common.pipeline.pojo.element.Element +import io.swagger.annotations.ApiModel +import io.swagger.annotations.ApiModelProperty + +@ApiModel("流水线暂停操作实体类") +data class BuildTaskPauseInfo ( + @ApiModelProperty("任务ID") + val taskId: String, + @ApiModelProperty("element信息,若插件内有变量变更需给出变更后的element") + val element: Element?, + @ApiModelProperty("是否继续 true:继续构建 false:停止构建") + val isContinue: Boolean, + @ApiModelProperty("当前stageId") + val stageId: String, + @ApiModelProperty("当前containerId") + val containerId: String +) diff --git a/src/backend/ci/core/process/biz-process/src/main/kotlin/com/tencent/devops/process/api/ServiceBuildResourceImpl.kt b/src/backend/ci/core/process/biz-process/src/main/kotlin/com/tencent/devops/process/api/ServiceBuildResourceImpl.kt index 533ae696304..28c82220cf8 100644 --- a/src/backend/ci/core/process/biz-process/src/main/kotlin/com/tencent/devops/process/api/ServiceBuildResourceImpl.kt +++ b/src/backend/ci/core/process/biz-process/src/main/kotlin/com/tencent/devops/process/api/ServiceBuildResourceImpl.kt @@ -36,6 +36,7 @@ import com.tencent.devops.common.pipeline.enums.BuildStatus import com.tencent.devops.common.pipeline.enums.ChannelCode import com.tencent.devops.common.pipeline.enums.StartType import com.tencent.devops.common.pipeline.pojo.StageReviewRequest +import com.tencent.devops.common.pipeline.pojo.element.Element import com.tencent.devops.common.web.RestResource import com.tencent.devops.process.api.service.ServiceBuildResource import com.tencent.devops.process.service.builds.PipelineBuildFacadeService @@ -47,10 +48,12 @@ import com.tencent.devops.process.pojo.BuildHistoryVariables import com.tencent.devops.process.pojo.BuildHistoryWithVars import com.tencent.devops.process.pojo.BuildId import com.tencent.devops.process.pojo.BuildManualStartupInfo +import com.tencent.devops.process.pojo.BuildTaskPauseInfo import com.tencent.devops.process.pojo.ReviewParam import com.tencent.devops.process.pojo.VmInfo import com.tencent.devops.process.pojo.pipeline.ModelDetail import com.tencent.devops.process.pojo.pipeline.PipelineLatestBuild +import com.tencent.devops.process.service.builds.PipelinePauseBuildFacadeService import org.springframework.beans.factory.annotation.Autowired @Suppress("ALL") @@ -58,7 +61,8 @@ import org.springframework.beans.factory.annotation.Autowired class ServiceBuildResourceImpl @Autowired constructor( private val pipelineBuildFacadeService: PipelineBuildFacadeService, private val engineVMBuildService: EngineVMBuildService, - private val vmBuildService: PipelineVMBuildService + private val vmBuildService: PipelineVMBuildService, + private val pipelinePauseBuildFacadeService: PipelinePauseBuildFacadeService ) : ServiceBuildResource { override fun setVMStatus( @@ -510,6 +514,30 @@ class ServiceBuildResourceImpl @Autowired constructor( return Result(true) } + override fun executionPauseAtom( + userId: String, + projectId: String, + pipelineId: String, + buildId: String, + taskPauseExecute: BuildTaskPauseInfo + ): Result { + checkParam(projectId, pipelineId) + checkUserId(userId) + return Result( + pipelinePauseBuildFacadeService.executePauseAtom( + userId = userId, + projectId = projectId, + pipelineId = pipelineId, + buildId = buildId, + isContinue = taskPauseExecute.isContinue, + taskId = taskPauseExecute.taskId, + element = taskPauseExecute.element, + stageId = taskPauseExecute.stageId, + containerId = taskPauseExecute.containerId + ) + ) + } + private fun checkParam(projectId: String, pipelineId: String) { if (pipelineId.isBlank()) { throw ParamBlankException("Invalid pipelineId") diff --git a/src/backend/ci/core/process/biz-process/src/main/kotlin/com/tencent/devops/process/api/UserBuildResourceImpl.kt b/src/backend/ci/core/process/biz-process/src/main/kotlin/com/tencent/devops/process/api/UserBuildResourceImpl.kt index ed69d2239cf..8ac1f0169de 100644 --- a/src/backend/ci/core/process/biz-process/src/main/kotlin/com/tencent/devops/process/api/UserBuildResourceImpl.kt +++ b/src/backend/ci/core/process/biz-process/src/main/kotlin/com/tencent/devops/process/api/UserBuildResourceImpl.kt @@ -408,7 +408,7 @@ class UserBuildResourceImpl @Autowired constructor( pipelineId: String, buildId: String, taskId: String, - element: Element, + element: Element?, isContinue: Boolean, stageId: String, containerId: String diff --git a/src/backend/ci/core/process/biz-process/src/main/kotlin/com/tencent/devops/process/service/builds/PipelinePauseBuildFacadeService.kt b/src/backend/ci/core/process/biz-process/src/main/kotlin/com/tencent/devops/process/service/builds/PipelinePauseBuildFacadeService.kt index d073cce25e4..f813662340e 100644 --- a/src/backend/ci/core/process/biz-process/src/main/kotlin/com/tencent/devops/process/service/builds/PipelinePauseBuildFacadeService.kt +++ b/src/backend/ci/core/process/biz-process/src/main/kotlin/com/tencent/devops/process/service/builds/PipelinePauseBuildFacadeService.kt @@ -75,7 +75,7 @@ class PipelinePauseBuildFacadeService( stageId: String, containerId: String, isContinue: Boolean, - element: Element, + element: Element?, checkPermission: Boolean? = true ): Boolean { logger.info("executePauseAtom| $userId| $pipelineId|$buildId| $stageId| $containerId| $taskId| $isContinue") @@ -89,17 +89,6 @@ class PipelinePauseBuildFacadeService( ) } - val newElementStr = ParameterUtils.element2Str(element, objectMapper) - if (newElementStr.isNullOrEmpty()) { - logger.warn("executePauseAtom element is too long") - throw ErrorCodeException( - statusCode = Response.Status.INTERNAL_SERVER_ERROR.statusCode, - errorCode = ProcessMessageCode.ERROR_ELEMENT_TOO_LONG, - defaultMessage = "${buildId}element大小越界", - params = arrayOf(buildId) - ) - } - val buildInfo = pipelineRuntimeService.getBuildInfo(buildId) ?: throw ErrorCodeException( statusCode = Response.Status.NOT_FOUND.statusCode, @@ -128,21 +117,14 @@ class PipelinePauseBuildFacadeService( actionType = ActionType.END // END才会对应成取消状态 } - val isDiff = findDiffValue( - buildId = buildId, - taskId = taskId, - userId = userId, - newElement = element, - oldTask = taskRecord - ) - - if (isDiff) { - pipelineTaskPauseService.savePauseValue(PipelinePauseValue( + if (element != null) { + findAndSaveDiff( + element = element, buildId = buildId, taskId = taskId, - newValue = newElementStr!!, - defaultValue = objectMapper.writeValueAsString(taskRecord.taskParams) - )) + userId = userId, + taskRecord = taskRecord + ) } pipelineEventDispatcher.dispatch( @@ -161,14 +143,17 @@ class PipelinePauseBuildFacadeService( return true } - fun findDiffValue( - newElement: Element, + private fun findDiffValue( + newElement: Element?, buildId: String, taskId: String, userId: String, oldTask: PipelineBuildTask ): Boolean { var isDiff = false + if (newElement == null) { + return isDiff + } val newInputData = ParameterUtils.getElementInput(newElement) val oldInputData = ParameterUtils.getParamInputs(oldTask.taskParams) ?: return isDiff @@ -203,4 +188,39 @@ class PipelinePauseBuildFacadeService( } return isDiff } + + private fun findAndSaveDiff( + element: Element, + buildId: String, + taskId: String, + userId: String, + taskRecord: PipelineBuildTask + ) { + val newElementStr = ParameterUtils.element2Str(element, objectMapper) + if (newElementStr.isNullOrEmpty()) { + logger.warn("executePauseAtom element is too long") + throw ErrorCodeException( + statusCode = Response.Status.INTERNAL_SERVER_ERROR.statusCode, + errorCode = ProcessMessageCode.ERROR_ELEMENT_TOO_LONG, + defaultMessage = "${buildId}element大小越界", + params = arrayOf(buildId) + ) + } + val isDiff = findDiffValue( + buildId = buildId, + taskId = taskId, + userId = userId, + newElement = element, + oldTask = taskRecord + ) + + if (isDiff) { + pipelineTaskPauseService.savePauseValue(PipelinePauseValue( + buildId = buildId, + taskId = taskId, + newValue = newElementStr!!, + defaultValue = objectMapper.writeValueAsString(taskRecord.taskParams) + )) + } + } } From 11fa7395ed21f3f4c792da26c2f163bc03303359 Mon Sep 17 00:00:00 2001 From: fitzcao Date: Wed, 7 Jul 2021 17:11:54 +0800 Subject: [PATCH 15/30] =?UTF-8?q?feat:=20=E5=AF=B9=E4=BA=8E=E6=B5=81?= =?UTF-8?q?=E6=B0=B4=E7=BA=BFTASK=E6=89=A7=E8=A1=8C=E5=89=8D=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E8=87=AA=E5=8A=A8=E6=9A=82=E5=81=9C=EF=BC=8C=E5=B8=8C?= =?UTF-8?q?=E6=9C=9B=E8=83=BD=E5=BC=80=E6=94=BE=E5=BA=94=E7=94=A8=E6=80=81?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=EF=BC=8C=E4=BD=BF=E6=8F=92=E4=BB=B6=E7=BB=A7?= =?UTF-8?q?=E7=BB=AD=E6=89=A7=E8=A1=8C=E6=88=96=E8=80=85=E4=B8=AD=E6=AD=A2?= =?UTF-8?q?=20#4132?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tencent/devops/openapi/api/apigw/v3/ApigwBuildResourceV3.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/ci/core/openapi/api-openapi/src/main/kotlin/com/tencent/devops/openapi/api/apigw/v3/ApigwBuildResourceV3.kt b/src/backend/ci/core/openapi/api-openapi/src/main/kotlin/com/tencent/devops/openapi/api/apigw/v3/ApigwBuildResourceV3.kt index 559592970e1..c5accbe1333 100644 --- a/src/backend/ci/core/openapi/api-openapi/src/main/kotlin/com/tencent/devops/openapi/api/apigw/v3/ApigwBuildResourceV3.kt +++ b/src/backend/ci/core/openapi/api-openapi/src/main/kotlin/com/tencent/devops/openapi/api/apigw/v3/ApigwBuildResourceV3.kt @@ -302,7 +302,7 @@ interface ApigwBuildResourceV3 { @ApiOperation("操作暂停插件") @POST - @Path("/builds/{buildId}/taskIds/{taskId}/execution/pause") + @Path("/builds/{buildId}/execute/pause") fun executionPauseAtom( @ApiParam(value = "用户ID", required = true, defaultValue = AUTH_HEADER_USER_ID_DEFAULT_VALUE) @HeaderParam(AUTH_HEADER_USER_ID) From 9e940bfb45d3e23e253354ec642746d8b705796d Mon Sep 17 00:00:00 2001 From: fitzcao Date: Wed, 7 Jul 2021 17:14:24 +0800 Subject: [PATCH 16/30] =?UTF-8?q?feat:=20=E5=AF=B9=E4=BA=8E=E6=B5=81?= =?UTF-8?q?=E6=B0=B4=E7=BA=BFTASK=E6=89=A7=E8=A1=8C=E5=89=8D=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E8=87=AA=E5=8A=A8=E6=9A=82=E5=81=9C=EF=BC=8C=E5=B8=8C?= =?UTF-8?q?=E6=9C=9B=E8=83=BD=E5=BC=80=E6=94=BE=E5=BA=94=E7=94=A8=E6=80=81?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=EF=BC=8C=E4=BD=BF=E6=8F=92=E4=BB=B6=E7=BB=A7?= =?UTF-8?q?=E7=BB=AD=E6=89=A7=E8=A1=8C=E6=88=96=E8=80=85=E4=B8=AD=E6=AD=A2?= =?UTF-8?q?=20#4132?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tencent/devops/openapi/api/apigw/v3/ApigwBuildResourceV3.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/ci/core/openapi/api-openapi/src/main/kotlin/com/tencent/devops/openapi/api/apigw/v3/ApigwBuildResourceV3.kt b/src/backend/ci/core/openapi/api-openapi/src/main/kotlin/com/tencent/devops/openapi/api/apigw/v3/ApigwBuildResourceV3.kt index c5accbe1333..06ba1cb63df 100644 --- a/src/backend/ci/core/openapi/api-openapi/src/main/kotlin/com/tencent/devops/openapi/api/apigw/v3/ApigwBuildResourceV3.kt +++ b/src/backend/ci/core/openapi/api-openapi/src/main/kotlin/com/tencent/devops/openapi/api/apigw/v3/ApigwBuildResourceV3.kt @@ -302,7 +302,7 @@ interface ApigwBuildResourceV3 { @ApiOperation("操作暂停插件") @POST - @Path("/builds/{buildId}/execute/pause") + @Path("/{buildId}/execute/pause") fun executionPauseAtom( @ApiParam(value = "用户ID", required = true, defaultValue = AUTH_HEADER_USER_ID_DEFAULT_VALUE) @HeaderParam(AUTH_HEADER_USER_ID) From ceb4e33d9ac55f738625a814d8f66e747ff608ce Mon Sep 17 00:00:00 2001 From: fitzcao Date: Wed, 7 Jul 2021 18:39:51 +0800 Subject: [PATCH 17/30] =?UTF-8?q?feat:=20=E5=AF=B9=E4=BA=8E=E6=B5=81?= =?UTF-8?q?=E6=B0=B4=E7=BA=BFTASK=E6=89=A7=E8=A1=8C=E5=89=8D=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E8=87=AA=E5=8A=A8=E6=9A=82=E5=81=9C=EF=BC=8C=E5=B8=8C?= =?UTF-8?q?=E6=9C=9B=E8=83=BD=E5=BC=80=E6=94=BE=E5=BA=94=E7=94=A8=E6=80=81?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=EF=BC=8C=E4=BD=BF=E6=8F=92=E4=BB=B6=E7=BB=A7?= =?UTF-8?q?=E7=BB=AD=E6=89=A7=E8=A1=8C=E6=88=96=E8=80=85=E4=B8=AD=E6=AD=A2?= =?UTF-8?q?=20#4132?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tencent/devops/openapi/api/apigw/v3/ApigwBuildResourceV3.kt | 2 -- .../openapi/resources/apigw/v3/ApigwBuildResourceV3Impl.kt | 1 - .../tencent/devops/process/api/service/ServiceBuildResource.kt | 1 - .../com/tencent/devops/process/pojo/BuildTaskPauseInfo.kt | 2 +- .../com/tencent/devops/process/api/ServiceBuildResourceImpl.kt | 1 - 5 files changed, 1 insertion(+), 6 deletions(-) diff --git a/src/backend/ci/core/openapi/api-openapi/src/main/kotlin/com/tencent/devops/openapi/api/apigw/v3/ApigwBuildResourceV3.kt b/src/backend/ci/core/openapi/api-openapi/src/main/kotlin/com/tencent/devops/openapi/api/apigw/v3/ApigwBuildResourceV3.kt index 06ba1cb63df..822990d890a 100644 --- a/src/backend/ci/core/openapi/api-openapi/src/main/kotlin/com/tencent/devops/openapi/api/apigw/v3/ApigwBuildResourceV3.kt +++ b/src/backend/ci/core/openapi/api-openapi/src/main/kotlin/com/tencent/devops/openapi/api/apigw/v3/ApigwBuildResourceV3.kt @@ -35,7 +35,6 @@ import com.tencent.devops.common.api.auth.AUTH_HEADER_USER_ID_DEFAULT_VALUE import com.tencent.devops.common.api.pojo.BuildHistoryPage import com.tencent.devops.common.api.pojo.Result import com.tencent.devops.common.pipeline.pojo.StageReviewRequest -import com.tencent.devops.common.pipeline.pojo.element.Element import com.tencent.devops.process.pojo.BuildHistory import com.tencent.devops.process.pojo.BuildHistoryWithVars import com.tencent.devops.process.pojo.BuildId @@ -299,7 +298,6 @@ interface ApigwBuildResourceV3 { variableNames: List ): Result> - @ApiOperation("操作暂停插件") @POST @Path("/{buildId}/execute/pause") diff --git a/src/backend/ci/core/openapi/biz-openapi/src/main/kotlin/com/tencent/devops/openapi/resources/apigw/v3/ApigwBuildResourceV3Impl.kt b/src/backend/ci/core/openapi/biz-openapi/src/main/kotlin/com/tencent/devops/openapi/resources/apigw/v3/ApigwBuildResourceV3Impl.kt index a39be32f837..4c394a0d8d8 100644 --- a/src/backend/ci/core/openapi/biz-openapi/src/main/kotlin/com/tencent/devops/openapi/resources/apigw/v3/ApigwBuildResourceV3Impl.kt +++ b/src/backend/ci/core/openapi/biz-openapi/src/main/kotlin/com/tencent/devops/openapi/resources/apigw/v3/ApigwBuildResourceV3Impl.kt @@ -31,7 +31,6 @@ import com.tencent.devops.common.api.pojo.Result import com.tencent.devops.common.client.Client import com.tencent.devops.common.pipeline.enums.ChannelCode import com.tencent.devops.common.pipeline.pojo.StageReviewRequest -import com.tencent.devops.common.pipeline.pojo.element.Element import com.tencent.devops.common.web.RestResource import com.tencent.devops.openapi.api.apigw.v3.ApigwBuildResourceV3 import com.tencent.devops.process.api.service.ServiceBuildResource diff --git a/src/backend/ci/core/process/api-process/src/main/kotlin/com/tencent/devops/process/api/service/ServiceBuildResource.kt b/src/backend/ci/core/process/api-process/src/main/kotlin/com/tencent/devops/process/api/service/ServiceBuildResource.kt index 27b34a79ca3..3ae56e16782 100644 --- a/src/backend/ci/core/process/api-process/src/main/kotlin/com/tencent/devops/process/api/service/ServiceBuildResource.kt +++ b/src/backend/ci/core/process/api-process/src/main/kotlin/com/tencent/devops/process/api/service/ServiceBuildResource.kt @@ -36,7 +36,6 @@ import com.tencent.devops.common.api.pojo.SimpleResult import com.tencent.devops.common.pipeline.enums.BuildStatus import com.tencent.devops.common.pipeline.enums.ChannelCode import com.tencent.devops.common.pipeline.pojo.StageReviewRequest -import com.tencent.devops.common.pipeline.pojo.element.Element import com.tencent.devops.process.pojo.BuildBasicInfo import com.tencent.devops.process.pojo.BuildHistory import com.tencent.devops.process.pojo.BuildHistoryVariables diff --git a/src/backend/ci/core/process/api-process/src/main/kotlin/com/tencent/devops/process/pojo/BuildTaskPauseInfo.kt b/src/backend/ci/core/process/api-process/src/main/kotlin/com/tencent/devops/process/pojo/BuildTaskPauseInfo.kt index 6960a2fbedf..54a899823ce 100644 --- a/src/backend/ci/core/process/api-process/src/main/kotlin/com/tencent/devops/process/pojo/BuildTaskPauseInfo.kt +++ b/src/backend/ci/core/process/api-process/src/main/kotlin/com/tencent/devops/process/pojo/BuildTaskPauseInfo.kt @@ -34,7 +34,7 @@ import io.swagger.annotations.ApiModel import io.swagger.annotations.ApiModelProperty @ApiModel("流水线暂停操作实体类") -data class BuildTaskPauseInfo ( +data class BuildTaskPauseInfo( @ApiModelProperty("任务ID") val taskId: String, @ApiModelProperty("element信息,若插件内有变量变更需给出变更后的element") diff --git a/src/backend/ci/core/process/biz-process/src/main/kotlin/com/tencent/devops/process/api/ServiceBuildResourceImpl.kt b/src/backend/ci/core/process/biz-process/src/main/kotlin/com/tencent/devops/process/api/ServiceBuildResourceImpl.kt index 28c82220cf8..8e733bc1434 100644 --- a/src/backend/ci/core/process/biz-process/src/main/kotlin/com/tencent/devops/process/api/ServiceBuildResourceImpl.kt +++ b/src/backend/ci/core/process/biz-process/src/main/kotlin/com/tencent/devops/process/api/ServiceBuildResourceImpl.kt @@ -36,7 +36,6 @@ import com.tencent.devops.common.pipeline.enums.BuildStatus import com.tencent.devops.common.pipeline.enums.ChannelCode import com.tencent.devops.common.pipeline.enums.StartType import com.tencent.devops.common.pipeline.pojo.StageReviewRequest -import com.tencent.devops.common.pipeline.pojo.element.Element import com.tencent.devops.common.web.RestResource import com.tencent.devops.process.api.service.ServiceBuildResource import com.tencent.devops.process.service.builds.PipelineBuildFacadeService From d01520e11b2c0e1fbc42a63804c522bc1996cf4c Mon Sep 17 00:00:00 2001 From: zanyzhao Date: Wed, 7 Jul 2021 19:51:07 +0800 Subject: [PATCH 18/30] =?UTF-8?q?feat:=20=E5=B0=86QQ=E7=BE=A4=E5=8F=B7?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E8=93=9D=E9=B2=B8=E7=A4=BE=E5=8C=BA=E7=89=88?= =?UTF-8?q?=20#4633?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- README_EN.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1fddba0c860..3c61a5ca5f9 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ bk-ci提供了流水线、代码库、凭证管理、环境管理、研发商店 ## Support 1. [GitHub讨论区](https://github.com/Tencent/bk-ci/discussions) -2. QQ群:744672165 +2. QQ群:495299374 ## BlueKing Community - [BK-BCS](https://github.com/Tencent/bk-bcs):蓝鲸容器管理平台是以容器技术为基础,为微服务业务提供编排管理的基础服务平台。 diff --git a/README_EN.md b/README_EN.md index 07442812a3f..4ccb818aab9 100644 --- a/README_EN.md +++ b/README_EN.md @@ -49,7 +49,7 @@ bk-ci provides five core services, namely Process, Repository, Ticket, Environme ## Support 1. [GitHub Discussions](https://github.com/Tencent/bk-ci/discussions) -2. QQ Group: 744672165 +2. QQ Group: 495299374 ## BlueKing Community From 54831fd3b9d3deca015d12e13ee4149cb4a29128 Mon Sep 17 00:00:00 2001 From: carlyin <449036249@qq.com> Date: Thu, 8 Jul 2021 21:18:36 +0800 Subject: [PATCH 19/30] =?UTF-8?q?perf:misc=E5=A4=9A=E7=BA=BF=E7=A8=8B?= =?UTF-8?q?=E6=B8=85=E7=90=86=E6=9E=84=E5=BB=BA=E6=95=B0=E6=8D=AE=E4=BC=98?= =?UTF-8?q?=E5=8C=96=20#4645?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PipelineBuildHistoryDataClearJob.kt | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/backend/ci/core/misc/biz-misc/src/main/kotlin/com/tencent/devops/misc/cron/process/PipelineBuildHistoryDataClearJob.kt b/src/backend/ci/core/misc/biz-misc/src/main/kotlin/com/tencent/devops/misc/cron/process/PipelineBuildHistoryDataClearJob.kt index 97ac618db2c..a99230ab43a 100644 --- a/src/backend/ci/core/misc/biz-misc/src/main/kotlin/com/tencent/devops/misc/cron/process/PipelineBuildHistoryDataClearJob.kt +++ b/src/backend/ci/core/misc/biz-misc/src/main/kotlin/com/tencent/devops/misc/cron/process/PipelineBuildHistoryDataClearJob.kt @@ -50,6 +50,9 @@ import java.time.LocalDateTime import java.util.concurrent.Callable import java.util.concurrent.Executors import java.util.concurrent.Future +import java.util.concurrent.LinkedBlockingQueue +import java.util.concurrent.ThreadPoolExecutor +import java.util.concurrent.TimeUnit @Component @Suppress("ALL") @@ -78,7 +81,14 @@ class PipelineBuildHistoryDataClearJob @Autowired constructor( @Value("\${process.deletedPipelineStoreDays:30}") private val deletedPipelineStoreDays: Long = 30 // 回收站已删除流水线保存天数 - private val executor = Executors.newFixedThreadPool(miscBuildDataClearConfig.maxThreadHandleProjectNum) + // 创建带有边界队列的线程池,防止内存爆掉 + private val executor = ThreadPoolExecutor( + miscBuildDataClearConfig.maxThreadHandleProjectNum, + miscBuildDataClearConfig.maxThreadHandleProjectNum, + 0L, + TimeUnit.MILLISECONDS, + LinkedBlockingQueue(10) + ) @Scheduled(initialDelay = 10000, fixedDelay = 12000) fun pipelineBuildHistoryDataClear() { @@ -108,7 +118,6 @@ class PipelineBuildHistoryDataClearJob @Autowired constructor( } // 获取清理项目构建数据的线程数量 val maxThreadHandleProjectNum = miscBuildDataClearConfig.maxThreadHandleProjectNum - val futureList = mutableListOf>() val avgProjectNum = maxProjectNum / maxThreadHandleProjectNum for (index in 1..maxThreadHandleProjectNum) { // 计算线程能处理的最大项目主键ID @@ -117,18 +126,13 @@ class PipelineBuildHistoryDataClearJob @Autowired constructor( } else { index * avgProjectNum + maxProjectNum % maxThreadHandleProjectNum } - futureList.add( - doClearBus( - threadNo = index, - projectIdList = projectIdList, - minThreadProjectPrimaryId = (index - 1) * avgProjectNum, - maxThreadProjectPrimaryId = maxThreadProjectPrimaryId - ) + doClearBus( + threadNo = index, + projectIdList = projectIdList, + minThreadProjectPrimaryId = (index - 1) * avgProjectNum, + maxThreadProjectPrimaryId = maxThreadProjectPrimaryId ) } - futureList.forEachIndexed { index, future -> - logger.info("future-$index doClearBus result:${future.get()}") - } } catch (t: Throwable) { logger.warn("pipelineBuildHistoryDataClear failed", t) } finally { From 6b7a67939a43958d6578aab97eb5f3cd095d3e32 Mon Sep 17 00:00:00 2001 From: carlyin <449036249@qq.com> Date: Thu, 8 Jul 2021 22:17:58 +0800 Subject: [PATCH 20/30] =?UTF-8?q?perf:misc=E5=A4=9A=E7=BA=BF=E7=A8=8B?= =?UTF-8?q?=E6=B8=85=E7=90=86=E6=9E=84=E5=BB=BA=E6=95=B0=E6=8D=AE=E4=BC=98?= =?UTF-8?q?=E5=8C=96=20#4645?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PipelineBuildHistoryDataClearJob.kt | 32 ++++++++++++------- 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/src/backend/ci/core/misc/biz-misc/src/main/kotlin/com/tencent/devops/misc/cron/process/PipelineBuildHistoryDataClearJob.kt b/src/backend/ci/core/misc/biz-misc/src/main/kotlin/com/tencent/devops/misc/cron/process/PipelineBuildHistoryDataClearJob.kt index a99230ab43a..abea09c97f8 100644 --- a/src/backend/ci/core/misc/biz-misc/src/main/kotlin/com/tencent/devops/misc/cron/process/PipelineBuildHistoryDataClearJob.kt +++ b/src/backend/ci/core/misc/biz-misc/src/main/kotlin/com/tencent/devops/misc/cron/process/PipelineBuildHistoryDataClearJob.kt @@ -52,6 +52,7 @@ import java.util.concurrent.Executors import java.util.concurrent.Future import java.util.concurrent.LinkedBlockingQueue import java.util.concurrent.ThreadPoolExecutor +import java.util.concurrent.ThreadPoolExecutor.AbortPolicy import java.util.concurrent.TimeUnit @Component @@ -76,20 +77,12 @@ class PipelineBuildHistoryDataClearJob @Autowired constructor( "pipeline:build:history:data:clear:project:id" private const val PIPELINE_BUILD_HISTORY_DATA_CLEAR_PROJECT_LIST_KEY = "pipeline:build:history:data:clear:project:list" + private var executor:ThreadPoolExecutor? = null } @Value("\${process.deletedPipelineStoreDays:30}") private val deletedPipelineStoreDays: Long = 30 // 回收站已删除流水线保存天数 - // 创建带有边界队列的线程池,防止内存爆掉 - private val executor = ThreadPoolExecutor( - miscBuildDataClearConfig.maxThreadHandleProjectNum, - miscBuildDataClearConfig.maxThreadHandleProjectNum, - 0L, - TimeUnit.MILLISECONDS, - LinkedBlockingQueue(10) - ) - @Scheduled(initialDelay = 10000, fixedDelay = 12000) fun pipelineBuildHistoryDataClear() { if (!miscBuildDataClearConfig.switch.toBoolean()) { @@ -97,8 +90,23 @@ class PipelineBuildHistoryDataClearJob @Autowired constructor( return } logger.info("pipelineBuildHistoryDataClear start") - val lock = RedisLock(redisOperation, - LOCK_KEY, 3000) + if (executor == null) { + // 创建带有边界队列的线程池,防止内存爆掉 + logger.info("pipelineBuildHistoryDataClear create executor") + executor = ThreadPoolExecutor( + miscBuildDataClearConfig.maxThreadHandleProjectNum, + miscBuildDataClearConfig.maxThreadHandleProjectNum, + 0L, + TimeUnit.MILLISECONDS, + LinkedBlockingQueue(10), + Executors.defaultThreadFactory(), + ThreadPoolExecutor.DiscardPolicy() + ) + } + val lock = RedisLock( + redisOperation, + LOCK_KEY, 3000 + ) try { if (!lock.tryLock()) { logger.info("get lock failed, skip") @@ -147,7 +155,7 @@ class PipelineBuildHistoryDataClearJob @Autowired constructor( maxThreadProjectPrimaryId: Long ): Future { val threadName = "Thread-$threadNo" - return executor.submit(Callable { + return executor!!.submit(Callable { var handleProjectPrimaryId = redisOperation.get("$threadName:$PIPELINE_BUILD_HISTORY_DATA_CLEAR_PROJECT_ID_KEY")?.toLong() if (handleProjectPrimaryId == null) { From 9eb24b67cab0b73a5e0ee57b45ac1c5126860002 Mon Sep 17 00:00:00 2001 From: carlyin <449036249@qq.com> Date: Fri, 9 Jul 2021 15:31:15 +0800 Subject: [PATCH 21/30] =?UTF-8?q?perf:misc=E5=A4=9A=E7=BA=BF=E7=A8=8B?= =?UTF-8?q?=E6=B8=85=E7=90=86=E6=9E=84=E5=BB=BA=E6=95=B0=E6=8D=AE=E4=BC=98?= =?UTF-8?q?=E5=8C=96=20#4645?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PipelineBuildHistoryDataClearJob.kt | 88 +++++++++++-------- 1 file changed, 51 insertions(+), 37 deletions(-) diff --git a/src/backend/ci/core/misc/biz-misc/src/main/kotlin/com/tencent/devops/misc/cron/process/PipelineBuildHistoryDataClearJob.kt b/src/backend/ci/core/misc/biz-misc/src/main/kotlin/com/tencent/devops/misc/cron/process/PipelineBuildHistoryDataClearJob.kt index abea09c97f8..cedc69a8174 100644 --- a/src/backend/ci/core/misc/biz-misc/src/main/kotlin/com/tencent/devops/misc/cron/process/PipelineBuildHistoryDataClearJob.kt +++ b/src/backend/ci/core/misc/biz-misc/src/main/kotlin/com/tencent/devops/misc/cron/process/PipelineBuildHistoryDataClearJob.kt @@ -77,6 +77,8 @@ class PipelineBuildHistoryDataClearJob @Autowired constructor( "pipeline:build:history:data:clear:project:id" private const val PIPELINE_BUILD_HISTORY_DATA_CLEAR_PROJECT_LIST_KEY = "pipeline:build:history:data:clear:project:list" + private const val PIPELINE_BUILD_HISTORY_DATA_CLEAR_THREAD_SET_KEY = + "pipeline:build:history:data:clear:thread:set" private var executor:ThreadPoolExecutor? = null } @@ -134,12 +136,15 @@ class PipelineBuildHistoryDataClearJob @Autowired constructor( } else { index * avgProjectNum + maxProjectNum % maxThreadHandleProjectNum } - doClearBus( - threadNo = index, - projectIdList = projectIdList, - minThreadProjectPrimaryId = (index - 1) * avgProjectNum, - maxThreadProjectPrimaryId = maxThreadProjectPrimaryId - ) + // 判断线程是否正在处理任务,如果正在处理任务则不分配新任务 + if (!redisOperation.isMember(PIPELINE_BUILD_HISTORY_DATA_CLEAR_THREAD_SET_KEY, index.toString())) { + doClearBus( + threadNo = index, + projectIdList = projectIdList, + minThreadProjectPrimaryId = (index - 1) * avgProjectNum, + maxThreadProjectPrimaryId = maxThreadProjectPrimaryId + ) + } } } catch (t: Throwable) { logger.warn("pipelineBuildHistoryDataClear failed", t) @@ -168,39 +173,48 @@ class PipelineBuildHistoryDataClearJob @Autowired constructor( return@Callable true } } - val maxEveryProjectHandleNum = miscBuildDataClearConfig.maxEveryProjectHandleNum - var maxHandleProjectPrimaryId = handleProjectPrimaryId ?: 0L - val projectInfoList = if (projectIdList.isNullOrEmpty()) { - val channelCodeList = miscBuildDataClearConfig.clearChannelCodes.split(",") - maxHandleProjectPrimaryId = handleProjectPrimaryId + maxEveryProjectHandleNum - projectMiscService.getProjectInfoList( - minId = handleProjectPrimaryId, - maxId = maxHandleProjectPrimaryId, - channelCodeList = channelCodeList - ) - } else { - projectMiscService.getProjectInfoList(projectIdList = projectIdList) - } - // 根据项目依次查询T_PIPELINE_INFO表中的流水线数据处理 - projectInfoList?.forEach { projectInfo -> - val channel = projectInfo.channel - // 获取项目对应的流水线数据清理配置类,如果不存在说明无需清理该项目下的构建记录 - val projectDataClearConfigService = - ProjectDataClearConfigFactory.getProjectDataClearConfigService(channel) ?: return@forEach - val projectPrimaryId = projectInfo.id - if (projectPrimaryId > maxHandleProjectPrimaryId) { - maxHandleProjectPrimaryId = projectPrimaryId + // 将线程编号存入redis集合 + redisOperation.sadd(PIPELINE_BUILD_HISTORY_DATA_CLEAR_THREAD_SET_KEY , threadNo.toString()) + try { + val maxEveryProjectHandleNum = miscBuildDataClearConfig.maxEveryProjectHandleNum + var maxHandleProjectPrimaryId = handleProjectPrimaryId ?: 0L + val projectInfoList = if (projectIdList.isNullOrEmpty()) { + val channelCodeList = miscBuildDataClearConfig.clearChannelCodes.split(",") + maxHandleProjectPrimaryId = handleProjectPrimaryId + maxEveryProjectHandleNum + projectMiscService.getProjectInfoList( + minId = handleProjectPrimaryId, + maxId = maxHandleProjectPrimaryId, + channelCodeList = channelCodeList + ) + } else { + projectMiscService.getProjectInfoList(projectIdList = projectIdList) + } + // 根据项目依次查询T_PIPELINE_INFO表中的流水线数据处理 + projectInfoList?.forEach { projectInfo -> + val channel = projectInfo.channel + // 获取项目对应的流水线数据清理配置类,如果不存在说明无需清理该项目下的构建记录 + val projectDataClearConfigService = + ProjectDataClearConfigFactory.getProjectDataClearConfigService(channel) ?: return@forEach + val projectPrimaryId = projectInfo.id + if (projectPrimaryId > maxHandleProjectPrimaryId) { + maxHandleProjectPrimaryId = projectPrimaryId + } + val projectId = projectInfo.projectId + // 清理流水线构建数据 + clearPipelineBuildData(projectId, projectDataClearConfigService) } - val projectId = projectInfo.projectId - // 清理流水线构建数据 - clearPipelineBuildData(projectId, projectDataClearConfigService) + // 将当前已处理完的最大项目Id存入redis + redisOperation.set( + key = "$threadName:$PIPELINE_BUILD_HISTORY_DATA_CLEAR_PROJECT_ID_KEY", + value = maxHandleProjectPrimaryId.toString(), + expired = false + ) + } catch (ignore: Exception) { + logger.warn("pipelineBuildHistoryDataClear doClearBus failed", ignore) + } finally { + // 释放redis集合中的线程编号 + redisOperation.sremove(PIPELINE_BUILD_HISTORY_DATA_CLEAR_THREAD_SET_KEY , threadNo.toString()) } - // 将当前已处理完的最大项目Id存入redis - redisOperation.set( - key = "$threadName:$PIPELINE_BUILD_HISTORY_DATA_CLEAR_PROJECT_ID_KEY", - value = maxHandleProjectPrimaryId.toString(), - expired = false - ) return@Callable true }) } From 453901d454d8fd6fa403f62fd5f5b94de99a340d Mon Sep 17 00:00:00 2001 From: carlyin <449036249@qq.com> Date: Fri, 9 Jul 2021 15:57:54 +0800 Subject: [PATCH 22/30] =?UTF-8?q?perf:misc=E5=A4=9A=E7=BA=BF=E7=A8=8B?= =?UTF-8?q?=E6=B8=85=E7=90=86=E6=9E=84=E5=BB=BA=E6=95=B0=E6=8D=AE=E4=BC=98?= =?UTF-8?q?=E5=8C=96=20#4645?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../misc/cron/process/PipelineBuildHistoryDataClearJob.kt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/backend/ci/core/misc/biz-misc/src/main/kotlin/com/tencent/devops/misc/cron/process/PipelineBuildHistoryDataClearJob.kt b/src/backend/ci/core/misc/biz-misc/src/main/kotlin/com/tencent/devops/misc/cron/process/PipelineBuildHistoryDataClearJob.kt index cedc69a8174..b63fa2ffbd0 100644 --- a/src/backend/ci/core/misc/biz-misc/src/main/kotlin/com/tencent/devops/misc/cron/process/PipelineBuildHistoryDataClearJob.kt +++ b/src/backend/ci/core/misc/biz-misc/src/main/kotlin/com/tencent/devops/misc/cron/process/PipelineBuildHistoryDataClearJob.kt @@ -52,7 +52,6 @@ import java.util.concurrent.Executors import java.util.concurrent.Future import java.util.concurrent.LinkedBlockingQueue import java.util.concurrent.ThreadPoolExecutor -import java.util.concurrent.ThreadPoolExecutor.AbortPolicy import java.util.concurrent.TimeUnit @Component @@ -136,7 +135,7 @@ class PipelineBuildHistoryDataClearJob @Autowired constructor( } else { index * avgProjectNum + maxProjectNum % maxThreadHandleProjectNum } - // 判断线程是否正在处理任务,如果正在处理任务则不分配新任务 + // 判断线程是否正在处理任务,如正在处理则不分配新任务(定时任务12秒执行一次,线程启动到往set集合设置编号耗费时间很短,故不加锁) if (!redisOperation.isMember(PIPELINE_BUILD_HISTORY_DATA_CLEAR_THREAD_SET_KEY, index.toString())) { doClearBus( threadNo = index, From 6af870c0a9ae72e365c98e64a67a598ac5223de5 Mon Sep 17 00:00:00 2001 From: carlyin <449036249@qq.com> Date: Fri, 9 Jul 2021 16:16:13 +0800 Subject: [PATCH 23/30] =?UTF-8?q?perf:misc=E5=A4=9A=E7=BA=BF=E7=A8=8B?= =?UTF-8?q?=E6=B8=85=E7=90=86=E6=9E=84=E5=BB=BA=E6=95=B0=E6=8D=AE=E4=BC=98?= =?UTF-8?q?=E5=8C=96=20#4645?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../misc/cron/process/PipelineBuildHistoryDataClearJob.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/backend/ci/core/misc/biz-misc/src/main/kotlin/com/tencent/devops/misc/cron/process/PipelineBuildHistoryDataClearJob.kt b/src/backend/ci/core/misc/biz-misc/src/main/kotlin/com/tencent/devops/misc/cron/process/PipelineBuildHistoryDataClearJob.kt index b63fa2ffbd0..ab41fa57a1c 100644 --- a/src/backend/ci/core/misc/biz-misc/src/main/kotlin/com/tencent/devops/misc/cron/process/PipelineBuildHistoryDataClearJob.kt +++ b/src/backend/ci/core/misc/biz-misc/src/main/kotlin/com/tencent/devops/misc/cron/process/PipelineBuildHistoryDataClearJob.kt @@ -78,7 +78,7 @@ class PipelineBuildHistoryDataClearJob @Autowired constructor( "pipeline:build:history:data:clear:project:list" private const val PIPELINE_BUILD_HISTORY_DATA_CLEAR_THREAD_SET_KEY = "pipeline:build:history:data:clear:thread:set" - private var executor:ThreadPoolExecutor? = null + private var executor: ThreadPoolExecutor? = null } @Value("\${process.deletedPipelineStoreDays:30}") @@ -173,7 +173,7 @@ class PipelineBuildHistoryDataClearJob @Autowired constructor( } } // 将线程编号存入redis集合 - redisOperation.sadd(PIPELINE_BUILD_HISTORY_DATA_CLEAR_THREAD_SET_KEY , threadNo.toString()) + redisOperation.sadd(PIPELINE_BUILD_HISTORY_DATA_CLEAR_THREAD_SET_KEY, threadNo.toString()) try { val maxEveryProjectHandleNum = miscBuildDataClearConfig.maxEveryProjectHandleNum var maxHandleProjectPrimaryId = handleProjectPrimaryId ?: 0L @@ -212,7 +212,7 @@ class PipelineBuildHistoryDataClearJob @Autowired constructor( logger.warn("pipelineBuildHistoryDataClear doClearBus failed", ignore) } finally { // 释放redis集合中的线程编号 - redisOperation.sremove(PIPELINE_BUILD_HISTORY_DATA_CLEAR_THREAD_SET_KEY , threadNo.toString()) + redisOperation.sremove(PIPELINE_BUILD_HISTORY_DATA_CLEAR_THREAD_SET_KEY, threadNo.toString()) } return@Callable true }) From f8fcf6b52e5a0d2e12440a59e036c19a858192e6 Mon Sep 17 00:00:00 2001 From: vhwweng <1010382269@qq.com> Date: Fri, 9 Jul 2021 19:37:50 +0800 Subject: [PATCH 24/30] =?UTF-8?q?format:=20=E4=BA=BA=E5=B7=A5=E5=AE=A1?= =?UTF-8?q?=E6=A0=B8=E5=85=AC=E5=85=B1=E9=83=A8=E5=88=86=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E6=8F=90=E5=8F=96=E4=BC=98=E5=8C=96=20issue=20#4655?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AtomFormComponent/DefineParam/index.vue | 91 +---------- .../AtomFormComponent/DefineParam/show.vue | 146 ++++++++++++++++++ .../src/components/Stages/CheckAtomDialog.vue | 106 +------------ 3 files changed, 161 insertions(+), 182 deletions(-) create mode 100644 src/frontend/devops-pipeline/src/components/AtomFormComponent/DefineParam/show.vue diff --git a/src/frontend/devops-pipeline/src/components/AtomFormComponent/DefineParam/index.vue b/src/frontend/devops-pipeline/src/components/AtomFormComponent/DefineParam/index.vue index 8f7e8c92301..841ca9e5fc6 100644 --- a/src/frontend/devops-pipeline/src/components/AtomFormComponent/DefineParam/index.vue +++ b/src/frontend/devops-pipeline/src/components/AtomFormComponent/DefineParam/index.vue @@ -69,45 +69,8 @@ :is-error="errors.has(`param-${param.key}.defaultValue`)" :error-msg="errors.first(`param-${param.key}.defaultValue`)" :desc="$t(`editPage.${getParamsDefaultValueLabelTips(param.valueType)}`)"> - - - - - - + + { return CHECK_PARAM_LIST.map(item => { @@ -204,9 +153,9 @@ draggable, Accordion, VuexInput, - EnumInput, VuexTextarea, - AtomCheckbox + AtomCheckbox, + DefineParamShow }, mixins: [atomFieldMixin], props: { @@ -244,10 +193,6 @@ animation: 200, disabled: this.disabled } - }, - - boolList () { - return BOOLEAN } }, watch: { @@ -262,9 +207,6 @@ this.globalParams = this.value }, methods: { - isTextareaParam, - isStringParam, - isBooleanParam, isMultipleParam, getParamsDefaultValueLabel, getParamsDefaultValueLabelTips, @@ -330,30 +272,9 @@ this.$emit('input', value) }, - editParamShow (paramIndex) { - let isShow = false - const param = this.value[paramIndex] - if (param) { - isShow = param.required - } - this.handleParamChange('required', !isShow, paramIndex) - }, - isSelectorParam (type) { return isMultipleParam(type) || isEnumParam(type) }, - - transformOpt (opts) { - const uniqueMap = {} - opts = opts.filter(opt => opt.key.length) - return Array.isArray(opts) ? opts.filter(opt => { - if (!uniqueMap[opt.key]) { - uniqueMap[opt.key] = 1 - return true - } - return false - }).map(opt => ({ id: opt.key, name: opt.value })) : [] - }, getOptions (param) { try { @@ -379,6 +300,8 @@ }, handleParamChange (key, value, paramIndex) { + console.log(key, value, paramIndex, 111111111) + // const { key, value, paramIndex } = payload const param = this.globalParams[paramIndex] if (isMultipleParam(param.valueType) && key === 'value') { diff --git a/src/frontend/devops-pipeline/src/components/AtomFormComponent/DefineParam/show.vue b/src/frontend/devops-pipeline/src/components/AtomFormComponent/DefineParam/show.vue new file mode 100644 index 00000000000..2e76127ae8f --- /dev/null +++ b/src/frontend/devops-pipeline/src/components/AtomFormComponent/DefineParam/show.vue @@ -0,0 +1,146 @@ + + + diff --git a/src/frontend/devops-pipeline/src/components/Stages/CheckAtomDialog.vue b/src/frontend/devops-pipeline/src/components/Stages/CheckAtomDialog.vue index 9f442bc578d..94ea1fbd904 100755 --- a/src/frontend/devops-pipeline/src/components/Stages/CheckAtomDialog.vue +++ b/src/frontend/devops-pipeline/src/components/Stages/CheckAtomDialog.vue @@ -45,46 +45,8 @@
    - - - - - - + +
    @@ -102,33 +64,18 @@ isStringParam, isBooleanParam, isEnumParam, - isMultipleParam, - CHECK_PARAM_LIST } from '@/store/modules/atom/paramsConfig' + isMultipleParam + } from '@/store/modules/atom/paramsConfig' import FormField from '@/components/AtomPropertyPanel/FormField' - import EnumInput from '@/components/atomFormField/EnumInput' import VuexInput from '@/components/atomFormField/VuexInput' - import VuexTextarea from '@/components/atomFormField/VuexTextarea' - import Selector from '@/components/atomFormField/Selector' - - const BOOLEAN = [ - { - value: true, - label: true - }, - { - value: false, - label: false - } - ] + import DefineParamShow from '@/components/AtomFormComponent/DefineParam/show.vue' export default { name: 'check-atom-dialog', components: { - EnumInput, VuexInput, - VuexTextarea, - Selector, - FormField + FormField, + DefineParamShow }, mixins: [atomMixin], props: { @@ -151,14 +98,8 @@ isMetadataVar: { type: Boolean, default: false - }, - // 只允许修改值,不允许增减项和修改key - editValueOnly: { - type: Boolean, - default: false } }, - data () { return { isLoading: true, @@ -187,17 +128,6 @@ }, snonVarRule () { return !this.isSupportVar ? 'nonVarRule' : '' - }, - paramsList () { - return CHECK_PARAM_LIST.map(item => { - return { - id: item.id, - name: this.$t(`storeMap.${item.name}`) - } - }) - }, - boolList () { - return BOOLEAN } }, watch: { @@ -280,25 +210,8 @@ this.$bkMessage({ message: err.content, theme: 'error' }) }) }, - getSelectorDefaultVal ({ valueType, value = '' }) { - if (isMultipleParam(valueType)) { - return value && typeof value === 'string' ? value.split(',') : [] - } - - return value - }, - transformOpt (opts) { - const uniqueMap = {} - opts = opts.filter(opt => opt.key.length) - return Array.isArray(opts) ? opts.filter(opt => { - if (!uniqueMap[opt.key]) { - uniqueMap[opt.key] = 1 - return true - } - return false - }).map(opt => ({ id: opt.key, name: opt.value })) : [] - }, handleParamChange (key, value, paramIndex) { + // const { key, value, paramIndex } = payload const param = this.data.params if (isMultipleParam(param[paramIndex].valueType) && key === 'value') { Object.assign(param[paramIndex], { @@ -310,9 +223,6 @@ }) } this.handleUpdateElement('params', param) - }, - isSelectorParam (type) { - return isMultipleParam(type) || isEnumParam(type) } } } From f5f703fca93ef7431918ea4bac98cdff64bb5bc4 Mon Sep 17 00:00:00 2001 From: vhwweng <1010382269@qq.com> Date: Fri, 9 Jul 2021 19:38:40 +0800 Subject: [PATCH 25/30] =?UTF-8?q?format:=20=E4=BA=BA=E5=B7=A5=E5=AE=A1?= =?UTF-8?q?=E6=A0=B8=E5=85=AC=E5=85=B1=E9=83=A8=E5=88=86=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E6=8F=90=E5=8F=96=E4=BC=98=E5=8C=96=20issue=20#4655?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/AtomFormComponent/DefineParam/index.vue | 2 -- .../src/components/AtomFormComponent/DefineParam/show.vue | 8 -------- .../src/components/Stages/CheckAtomDialog.vue | 1 - 3 files changed, 11 deletions(-) diff --git a/src/frontend/devops-pipeline/src/components/AtomFormComponent/DefineParam/index.vue b/src/frontend/devops-pipeline/src/components/AtomFormComponent/DefineParam/index.vue index 841ca9e5fc6..303ed172c73 100644 --- a/src/frontend/devops-pipeline/src/components/AtomFormComponent/DefineParam/index.vue +++ b/src/frontend/devops-pipeline/src/components/AtomFormComponent/DefineParam/index.vue @@ -300,8 +300,6 @@ }, handleParamChange (key, value, paramIndex) { - console.log(key, value, paramIndex, 111111111) - // const { key, value, paramIndex } = payload const param = this.globalParams[paramIndex] if (isMultipleParam(param.valueType) && key === 'value') { diff --git a/src/frontend/devops-pipeline/src/components/AtomFormComponent/DefineParam/show.vue b/src/frontend/devops-pipeline/src/components/AtomFormComponent/DefineParam/show.vue index 2e76127ae8f..1efd2e630f9 100644 --- a/src/frontend/devops-pipeline/src/components/AtomFormComponent/DefineParam/show.vue +++ b/src/frontend/devops-pipeline/src/components/AtomFormComponent/DefineParam/show.vue @@ -102,14 +102,6 @@ return BOOLEAN } }, - watch: { - param (v) { - console.log(v) - } - }, - created () { - console.log(this.isMultipleParam, 2222222) - }, methods: { isBooleanParam, isStringParam, diff --git a/src/frontend/devops-pipeline/src/components/Stages/CheckAtomDialog.vue b/src/frontend/devops-pipeline/src/components/Stages/CheckAtomDialog.vue index 94ea1fbd904..e442decad23 100755 --- a/src/frontend/devops-pipeline/src/components/Stages/CheckAtomDialog.vue +++ b/src/frontend/devops-pipeline/src/components/Stages/CheckAtomDialog.vue @@ -211,7 +211,6 @@ }) }, handleParamChange (key, value, paramIndex) { - // const { key, value, paramIndex } = payload const param = this.data.params if (isMultipleParam(param[paramIndex].valueType) && key === 'value') { Object.assign(param[paramIndex], { From fffa126ff404f4045bc5123e2d1b62601a3fca77 Mon Sep 17 00:00:00 2001 From: carlyin <449036249@qq.com> Date: Fri, 9 Jul 2021 23:48:28 +0800 Subject: [PATCH 26/30] =?UTF-8?q?perf:misc=E5=A4=9A=E7=BA=BF=E7=A8=8B?= =?UTF-8?q?=E6=B8=85=E7=90=86=E6=9E=84=E5=BB=BA=E6=95=B0=E6=8D=AE=E4=BC=98?= =?UTF-8?q?=E5=8C=96=20#4645?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../misc/cron/process/PipelineBuildHistoryDataClearJob.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/ci/core/misc/biz-misc/src/main/kotlin/com/tencent/devops/misc/cron/process/PipelineBuildHistoryDataClearJob.kt b/src/backend/ci/core/misc/biz-misc/src/main/kotlin/com/tencent/devops/misc/cron/process/PipelineBuildHistoryDataClearJob.kt index ab41fa57a1c..26d9678d15e 100644 --- a/src/backend/ci/core/misc/biz-misc/src/main/kotlin/com/tencent/devops/misc/cron/process/PipelineBuildHistoryDataClearJob.kt +++ b/src/backend/ci/core/misc/biz-misc/src/main/kotlin/com/tencent/devops/misc/cron/process/PipelineBuildHistoryDataClearJob.kt @@ -168,7 +168,7 @@ class PipelineBuildHistoryDataClearJob @Autowired constructor( if (handleProjectPrimaryId >= maxThreadProjectPrimaryId) { // 已经清理完全部项目的流水线的过期构建记录,再重新开始清理 redisOperation.delete("$threadName:$PIPELINE_BUILD_HISTORY_DATA_CLEAR_PROJECT_ID_KEY") - logger.info("pipelineBuildHistoryDataClear reStart") + logger.info("pipelineBuildHistoryDataClear $threadName reStart") return@Callable true } } From 24c2ebd7ff3f4aaece69da3fad669a3d17e746fb Mon Sep 17 00:00:00 2001 From: stubenhuang Date: Mon, 12 Jul 2021 19:44:34 +0800 Subject: [PATCH 27/30] =?UTF-8?q?feat:=20=E7=BD=91=E5=85=B3=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E5=BC=BA=E5=88=B6=E8=B7=AF=E7=94=B1=E9=9B=86=E7=BE=A4?= =?UTF-8?q?=20#4662?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/gateway/core/lua/util/tag_util.lua | 105 +++++++++++++------------ 1 file changed, 55 insertions(+), 50 deletions(-) diff --git a/src/gateway/core/lua/util/tag_util.lua b/src/gateway/core/lua/util/tag_util.lua index 05765a645e8..5fb90e5bb9a 100644 --- a/src/gateway/core/lua/util/tag_util.lua +++ b/src/gateway/core/lua/util/tag_util.lua @@ -25,72 +25,77 @@ function _M:get_tag(ns_config) local devops_project = ngx.var.project_id local default_tag = ns_config.tag local tag = default_tag + local header_tag = ngx.header["X-DEVOPS-TAG"] - if devops_project ~= nil and devops_project ~= '' then - -- 获取redis连接 - local red, err = redisUtil:new() - if not red then - ngx.log(ngx.ERR, "tag failed to new redis ", err) - return tag - end - - -- 从缓存获取 - local tag_cache = ngx.shared.tag_project_store - local tag_cache_value = tag_cache:get(devops_project) - if tag_cache_value ~= nil then - tag = tag_cache_value - else - local redis_key = nil - if ngx.var.project == 'codecc' then - redis_key = 'project:setting:tag:codecc:v2' - else - redis_key = "project:setting:tag:v2" + if header_tag == nil then + if devops_project ~= nil and devops_project ~= '' then + -- 获取redis连接 + local red, err = redisUtil:new() + if not red then + ngx.log(ngx.ERR, "tag failed to new redis ", err) + return tag end - -- 从redis获取tag - local hash_key = '\xAC\xED\x00\x05t\x00' .. string.char(devops_project:len()) .. devops_project -- 兼容Spring Redis的hashKey的默认序列化 - local redRes, err = red:hget(redis_key, hash_key) - if not redRes then - ngx.log(ngx.ERR, "tag failed to get redis result: ", err) - tag_cache:set(devops_project, default_tag, 30) + + -- 从缓存获取 + local tag_cache = ngx.shared.tag_project_store + local tag_cache_value = tag_cache:get(devops_project) + if tag_cache_value ~= nil then + tag = tag_cache_value else - if redRes == ngx.null then + local redis_key = nil + if ngx.var.project == 'codecc' then + redis_key = 'project:setting:tag:codecc:v2' + else + redis_key = "project:setting:tag:v2" + end + -- 从redis获取tag + local hash_key = '\xAC\xED\x00\x05t\x00' .. string.char(devops_project:len()) .. devops_project -- 兼容Spring Redis的hashKey的默认序列化 + local redRes, err = red:hget(redis_key, hash_key) + if not redRes then + ngx.log(ngx.ERR, "tag failed to get redis result: ", err) tag_cache:set(devops_project, default_tag, 30) else - local hash_val = redRes:sub(8) -- 兼容Spring Redis的hashValue的默认序列化 - tag_cache:set(devops_project, hash_val, 30) - tag = hash_val + if redRes == ngx.null then + tag_cache:set(devops_project, default_tag, 30) + else + local hash_val = redRes:sub(8) -- 兼容Spring Redis的hashValue的默认序列化 + tag_cache:set(devops_project, hash_val, 30) + tag = hash_val + end end end - end - -- 是否只能用默认tag - if tag ~= ns_config.tag then - local pattern_key = "project:setting:tag:pattern:v2" - -- 先从本地缓存获取 - local pattern_cache_value = tag_cache:get(pattern_key) + -- 是否只能用默认tag + if tag ~= ns_config.tag then + local pattern_key = "project:setting:tag:pattern:v2" + -- 先从本地缓存获取 + local pattern_cache_value = tag_cache:get(pattern_key) - -- 再从redis获取 - if pattern_cache_value == nil then - pattern_cache_value = red:get(pattern_key) - if pattern_cache_value == ngx.null then - pattern_cache_value = 'null' + -- 再从redis获取 + if pattern_cache_value == nil then + pattern_cache_value = red:get(pattern_key) + if pattern_cache_value == ngx.null then + pattern_cache_value = 'null' + end + tag_cache:set(pattern_key, pattern_cache_value, 30) end - tag_cache:set(pattern_key, pattern_cache_value, 30) - end - -- 不为空且符合正则, 则有特殊处理 - if pattern_cache_value ~= 'null' and string.find(ngx.var.uri, pattern_cache_value) then - tag = default_tag + -- 不为空且符合正则, 则有特殊处理 + if pattern_cache_value ~= 'null' and string.find(ngx.var.uri, pattern_cache_value) then + tag = default_tag + end end + + --- 将redis连接放回pool中 + red:set_keepalive(config.redis.max_idle_time, config.redis.pool_size) end - --- 将redis连接放回pool中 - red:set_keepalive(config.redis.max_idle_time, config.redis.pool_size) + -- 设置tag到http请求头 + ngx.header["X-DEVOPS-TAG"] = tag + else + tag = header_tag end - -- 设置tag到http请求头 - ngx.header["X-DEVOPS-TAG"] = tag - return tag end From 3f6f901121f431149e7e6555107920df5bae0b71 Mon Sep 17 00:00:00 2001 From: stubenhuang Date: Mon, 12 Jul 2021 19:55:43 +0800 Subject: [PATCH 28/30] =?UTF-8?q?feat:=20=E7=BD=91=E5=85=B3=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E5=BC=BA=E5=88=B6=E8=B7=AF=E7=94=B1=E9=9B=86=E7=BE=A4?= =?UTF-8?q?=20#4662?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/gateway/core/lua/util/tag_util.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gateway/core/lua/util/tag_util.lua b/src/gateway/core/lua/util/tag_util.lua index 5fb90e5bb9a..d26de520b0c 100644 --- a/src/gateway/core/lua/util/tag_util.lua +++ b/src/gateway/core/lua/util/tag_util.lua @@ -25,7 +25,7 @@ function _M:get_tag(ns_config) local devops_project = ngx.var.project_id local default_tag = ns_config.tag local tag = default_tag - local header_tag = ngx.header["X-DEVOPS-TAG"] + local header_tag = ngx.var.http_x_devops_tag if header_tag == nil then if devops_project ~= nil and devops_project ~= '' then From 90f769c57df8ab4ebd436e606e636b6fc16b6e7c Mon Sep 17 00:00:00 2001 From: fitzcao Date: Mon, 12 Jul 2021 21:08:31 +0800 Subject: [PATCH 29/30] =?UTF-8?q?feat:=20=E5=AF=B9=E4=BA=8E=E6=B5=81?= =?UTF-8?q?=E6=B0=B4=E7=BA=BFTASK=E6=89=A7=E8=A1=8C=E5=89=8D=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E8=87=AA=E5=8A=A8=E6=9A=82=E5=81=9C=EF=BC=8C=E5=B8=8C?= =?UTF-8?q?=E6=9C=9B=E8=83=BD=E5=BC=80=E6=94=BE=E5=BA=94=E7=94=A8=E6=80=81?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=EF=BC=8C=E4=BD=BF=E6=8F=92=E4=BB=B6=E7=BB=A7?= =?UTF-8?q?=E7=BB=AD=E6=89=A7=E8=A1=8C=E6=88=96=E8=80=85=E4=B8=AD=E6=AD=A2?= =?UTF-8?q?=20#4132?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../devops/process/pojo/BuildTaskPauseInfo.kt | 46 +++++++++---------- 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/src/backend/ci/core/process/api-process/src/main/kotlin/com/tencent/devops/process/pojo/BuildTaskPauseInfo.kt b/src/backend/ci/core/process/api-process/src/main/kotlin/com/tencent/devops/process/pojo/BuildTaskPauseInfo.kt index 54a899823ce..c2a1e818007 100644 --- a/src/backend/ci/core/process/api-process/src/main/kotlin/com/tencent/devops/process/pojo/BuildTaskPauseInfo.kt +++ b/src/backend/ci/core/process/api-process/src/main/kotlin/com/tencent/devops/process/pojo/BuildTaskPauseInfo.kt @@ -1,30 +1,28 @@ /* + * Tencent is pleased to support the open source community by making BK-CI 蓝鲸持续集成平台 available. * - * * Tencent is pleased to support the open source community by making BK-CI 蓝鲸持续集成平台 available. - * * - * * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. - * * - * * BK-CI 蓝鲸持续集成平台 is licensed under the MIT license. - * * - * * A copy of the MIT License is included in this file. - * * - * * - * * Terms of the MIT License: - * * --------------------------------------------------- - * * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated - * * documentation files (the "Software"), to deal in the Software without restriction, including without limitation the - * * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to - * * permit persons to whom the Software is furnished to do so, subject to the following conditions: - * * - * * The above copyright notice and this permission notice shall be included in all copies or substantial portions of - * * the Software. - * * - * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT - * * LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN - * * NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. * + * BK-CI 蓝鲸持续集成平台 is licensed under the MIT license. + * + * A copy of the MIT License is included in this file. + * + * + * Terms of the MIT License: + * --------------------------------------------------- + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated + * documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of + * the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT + * LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + * NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package com.tencent.devops.process.pojo From 2dca9b567fe4dd22e519918386c71be93bbbce5c Mon Sep 17 00:00:00 2001 From: royalhuang Date: Mon, 12 Jul 2021 16:12:45 +0800 Subject: [PATCH 30/30] =?UTF-8?q?bugfix:=20=E5=8F=96=E6=B6=88=E6=9E=84?= =?UTF-8?q?=E5=BB=BA=E6=9C=BA=E4=B8=8A=E6=8A=A5=E6=97=A5=E5=BF=97=E7=9A=84?= =?UTF-8?q?=E5=BC=82=E6=AD=A5=E5=A4=84=E7=90=86=20#4658?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../log/resources/BuildLogPrintResourceImpl.kt | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/backend/ci/core/log/biz-log/src/main/kotlin/com/tencent/devops/log/resources/BuildLogPrintResourceImpl.kt b/src/backend/ci/core/log/biz-log/src/main/kotlin/com/tencent/devops/log/resources/BuildLogPrintResourceImpl.kt index e9c327dde81..5f3b6abc9df 100644 --- a/src/backend/ci/core/log/biz-log/src/main/kotlin/com/tencent/devops/log/resources/BuildLogPrintResourceImpl.kt +++ b/src/backend/ci/core/log/biz-log/src/main/kotlin/com/tencent/devops/log/resources/BuildLogPrintResourceImpl.kt @@ -56,7 +56,8 @@ class BuildLogPrintResourceImpl @Autowired constructor( logger.error("Invalid build ID[$buildId]") return Result(false) } - return buildLogPrintService.asyncDispatchEvent(LogEvent(buildId, listOf(logMessage))) + buildLogPrintService.dispatchEvent(LogEvent(buildId, listOf(logMessage))) + return Result(true) } override fun addRedLogLine(buildId: String, logMessage: LogMessage): Result { @@ -64,10 +65,11 @@ class BuildLogPrintResourceImpl @Autowired constructor( logger.error("Invalid build ID[$buildId]") return Result(false) } - return buildLogPrintService.asyncDispatchEvent(LogEvent( + buildLogPrintService.dispatchEvent(LogEvent( buildId = buildId, logs = listOf(logMessage.copy(message = Ansi().bold().fgRed().a(logMessage.message).reset().toString())) )) + return Result(true) } override fun addYellowLogLine(buildId: String, logMessage: LogMessage): Result { @@ -75,10 +77,11 @@ class BuildLogPrintResourceImpl @Autowired constructor( logger.error("Invalid build ID[$buildId]") return Result(false) } - return buildLogPrintService.asyncDispatchEvent(LogEvent( + buildLogPrintService.dispatchEvent(LogEvent( buildId = buildId, logs = listOf(logMessage.copy(message = Ansi().bold().fgYellow().a(logMessage.message).reset().toString())) )) + return Result(true) } override fun addLogMultiLine(buildId: String, logMessages: List): Result { @@ -86,7 +89,8 @@ class BuildLogPrintResourceImpl @Autowired constructor( logger.error("Invalid build ID[$buildId]") return Result(false) } - return buildLogPrintService.asyncDispatchEvent(LogEvent(buildId, logMessages)) + buildLogPrintService.dispatchEvent(LogEvent(buildId, logMessages)) + return Result(true) } override fun addLogStatus(