Skip to content

Commit

Permalink
Merge branch 'feat_8122' of http://git.woa.com/bkdevops/bk-ci into fe…
Browse files Browse the repository at this point in the history
…at_8122

# Conflicts:
#	support-files/sql/5001_init_dml/5001_ci_project-init_dml_mysql.sql
  • Loading branch information
mingshewhe committed Oct 23, 2023
2 parents 23e4931 + 80ac17b commit 2b47988
Show file tree
Hide file tree
Showing 22 changed files with 261 additions and 45 deletions.
32 changes: 31 additions & 1 deletion CHANGELOG/CHANGELOG-1.13.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<!-- BEGIN MUNGE: GENERATED_TOC -->

- [v1.13.0-rc.4](#v1130-rc4)
- [Changelog since v1.13.0-rc.3](#changelog-since-v1130-rc3)
- [v1.13.0-rc.3](#v1130-rc3)
- [Changelog since v1.13.0-rc.2](#changelog-since-v1130-rc2)

- [v1.13.0-rc.2](#v1130-rc2)
- [Changelog since v1.12.0-rc.8](#changelog-since-v1120-rc8)

Expand All @@ -10,6 +12,33 @@


<!-- NEW RELEASE NOTES ENTRY -->

# v1.13.0-rc.4
## Changelog since v1.13.0-rc.3
#### 新增
- [新增] 新增判断是否是项目成员user态接口 [链接](http://github.com/TencentBlueKing/bk-ci/issues/9569)
- [新增] 新增获取部门员工信息接口 [链接](http://github.com/TencentBlueKing/bk-ci/issues/9570)
- [新增] 支持开通蓝盾项目权限的同时开通对应的监控空间权限 [链接](http://github.com/TencentBlueKing/bk-ci/issues/8935)
- [新增] 增加获取项目信息及成员信息接口 [链接](http://github.com/TencentBlueKing/bk-ci/issues/9392)
- [新增] 接入审计中心 [链接](http://github.com/TencentBlueKing/bk-ci/issues/9414)
- [新增] fit-sec线权限升级支持 [链接](http://github.com/TencentBlueKing/bk-ci/issues/9521)
- [新增] 优化Env模块的日志打印逻辑 [链接](http://github.com/TencentBlueKing/bk-ci/issues/9470)
- [新增] user类接口传递网关token [链接](http://github.com/TencentBlueKing/bk-ci/issues/9482)
- [新增] build_msg需要根据事件触发场景细化 [链接](http://github.com/TencentBlueKing/bk-ci/issues/8831)
- [新增] bkrepo客户端新增apk加固接口 [链接](http://github.com/TencentBlueKing/bk-ci/issues/9423)
- [新增] 新增不用SQL检查的代码 [链接](http://github.com/TencentBlueKing/bk-ci/issues/9346)

#### 优化
- [优化] 静态资源文件的url地址域名支持适配特定环境 [链接](http://github.com/TencentBlueKing/bk-ci/issues/9504)
- [优化] metrics接口优化补充,调整项目下插件信息来源 [链接](http://github.com/TencentBlueKing/bk-ci/issues/9488)
- [优化] 增加国际化初始化配置 [链接](http://github.com/TencentBlueKing/bk-ci/issues/9413)

#### 修复
- [修复] 获取子流水线执行状态接口不需要做权限校验 [链接](http://github.com/TencentBlueKing/bk-ci/issues/9552)
- [修复] 查看研发商店的模版时,若插件可见范围符合要求,不应该提示项目xxx不允许使用插件xxx [链接](http://github.com/TencentBlueKing/bk-ci/issues/9531)
- [修复] 增加开源版插件的task.json的packagePath字段的非空校验 [链接](http://github.com/TencentBlueKing/bk-ci/issues/9509)
- [修复] 删除流水线后,未删除制品库中流水线的资源 [链接](http://github.com/TencentBlueKing/bk-ci/issues/9491)

# v1.13.0-rc.3
## Changelog since v1.13.0-rc.2
#### 新增
Expand All @@ -31,6 +60,7 @@
- [修复] 申请加入组bug修复 [链接](http://github.com/TencentBlueKing/bk-ci/issues/9512)
- [修复] 调用权限中心接口增加重试 [链接](http://github.com/TencentBlueKing/bk-ci/issues/9477)
- [修复] 共享凭据不需要依赖插件敏感接口权限校验 [链接](http://github.com/TencentBlueKing/bk-ci/issues/9398)

# v1.13.0-rc.2
## Changelog since v1.12.0-rc.8
#### 新增
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,7 @@ object WebhookI18nConstants {

// issues操作类型不匹配
const val ISSUES_ACTION_NOT_MATCH = "bkRepoTriggerIssueActionNotMatch"

// 事件回放匹配码后缀
const val EVENT_REPLAY_SUFFIX = "Replay"
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import com.tencent.devops.common.webhook.service.code.filter.WebhookFilter
import com.tencent.devops.common.webhook.service.code.filter.WebhookFilterChain
import com.tencent.devops.common.webhook.service.code.filter.WebhookFilterResponse
import com.tencent.devops.common.webhook.service.code.pojo.WebhookMatchResult
import com.tencent.devops.process.pojo.trigger.PipelineEventReplayInfo
import com.tencent.devops.repository.pojo.Repository
import com.tencent.devops.scm.pojo.WebhookCommit

Expand Down Expand Up @@ -75,7 +76,7 @@ interface CodeWebhookTriggerHandler<T : CodeWebhookEvent> {
/**
* 获取事件说明,根据不同的事件组织事件说明
*/
fun getEventDesc(event: T): String = ""
fun getEventDesc(event: T, replayInfo: PipelineEventReplayInfo? = null): String = ""

/**
* 获取webhook事件生产者ID,工蜂-工蜂ID,github-github id,svn-svn path,p4-p4port
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import com.tencent.devops.common.webhook.pojo.code.WebHookParams
import com.tencent.devops.common.webhook.pojo.code.github.GithubCreateEvent
import com.tencent.devops.common.webhook.service.code.filter.WebhookFilter
import com.tencent.devops.common.webhook.service.code.handler.GitHookTriggerHandler
import com.tencent.devops.process.pojo.trigger.PipelineEventReplayInfo
import com.tencent.devops.repository.pojo.Repository
import com.tencent.devops.scm.utils.code.git.GitUtils
import java.time.LocalDateTime
Expand Down Expand Up @@ -78,20 +79,22 @@ class GithubCreateTriggerHandler : GitHookTriggerHandler<GithubCreateEvent> {
return event.ref
}

override fun getEventDesc(event: GithubCreateEvent): String {
override fun getEventDesc(event: GithubCreateEvent, replayInfo: PipelineEventReplayInfo?): String {
var i18Code = WebhookI18nConstants.GITHUB_CREATE_TAG_EVENT_DESC
val linkUrl = if (event.ref_type == "tag") {
"https://github.com/${event.repository.fullName}/releases/tag/${event.ref}"
} else {
i18Code = WebhookI18nConstants.GITHUB_CREATE_BRANCH_EVENT_DESC
"https://github.com/${event.repository.fullName}/tree/${event.ref}"
}
// 事件重放
val (username, code) = PipelineEventReplayInfo.getTriggerInfo(replayInfo, getUsername(event), i18Code)
return I18Variable(
code = i18Code,
code = code,
params = listOf(
getBranchName(event),
linkUrl,
getUsername(event),
username,
DateTimeUtil.formatMilliTime(LocalDateTime.now().timestampmilli())
)
).toJsonStr()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ import com.tencent.devops.common.webhook.service.code.filter.WebhookFilter
import com.tencent.devops.common.webhook.service.code.handler.GitHookTriggerHandler
import com.tencent.devops.common.webhook.service.code.pojo.WebhookMatchResult
import com.tencent.devops.common.webhook.util.WebhookUtils
import com.tencent.devops.process.pojo.trigger.PipelineEventReplayInfo
import com.tencent.devops.repository.pojo.Repository
import com.tencent.devops.scm.utils.code.git.GitUtils
import org.slf4j.LoggerFactory
Expand Down Expand Up @@ -130,13 +131,18 @@ class GithubPrTriggerHandler : GitHookTriggerHandler<GithubPullRequestEvent> {
return event.pullRequest.title
}

override fun getEventDesc(event: GithubPullRequestEvent): String {
override fun getEventDesc(event: GithubPullRequestEvent, replayInfo: PipelineEventReplayInfo?): String {
val (username, i18Code) = PipelineEventReplayInfo.getTriggerInfo(
replayInfo,
getUsername(event),
WebhookI18nConstants.GITHUB_PR_EVENT_DESC
)
return I18Variable(
code = WebhookI18nConstants.GITHUB_PR_EVENT_DESC,
code = i18Code,
params = listOf(
event.pullRequest.htmlUrl,
event.pullRequest.number.toString(),
getUsername(event),
username,
event.action
)
).toJsonStr()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ import com.tencent.devops.common.webhook.service.code.filter.WebhookFilter
import com.tencent.devops.common.webhook.service.code.handler.GitHookTriggerHandler
import com.tencent.devops.common.webhook.service.code.pojo.WebhookMatchResult
import com.tencent.devops.common.webhook.util.WebhookUtils
import com.tencent.devops.process.pojo.trigger.PipelineEventReplayInfo
import com.tencent.devops.repository.pojo.Repository
import com.tencent.devops.scm.utils.code.git.GitUtils
import org.slf4j.LoggerFactory
Expand Down Expand Up @@ -105,7 +106,7 @@ class GithubPushTriggerHandler : GitHookTriggerHandler<GithubPushEvent> {
return event.headCommit?.message ?: ""
}

override fun getEventDesc(event: GithubPushEvent): String {
override fun getEventDesc(event: GithubPushEvent, replayInfo: PipelineEventReplayInfo?): String {
val linkUrl = if (event.headCommit != null) {
"https://github.com/${event.repository.fullName}/commit/${event.headCommit?.id}"
} else {
Expand All @@ -117,13 +118,18 @@ class GithubPushTriggerHandler : GitHookTriggerHandler<GithubPushEvent> {
} else {
revision
}
val (username, i18Code) = PipelineEventReplayInfo.getTriggerInfo(
replayInfo,
getUsername(event),
WebhookI18nConstants.GITHUB_PUSH_EVENT_DESC
)
return I18Variable(
code = WebhookI18nConstants.GITHUB_PUSH_EVENT_DESC,
code = i18Code,
params = listOf(
getBranchName(event),
linkUrl,
commitId,
getUsername(event)
username
)
).toJsonStr()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import com.tencent.devops.common.webhook.service.code.filter.WebhookFilter
import com.tencent.devops.common.webhook.service.code.filter.WebhookFilterResponse
import com.tencent.devops.common.webhook.service.code.handler.CodeWebhookTriggerHandler
import com.tencent.devops.common.webhook.util.WebhookUtils
import com.tencent.devops.process.pojo.trigger.PipelineEventReplayInfo
import com.tencent.devops.process.utils.PIPELINE_BUILD_MSG
import com.tencent.devops.repository.pojo.Repository

Expand Down Expand Up @@ -82,12 +83,17 @@ class P4ChangeTriggerHandler(

override fun getMessage(event: P4ChangeEvent) = event.description

override fun getEventDesc(event: P4ChangeEvent): String {
override fun getEventDesc(event: P4ChangeEvent, replayInfo: PipelineEventReplayInfo?): String {
val (username, i18Code) = PipelineEventReplayInfo.getTriggerInfo(
replayInfo,
getUsername(event),
WebhookI18nConstants.P4_EVENT_DESC
)
return I18Variable(
code = WebhookI18nConstants.P4_EVENT_DESC,
code = i18Code,
params = listOf(
getRevision(event),
getUsername(event),
username,
getFormatEventType(event)
)
).toJsonStr()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import com.tencent.devops.common.webhook.service.code.filter.WebhookFilter
import com.tencent.devops.common.webhook.service.code.filter.WebhookFilterResponse
import com.tencent.devops.common.webhook.service.code.handler.CodeWebhookTriggerHandler
import com.tencent.devops.common.webhook.util.WebhookUtils
import com.tencent.devops.process.pojo.trigger.PipelineEventReplayInfo
import com.tencent.devops.process.utils.PIPELINE_BUILD_MSG
import com.tencent.devops.repository.api.ServiceP4Resource
import com.tencent.devops.repository.pojo.Repository
Expand Down Expand Up @@ -85,12 +86,17 @@ class P4ShelveTriggerHandler(

override fun getMessage(event: P4ShelveEvent) = event.description

override fun getEventDesc(event: P4ShelveEvent): String {
override fun getEventDesc(event: P4ShelveEvent, replayInfo: PipelineEventReplayInfo?): String {
val (username, i18Code) = PipelineEventReplayInfo.getTriggerInfo(
replayInfo,
getUsername(event),
WebhookI18nConstants.P4_EVENT_DESC
)
return I18Variable(
code = WebhookI18nConstants.P4_EVENT_DESC,
code = i18Code,
params = listOf(
getRevision(event),
getUsername(event),
username,
getFormatEventType(event)
)
).toJsonStr()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import com.tencent.devops.common.webhook.service.code.filter.UserFilter
import com.tencent.devops.common.webhook.service.code.filter.WebhookFilter
import com.tencent.devops.common.webhook.service.code.handler.CodeWebhookTriggerHandler
import com.tencent.devops.common.webhook.util.WebhookUtils
import com.tencent.devops.process.pojo.trigger.PipelineEventReplayInfo
import com.tencent.devops.repository.pojo.Repository

@CodeWebhookHandler
Expand Down Expand Up @@ -81,12 +82,17 @@ class SvnCommitTriggerHandler : CodeWebhookTriggerHandler<SvnCommitEvent> {
return event.log
}

override fun getEventDesc(event: SvnCommitEvent): String {
override fun getEventDesc(event: SvnCommitEvent, replayInfo: PipelineEventReplayInfo?): String {
val (username, i18Code) = PipelineEventReplayInfo.getTriggerInfo(
replayInfo,
getUsername(event),
WebhookI18nConstants.SVN_COMMIT_EVENT_DESC
)
return I18Variable(
code = WebhookI18nConstants.SVN_COMMIT_EVENT_DESC,
code = i18Code,
params = listOf(
getRevision(event),
getUsername(event)
username
)
).toJsonStr()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ import com.tencent.devops.common.webhook.service.code.filter.GitUrlFilter
import com.tencent.devops.common.webhook.service.code.filter.WebhookFilter
import com.tencent.devops.common.webhook.service.code.handler.GitHookTriggerHandler
import com.tencent.devops.common.webhook.util.WebhookUtils
import com.tencent.devops.process.pojo.trigger.PipelineEventReplayInfo
import com.tencent.devops.repository.pojo.Repository
import com.tencent.devops.scm.utils.code.git.GitUtils

Expand Down Expand Up @@ -130,13 +131,18 @@ class TGitIssueTriggerHandler(
return event.objectAttributes.title
}

override fun getEventDesc(event: GitIssueEvent): String {
override fun getEventDesc(event: GitIssueEvent, replayInfo: PipelineEventReplayInfo?): String {
val (username, i18Code) = PipelineEventReplayInfo.getTriggerInfo(
replayInfo,
getUsername(event),
getI18Code(event)
)
return I18Variable(
code = getI18Code(event),
code = i18Code,
params = listOf(
"${event.objectAttributes.url}",
event.objectAttributes.iid,
getUsername(event)
username
)
).toJsonStr()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ import com.tencent.devops.common.webhook.util.WebhookUtils
import com.tencent.devops.common.webhook.util.WebhookUtils.convert
import com.tencent.devops.common.webhook.util.WebhookUtils.getBranch
import com.tencent.devops.process.engine.service.code.filter.CommitMessageFilter
import com.tencent.devops.process.pojo.trigger.PipelineEventReplayInfo
import com.tencent.devops.repository.pojo.CodeGitlabRepository
import com.tencent.devops.repository.pojo.Repository
import com.tencent.devops.scm.pojo.WebhookCommit
Expand Down Expand Up @@ -160,13 +161,18 @@ class TGitMrTriggerHandler(
return event.object_attributes.id
}

override fun getEventDesc(event: GitMergeRequestEvent): String {
override fun getEventDesc(event: GitMergeRequestEvent, replayInfo: PipelineEventReplayInfo?): String {
val (username, i18Code) = PipelineEventReplayInfo.getTriggerInfo(
replayInfo,
getUsername(event),
getI18Code(event)
)
return I18Variable(
code = getI18Code(event),
code = i18Code,
params = listOf(
"${event.object_attributes.url}",
event.object_attributes.iid.toString(),
getUsername(event)
username
)
).toJsonStr()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ import com.tencent.devops.common.webhook.service.code.filter.RegexContainFilter
import com.tencent.devops.common.webhook.service.code.filter.WebhookFilter
import com.tencent.devops.common.webhook.service.code.handler.CodeWebhookTriggerHandler
import com.tencent.devops.common.webhook.util.WebhookUtils
import com.tencent.devops.process.pojo.trigger.PipelineEventReplayInfo
import com.tencent.devops.repository.pojo.CodeGitlabRepository
import com.tencent.devops.repository.pojo.Repository
import com.tencent.devops.scm.utils.code.git.GitUtils
Expand Down Expand Up @@ -164,13 +165,18 @@ class TGitNoteTriggerHandler(
return event.objectAttributes.note
}

override fun getEventDesc(event: GitNoteEvent): String {
override fun getEventDesc(event: GitNoteEvent, replayInfo: PipelineEventReplayInfo?): String {
val (username, i18Code) = PipelineEventReplayInfo.getTriggerInfo(
replayInfo,
getUsername(event),
WebhookI18nConstants.TGIT_NOTE_EVENT_DESC
)
return I18Variable(
code = WebhookI18nConstants.TGIT_NOTE_EVENT_DESC,
code = i18Code,
params = listOf(
event.objectAttributes.url,
event.objectAttributes.id.toString(),
getUsername(event)
username
)
).toJsonStr()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ import com.tencent.devops.common.webhook.service.code.pojo.WebhookMatchResult
import com.tencent.devops.common.webhook.util.WebhookUtils
import com.tencent.devops.common.webhook.util.WebhookUtils.convert
import com.tencent.devops.process.engine.service.code.filter.CommitMessageFilter
import com.tencent.devops.process.pojo.trigger.PipelineEventReplayInfo
import com.tencent.devops.repository.pojo.Repository
import com.tencent.devops.scm.pojo.WebhookCommit
import com.tencent.devops.scm.utils.code.git.GitUtils
Expand Down Expand Up @@ -130,14 +131,19 @@ class TGitPushTriggerHandler(
}
}

override fun getEventDesc(event: GitPushEvent): String {
override fun getEventDesc(event: GitPushEvent, replayInfo: PipelineEventReplayInfo?): String {
val (username, i18Code) = PipelineEventReplayInfo.getTriggerInfo(
replayInfo,
getUsername(event),
TGIT_PUSH_EVENT_DESC
)
return I18Variable(
code = TGIT_PUSH_EVENT_DESC,
code = i18Code,
params = listOf(
getBranchName(event),
"${event.repository.homepage}/commit/${event.checkout_sha}",
"${event.checkout_sha}".substring(0, GitPushEvent.SHORT_COMMIT_ID_LENGTH),
event.user_name
username
)
).toJsonStr()
}
Expand Down
Loading

0 comments on commit 2b47988

Please sign in to comment.