Skip to content

Commit

Permalink
【PAC】feat:支持从代码库维度查看对应的代码库事件 #8122
Browse files Browse the repository at this point in the history
  • Loading branch information
mingshewhe committed Oct 21, 2023
1 parent e950af8 commit 8cc764c
Show file tree
Hide file tree
Showing 10 changed files with 10 additions and 163 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ import com.tencent.devops.common.pipeline.pojo.element.market.MarketCheckImageEl
import com.tencent.devops.common.pipeline.pojo.element.matrix.MatrixStatusElement
import com.tencent.devops.common.pipeline.pojo.element.quality.QualityGateInElement
import com.tencent.devops.common.pipeline.pojo.element.quality.QualityGateOutElement
import com.tencent.devops.common.pipeline.pojo.element.trigger.CodeGitGenericWebHookTriggerElement
import com.tencent.devops.common.pipeline.pojo.element.trigger.CodeGitWebHookTriggerElement
import com.tencent.devops.common.pipeline.pojo.element.trigger.CodeGithubWebHookTriggerElement
import com.tencent.devops.common.pipeline.pojo.element.trigger.CodeGitlabWebHookTriggerElement
Expand Down Expand Up @@ -89,10 +88,6 @@ import io.swagger.annotations.ApiModelProperty
JsonSubTypes.Type(value = QualityGateInElement::class, name = QualityGateInElement.classType),
JsonSubTypes.Type(value = QualityGateOutElement::class, name = QualityGateOutElement.classType),
JsonSubTypes.Type(value = CodeTGitWebHookTriggerElement::class, name = CodeTGitWebHookTriggerElement.classType),
JsonSubTypes.Type(
value = CodeGitGenericWebHookTriggerElement::class,
name = CodeGitGenericWebHookTriggerElement.classType
),
JsonSubTypes.Type(value = CodeP4WebHookTriggerElement::class, name = CodeP4WebHookTriggerElement.classType)
)
@Suppress("ALL")
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ data class CodeGithubWebHookTriggerElement(

override fun getClassType() = classType

override fun getTaskAtom() = taskAtom

override fun findFirstTaskIdByStartType(startType: StartType): String {
return if (startType.name == StartType.WEB_HOOK.name) {
this.id!!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ data class CodeGitlabWebHookTriggerElement(

override fun getClassType() = classType

override fun getTaskAtom() = taskAtom

override fun findFirstTaskIdByStartType(startType: StartType): String {
return if (startType.name == StartType.WEB_HOOK.name) {
this.id!!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ data class CodeP4WebHookTriggerElement(

override fun getClassType() = classType

override fun getTaskAtom() = taskAtom

override fun findFirstTaskIdByStartType(startType: StartType): String {
return if (startType.name == StartType.WEB_HOOK.name) {
this.id!!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ data class CodeSVNWebHookTriggerElement(

override fun getClassType() = classType

override fun getTaskAtom() = taskAtom

override fun findFirstTaskIdByStartType(startType: StartType): String {
return if (startType.name == StartType.WEB_HOOK.name) {
this.id!!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ data class CodeTGitWebHookTriggerElement(

override fun getClassType() = classType

override fun getTaskAtom() = taskAtom

override fun findFirstTaskIdByStartType(startType: StartType): String {
return if (startType.name == StartType.WEB_HOOK.name) {
this.id!!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,13 @@ package com.tencent.devops.common.pipeline.utils

import com.tencent.devops.common.api.enums.RepositoryConfig
import com.tencent.devops.common.api.enums.RepositoryType
import com.tencent.devops.common.api.enums.RepositoryTypeNew
import com.tencent.devops.common.api.exception.InvalidParamException
import com.tencent.devops.common.api.util.EnvUtils
import com.tencent.devops.common.pipeline.pojo.element.Element
import com.tencent.devops.common.pipeline.pojo.element.agent.CodeGitElement
import com.tencent.devops.common.pipeline.pojo.element.agent.CodeGitlabElement
import com.tencent.devops.common.pipeline.pojo.element.agent.CodeSvnElement
import com.tencent.devops.common.pipeline.pojo.element.agent.GithubElement
import com.tencent.devops.common.pipeline.pojo.element.trigger.CodeGitGenericWebHookTriggerElement
import com.tencent.devops.common.pipeline.pojo.element.trigger.CodeGitWebHookTriggerElement
import com.tencent.devops.common.pipeline.pojo.element.trigger.CodeGithubWebHookTriggerElement
import com.tencent.devops.common.pipeline.pojo.element.trigger.CodeGitlabWebHookTriggerElement
Expand Down Expand Up @@ -95,32 +93,6 @@ object RepositoryConfigUtils {
repositoryName = element.data.input.repositoryName,
repositoryType = element.data.input.repositoryType ?: RepositoryType.ID
)
is CodeGitGenericWebHookTriggerElement -> {
with(element.data.input) {
when (repositoryType) {
RepositoryTypeNew.URL ->
RepositoryConfig(
repositoryHashId = null,
repositoryName = repositoryUrl,
repositoryType = RepositoryType.NAME
)
RepositoryTypeNew.ID ->
RepositoryConfig(
repositoryHashId = repositoryHashId,
repositoryName = repositoryName,
repositoryType = RepositoryType.ID
)
RepositoryTypeNew.NAME ->
RepositoryConfig(
repositoryHashId = repositoryHashId,
repositoryName = repositoryName,
repositoryType = RepositoryType.NAME
)
else ->
throw InvalidParamException("Unknown repositoryType -> $element")
}
}
}
is CodeP4WebHookTriggerElement -> RepositoryConfig(
repositoryHashId = element.data.input.repositoryHashId,
repositoryName = element.data.input.repositoryName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ import com.tencent.devops.common.pipeline.pojo.element.market.MarketCheckImageEl
import com.tencent.devops.common.pipeline.pojo.element.matrix.MatrixStatusElement
import com.tencent.devops.common.pipeline.pojo.element.quality.QualityGateInElement
import com.tencent.devops.common.pipeline.pojo.element.quality.QualityGateOutElement
import com.tencent.devops.common.pipeline.pojo.element.trigger.CodeGitGenericWebHookTriggerElement
import com.tencent.devops.common.pipeline.pojo.element.trigger.CodeGitWebHookTriggerElement
import com.tencent.devops.common.pipeline.pojo.element.trigger.CodeGithubWebHookTriggerElement
import com.tencent.devops.common.pipeline.pojo.element.trigger.CodeGitlabWebHookTriggerElement
Expand All @@ -68,7 +67,6 @@ class EnvControlTaskTypeTest {
assertEquals(EnvControlTaskType.parse(""), actualNull)
assertEquals(EnvControlTaskType.parse("nullActual"), actualNull)
assertEquals(EnvControlTaskType.parse("Other"), actualNull)
assertEquals(EnvControlTaskType.parse(CodeGitGenericWebHookTriggerElement.classType), actualNull)
assertEquals(EnvControlTaskType.parse(CodeP4WebHookTriggerElement.classType), actualNull)
assertEquals(EnvControlTaskType.parse(MatrixStatusElement.classType), actualNull)
assertEquals(EnvControlTaskType.parse(CodeGitWebHookTriggerElement.classType), actualNull)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ import com.tencent.devops.model.process.tables.TPipelineViewGroup
import com.tencent.devops.model.process.tables.TPipelineViewTop
import com.tencent.devops.model.process.tables.TPipelineViewUserLastView
import com.tencent.devops.model.process.tables.TPipelineViewUserSettings
import com.tencent.devops.model.process.tables.TPipelineWebhookBuildLogDetail
import com.tencent.devops.model.process.tables.TPipelineWebhookBuildParameter
import com.tencent.devops.model.process.tables.TPipelineWebhookQueue
import com.tencent.devops.model.process.tables.TProjectPipelineCallback
Expand Down Expand Up @@ -97,7 +96,6 @@ import com.tencent.devops.model.process.tables.records.TPipelineViewRecord
import com.tencent.devops.model.process.tables.records.TPipelineViewTopRecord
import com.tencent.devops.model.process.tables.records.TPipelineViewUserLastViewRecord
import com.tencent.devops.model.process.tables.records.TPipelineViewUserSettingsRecord
import com.tencent.devops.model.process.tables.records.TPipelineWebhookBuildLogDetailRecord
import com.tencent.devops.model.process.tables.records.TPipelineWebhookBuildParameterRecord
import com.tencent.devops.model.process.tables.records.TPipelineWebhookQueueRecord
import com.tencent.devops.model.process.tables.records.TProjectPipelineCallbackHistoryRecord
Expand Down Expand Up @@ -653,31 +651,6 @@ class ProcessDataMigrateDao {
}
}

fun getPipelineWebhookBuildLogDetailRecords(
dslContext: DSLContext,
projectId: String,
pipelineId: String,
limit: Int,
offset: Int
): List<TPipelineWebhookBuildLogDetailRecord> {
with(TPipelineWebhookBuildLogDetail.T_PIPELINE_WEBHOOK_BUILD_LOG_DETAIL) {
return dslContext.selectFrom(this)
.where(PROJECT_ID.eq(projectId).and(PIPELINE_ID.eq(pipelineId)))
.orderBy(ID.asc())
.limit(limit).offset(offset).fetchInto(TPipelineWebhookBuildLogDetailRecord::class.java)
}
}

fun migratePipelineWebhookBuildLogDetailData(
migratingShardingDslContext: DSLContext,
webhookBuildLogDetailRecords: List<TPipelineWebhookBuildLogDetailRecord>
) {
with(TPipelineWebhookBuildLogDetail.T_PIPELINE_WEBHOOK_BUILD_LOG_DETAIL) {
val insertRecords = webhookBuildLogDetailRecords.map { migratingShardingDslContext.newRecord(this, it) }
migratingShardingDslContext.batchInsert(insertRecords).execute()
}
}

fun getPipelineWebhookQueueRecords(
dslContext: DSLContext,
projectId: String,
Expand Down

0 comments on commit 8cc764c

Please sign in to comment.