From fac95526e5e46523524bfeaadeb2b1ab15128893 Mon Sep 17 00:00:00 2001 From: mingshewhe Date: Mon, 21 Feb 2022 15:30:32 +0800 Subject: [PATCH 1/3] =?UTF-8?q?feat:=20=E5=BD=93=20mr=20=E8=A7=A6=E5=8F=91?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=20webhookinfo=20=E4=B8=AD=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=20mr=20=E7=9A=84=E6=BA=90=E5=88=86=E6=94=AF=20=E5=92=8C=20id?= =?UTF-8?q?=20#6153?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/tencent/devops/process/pojo/code/WebhookInfo.kt | 4 +++- .../devops/process/engine/service/PipelineRuntimeService.kt | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/backend/ci/core/process/api-process/src/main/kotlin/com/tencent/devops/process/pojo/code/WebhookInfo.kt b/src/backend/ci/core/process/api-process/src/main/kotlin/com/tencent/devops/process/pojo/code/WebhookInfo.kt index aefd26a1d3e..467c36a360e 100644 --- a/src/backend/ci/core/process/api-process/src/main/kotlin/com/tencent/devops/process/pojo/code/WebhookInfo.kt +++ b/src/backend/ci/core/process/api-process/src/main/kotlin/com/tencent/devops/process/pojo/code/WebhookInfo.kt @@ -35,5 +35,7 @@ data class WebhookInfo( val webhookMessage: String?, val webhookCommitId: String?, // 合并后commitId - val webhookMergeCommitSha: String? + val webhookMergeCommitSha: String?, + // 源分支 + val webhookSourceBranch: String? ) diff --git a/src/backend/ci/core/process/biz-base/src/main/kotlin/com/tencent/devops/process/engine/service/PipelineRuntimeService.kt b/src/backend/ci/core/process/biz-base/src/main/kotlin/com/tencent/devops/process/engine/service/PipelineRuntimeService.kt index a991742b538..f0566691559 100644 --- a/src/backend/ci/core/process/biz-base/src/main/kotlin/com/tencent/devops/process/engine/service/PipelineRuntimeService.kt +++ b/src/backend/ci/core/process/biz-base/src/main/kotlin/com/tencent/devops/process/engine/service/PipelineRuntimeService.kt @@ -69,6 +69,7 @@ import com.tencent.devops.common.redis.RedisOperation import com.tencent.devops.common.service.trace.TraceTag import com.tencent.devops.common.webhook.pojo.code.BK_REPO_GIT_WEBHOOK_EVENT_TYPE import com.tencent.devops.common.webhook.pojo.code.BK_REPO_GIT_WEBHOOK_MR_MERGE_COMMIT_SHA +import com.tencent.devops.common.webhook.pojo.code.BK_REPO_GIT_WEBHOOK_MR_SOURCE_BRANCH import com.tencent.devops.common.webhook.pojo.code.BK_REPO_WEBHOOK_REPO_URL import com.tencent.devops.common.webhook.pojo.code.PIPELINE_WEBHOOK_BRANCH import com.tencent.devops.common.webhook.pojo.code.PIPELINE_WEBHOOK_COMMIT_MESSAGE @@ -1144,7 +1145,8 @@ class PipelineRuntimeService @Autowired constructor( params[PIPELINE_WEBHOOK_EVENT_TYPE] as String? }, webhookCommitId = params[PIPELINE_WEBHOOK_REVISION] as String?, - webhookMergeCommitSha = params[BK_REPO_GIT_WEBHOOK_MR_MERGE_COMMIT_SHA] as String? + webhookMergeCommitSha = params[BK_REPO_GIT_WEBHOOK_MR_MERGE_COMMIT_SHA] as String?, + webhookSourceBranch = params[BK_REPO_GIT_WEBHOOK_MR_SOURCE_BRANCH] as String? ), formatted = false ) From 9b5818ecc0290e48abe0d77c5e5e68fcea1c2844 Mon Sep 17 00:00:00 2001 From: mingshewhe Date: Mon, 21 Feb 2022 17:40:51 +0800 Subject: [PATCH 2/3] =?UTF-8?q?feat:=20"SVN=E4=BA=8B=E4=BB=B6=E8=A7=A6?= =?UTF-8?q?=E5=8F=91"=E5=8C=B9=E9=85=8D=E5=88=B0=E7=9A=84=E9=80=9A?= =?UTF-8?q?=E9=85=8D=E7=AC=A6=E8=B7=AF=E5=BE=84=E4=BD=9C=E4=B8=BAoutput?= =?UTF-8?q?=E4=BC=A0=E5=87=BA=E6=9D=A5=20#5973?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tencent/devops/common/webhook/pojo/code/WebhookConstant.kt | 1 + .../common/webhook/service/code/param/SvnWebHookStartParam.kt | 3 +++ 2 files changed, 4 insertions(+) diff --git a/src/backend/ci/core/common/common-webhook/api-common-webhook/src/main/kotlin/com/tencent/devops/common/webhook/pojo/code/WebhookConstant.kt b/src/backend/ci/core/common/common-webhook/api-common-webhook/src/main/kotlin/com/tencent/devops/common/webhook/pojo/code/WebhookConstant.kt index b4d21979c6c..1b7ecaeb511 100644 --- a/src/backend/ci/core/common/common-webhook/api-common-webhook/src/main/kotlin/com/tencent/devops/common/webhook/pojo/code/WebhookConstant.kt +++ b/src/backend/ci/core/common/common-webhook/api-common-webhook/src/main/kotlin/com/tencent/devops/common/webhook/pojo/code/WebhookConstant.kt @@ -121,6 +121,7 @@ const val BK_REPO_SVN_WEBHOOK_RELATIVE_PATH = "BK_CI_REPO_SVN_WEBHOOK_INCLUDE_PA const val BK_REPO_SVN_WEBHOOK_EXCLUDE_PATHS = "BK_CI_REPO_SVN_WEBHOOK_EXCLUDE_PATHS" const val BK_REPO_SVN_WEBHOOK_INCLUDE_USERS = "BK_CI_REPO_SVN_WEBHOOK_INCLUDE_USERS" const val BK_REPO_SVN_WEBHOOK_EXCLUDE_USERS = "BK_CI_REPO_SVN_WEBHOOK_EXCLUDE_USERS" +const val BK_REPO_SVN_WEBHOOK_FINAL_INCLUDE_PATH = "BK_REPO_SVN_WEBHOOK_FINAL_INCLUDE_PATH" const val PIPELINE_WEBHOOK_MR_ID = "BK_CI_HOOK_MR_ID" // bk_hookMergeRequestId const val PIPELINE_WEBHOOK_MR_COMMITTER = "BK_CI_HOOK_MR_COMMITTER" // "bk_hookMergeRequest_committer" diff --git a/src/backend/ci/core/common/common-webhook/biz-common-webhook/src/main/kotlin/com/tencent/devops/common/webhook/service/code/param/SvnWebHookStartParam.kt b/src/backend/ci/core/common/common-webhook/biz-common-webhook/src/main/kotlin/com/tencent/devops/common/webhook/service/code/param/SvnWebHookStartParam.kt index 3f6d0a77ced..af3f0c82b22 100644 --- a/src/backend/ci/core/common/common-webhook/biz-common-webhook/src/main/kotlin/com/tencent/devops/common/webhook/service/code/param/SvnWebHookStartParam.kt +++ b/src/backend/ci/core/common/common-webhook/biz-common-webhook/src/main/kotlin/com/tencent/devops/common/webhook/service/code/param/SvnWebHookStartParam.kt @@ -30,8 +30,10 @@ package com.tencent.devops.common.webhook.service.code.param import com.tencent.devops.common.pipeline.pojo.element.trigger.CodeSVNWebHookTriggerElement import com.tencent.devops.common.webhook.pojo.code.BK_REPO_SVN_WEBHOOK_EXCLUDE_PATHS import com.tencent.devops.common.webhook.pojo.code.BK_REPO_SVN_WEBHOOK_EXCLUDE_USERS +import com.tencent.devops.common.webhook.pojo.code.BK_REPO_SVN_WEBHOOK_FINAL_INCLUDE_PATH import com.tencent.devops.common.webhook.pojo.code.BK_REPO_SVN_WEBHOOK_INCLUDE_USERS import com.tencent.devops.common.webhook.pojo.code.BK_REPO_SVN_WEBHOOK_RELATIVE_PATH +import com.tencent.devops.common.webhook.pojo.code.MATCH_PATHS import com.tencent.devops.common.webhook.pojo.code.WebHookParams import com.tencent.devops.common.webhook.service.code.matcher.ScmWebhookMatcher import com.tencent.devops.repository.pojo.Repository @@ -58,6 +60,7 @@ class SvnWebHookStartParam : ScmWebhookStartParams startParams[BK_REPO_SVN_WEBHOOK_EXCLUDE_PATHS] = element.excludePaths ?: "" startParams[BK_REPO_SVN_WEBHOOK_INCLUDE_USERS] = element.includeUsers?.joinToString(",") ?: "" startParams[BK_REPO_SVN_WEBHOOK_EXCLUDE_USERS] = element.excludeUsers?.joinToString(",") ?: "" + startParams[BK_REPO_SVN_WEBHOOK_FINAL_INCLUDE_PATH] = matchResult.extra[MATCH_PATHS] ?: "" startParams.putAll(matcher.retrieveParams()) return startParams } From daa446e9463ce53f5deda113336fc6681c4093f9 Mon Sep 17 00:00:00 2001 From: mingshewhe Date: Mon, 21 Feb 2022 23:11:18 +0800 Subject: [PATCH 3/3] =?UTF-8?q?bug:=20=E9=A1=B9=E7=9B=AE=E5=90=8D=E4=B8=AD?= =?UTF-8?q?=E6=9C=89=5F=E5=AF=BC=E8=87=B4=E5=AE=9A=E6=97=B6=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E4=B8=8D=E8=A7=A6=E5=8F=91=20#6062?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plugin/trigger/timer/quartz/PipelineQuartzService.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/ci/core/process/plugin-trigger/src/main/kotlin/com/tencent/devops/process/plugin/trigger/timer/quartz/PipelineQuartzService.kt b/src/backend/ci/core/process/plugin-trigger/src/main/kotlin/com/tencent/devops/process/plugin/trigger/timer/quartz/PipelineQuartzService.kt index 37a6fed17e9..39baa4317ad 100644 --- a/src/backend/ci/core/process/plugin-trigger/src/main/kotlin/com/tencent/devops/process/plugin/trigger/timer/quartz/PipelineQuartzService.kt +++ b/src/backend/ci/core/process/plugin-trigger/src/main/kotlin/com/tencent/devops/process/plugin/trigger/timer/quartz/PipelineQuartzService.kt @@ -147,7 +147,7 @@ class PipelineJobBean( fun execute(context: JobExecutionContext?) { val jobKey = context?.jobDetail?.key ?: return val comboKey = jobKey.name - val comboKeys = comboKey.split("_") + val comboKeys = comboKey.split(Regex("_"), 3) val pipelineId = comboKeys[0] val crontabMd5 = comboKeys[1] val projectId = comboKeys[2]