From 1e698487f265a5d660710553ebd7702944ab9768 Mon Sep 17 00:00:00 2001 From: yjieliang Date: Tue, 10 Oct 2023 11:26:18 +0800 Subject: [PATCH 01/73] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../store/api/atom/BuildAtomResource.kt | 39 ++++++++++++++++++ .../store/pojo/atom/enums/AtomStatusEnum.kt | 3 +- .../pojo/common/enums/ReleaseTypeEnum.kt | 3 +- .../atom/impl/SampleAtomReleaseServiceImpl.kt | 7 ++++ .../tencent/devops/store/dao/atom/AtomDao.kt | 12 ++++++ .../devops/store/dao/atom/MarketAtomDao.kt | 2 + .../store/dao/atom/MarketAtomVersionLogDao.kt | 2 + .../resources/atom/BuildAtomResourceImpl.kt | 21 +++++++++- .../store/service/atom/AtomReleaseService.kt | 15 ++++++- .../atom/impl/AtomReleaseServiceImpl.kt | 40 +++++++++++-------- .../atom/impl/MarketAtomServiceImpl.kt | 4 +- .../service/common/StoreI18nMessageService.kt | 6 ++- .../impl/StoreI18nMessageServiceImpl.kt | 34 +++++++++++----- 13 files changed, 154 insertions(+), 34 deletions(-) diff --git a/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/api/atom/BuildAtomResource.kt b/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/api/atom/BuildAtomResource.kt index 7fbd840fb64..4367ba08e4f 100644 --- a/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/api/atom/BuildAtomResource.kt +++ b/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/api/atom/BuildAtomResource.kt @@ -27,13 +27,18 @@ package com.tencent.devops.store.api.atom +import com.tencent.devops.common.api.auth.AUTH_HEADER_USER_ID import com.tencent.devops.common.api.pojo.Result +import com.tencent.devops.store.pojo.atom.MarketAtomUpdateRequest +import com.tencent.devops.store.pojo.common.StoreProcessInfo import com.tencent.devops.store.pojo.common.VersionInfo import io.swagger.annotations.Api import io.swagger.annotations.ApiOperation import io.swagger.annotations.ApiParam import javax.ws.rs.Consumes import javax.ws.rs.GET +import javax.ws.rs.HeaderParam +import javax.ws.rs.POST import javax.ws.rs.Path import javax.ws.rs.PathParam import javax.ws.rs.Produces @@ -56,4 +61,38 @@ interface BuildAtomResource { @PathParam("atomCode") atomCode: String ): Result + + @ApiOperation("使用分支创建插件测试版本") + @POST + @Path("/creat/test/version") + fun creatAtomBranchTestVersion( + @ApiParam("userId", required = true) + @HeaderParam(AUTH_HEADER_USER_ID) + userId: String, + @ApiParam("新增插件请求报文体", required = true) + marketAtomUpdateRequest: MarketAtomUpdateRequest + ): Result + + @ApiOperation("结束分支测试版本测试") + @POST + @Path("/end/test/version") + fun endBranchVersionTest( + @ApiParam("userId", required = true) + @HeaderParam(AUTH_HEADER_USER_ID) + userId: String, + @ApiParam("插件ID", required = true) + atomId: String + ): Result + + @ApiOperation("根据插件版本ID获取插件版本进度") + @GET + @Path("/desk/atom/release/process/{atomId}") + fun getProcessInfo( + @ApiParam("userId", required = true) + @HeaderParam(AUTH_HEADER_USER_ID) + userId: String, + @ApiParam("atomId", required = true) + @PathParam("atomId") + atomId: String + ): Result } diff --git a/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/pojo/atom/enums/AtomStatusEnum.kt b/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/pojo/atom/enums/AtomStatusEnum.kt index bfae30d3e73..dd8fc20485e 100644 --- a/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/pojo/atom/enums/AtomStatusEnum.kt +++ b/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/pojo/atom/enums/AtomStatusEnum.kt @@ -41,7 +41,8 @@ enum class AtomStatusEnum(val status: Int) { UNDERCARRIAGING(9), // 下架中 UNDERCARRIAGED(10), // 已下架 CODECCING(11), // 代码检查中 - CODECC_FAIL(12); // 代码检查失败 + CODECC_FAIL(12), // 代码检查失败 + TESTED(13); // 测试结束(仅分支测试使用) companion object { diff --git a/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/pojo/common/enums/ReleaseTypeEnum.kt b/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/pojo/common/enums/ReleaseTypeEnum.kt index ed92dcb299a..1e648311a53 100644 --- a/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/pojo/common/enums/ReleaseTypeEnum.kt +++ b/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/pojo/common/enums/ReleaseTypeEnum.kt @@ -33,7 +33,8 @@ enum class ReleaseTypeEnum(val releaseType: Int) { COMPATIBILITY_UPGRADE(2), // 兼容性功能更新 COMPATIBILITY_FIX(3), // 兼容性问题修正 CANCEL_RE_RELEASE(4), // 取消发布后重新发布 - HIS_VERSION_UPGRADE(5); // 历史大版本下的小版本更新 + HIS_VERSION_UPGRADE(5), // 历史大版本下的小版本更新 + BRANCH_TEST(6); // 分支测试 fun isDefaultShow(): Boolean = this == COMPATIBILITY_UPGRADE || this == COMPATIBILITY_FIX diff --git a/src/backend/ci/core/store/biz-store-sample/src/main/kotlin/com/tencent/devops/store/service/atom/impl/SampleAtomReleaseServiceImpl.kt b/src/backend/ci/core/store/biz-store-sample/src/main/kotlin/com/tencent/devops/store/service/atom/impl/SampleAtomReleaseServiceImpl.kt index 00d3afed22c..ca93e99ac15 100644 --- a/src/backend/ci/core/store/biz-store-sample/src/main/kotlin/com/tencent/devops/store/service/atom/impl/SampleAtomReleaseServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store-sample/src/main/kotlin/com/tencent/devops/store/service/atom/impl/SampleAtomReleaseServiceImpl.kt @@ -219,4 +219,11 @@ class SampleAtomReleaseServiceImpl : SampleAtomReleaseService, AtomReleaseServic return if (validateFlag) Triple(true, "", null) else Triple(false, StoreMessageCode.USER_ATOM_RELEASE_STEPS_ERROR, null) } + + override fun creatAtomBranchTestVersion( + userId: String, + marketAtomUpdateRequest: MarketAtomUpdateRequest + ): Result = Result("") + + override fun endBranchVersionTest(userId: String, atomId: String): Result = Result(true) } diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt index b74cc0c6ddd..381e7f1968e 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt @@ -259,6 +259,16 @@ class AtomDao : AtomBaseDao() { } } + fun getAtomTestVersion(dslContext: DSLContext, atomCode: String, versionPrefix: String): TAtomRecord? { + return with(TAtom.T_ATOM) { + dslContext.selectFrom(this) + .where(ATOM_CODE.eq(atomCode).and(VERSION.like("$versionPrefix-%"))) + .orderBy(CREATE_TIME.desc()) + .limit(1) + .fetchOne() + } + } + fun getPipelineAtom( dslContext: DSLContext, atomCode: String, @@ -628,6 +638,8 @@ class AtomDao : AtomBaseDao() { .join(tspr) .on(ta.ATOM_CODE.eq(tspr.STORE_CODE)) .where(initTestAtomCondition) + .groupBy(ta.ATOM_CODE) + .orderBy(ta.CREATE_TIME.desc()) ) } val t = queryAtomStep.asTable("t") diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/MarketAtomDao.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/MarketAtomDao.kt index 37b9ea09d72..b79b8c9f043 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/MarketAtomDao.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/MarketAtomDao.kt @@ -28,6 +28,7 @@ package com.tencent.devops.store.dao.atom import com.tencent.devops.common.api.constant.INIT_VERSION +import com.tencent.devops.common.api.constant.TEST import com.tencent.devops.common.api.util.JsonUtil import com.tencent.devops.model.store.tables.TAtom import com.tencent.devops.model.store.tables.TAtomEnvInfo @@ -579,6 +580,7 @@ class MarketAtomDao : AtomBaseDao() { return with(TAtom.T_ATOM) { val baseStep = dslContext.selectFrom(this) .where(ATOM_CODE.eq(atomCode)) + .and(VERSION.notContains(TEST)) .orderBy(CREATE_TIME.desc()) if (null != page && null != pageSize) { baseStep.limit((page - 1) * pageSize, pageSize).fetch() diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/MarketAtomVersionLogDao.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/MarketAtomVersionLogDao.kt index 9dc116b8952..3f84b6ea8d5 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/MarketAtomVersionLogDao.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/MarketAtomVersionLogDao.kt @@ -31,6 +31,7 @@ import com.tencent.devops.common.api.util.UUIDUtil import com.tencent.devops.model.store.tables.TAtom import com.tencent.devops.model.store.tables.TAtomVersionLog import com.tencent.devops.model.store.tables.records.TAtomVersionLogRecord +import com.tencent.devops.store.pojo.common.enums.ReleaseTypeEnum import org.jooq.DSLContext import org.jooq.Result import org.springframework.stereotype.Repository @@ -85,6 +86,7 @@ class MarketAtomVersionLogDao { with(TAtomVersionLog.T_ATOM_VERSION_LOG) { return dslContext.selectFrom(this) .where(ATOM_ID.`in`(atomIds)) + .and(RELEASE_TYPE.notEqual(ReleaseTypeEnum.BRANCH_TEST.releaseType.toByte())) .fetch() } } diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/resources/atom/BuildAtomResourceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/resources/atom/BuildAtomResourceImpl.kt index a2fff1e44de..241efd1e7f5 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/resources/atom/BuildAtomResourceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/resources/atom/BuildAtomResourceImpl.kt @@ -29,16 +29,35 @@ package com.tencent.devops.store.resources.atom import com.tencent.devops.common.api.pojo.Result import com.tencent.devops.common.web.RestResource import com.tencent.devops.store.api.atom.BuildAtomResource +import com.tencent.devops.store.pojo.atom.MarketAtomUpdateRequest +import com.tencent.devops.store.pojo.common.StoreProcessInfo import com.tencent.devops.store.pojo.common.VersionInfo +import com.tencent.devops.store.service.atom.AtomReleaseService import com.tencent.devops.store.service.atom.AtomService import org.springframework.beans.factory.annotation.Autowired @RestResource class BuildAtomResourceImpl @Autowired constructor( - private val atomService: AtomService + private val atomService: AtomService, + private val atomReleaseService: AtomReleaseService ) : BuildAtomResource { override fun getAtomDefaultValidVersion(projectCode: String, atomCode: String): Result { return atomService.getAtomDefaultValidVersion(projectCode, atomCode) } + + override fun creatAtomBranchTestVersion( + userId: String, + marketAtomUpdateRequest: MarketAtomUpdateRequest + ): Result { + return atomReleaseService.creatAtomBranchTestVersion(userId, marketAtomUpdateRequest) + } + + override fun endBranchVersionTest(userId: String, atomId: String): Result { + return atomReleaseService.endBranchVersionTest(userId, atomId) + } + + override fun getProcessInfo(userId: String, atomId: String): Result { + return atomReleaseService.getProcessInfo(userId, atomId) + } } diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/AtomReleaseService.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/AtomReleaseService.kt index 564646a4d41..29c16445550 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/AtomReleaseService.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/AtomReleaseService.kt @@ -49,7 +49,7 @@ interface AtomReleaseService { userId: String, projectCode: String, marketAtomUpdateRequest: MarketAtomUpdateRequest - ): Result + ): Result /** * 获取插件版本发布进度 @@ -95,4 +95,17 @@ interface AtomReleaseService { repositoryHashId: String?, branch: String? ) + + /** + * 创建分支测试版本 + */ + fun creatAtomBranchTestVersion( + userId: String, + marketAtomUpdateRequest: MarketAtomUpdateRequest + ): Result + + /** + * 结束分支版本测试 + */ + fun endBranchVersionTest(userId: String, atomId: String): Result } diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt index d022010a185..96310f0c074 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt @@ -321,7 +321,7 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ userId: String, projectCode: String, marketAtomUpdateRequest: MarketAtomUpdateRequest - ): Result { + ): Result { logger.info("updateMarketAtom userId is :$userId,marketAtomUpdateRequest is :$marketAtomUpdateRequest") val atomCode = marketAtomUpdateRequest.atomCode val version = marketAtomUpdateRequest.version @@ -379,7 +379,8 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ i18nDir = i18nDir, propertiesKeyPrefix = KEY_RELEASE_INFO, dbKeyPrefix = StoreUtils.getStoreFieldKeyPrefix(StoreTypeEnum.ATOM, atomCode, version), - repositoryHashId = atomRecord.repositoryHashId + repositoryHashId = atomRecord.repositoryHashId, + branch = branch ).toMutableMap() updateRequestDataMap[versionContentFieldName] = updateRequestDataMap["$KEY_VERSION_INFO.$versionContentFieldName"].toString() @@ -414,7 +415,8 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ fileDir = "$atomCode/$version", i18nDir = i18nDir, dbKeyPrefix = StoreUtils.getStoreFieldKeyPrefix(StoreTypeEnum.ATOM, atomCode, version), - repositoryHashId = atomRecord.repositoryHashId + repositoryHashId = atomRecord.repositoryHashId, + branch = branch ) // 校验插件发布类型 marketAtomCommonService.validateReleaseType( @@ -578,7 +580,7 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ validOsArchFlag: Boolean? = null ) - private fun updateMarketAtom( + protected fun updateMarketAtom( context: DSLContext, userId: String, atomId: String, @@ -662,7 +664,8 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ fileDir = "$atomCode/$atomVersion", i18nDir = StoreUtils.getStoreI18nDir(atomLanguage, getAtomPackageSourceType(repositoryHashId)), keyPrefix = "${StoreTypeEnum.ATOM.name}.$atomCode.$atomVersion", - repositoryHashId = repositoryHashId + repositoryHashId = repositoryHashId, + branch = branch ) val storeErrorCodeInfo = StoreErrorCodeInfo( storeCode = atomCode, @@ -688,6 +691,7 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ branch: String? = null ): GetAtomQualityConfigResult { try { + val testVersionFlag = branch?.let { it != MASTER } ?: false val qualityJsonStr = getFileStr( projectCode = projectCode, atomCode = atomCode, @@ -704,7 +708,8 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ fileDir = "$atomCode/$atomVersion", i18nDir = i18nDir, dbKeyPrefix = StoreUtils.getStoreFieldKeyPrefix(StoreTypeEnum.ATOM, atomCode, atomVersion), - repositoryHashId = repositoryHashId + repositoryHashId = repositoryHashId, + branch = branch ) val indicators = qualityDataMap["indicators"] as Map val stageCode = (qualityDataMap["stage"] as String).lowercase(Locale.getDefault()) @@ -718,8 +723,8 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ // 先注册基础数据 val metadataResultMap = registerMetadata( userId = userId, - atomCode = atomCode, - atomName = atomName, + atomCode = if (testVersionFlag) "$atomCode-$branch" else atomCode, + atomName = if (testVersionFlag) "$atomName-$branch" else atomName, indicators = indicators ) @@ -727,8 +732,8 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ registerIndicator( userId = userId, projectId = projectCode, - atomCode = atomCode, - atomName = atomName, + atomCode = if (testVersionFlag) "$atomCode-$branch" else atomCode, + atomName = if (testVersionFlag) "$atomName-$branch" else atomName, atomVersion = atomVersion, stage = stageCode, metadataResultMap = metadataResultMap, @@ -738,8 +743,8 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ // 最后注册控制点 registerControlPoint( userId = userId, - atomCode = atomCode, - atomName = atomName, + atomCode = if (testVersionFlag) "$atomCode-$branch" else atomCode, + atomName = if (testVersionFlag) "$atomName-$branch" else atomName, atomVersion = atomVersion, stage = stageCode, projectId = projectCode @@ -748,9 +753,12 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ GetAtomQualityConfigResult("0", arrayOf("")) } else { try { - client.get(ServiceQualityIndicatorMarketResource::class).deleteTestIndicator(atomCode) - client.get(ServiceQualityMetadataMarketResource::class).deleteTestMetadata(atomCode) - client.get(ServiceQualityControlPointMarketResource::class).deleteTestControlPoint(atomCode) + client.get(ServiceQualityIndicatorMarketResource::class) + .deleteTestIndicator(if (testVersionFlag) "$atomCode-$branch" else atomCode) + client.get(ServiceQualityMetadataMarketResource::class) + .deleteTestMetadata(if (testVersionFlag) "$atomCode-$branch" else atomCode) + client.get(ServiceQualityControlPointMarketResource::class) + .deleteTestControlPoint(if (testVersionFlag) "$atomCode-$branch" else atomCode) } catch (ignored: Throwable) { logger.warn("clear atom:$atomCode test quality data fail", ignored) } @@ -931,7 +939,7 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ return flag } - private fun upgradeMarketAtom( + protected fun upgradeMarketAtom( marketAtomUpdateRequest: MarketAtomUpdateRequest, context: DSLContext, userId: String, diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/MarketAtomServiceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/MarketAtomServiceImpl.kt index 88db845a901..c935effdce3 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/MarketAtomServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/MarketAtomServiceImpl.kt @@ -42,6 +42,7 @@ import com.tencent.devops.common.api.constant.OR import com.tencent.devops.common.api.constant.OUTPUT_DESC import com.tencent.devops.common.api.constant.REQUIRED import com.tencent.devops.common.api.constant.SINGLE_SELECTOR +import com.tencent.devops.common.api.constant.TEST import com.tencent.devops.common.api.constant.TIMETOSELECT import com.tencent.devops.common.api.enums.FrontendTypeEnum import com.tencent.devops.common.api.exception.ErrorCodeException @@ -579,7 +580,8 @@ abstract class MarketAtomServiceImpl @Autowired constructor() : MarketAtomServic // 获取插件处于流程中的版本信息 var processingVersionInfoMap: MutableMap>? = null processingAtomRecords?.forEach { processingAtomRecord -> - if (processingAtomRecord.version == INIT_VERSION || processingAtomRecord.version.isNullOrBlank()) { + if (processingAtomRecord.version == INIT_VERSION || processingAtomRecord.version.isNullOrBlank() + || processingAtomRecord.version.contains(TEST)) { return@forEach } if (processingVersionInfoMap == null) { diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/common/StoreI18nMessageService.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/common/StoreI18nMessageService.kt index 70684891078..231b80bd91b 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/common/StoreI18nMessageService.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/common/StoreI18nMessageService.kt @@ -50,7 +50,8 @@ interface StoreI18nMessageService { i18nDir: String, propertiesKeyPrefix: String? = null, dbKeyPrefix: String? = null, - repositoryHashId: String? = null + repositoryHashId: String? = null, + branch: String? = null ): Map /** @@ -71,7 +72,8 @@ interface StoreI18nMessageService { fileDir: String, i18nDir: String, keyPrefix: String? = null, - repositoryHashId: String? = null + repositoryHashId: String? = null, + branch: String? = null ) /** diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/common/impl/StoreI18nMessageServiceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/common/impl/StoreI18nMessageServiceImpl.kt index 2e41b294702..8a965cbaf7d 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/common/impl/StoreI18nMessageServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/common/impl/StoreI18nMessageServiceImpl.kt @@ -91,7 +91,8 @@ abstract class StoreI18nMessageServiceImpl : StoreI18nMessageService { i18nDir: String, propertiesKeyPrefix: String?, dbKeyPrefix: String?, - repositoryHashId: String? + repositoryHashId: String?, + branch: String? ): Map { logger.info( "parseJsonMap params:[$userId|$projectCode|$fileDir|$i18nDir|$propertiesKeyPrefix|$dbKeyPrefix|" + @@ -108,7 +109,8 @@ abstract class StoreI18nMessageServiceImpl : StoreI18nMessageService { fileDir = fileDir, i18nDir = i18nDir, fileName = fileName, - repositoryHashId = repositoryHashId + repositoryHashId = repositoryHashId, + branch = branch ) val fieldLocaleInfos = if (jsonLocaleLanguage == devopsDefaultLocaleLanguage) { // 如果map集合中默认字段值对应的语言和蓝盾默认语言一致,则无需替换 @@ -140,7 +142,8 @@ abstract class StoreI18nMessageServiceImpl : StoreI18nMessageService { repositoryHashId = repositoryHashId, fieldLocaleInfos = fieldLocaleInfos, dbKeyPrefix = dbKeyPrefix, - userId = userId + userId = userId, + branch = branch ) } return jsonMap @@ -153,9 +156,12 @@ abstract class StoreI18nMessageServiceImpl : StoreI18nMessageService { fileDir: String, i18nDir: String, keyPrefix: String?, - repositoryHashId: String? + repositoryHashId: String?, + branch: String? ) { - logger.info("parseErrorCode params:[$userId|$projectCode|$fileDir|$i18nDir|$keyPrefix|$repositoryHashId]") + logger.info( + "parseErrorCode params:[$userId|$projectCode|$fileDir|$i18nDir|$keyPrefix|$repositoryHashId|$branch]" + ) val fieldLocaleInfos = mutableListOf() errorCodes.forEach { errorCode -> fieldLocaleInfos.add(FieldLocaleInfo(fieldName = errorCode.toString(), fieldValue = "")) @@ -168,7 +174,8 @@ abstract class StoreI18nMessageServiceImpl : StoreI18nMessageService { repositoryHashId = repositoryHashId, fieldLocaleInfos = fieldLocaleInfos, dbKeyPrefix = keyPrefix, - userId = userId + userId = userId, + branch = branch ) } @@ -215,7 +222,8 @@ abstract class StoreI18nMessageServiceImpl : StoreI18nMessageService { repositoryHashId: String?, fieldLocaleInfos: MutableList, dbKeyPrefix: String?, - userId: String + userId: String, + branch: String? ) { executors.submit { // 获取资源文件名称列表 @@ -223,7 +231,8 @@ abstract class StoreI18nMessageServiceImpl : StoreI18nMessageService { projectCode = projectCode, fileDir = fileDir, i18nDir = i18nDir, - repositoryHashId = repositoryHashId + repositoryHashId = repositoryHashId, + branch = branch ) logger.info("parseJsonMap propertiesFileNames:$propertiesFileNames") val regex = MESSAGE_NAME_TEMPLATE.format("(.*)").toRegex() @@ -236,7 +245,8 @@ abstract class StoreI18nMessageServiceImpl : StoreI18nMessageService { fileDir = fileDir, i18nDir = i18nDir, fileName = propertiesFileName, - repositoryHashId = repositoryHashId + repositoryHashId = repositoryHashId, + branch = branch ) ?: return@forEach val description = fileProperties["$KEY_RELEASE_INFO.$KEY_DESCRIPTION"]?.toString() if (!description.isNullOrBlank()) { @@ -316,13 +326,15 @@ abstract class StoreI18nMessageServiceImpl : StoreI18nMessageService { fileDir: String, i18nDir: String, fileName: String, - repositoryHashId: String? + repositoryHashId: String?, + branch: String? = null ): Properties? { val fileStr = getFileStr( projectCode = projectCode, fileDir = fileDir, fileName = "$i18nDir/$fileName", - repositoryHashId = repositoryHashId + repositoryHashId = repositoryHashId, + branch = branch ) return if (fileStr.isNullOrBlank()) { null From e7b1d2ebbcc14b88c75ee26bbc09e4cc9a017fc6 Mon Sep 17 00:00:00 2001 From: yjieliang Date: Tue, 10 Oct 2023 15:33:53 +0800 Subject: [PATCH 02/73] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tencent/devops/store/pojo/atom/MarketAtomUpdateRequest.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/pojo/atom/MarketAtomUpdateRequest.kt b/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/pojo/atom/MarketAtomUpdateRequest.kt index aa91648f4f1..1cd7e6e1ad6 100644 --- a/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/pojo/atom/MarketAtomUpdateRequest.kt +++ b/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/pojo/atom/MarketAtomUpdateRequest.kt @@ -57,7 +57,7 @@ data class MarketAtomUpdateRequest( @ApiModelProperty("logo地址", required = false) val logoUrl: String?, @ApiModelProperty("版本号", required = true) - val version: String, + var version: String, @ApiModelProperty( "发布类型,NEW:新上架 INCOMPATIBILITY_UPGRADE:非兼容性升级 COMPATIBILITY_UPGRADE:兼容性功能更新 COMPATIBILITY_FIX:兼容性问题修正", required = true From a014b025ced74503bcf67dcefd6b128acc5e5d0c Mon Sep 17 00:00:00 2001 From: yjieliang Date: Tue, 10 Oct 2023 15:55:33 +0800 Subject: [PATCH 03/73] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../devops/store/service/atom/impl/MarketAtomServiceImpl.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/MarketAtomServiceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/MarketAtomServiceImpl.kt index 4e88edae0b3..699c17e3f40 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/MarketAtomServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/MarketAtomServiceImpl.kt @@ -584,8 +584,8 @@ abstract class MarketAtomServiceImpl @Autowired constructor() : MarketAtomServic // 获取插件处于流程中的版本信息 var processingVersionInfoMap: MutableMap>? = null processingAtomRecords?.forEach { processingAtomRecord -> - if (processingAtomRecord.version == INIT_VERSION || processingAtomRecord.version.isNullOrBlank() - || processingAtomRecord.version.contains(TEST)) { + if (processingAtomRecord.version == INIT_VERSION || processingAtomRecord.version.isNullOrBlank() || + processingAtomRecord.version.contains(TEST)) { return@forEach } if (processingVersionInfoMap == null) { From 1058e8170e75a4ecfa259c66ebf36361676a6924 Mon Sep 17 00:00:00 2001 From: yjieliang Date: Thu, 12 Oct 2023 09:40:10 +0800 Subject: [PATCH 04/73] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../devops/store/service/atom/impl/AtomServiceImpl.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomServiceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomServiceImpl.kt index f477c9db88b..d1bae9d30bc 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomServiceImpl.kt @@ -36,6 +36,7 @@ import com.tencent.devops.common.api.constant.KEY_SUMMARY import com.tencent.devops.common.api.constant.KEY_VERSION import com.tencent.devops.common.api.constant.KEY_WEIGHT import com.tencent.devops.common.api.constant.NAME +import com.tencent.devops.common.api.constant.TEST import com.tencent.devops.common.api.constant.VERSION import com.tencent.devops.common.api.enums.FrontendTypeEnum import com.tencent.devops.common.api.enums.SystemModuleEnum @@ -114,7 +115,6 @@ import com.tencent.devops.store.pojo.common.enums.StoreTypeEnum import com.tencent.devops.store.service.atom.AtomLabelService import com.tencent.devops.store.service.atom.AtomService import com.tencent.devops.store.service.atom.MarketAtomCommonService -import com.tencent.devops.store.service.common.action.StoreDecorateFactory import com.tencent.devops.store.service.common.ClassifyService import com.tencent.devops.store.service.common.StoreCommonService import com.tencent.devops.store.service.common.StoreHonorService @@ -122,6 +122,7 @@ import com.tencent.devops.store.service.common.StoreI18nMessageService import com.tencent.devops.store.service.common.StoreIndexManageService import com.tencent.devops.store.service.common.StoreProjectService import com.tencent.devops.store.service.common.StoreUserService +import com.tencent.devops.store.service.common.action.StoreDecorateFactory import com.tencent.devops.store.utils.StoreUtils import com.tencent.devops.store.utils.VersionUtils import java.math.BigDecimal @@ -713,7 +714,7 @@ abstract class AtomServiceImpl @Autowired constructor() : AtomService { versionName = "$atomVersion ($atomStatusMsg)" latestVersionName = "$latestVersionName ($atomStatusMsg)" } - if (tmpVersionPrefix != versionPrefix) { + if (tmpVersionPrefix != versionPrefix && !atomVersion.contains(TEST)) { versionList.add(VersionInfo(latestVersionName, "$versionPrefix*")) // 添加大版本号的通用最新模式(如1.*) tmpVersionPrefix = versionPrefix } From 42104aa13f190a74a4f71bbc375a9b29e69918a6 Mon Sep 17 00:00:00 2001 From: yjieliang Date: Mon, 16 Oct 2023 18:34:18 +0800 Subject: [PATCH 05/73] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../log/api/print/BuildLogPrintResource.kt | 81 +++++++++++++++++++ .../resources/BuildLogPrintResourceImpl.kt | 65 ++++++++++++++- 2 files changed, 145 insertions(+), 1 deletion(-) diff --git a/src/backend/ci/core/log/api-log/src/main/kotlin/com/tencent/devops/log/api/print/BuildLogPrintResource.kt b/src/backend/ci/core/log/api-log/src/main/kotlin/com/tencent/devops/log/api/print/BuildLogPrintResource.kt index 3e17a790c1e..cd254968258 100644 --- a/src/backend/ci/core/log/api-log/src/main/kotlin/com/tencent/devops/log/api/print/BuildLogPrintResource.kt +++ b/src/backend/ci/core/log/api-log/src/main/kotlin/com/tencent/devops/log/api/print/BuildLogPrintResource.kt @@ -28,17 +28,23 @@ package com.tencent.devops.log.api.print import com.tencent.devops.common.api.auth.AUTH_HEADER_DEVOPS_BUILD_ID +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.Result +import com.tencent.devops.common.log.pojo.QueryLogs import com.tencent.devops.common.log.pojo.TaskBuildLogProperty +import com.tencent.devops.common.log.pojo.enums.LogType import com.tencent.devops.common.log.pojo.message.LogMessage import io.swagger.annotations.Api import io.swagger.annotations.ApiOperation import io.swagger.annotations.ApiParam import javax.ws.rs.Consumes +import javax.ws.rs.GET import javax.ws.rs.HeaderParam import javax.ws.rs.POST import javax.ws.rs.PUT import javax.ws.rs.Path +import javax.ws.rs.PathParam import javax.ws.rs.Produces import javax.ws.rs.QueryParam import javax.ws.rs.core.MediaType @@ -162,4 +168,79 @@ interface BuildLogPrintResource { @ApiParam("所有插件的日志存储结果", required = true) propertyList: List ): Result + + @ApiOperation("根据构建ID获取初始化所有日志") + @GET + @Path("/{projectId}/{pipelineId}/{buildId}/") + fun getInitLogs( + @ApiParam("用户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, + @ApiParam("是否包含调试日志", required = false) + @QueryParam("debug") + debug: Boolean? = false, + @ApiParam("过滤日志级别", required = false) + @QueryParam("logType") + logType: LogType? = null, + @ApiParam("对应elementId", required = false) + @QueryParam("tag") + tag: String?, + @ApiParam("指定subTag", required = false) + @QueryParam("subTag") + subTag: String?, + @ApiParam("对应jobId", required = false) + @QueryParam("jobId") + jobId: String?, + @ApiParam("执行次数", required = false) + @QueryParam("executeCount") + executeCount: Int? + ): Result + + @ApiOperation("获取某行后的日志") + @GET + @Path("/{projectId}/{pipelineId}/{buildId}/after") + fun getAfterLogs( + @ApiParam("用户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, + @ApiParam("起始行号", required = true) + @QueryParam("start") + start: Long, + @ApiParam("是否包含调试日志", required = false) + @QueryParam("debug") + debug: Boolean? = false, + @ApiParam("过滤日志级别", required = false) + @QueryParam("logType") + logType: LogType? = null, + @ApiParam("对应elementId", required = false) + @QueryParam("tag") + tag: String?, + @ApiParam("指定subTag", required = false) + @QueryParam("subTag") + subTag: String?, + @ApiParam("对应jobId", required = false) + @QueryParam("jobId") + jobId: String?, + @ApiParam("执行次数", required = false) + @QueryParam("executeCount") + executeCount: Int? + ): Result } 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 279b69a07c5..8f5cab0cc75 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 @@ -28,8 +28,10 @@ package com.tencent.devops.log.resources import com.tencent.devops.common.api.pojo.Result +import com.tencent.devops.common.log.pojo.QueryLogs import com.tencent.devops.common.log.pojo.TaskBuildLogProperty import com.tencent.devops.common.log.pojo.enums.LogStorageMode +import com.tencent.devops.common.log.pojo.enums.LogType import com.tencent.devops.common.log.pojo.message.LogMessage import com.tencent.devops.common.web.RestResource import com.tencent.devops.log.api.print.BuildLogPrintResource @@ -37,6 +39,7 @@ import com.tencent.devops.log.event.LogOriginEvent import com.tencent.devops.log.event.LogStatusEvent import com.tencent.devops.log.meta.Ansi import com.tencent.devops.log.service.BuildLogPrintService +import com.tencent.devops.log.service.BuildLogQueryService import com.tencent.devops.log.service.IndexService import com.tencent.devops.log.service.LogStatusService import io.micrometer.core.annotation.Timed @@ -55,7 +58,8 @@ class BuildLogPrintResourceImpl @Autowired constructor( private val buildLogPrintService: BuildLogPrintService, private val logStatusService: LogStatusService, private val indexService: IndexService, - private val meterRegistry: MeterRegistry + private val meterRegistry: MeterRegistry, + private val buildLogQueryService: BuildLogQueryService ) : BuildLogPrintResource { @Value("\${spring.application.name:#{null}}") @@ -190,6 +194,65 @@ class BuildLogPrintResourceImpl @Autowired constructor( return Result(true) } + override fun getInitLogs( + userId: String, + projectId: String, + pipelineId: String, + buildId: String, + debug: Boolean?, + logType: LogType?, + tag: String?, + subTag: String?, + jobId: String?, + executeCount: Int? + ): Result { + val initLogs = buildLogQueryService.getInitLogs( + userId = userId, + projectId = projectId, + pipelineId = pipelineId, + buildId = buildId, + debug = debug, + logType = logType, + tag = tag, + subTag = subTag, + jobId = jobId, + executeCount = executeCount + ) + recordMultiLogCount(initLogs.data?.logs?.size ?: 0) + return initLogs + } + + override fun getAfterLogs( + userId: String, + projectId: String, + pipelineId: String, + buildId: String, + start: Long, + debug: Boolean?, + logType: LogType?, + tag: String?, + subTag: String?, + jobId: String?, + executeCount: Int? + ): Result { + val afterLogs = buildLogQueryService.getAfterLogs( + userId = userId, + projectId = projectId, + pipelineId = pipelineId, + buildId = buildId, + start = start, + debug = debug, + logType = logType, + tag = tag, + subTag = subTag, + jobId = jobId, + executeCount = executeCount + ) + recordMultiLogCount(afterLogs.data?.logs?.size ?: 0) + + return afterLogs + } + /** * 记录日志列表函数 */ From 7168c614cf5de1c853c8fdc7881f920075e233b7 Mon Sep 17 00:00:00 2001 From: yjieliang Date: Tue, 17 Oct 2023 14:59:24 +0800 Subject: [PATCH 06/73] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kotlin/com/tencent/devops/store/dao/atom/AtomBaseDao.kt | 3 ++- .../main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomBaseDao.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomBaseDao.kt index 86ba45bfa14..e96ff8d83e0 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomBaseDao.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomBaseDao.kt @@ -27,6 +27,7 @@ package com.tencent.devops.store.dao.atom +import com.tencent.devops.common.api.constant.TEST import com.tencent.devops.common.db.utils.JooqUtils import com.tencent.devops.model.store.tables.TAtom import com.tencent.devops.model.store.tables.records.TAtomRecord @@ -77,7 +78,7 @@ abstract class AtomBaseDao { fun getNewestAtomByCode(dslContext: DSLContext, atomCode: String): TAtomRecord? { return with(TAtom.T_ATOM) { dslContext.selectFrom(this) - .where(ATOM_CODE.eq(atomCode)) + .where(ATOM_CODE.eq(atomCode).and(VERSION.notContains(TEST))) .orderBy(CREATE_TIME.desc()) .limit(1) .fetchOne() diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt index 32f9a9ce91c..2223af488c4 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt @@ -341,6 +341,7 @@ class AtomDao : AtomBaseDao() { ): MutableList { val conditions = mutableListOf() conditions.add(tAtom.ATOM_CODE.eq(atomCode)) + conditions.add(tAtom.ATOM_STATUS.notEqual(AtomStatusEnum.TESTED.status.toByte())) if (version != null) { conditions.add(tAtom.VERSION.like(VersionUtils.generateQueryVersion(version))) } From 69087fe79c7a34b9b62958313f3b024442f20598 Mon Sep 17 00:00:00 2001 From: yjieliang Date: Tue, 17 Oct 2023 15:04:15 +0800 Subject: [PATCH 07/73] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/tencent/devops/store/api/atom/BuildAtomResource.kt | 6 ++++-- .../store/service/atom/impl/SampleAtomReleaseServiceImpl.kt | 2 +- .../devops/store/resources/atom/BuildAtomResourceImpl.kt | 4 ++-- .../tencent/devops/store/service/atom/AtomReleaseService.kt | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/api/atom/BuildAtomResource.kt b/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/api/atom/BuildAtomResource.kt index 4367ba08e4f..7f815a15e6a 100644 --- a/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/api/atom/BuildAtomResource.kt +++ b/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/api/atom/BuildAtomResource.kt @@ -42,6 +42,7 @@ import javax.ws.rs.POST import javax.ws.rs.Path import javax.ws.rs.PathParam import javax.ws.rs.Produces +import javax.ws.rs.QueryParam import javax.ws.rs.core.MediaType @Api(tags = ["BUILD_PIPELINE_ATOM"], description = "流水线-插件") @@ -80,8 +81,9 @@ interface BuildAtomResource { @ApiParam("userId", required = true) @HeaderParam(AUTH_HEADER_USER_ID) userId: String, - @ApiParam("插件ID", required = true) - atomId: String + @ApiParam("插件分支", required = true) + @QueryParam("branch") + branch: String ): Result @ApiOperation("根据插件版本ID获取插件版本进度") diff --git a/src/backend/ci/core/store/biz-store-sample/src/main/kotlin/com/tencent/devops/store/service/atom/impl/SampleAtomReleaseServiceImpl.kt b/src/backend/ci/core/store/biz-store-sample/src/main/kotlin/com/tencent/devops/store/service/atom/impl/SampleAtomReleaseServiceImpl.kt index ca93e99ac15..013b5f50b7c 100644 --- a/src/backend/ci/core/store/biz-store-sample/src/main/kotlin/com/tencent/devops/store/service/atom/impl/SampleAtomReleaseServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store-sample/src/main/kotlin/com/tencent/devops/store/service/atom/impl/SampleAtomReleaseServiceImpl.kt @@ -225,5 +225,5 @@ class SampleAtomReleaseServiceImpl : SampleAtomReleaseService, AtomReleaseServic marketAtomUpdateRequest: MarketAtomUpdateRequest ): Result = Result("") - override fun endBranchVersionTest(userId: String, atomId: String): Result = Result(true) + override fun endBranchVersionTest(userId: String, branch: String): Result = Result(true) } diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/resources/atom/BuildAtomResourceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/resources/atom/BuildAtomResourceImpl.kt index 241efd1e7f5..be1b6e613b4 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/resources/atom/BuildAtomResourceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/resources/atom/BuildAtomResourceImpl.kt @@ -53,8 +53,8 @@ class BuildAtomResourceImpl @Autowired constructor( return atomReleaseService.creatAtomBranchTestVersion(userId, marketAtomUpdateRequest) } - override fun endBranchVersionTest(userId: String, atomId: String): Result { - return atomReleaseService.endBranchVersionTest(userId, atomId) + override fun endBranchVersionTest(userId: String, branch: String): Result { + return atomReleaseService.endBranchVersionTest(userId, branch) } override fun getProcessInfo(userId: String, atomId: String): Result { diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/AtomReleaseService.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/AtomReleaseService.kt index 29c16445550..11f2be0b9bc 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/AtomReleaseService.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/AtomReleaseService.kt @@ -107,5 +107,5 @@ interface AtomReleaseService { /** * 结束分支版本测试 */ - fun endBranchVersionTest(userId: String, atomId: String): Result + fun endBranchVersionTest(userId: String, branch: String): Result } From 27eb20cc0ef72251ebced5f8b86a24670cc6a6c6 Mon Sep 17 00:00:00 2001 From: yjieliang Date: Tue, 17 Oct 2023 15:28:57 +0800 Subject: [PATCH 08/73] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../devops/store/api/atom/BuildAtomResource.kt | 7 +++++-- .../devops/store/constant/StoreMessageCode.kt | 1 + .../atom/impl/SampleAtomReleaseServiceImpl.kt | 6 +++++- .../tencent/devops/store/dao/atom/MarketAtomDao.kt | 14 ++++++++++++-- .../store/resources/atom/BuildAtomResourceImpl.kt | 4 ++-- .../store/service/atom/AtomReleaseService.kt | 2 +- support-files/i18n/store/message_en_US.properties | 1 + support-files/i18n/store/message_zh_CN.properties | 1 + 8 files changed, 28 insertions(+), 8 deletions(-) diff --git a/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/api/atom/BuildAtomResource.kt b/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/api/atom/BuildAtomResource.kt index 7f815a15e6a..74bed351aa4 100644 --- a/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/api/atom/BuildAtomResource.kt +++ b/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/api/atom/BuildAtomResource.kt @@ -74,14 +74,17 @@ interface BuildAtomResource { marketAtomUpdateRequest: MarketAtomUpdateRequest ): Result - @ApiOperation("结束分支测试版本测试") + @ApiOperation("结束插件分支测试版本测试") @POST - @Path("/end/test/version") + @Path("/end/atom/{atomCode}/test/version") fun endBranchVersionTest( @ApiParam("userId", required = true) @HeaderParam(AUTH_HEADER_USER_ID) userId: String, @ApiParam("插件分支", required = true) + @PathParam("atomCode") + atomCode: String, + @ApiParam("插件分支", required = true) @QueryParam("branch") branch: String ): Result diff --git a/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/constant/StoreMessageCode.kt b/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/constant/StoreMessageCode.kt index 067bd913a06..8437fa3792a 100644 --- a/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/constant/StoreMessageCode.kt +++ b/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/constant/StoreMessageCode.kt @@ -150,6 +150,7 @@ object StoreMessageCode { const val BUILD_VISIT_NO_PERMISSION = "2120923" // 接口请求中的插件【{0}】不是当前当前构建运行的插件 const val VERSION_PUBLISHED = "2120924" // 组件{0}版本({1})已发布 const val NO_COMPONENT_ADMIN_AND_CREATETOR_PERMISSION = "2120925" // 无组件{0}管理员或当前版本创建者权限,请联系组件管理员。 + const val USER_NOT_IS_STORE_MEMBE = "2120926" // 研发商店:用户{0}不是组件成员 const val BK_OTHER = "bkOther" // 其他 const val BK_PIPELINED_JOB = "bkPipelinedJob" // 流水线Job diff --git a/src/backend/ci/core/store/biz-store-sample/src/main/kotlin/com/tencent/devops/store/service/atom/impl/SampleAtomReleaseServiceImpl.kt b/src/backend/ci/core/store/biz-store-sample/src/main/kotlin/com/tencent/devops/store/service/atom/impl/SampleAtomReleaseServiceImpl.kt index 013b5f50b7c..1ea881de42c 100644 --- a/src/backend/ci/core/store/biz-store-sample/src/main/kotlin/com/tencent/devops/store/service/atom/impl/SampleAtomReleaseServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store-sample/src/main/kotlin/com/tencent/devops/store/service/atom/impl/SampleAtomReleaseServiceImpl.kt @@ -225,5 +225,9 @@ class SampleAtomReleaseServiceImpl : SampleAtomReleaseService, AtomReleaseServic marketAtomUpdateRequest: MarketAtomUpdateRequest ): Result = Result("") - override fun endBranchVersionTest(userId: String, branch: String): Result = Result(true) + override fun endBranchVersionTest( + userId: String, + atomCode: String, + branch: String + ): Result = Result(true) } diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/MarketAtomDao.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/MarketAtomDao.kt index b79b8c9f043..762345832ec 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/MarketAtomDao.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/MarketAtomDao.kt @@ -49,6 +49,8 @@ import com.tencent.devops.store.pojo.atom.enums.AtomTypeEnum import com.tencent.devops.store.pojo.atom.enums.MarketAtomSortTypeEnum import com.tencent.devops.store.pojo.common.enums.StoreTypeEnum import com.tencent.devops.store.utils.VersionUtils +import java.math.BigDecimal +import java.time.LocalDateTime import org.jooq.Condition import org.jooq.DSLContext import org.jooq.Record @@ -57,8 +59,6 @@ import org.jooq.SelectOnConditionStep import org.jooq.UpdateSetFirstStep import org.jooq.impl.DSL import org.springframework.stereotype.Repository -import java.math.BigDecimal -import java.time.LocalDateTime @Suppress("ALL") @Repository @@ -613,6 +613,16 @@ class MarketAtomDao : AtomBaseDao() { } } + fun getAtomRecordByversionPrefix(dslContext: DSLContext, atomCode: String, versionPrefix: String): TAtomRecord? { + return with(TAtom.T_ATOM) { + dslContext.selectFrom(this) + .where(ATOM_CODE.eq(atomCode).and(VERSION.startsWith(versionPrefix))) + .fetchOne() + } + } + + + fun getAtomById(dslContext: DSLContext, atomId: String): Record? { val tAtom = TAtom.T_ATOM val tAtomVersionLog = TAtomVersionLog.T_ATOM_VERSION_LOG diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/resources/atom/BuildAtomResourceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/resources/atom/BuildAtomResourceImpl.kt index be1b6e613b4..b08f8e1f04a 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/resources/atom/BuildAtomResourceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/resources/atom/BuildAtomResourceImpl.kt @@ -53,8 +53,8 @@ class BuildAtomResourceImpl @Autowired constructor( return atomReleaseService.creatAtomBranchTestVersion(userId, marketAtomUpdateRequest) } - override fun endBranchVersionTest(userId: String, branch: String): Result { - return atomReleaseService.endBranchVersionTest(userId, branch) + override fun endBranchVersionTest(userId: String, atomCode: String, branch: String): Result { + return atomReleaseService.endBranchVersionTest(userId, atomCode, branch) } override fun getProcessInfo(userId: String, atomId: String): Result { diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/AtomReleaseService.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/AtomReleaseService.kt index 11f2be0b9bc..1ff3dd2e241 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/AtomReleaseService.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/AtomReleaseService.kt @@ -107,5 +107,5 @@ interface AtomReleaseService { /** * 结束分支版本测试 */ - fun endBranchVersionTest(userId: String, branch: String): Result + fun endBranchVersionTest(userId: String, atomCode: String, branch: String): Result } diff --git a/support-files/i18n/store/message_en_US.properties b/support-files/i18n/store/message_en_US.properties index b79301eaa1e..ea1d395eaf0 100644 --- a/support-files/i18n/store/message_en_US.properties +++ b/support-files/i18n/store/message_en_US.properties @@ -93,6 +93,7 @@ 2120923=The atom 【{0}】 in the interface request is not the atom running in the current build. 2120924=Component {0} version ({1}) has been published. 2120925=You do not have admin or current version creator permissions for component {0}. Please contact the component admin. +2120926=store:The user {0} is not a member of the component ATOM.classify.common=Others ATOM.classify.compileBuild=Compile ATOM.classify.deploy=Deploy diff --git a/support-files/i18n/store/message_zh_CN.properties b/support-files/i18n/store/message_zh_CN.properties index 3e97dac58bd..8f4512ede5f 100644 --- a/support-files/i18n/store/message_zh_CN.properties +++ b/support-files/i18n/store/message_zh_CN.properties @@ -93,6 +93,7 @@ 2120923=接口请求中的插件【{0}】不是当前当前构建运行的插件 2120924=组件{0}版本({1})已发布 2120925=无组件{0}管理员或当前版本创建者权限,请联系组件管理员。 +2120926=研发商店:用户{0}不是组件成员 ATOM.classify.common=其它 ATOM.classify.compileBuild=编译 ATOM.classify.deploy=部署 From a8cadd8c22d0381e48159c89f0711bba08f3e2f6 Mon Sep 17 00:00:00 2001 From: yjieliang Date: Tue, 17 Oct 2023 15:38:59 +0800 Subject: [PATCH 09/73] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kotlin/com/tencent/devops/store/dao/atom/MarketAtomDao.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/MarketAtomDao.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/MarketAtomDao.kt index 762345832ec..b783a694177 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/MarketAtomDao.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/MarketAtomDao.kt @@ -613,7 +613,7 @@ class MarketAtomDao : AtomBaseDao() { } } - fun getAtomRecordByversionPrefix(dslContext: DSLContext, atomCode: String, versionPrefix: String): TAtomRecord? { + fun getAtomRecordByVersionPrefix(dslContext: DSLContext, atomCode: String, versionPrefix: String): TAtomRecord? { return with(TAtom.T_ATOM) { dslContext.selectFrom(this) .where(ATOM_CODE.eq(atomCode).and(VERSION.startsWith(versionPrefix))) From 9148738e009ae67e5184e46900ad06e4c6ce8c56 Mon Sep 17 00:00:00 2001 From: yjieliang Date: Tue, 17 Oct 2023 15:42:10 +0800 Subject: [PATCH 10/73] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/tencent/devops/store/dao/atom/MarketAtomDao.kt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/MarketAtomDao.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/MarketAtomDao.kt index b783a694177..267e50bb07b 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/MarketAtomDao.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/MarketAtomDao.kt @@ -613,11 +613,15 @@ class MarketAtomDao : AtomBaseDao() { } } - fun getAtomRecordByVersionPrefix(dslContext: DSLContext, atomCode: String, versionPrefix: String): TAtomRecord? { + fun getAtomRecordByVersionPrefix( + dslContext: DSLContext, + atomCode: String, + versionPrefix: String + ): Result { return with(TAtom.T_ATOM) { dslContext.selectFrom(this) .where(ATOM_CODE.eq(atomCode).and(VERSION.startsWith(versionPrefix))) - .fetchOne() + .fetch() } } From 4fd28076928aef2857ef557740981140a386664e Mon Sep 17 00:00:00 2001 From: yjieliang Date: Tue, 17 Oct 2023 15:52:46 +0800 Subject: [PATCH 11/73] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/tencent/devops/store/pojo/common/StoreConstants.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/pojo/common/StoreConstants.kt b/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/pojo/common/StoreConstants.kt index c2ae548dbce..f83b7653f7c 100644 --- a/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/pojo/common/StoreConstants.kt +++ b/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/pojo/common/StoreConstants.kt @@ -172,3 +172,4 @@ const val BK_CODE_QUALITY = "bkCodeQuality" // codecc代码质量 const val BK_TRUSTWORTHY = "bkTrustworthy" // 可信插件 const val BK_TRIGGER = "bkTrigger" // 触发器 const val BK_NORMAL = "bkNormal" // 无编译环境 +const val BRANCH_TEST_VERSION = "branch-test-version" From 842de5db23b7b5a3248327f9b015e29ebf4f3961 Mon Sep 17 00:00:00 2001 From: yjieliang Date: Tue, 17 Oct 2023 15:55:13 +0800 Subject: [PATCH 12/73] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kotlin/com/tencent/devops/store/dao/atom/MarketAtomDao.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/MarketAtomDao.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/MarketAtomDao.kt index 267e50bb07b..734fa02c9b9 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/MarketAtomDao.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/MarketAtomDao.kt @@ -620,7 +620,9 @@ class MarketAtomDao : AtomBaseDao() { ): Result { return with(TAtom.T_ATOM) { dslContext.selectFrom(this) - .where(ATOM_CODE.eq(atomCode).and(VERSION.startsWith(versionPrefix))) + .where(ATOM_CODE.eq(atomCode)) + .and(VERSION.startsWith(versionPrefix)) + .and(ATOM_STATUS.eq(AtomStatusEnum.TESTING.status.toByte())) .fetch() } } From ded81a4432d76b88f5e460ea09d125e5279039eb Mon Sep 17 00:00:00 2001 From: yjieliang Date: Tue, 17 Oct 2023 15:57:24 +0800 Subject: [PATCH 13/73] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kotlin/com/tencent/devops/store/dao/atom/MarketAtomDao.kt | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/MarketAtomDao.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/MarketAtomDao.kt index 734fa02c9b9..f5cdfec183b 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/MarketAtomDao.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/MarketAtomDao.kt @@ -627,8 +627,6 @@ class MarketAtomDao : AtomBaseDao() { } } - - fun getAtomById(dslContext: DSLContext, atomId: String): Record? { val tAtom = TAtom.T_ATOM val tAtomVersionLog = TAtomVersionLog.T_ATOM_VERSION_LOG From 4316c262333c7b6fe8167d50215b9ccfdfe98b67 Mon Sep 17 00:00:00 2001 From: yjieliang Date: Wed, 18 Oct 2023 17:20:15 +0800 Subject: [PATCH 14/73] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/tencent/devops/store/api/atom/BuildAtomResource.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/api/atom/BuildAtomResource.kt b/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/api/atom/BuildAtomResource.kt index 74bed351aa4..9237112d9b9 100644 --- a/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/api/atom/BuildAtomResource.kt +++ b/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/api/atom/BuildAtomResource.kt @@ -75,8 +75,8 @@ interface BuildAtomResource { ): Result @ApiOperation("结束插件分支测试版本测试") - @POST - @Path("/end/atom/{atomCode}/test/version") + @GET + @Path("/end/atoms/{atomCode}/test/version") fun endBranchVersionTest( @ApiParam("userId", required = true) @HeaderParam(AUTH_HEADER_USER_ID) From aea542766b2853161391d771b04ecee8f555e388 Mon Sep 17 00:00:00 2001 From: yjieliang Date: Wed, 18 Oct 2023 18:40:27 +0800 Subject: [PATCH 15/73] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- support-files/sql/1001_ci_store_ddl_mysql.sql | 2 +- .../2020_ci_store-update_v2.0_mysql.sql | 27 +++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 support-files/sql/2003_v2.x/2020_ci_store-update_v2.0_mysql.sql diff --git a/support-files/sql/1001_ci_store_ddl_mysql.sql b/support-files/sql/1001_ci_store_ddl_mysql.sql index 3052979d14a..cab6900e934 100644 --- a/support-files/sql/1001_ci_store_ddl_mysql.sql +++ b/support-files/sql/1001_ci_store_ddl_mysql.sql @@ -61,7 +61,7 @@ CREATE TABLE IF NOT EXISTS `T_ATOM` ( `SUMMARY` varchar(256) DEFAULT NULL COMMENT '简介', `DESCRIPTION` text COMMENT '描述', `CATEGROY` tinyint(4) NOT NULL DEFAULT '1' COMMENT '类别', - `VERSION` varchar(20) NOT NULL COMMENT '版本号', + `VERSION` varchar(30) NOT NULL COMMENT '版本号', `LOGO_URL` varchar(256) DEFAULT NULL COMMENT 'LOGO URL地址', `ICON` text COMMENT '插件图标', `DEFAULT_FLAG` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否为默认原子', diff --git a/support-files/sql/2003_v2.x/2020_ci_store-update_v2.0_mysql.sql b/support-files/sql/2003_v2.x/2020_ci_store-update_v2.0_mysql.sql new file mode 100644 index 00000000000..60f93e020b5 --- /dev/null +++ b/support-files/sql/2003_v2.x/2020_ci_store-update_v2.0_mysql.sql @@ -0,0 +1,27 @@ +USE devops_ci_store; +SET NAMES utf8mb4; + +DROP PROCEDURE IF EXISTS ci_store_schema_update; + +DELIMITER + +CREATE PROCEDURE ci_store_schema_update() +BEGIN + + DECLARE db VARCHAR(100); + SET AUTOCOMMIT = 0; + SELECT DATABASE() INTO db; + + IF EXISTS(SELECT 1 + FROM information_schema.COLUMNS + WHERE TABLE_SCHEMA = db + AND TABLE_NAME = 'T_ATOM' + AND COLUMN_NAME = 'VERSION') THEN + ALTER TABLE T_ATOM MODIFY COLUMN VERSION varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '版本号'; + END IF; + + COMMIT; +END +DELIMITER ; +COMMIT; +CALL ci_store_schema_update(); From 634862c0cdc2cf64f48a8f9c75f68471ea3345ba Mon Sep 17 00:00:00 2001 From: yjieliang Date: Thu, 19 Oct 2023 15:05:46 +0800 Subject: [PATCH 16/73] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt index 2223af488c4..9eaf7be535b 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt @@ -263,7 +263,7 @@ class AtomDao : AtomBaseDao() { fun getAtomTestVersion(dslContext: DSLContext, atomCode: String, versionPrefix: String): TAtomRecord? { return with(TAtom.T_ATOM) { dslContext.selectFrom(this) - .where(ATOM_CODE.eq(atomCode).and(VERSION.like("$versionPrefix-%"))) + .where(ATOM_CODE.eq(atomCode).and(VERSION.startsWith(versionPrefix))) .orderBy(CREATE_TIME.desc()) .limit(1) .fetchOne() From fa18de84d1e59f2aedbdab29d4e6a747fe28c10e Mon Sep 17 00:00:00 2001 From: yjieliang Date: Thu, 19 Oct 2023 20:59:24 +0800 Subject: [PATCH 17/73] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/tencent/devops/store/dao/atom/AtomDao.kt | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt index 9eaf7be535b..14b8bec65a9 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt @@ -36,6 +36,7 @@ import com.tencent.devops.common.api.constant.KEY_SUMMARY import com.tencent.devops.common.api.constant.KEY_VERSION import com.tencent.devops.common.api.constant.KEY_WEIGHT import com.tencent.devops.common.api.constant.NAME +import com.tencent.devops.common.api.constant.TEST import com.tencent.devops.common.api.constant.VERSION import com.tencent.devops.common.api.util.JsonUtil import com.tencent.devops.common.db.utils.JooqUtils @@ -99,6 +100,7 @@ import org.jooq.SelectOnConditionStep import org.jooq.impl.DSL import org.springframework.stereotype.Repository + @Suppress("ALL") @Repository class AtomDao : AtomBaseDao() { @@ -523,14 +525,22 @@ class AtomDao : AtomBaseDao() { delim = ".", count = -1 ) + val field = DSL.`when`((t.field(KEY_VERSION) as Field).startsWith(TEST), 1) + .otherwise(0) as Field val queryStep = dslContext.select( t.field(KEY_VERSION), t.field(KEY_ATOM_STATUS), firstVersion, secondVersion, - thirdVersion + thirdVersion, + field ).from(t) - .orderBy(firstVersion.plus(0).desc(), secondVersion.plus(0).desc(), thirdVersion.plus(0).desc()) + .orderBy( + field, + firstVersion.plus(0).desc(), + secondVersion.plus(0).desc(), + thirdVersion.plus(0).desc() + ) limitNum?.let { queryStep.limit(it) } return queryStep.skipCheck().fetch() } From 32764f3d92327e44fdaebe36ece1389b1f910164 Mon Sep 17 00:00:00 2001 From: yjieliang Date: Thu, 19 Oct 2023 21:20:39 +0800 Subject: [PATCH 18/73] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt index 14b8bec65a9..63f485aee6d 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt @@ -100,7 +100,6 @@ import org.jooq.SelectOnConditionStep import org.jooq.impl.DSL import org.springframework.stereotype.Repository - @Suppress("ALL") @Repository class AtomDao : AtomBaseDao() { From f01c326b875f9bcc2a9562839196ca17441d845c Mon Sep 17 00:00:00 2001 From: yjieliang Date: Thu, 19 Oct 2023 21:48:24 +0800 Subject: [PATCH 19/73] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt index 63f485aee6d..8ec8c6a2e64 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt @@ -535,7 +535,7 @@ class AtomDao : AtomBaseDao() { field ).from(t) .orderBy( - field, + field.desc(), firstVersion.plus(0).desc(), secondVersion.plus(0).desc(), thirdVersion.plus(0).desc() From 5123d85e42c40bd5f3ba1213a6e489e84bb395fd Mon Sep 17 00:00:00 2001 From: yjieliang Date: Mon, 23 Oct 2023 10:02:10 +0800 Subject: [PATCH 20/73] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tencent/devops/store/service/atom/impl/AtomServiceImpl.kt | 2 +- .../devops/store/service/atom/impl/MarketAtomServiceImpl.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomServiceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomServiceImpl.kt index d1bae9d30bc..04a0ac21783 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomServiceImpl.kt @@ -714,7 +714,7 @@ abstract class AtomServiceImpl @Autowired constructor() : AtomService { versionName = "$atomVersion ($atomStatusMsg)" latestVersionName = "$latestVersionName ($atomStatusMsg)" } - if (tmpVersionPrefix != versionPrefix && !atomVersion.contains(TEST)) { + if (tmpVersionPrefix != versionPrefix && !atomVersion.startsWith(TEST)) { versionList.add(VersionInfo(latestVersionName, "$versionPrefix*")) // 添加大版本号的通用最新模式(如1.*) tmpVersionPrefix = versionPrefix } diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/MarketAtomServiceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/MarketAtomServiceImpl.kt index 699c17e3f40..4f9342f83f3 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/MarketAtomServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/MarketAtomServiceImpl.kt @@ -585,7 +585,7 @@ abstract class MarketAtomServiceImpl @Autowired constructor() : MarketAtomServic var processingVersionInfoMap: MutableMap>? = null processingAtomRecords?.forEach { processingAtomRecord -> if (processingAtomRecord.version == INIT_VERSION || processingAtomRecord.version.isNullOrBlank() || - processingAtomRecord.version.contains(TEST)) { + processingAtomRecord.version.startsWith(TEST)) { return@forEach } if (processingVersionInfoMap == null) { From 06789ee94f1d109674be6a950877b1b8e5c218be Mon Sep 17 00:00:00 2001 From: yjieliang Date: Mon, 23 Oct 2023 10:43:03 +0800 Subject: [PATCH 21/73] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sql/1001_ci_process_ddl_mysql.sql | 2 +- .../sql/1001_ci_quality_ddl_mysql.sql | 4 +-- .../2020_ci_process-update_v2.0_mysql.sql | 8 +++++ .../2020_ci_quality-update_v2.0_mysql.sql | 34 +++++++++++++++++++ .../2020_ci_store-update_v2.0_mysql.sql | 2 +- 5 files changed, 46 insertions(+), 4 deletions(-) create mode 100644 support-files/sql/2003_v2.x/2020_ci_quality-update_v2.0_mysql.sql diff --git a/support-files/sql/1001_ci_process_ddl_mysql.sql b/support-files/sql/1001_ci_process_ddl_mysql.sql index 9124b4450ec..85ddf1c63ba 100644 --- a/support-files/sql/1001_ci_process_ddl_mysql.sql +++ b/support-files/sql/1001_ci_process_ddl_mysql.sql @@ -363,7 +363,7 @@ CREATE TABLE IF NOT EXISTS `T_PIPELINE_MODEL_TASK` ( `OS` varchar(45) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '操作系统', `ADDITIONAL_OPTIONS` mediumtext CHARACTER SET utf8mb4 COMMENT '其他选项', `ATOM_CODE` varchar(32) COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '插件的唯一标识', - `ATOM_VERSION` varchar(20) COMMENT '插件版本号', + `ATOM_VERSION` varchar(30) COMMENT '插件版本号', `CREATE_TIME` datetime(3) COMMENT '创建时间', `UPDATE_TIME` datetime(3) COMMENT '更新时间', PRIMARY KEY (`PIPELINE_ID`,`PROJECT_ID`,`STAGE_ID`,`CONTAINER_ID`,`TASK_ID`), diff --git a/support-files/sql/1001_ci_quality_ddl_mysql.sql b/support-files/sql/1001_ci_quality_ddl_mysql.sql index 05d0103a1ae..2eb30ce97a0 100644 --- a/support-files/sql/1001_ci_quality_ddl_mysql.sql +++ b/support-files/sql/1001_ci_quality_ddl_mysql.sql @@ -183,7 +183,7 @@ CREATE TABLE IF NOT EXISTS `T_QUALITY_CONTROL_POINT` `UPDATE_USER` varchar(64) DEFAULT NULL COMMENT '更新用户', `CREATE_TIME` datetime DEFAULT NULL COMMENT '创建时间', `UPDATE_TIME` datetime DEFAULT NULL COMMENT '更新时间', - `ATOM_VERSION` varchar(16) DEFAULT '1.0.0' COMMENT '插件版本', + `ATOM_VERSION` varchar(30) DEFAULT '1.0.0' COMMENT '插件版本', `TEST_PROJECT` varchar(64) NOT NULL DEFAULT '' COMMENT '测试的项目', `CONTROL_POINT_HASH_ID` varchar(64) DEFAULT NULL COMMENT '哈希ID', `TAG` VARCHAR(64) NULL, @@ -261,7 +261,7 @@ CREATE TABLE IF NOT EXISTS `T_QUALITY_INDICATOR` `UPDATE_USER` varchar(64) DEFAULT NULL COMMENT '更新用户', `CREATE_TIME` datetime DEFAULT NULL COMMENT '创建时间', `UPDATE_TIME` datetime DEFAULT NULL COMMENT '更新时间', - `ATOM_VERSION` varchar(16) NOT NULL DEFAULT '1.0.0' COMMENT '插件版本号', + `ATOM_VERSION` varchar(30) NOT NULL DEFAULT '1.0.0' COMMENT '插件版本号', `LOG_PROMPT` varchar(1024) NOT NULL DEFAULT '' COMMENT '日志提示', PRIMARY KEY (`ID`) ) ENGINE = InnoDB diff --git a/support-files/sql/2003_v2.x/2020_ci_process-update_v2.0_mysql.sql b/support-files/sql/2003_v2.x/2020_ci_process-update_v2.0_mysql.sql index 7119a8d49e8..2a0a3facc0f 100644 --- a/support-files/sql/2003_v2.x/2020_ci_process-update_v2.0_mysql.sql +++ b/support-files/sql/2003_v2.x/2020_ci_process-update_v2.0_mysql.sql @@ -85,6 +85,14 @@ BEGIN ADD INDEX `IDX_TPVUS_PROJECT_ID`(`PROJECT_ID`); END IF; + IF EXISTS(SELECT 1 + FROM information_schema.COLUMNS + WHERE TABLE_SCHEMA = db + AND TABLE_NAME = 'T_PIPELINE_MODEL_TASK' + AND COLUMN_NAME = 'ATOM_VERSION') THEN + ALTER TABLE T_PIPELINE_MODEL_TASK MODIFY COLUMN ATOM_VERSION varchar(30) NULL; + END IF; + COMMIT; END DELIMITER ; diff --git a/support-files/sql/2003_v2.x/2020_ci_quality-update_v2.0_mysql.sql b/support-files/sql/2003_v2.x/2020_ci_quality-update_v2.0_mysql.sql new file mode 100644 index 00000000000..595c5157fb9 --- /dev/null +++ b/support-files/sql/2003_v2.x/2020_ci_quality-update_v2.0_mysql.sql @@ -0,0 +1,34 @@ +USE devops_ci_quality; +SET NAMES utf8mb4; + +DROP PROCEDURE IF EXISTS ci_quality_schema_update; + +DELIMITER + +CREATE PROCEDURE ci_quality_schema_update() +BEGIN + + DECLARE db VARCHAR(100); + SET AUTOCOMMIT = 0; + SELECT DATABASE() INTO db; + + IF EXISTS(SELECT 1 + FROM information_schema.COLUMNS + WHERE TABLE_SCHEMA = db + AND TABLE_NAME = 'T_QUALITY_CONTROL_POINT' + AND COLUMN_NAME = 'ATOM_VERSION') THEN + ALTER TABLE T_QUALITY_CONTROL_POINT MODIFY COLUMN ATOM_VERSION varchar(30) DEFAULT '1.0.0' NULL; + END IF; + IF EXISTS(SELECT 1 + FROM information_schema.COLUMNS + WHERE TABLE_SCHEMA = db + AND TABLE_NAME = 'T_QUALITY_INDICATOR' + AND COLUMN_NAME = 'ATOM_VERSION') THEN + ALTER TABLE T_QUALITY_INDICATOR MODIFY COLUMN ATOM_VERSION varchar(30) DEFAULT '1.0.0' NOT NULL; + END IF; + + COMMIT; +END +DELIMITER ; +COMMIT; +CALL ci_quality_schema_update(); diff --git a/support-files/sql/2003_v2.x/2020_ci_store-update_v2.0_mysql.sql b/support-files/sql/2003_v2.x/2020_ci_store-update_v2.0_mysql.sql index 60f93e020b5..2c3260b1517 100644 --- a/support-files/sql/2003_v2.x/2020_ci_store-update_v2.0_mysql.sql +++ b/support-files/sql/2003_v2.x/2020_ci_store-update_v2.0_mysql.sql @@ -17,7 +17,7 @@ BEGIN WHERE TABLE_SCHEMA = db AND TABLE_NAME = 'T_ATOM' AND COLUMN_NAME = 'VERSION') THEN - ALTER TABLE T_ATOM MODIFY COLUMN VERSION varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '版本号'; + ALTER TABLE T_ATOM MODIFY COLUMN VERSION varchar(30) NOT NULL; END IF; COMMIT; From 3708e0aec1b17496fb061b5052d38205eca0aea5 Mon Sep 17 00:00:00 2001 From: yjieliang Date: Mon, 23 Oct 2023 18:27:27 +0800 Subject: [PATCH 22/73] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../atom/impl/AtomReleaseServiceImpl.kt | 22 ++++++++----------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt index 96310f0c074..99abf7e9c35 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt @@ -691,7 +691,6 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ branch: String? = null ): GetAtomQualityConfigResult { try { - val testVersionFlag = branch?.let { it != MASTER } ?: false val qualityJsonStr = getFileStr( projectCode = projectCode, atomCode = atomCode, @@ -723,8 +722,8 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ // 先注册基础数据 val metadataResultMap = registerMetadata( userId = userId, - atomCode = if (testVersionFlag) "$atomCode-$branch" else atomCode, - atomName = if (testVersionFlag) "$atomName-$branch" else atomName, + atomCode = atomCode, + atomName = atomCode, indicators = indicators ) @@ -732,8 +731,8 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ registerIndicator( userId = userId, projectId = projectCode, - atomCode = if (testVersionFlag) "$atomCode-$branch" else atomCode, - atomName = if (testVersionFlag) "$atomName-$branch" else atomName, + atomCode = atomCode, + atomName = atomCode, atomVersion = atomVersion, stage = stageCode, metadataResultMap = metadataResultMap, @@ -743,8 +742,8 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ // 最后注册控制点 registerControlPoint( userId = userId, - atomCode = if (testVersionFlag) "$atomCode-$branch" else atomCode, - atomName = if (testVersionFlag) "$atomName-$branch" else atomName, + atomCode = atomCode, + atomName = atomCode, atomVersion = atomVersion, stage = stageCode, projectId = projectCode @@ -753,12 +752,9 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ GetAtomQualityConfigResult("0", arrayOf("")) } else { try { - client.get(ServiceQualityIndicatorMarketResource::class) - .deleteTestIndicator(if (testVersionFlag) "$atomCode-$branch" else atomCode) - client.get(ServiceQualityMetadataMarketResource::class) - .deleteTestMetadata(if (testVersionFlag) "$atomCode-$branch" else atomCode) - client.get(ServiceQualityControlPointMarketResource::class) - .deleteTestControlPoint(if (testVersionFlag) "$atomCode-$branch" else atomCode) + client.get(ServiceQualityIndicatorMarketResource::class).deleteTestIndicator(atomCode) + client.get(ServiceQualityMetadataMarketResource::class).deleteTestMetadata(atomCode) + client.get(ServiceQualityControlPointMarketResource::class).deleteTestControlPoint(atomCode) } catch (ignored: Throwable) { logger.warn("clear atom:$atomCode test quality data fail", ignored) } From d6ebb565100cbd9a6eab9dab238dd5b2a932dfb3 Mon Sep 17 00:00:00 2001 From: yjieliang Date: Tue, 24 Oct 2023 15:21:35 +0800 Subject: [PATCH 23/73] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../store/service/atom/impl/AtomReleaseServiceImpl.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt index 99abf7e9c35..855082b8e08 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt @@ -723,7 +723,7 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ val metadataResultMap = registerMetadata( userId = userId, atomCode = atomCode, - atomName = atomCode, + atomName = atomName, indicators = indicators ) @@ -732,7 +732,7 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ userId = userId, projectId = projectCode, atomCode = atomCode, - atomName = atomCode, + atomName = atomName, atomVersion = atomVersion, stage = stageCode, metadataResultMap = metadataResultMap, @@ -743,7 +743,7 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ registerControlPoint( userId = userId, atomCode = atomCode, - atomName = atomCode, + atomName = atomName, atomVersion = atomVersion, stage = stageCode, projectId = projectCode From 9c61e6877bb014ad69c41372b92d0ff61069fb09 Mon Sep 17 00:00:00 2001 From: yjieliang Date: Tue, 24 Oct 2023 18:31:11 +0800 Subject: [PATCH 24/73] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/api/constant/CommonConstants.kt | 1 + ...erviceQualityControlPointMarketResource.kt | 6 ++- .../ServiceQualityIndicatorMarketResource.kt | 6 ++- .../ServiceQualityMetadataMarketResource.kt | 8 +++- .../quality/dao/v2/QualityControlPointDao.kt | 28 ++++++----- ...ceQualityControlPointMarketResourceImpl.kt | 8 ++-- ...rviceQualityIndicatorMarketResourceImpl.kt | 12 +++-- ...erviceQualityMetadataMarketResourceImpl.kt | 12 +++-- .../service/v2/QualityControlPointService.kt | 17 ++++--- .../service/v2/QualityIndicatorService.kt | 26 +++++++---- .../service/v2/QualityMetadataService.kt | 14 +++--- .../atom/impl/AtomQualityServiceImpl.kt | 5 +- .../atom/impl/AtomReleaseServiceImpl.kt | 46 +++++++++++++------ 13 files changed, 127 insertions(+), 62 deletions(-) diff --git a/src/backend/ci/core/common/common-api/src/main/kotlin/com/tencent/devops/common/api/constant/CommonConstants.kt b/src/backend/ci/core/common/common-api/src/main/kotlin/com/tencent/devops/common/api/constant/CommonConstants.kt index 421d1cc9bd8..58865e82dd3 100644 --- a/src/backend/ci/core/common/common-api/src/main/kotlin/com/tencent/devops/common/api/constant/CommonConstants.kt +++ b/src/backend/ci/core/common/common-api/src/main/kotlin/com/tencent/devops/common/api/constant/CommonConstants.kt @@ -104,6 +104,7 @@ const val OR = "or" // 或 const val TIMETOSELECT = "timetoSelect" // 时必选 const val MASTER = "master" // 主干 const val SYSTEM = "system" // 系统 +const val IN_READY_TEST = "IN_READY_TEST" // 正在测试中 const val BUILD_RUNNING = "buildRunning" // 运行中 const val BUILD_QUEUE = "buildQueue" // 构建排队中 const val BUILD_REVIEWING = "buildReviewing" // 构建待审核 diff --git a/src/backend/ci/core/quality/api-quality/src/main/kotlin/com/tencent/devops/quality/api/v2/ServiceQualityControlPointMarketResource.kt b/src/backend/ci/core/quality/api-quality/src/main/kotlin/com/tencent/devops/quality/api/v2/ServiceQualityControlPointMarketResource.kt index 890d453f72f..50a16fb8d07 100644 --- a/src/backend/ci/core/quality/api-quality/src/main/kotlin/com/tencent/devops/quality/api/v2/ServiceQualityControlPointMarketResource.kt +++ b/src/backend/ci/core/quality/api-quality/src/main/kotlin/com/tencent/devops/quality/api/v2/ServiceQualityControlPointMarketResource.kt @@ -52,6 +52,8 @@ interface ServiceQualityControlPointMarketResource { fun setTestControlPoint( @QueryParam("userId") userId: String, + @QueryParam("tag") + tag: String, controlPoint: QualityControlPoint ): Result @@ -68,6 +70,8 @@ interface ServiceQualityControlPointMarketResource { @DELETE fun deleteTestControlPoint( @QueryParam("elementType") - elementType: String + elementType: String, + @QueryParam("tag") + tag: String ): Result } diff --git a/src/backend/ci/core/quality/api-quality/src/main/kotlin/com/tencent/devops/quality/api/v2/ServiceQualityIndicatorMarketResource.kt b/src/backend/ci/core/quality/api-quality/src/main/kotlin/com/tencent/devops/quality/api/v2/ServiceQualityIndicatorMarketResource.kt index 0aa06ccc9e1..571e38c4773 100644 --- a/src/backend/ci/core/quality/api-quality/src/main/kotlin/com/tencent/devops/quality/api/v2/ServiceQualityIndicatorMarketResource.kt +++ b/src/backend/ci/core/quality/api-quality/src/main/kotlin/com/tencent/devops/quality/api/v2/ServiceQualityIndicatorMarketResource.kt @@ -54,6 +54,8 @@ interface ServiceQualityIndicatorMarketResource { userId: String, @QueryParam("atomCode") atomCode: String, + @QueryParam("tag") + tag: String, indicatorUpdateList: Collection ): Result @@ -71,6 +73,8 @@ interface ServiceQualityIndicatorMarketResource { @DELETE fun deleteTestIndicator( @QueryParam("elementType") - elementType: String + elementType: String, + @QueryParam("extra") + extra: String ): Result } diff --git a/src/backend/ci/core/quality/api-quality/src/main/kotlin/com/tencent/devops/quality/api/v2/ServiceQualityMetadataMarketResource.kt b/src/backend/ci/core/quality/api-quality/src/main/kotlin/com/tencent/devops/quality/api/v2/ServiceQualityMetadataMarketResource.kt index f1f5b8e0c6d..ebdf485b0f5 100644 --- a/src/backend/ci/core/quality/api-quality/src/main/kotlin/com/tencent/devops/quality/api/v2/ServiceQualityMetadataMarketResource.kt +++ b/src/backend/ci/core/quality/api-quality/src/main/kotlin/com/tencent/devops/quality/api/v2/ServiceQualityMetadataMarketResource.kt @@ -46,7 +46,7 @@ import javax.ws.rs.core.MediaType @Consumes(MediaType.APPLICATION_JSON) interface ServiceQualityMetadataMarketResource { - @ApiOperation("注册插件指标的元数据") + @ApiOperation("注册插件指标的测试元数据") @Path("/setMetadata") @POST fun setTestMetadata( @@ -54,6 +54,8 @@ interface ServiceQualityMetadataMarketResource { userId: String, @QueryParam("atomCode") atomCode: String, + @QueryParam("extra") + extra: String, metadataList: List ): Result> @@ -70,6 +72,8 @@ interface ServiceQualityMetadataMarketResource { @DELETE fun deleteTestMetadata( @QueryParam("elementType") - elementType: String + elementType: String, + @QueryParam("extra") + extra: String ): Result } diff --git a/src/backend/ci/core/quality/biz-quality/src/main/kotlin/com/tencent/devops/quality/dao/v2/QualityControlPointDao.kt b/src/backend/ci/core/quality/biz-quality/src/main/kotlin/com/tencent/devops/quality/dao/v2/QualityControlPointDao.kt index a1b86856e3d..f40e9b06acd 100644 --- a/src/backend/ci/core/quality/biz-quality/src/main/kotlin/com/tencent/devops/quality/dao/v2/QualityControlPointDao.kt +++ b/src/backend/ci/core/quality/biz-quality/src/main/kotlin/com/tencent/devops/quality/dao/v2/QualityControlPointDao.kt @@ -27,6 +27,7 @@ package com.tencent.devops.quality.dao.v2 +import com.tencent.devops.common.api.constant.IN_READY_TEST import com.tencent.devops.common.api.util.HashUtil import com.tencent.devops.common.api.util.PageUtil import com.tencent.devops.model.quality.tables.TQualityControlPoint @@ -63,7 +64,7 @@ class QualityControlPointDao { val sqlLimit = PageUtil.convertPageSizeToSQLLimit(page, pageSize) with(TQualityControlPoint.T_QUALITY_CONTROL_POINT) { return dslContext.selectFrom(this) - .where((TAG.isNull).or(TAG.ne("IN_READY_TEST"))) + .where((TAG.isNull).or(TAG.notContains(IN_READY_TEST))) .orderBy(CREATE_TIME.desc()) .limit(sqlLimit.offset, sqlLimit.limit) .fetch() @@ -82,7 +83,7 @@ class QualityControlPointDao { fun count(dslContext: DSLContext): Long { with(TQualityControlPoint.T_QUALITY_CONTROL_POINT) { return dslContext.selectCount().from(this) - .where((TAG.isNull).or(TAG.ne("IN_READY_TEST"))) + .where((TAG.isNull).or(TAG.notContains(IN_READY_TEST))) .fetchOne(0, Long::class.java)!! } } @@ -110,7 +111,7 @@ class QualityControlPointDao { fun getStages(dslContext: DSLContext): Result> { return with(TQualityControlPoint.T_QUALITY_CONTROL_POINT) { dslContext.select(STAGE).from(this) - .where(STAGE.isNotNull.and(TAG.ne("IN_READY_TEST"))) + .where(STAGE.isNotNull.and(TAG.notContains(IN_READY_TEST))) .groupBy(STAGE) .fetch() } @@ -123,17 +124,22 @@ class QualityControlPointDao { fun getElementNames(dslContext: DSLContext): Result> { return with(TQualityControlPoint.T_QUALITY_CONTROL_POINT) { dslContext.select(ELEMENT_TYPE, NAME).from(this) - .where(NAME.isNotNull.and(TAG.ne("IN_READY_TEST"))) + .where(NAME.isNotNull.and(TAG.notContains(IN_READY_TEST))) .groupBy(ELEMENT_TYPE, NAME) .fetch() } } - fun setTestControlPoint(dslContext: DSLContext, userId: String, controlPoint: QualityControlPoint): Long { + fun setTestControlPoint( + dslContext: DSLContext, + userId: String, + tag: String, + controlPoint: QualityControlPoint + ): Long { var pointId = 0L with(TQualityControlPoint.T_QUALITY_CONTROL_POINT) { val testControlPoint = dslContext.selectFrom(this) - .where(ELEMENT_TYPE.eq(controlPoint.type).and(TAG.eq("IN_READY_TEST"))) + .where(ELEMENT_TYPE.eq(controlPoint.type).and(TAG.eq(tag))) .fetchOne() if (testControlPoint != null) { dslContext.update(this) @@ -177,7 +183,7 @@ class QualityControlPointDao { LocalDateTime.now(), controlPoint.atomVersion, controlPoint.testProject, - "IN_READY_TEST" + tag ).returning(ID).fetchOne()!!.id val hashId = HashUtil.encodeLongId(pointId) dslContext.update(this) @@ -197,8 +203,8 @@ class QualityControlPointDao { .where(ELEMENT_TYPE.eq(elementType)) .fetch() - val testControlPoint = controlPoints.firstOrNull { it.tag == "IN_READY_TEST" } - val prodControlPoint = controlPoints.firstOrNull { it.tag != "IN_READY_TEST" } + val testControlPoint = controlPoints.firstOrNull { it.tag == IN_READY_TEST } + val prodControlPoint = controlPoints.firstOrNull { it.tag != IN_READY_TEST } // 测试为空,代表quality.json被删了,直接把生产的也删了 if (testControlPoint == null) { @@ -227,10 +233,10 @@ class QualityControlPointDao { return 0 } - fun deleteTestControlPoint(dslContext: DSLContext, elementType: String): Int { + fun deleteTestControlPoint(dslContext: DSLContext, elementType: String, tag: String): Int { return with(TQualityControlPoint.T_QUALITY_CONTROL_POINT) { dslContext.deleteFrom(this) - .where(ELEMENT_TYPE.eq(elementType).and(TAG.eq("IN_READY_TEST"))) + .where(ELEMENT_TYPE.eq(elementType).and(TAG.eq(tag))) .execute() } } diff --git a/src/backend/ci/core/quality/biz-quality/src/main/kotlin/com/tencent/devops/quality/resources/v2/ServiceQualityControlPointMarketResourceImpl.kt b/src/backend/ci/core/quality/biz-quality/src/main/kotlin/com/tencent/devops/quality/resources/v2/ServiceQualityControlPointMarketResourceImpl.kt index b707dec692e..5b56af3daf5 100644 --- a/src/backend/ci/core/quality/biz-quality/src/main/kotlin/com/tencent/devops/quality/resources/v2/ServiceQualityControlPointMarketResourceImpl.kt +++ b/src/backend/ci/core/quality/biz-quality/src/main/kotlin/com/tencent/devops/quality/resources/v2/ServiceQualityControlPointMarketResourceImpl.kt @@ -39,15 +39,15 @@ class ServiceQualityControlPointMarketResourceImpl @Autowired constructor( private val controlPointService: QualityControlPointService ) : ServiceQualityControlPointMarketResource { - override fun setTestControlPoint(userId: String, controlPoint: QualityControlPoint): Result { - return Result(controlPointService.setTestControlPoint(userId, controlPoint)) + override fun setTestControlPoint(userId: String, tag: String, controlPoint: QualityControlPoint): Result { + return Result(controlPointService.setTestControlPoint(userId, tag, controlPoint)) } override fun refreshControlPoint(elementType: String): Result { return Result(controlPointService.refreshControlPoint(elementType)) } - override fun deleteTestControlPoint(elementType: String): Result { - return Result(controlPointService.deleteTestControlPoint(elementType)) + override fun deleteTestControlPoint(elementType: String, tag: String): Result { + return Result(controlPointService.deleteTestControlPoint(elementType, tag)) } } diff --git a/src/backend/ci/core/quality/biz-quality/src/main/kotlin/com/tencent/devops/quality/resources/v2/ServiceQualityIndicatorMarketResourceImpl.kt b/src/backend/ci/core/quality/biz-quality/src/main/kotlin/com/tencent/devops/quality/resources/v2/ServiceQualityIndicatorMarketResourceImpl.kt index a245b0118b5..3e04cb20a06 100644 --- a/src/backend/ci/core/quality/biz-quality/src/main/kotlin/com/tencent/devops/quality/resources/v2/ServiceQualityIndicatorMarketResourceImpl.kt +++ b/src/backend/ci/core/quality/biz-quality/src/main/kotlin/com/tencent/devops/quality/resources/v2/ServiceQualityIndicatorMarketResourceImpl.kt @@ -41,16 +41,22 @@ class ServiceQualityIndicatorMarketResourceImpl @Autowired constructor( override fun setTestIndicator( userId: String, atomCode: String, + tag: String, indicatorUpdateList: Collection ): Result { - return Result(qualityIndicatorService.setTestIndicator(userId, atomCode, indicatorUpdateList)) + return Result(qualityIndicatorService.setTestIndicator( + userId = userId, + elementType = atomCode, + tag = tag, + indicatorUpdateList = indicatorUpdateList + )) } override fun refreshIndicator(elementType: String, metadataMap: Map): Result { return Result(qualityIndicatorService.serviceRefreshIndicator(elementType, metadataMap)) } - override fun deleteTestIndicator(elementType: String): Result { - return Result(qualityIndicatorService.serviceDeleteTestIndicator(elementType)) + override fun deleteTestIndicator(elementType: String, extra: String): Result { + return Result(qualityIndicatorService.serviceDeleteTestIndicator(elementType, extra)) } } diff --git a/src/backend/ci/core/quality/biz-quality/src/main/kotlin/com/tencent/devops/quality/resources/v2/ServiceQualityMetadataMarketResourceImpl.kt b/src/backend/ci/core/quality/biz-quality/src/main/kotlin/com/tencent/devops/quality/resources/v2/ServiceQualityMetadataMarketResourceImpl.kt index 41c21242058..1f657c46b88 100644 --- a/src/backend/ci/core/quality/biz-quality/src/main/kotlin/com/tencent/devops/quality/resources/v2/ServiceQualityMetadataMarketResourceImpl.kt +++ b/src/backend/ci/core/quality/biz-quality/src/main/kotlin/com/tencent/devops/quality/resources/v2/ServiceQualityMetadataMarketResourceImpl.kt @@ -41,16 +41,22 @@ class ServiceQualityMetadataMarketResourceImpl @Autowired constructor( override fun setTestMetadata( userId: String, atomCode: String, + extra: String, metadataList: List ): Result> { - return Result(qualityMetadataService.serviceSetTestMetadata(userId, atomCode, metadataList)) + return Result(qualityMetadataService.serviceSetTestMetadata( + userId = userId, + elementType = atomCode, + extra = extra, + metadataList = metadataList + )) } override fun refreshMetadata(elementType: String): Result> { return Result(qualityMetadataService.serviceRefreshMetadata(elementType)) } - override fun deleteTestMetadata(elementType: String): Result { - return Result(qualityMetadataService.serviceDeleteTestMetadata(elementType)) + override fun deleteTestMetadata(elementType: String, extra: String): Result { + return Result(qualityMetadataService.serviceDeleteTestMetadata(elementType, extra)) } } diff --git a/src/backend/ci/core/quality/biz-quality/src/main/kotlin/com/tencent/devops/quality/service/v2/QualityControlPointService.kt b/src/backend/ci/core/quality/biz-quality/src/main/kotlin/com/tencent/devops/quality/service/v2/QualityControlPointService.kt index 89ceda93a86..0815b447ffe 100644 --- a/src/backend/ci/core/quality/biz-quality/src/main/kotlin/com/tencent/devops/quality/service/v2/QualityControlPointService.kt +++ b/src/backend/ci/core/quality/biz-quality/src/main/kotlin/com/tencent/devops/quality/service/v2/QualityControlPointService.kt @@ -235,9 +235,14 @@ class QualityControlPointService @Autowired constructor( return controlPoint != null && controlPoint.atomVersion <= atomVersion } - fun setTestControlPoint(userId: String, controlPoint: QualityControlPoint): Long { - logger.info("QUALITY|setTestControlPoint userId: $userId, controlPoint: ${controlPoint.type}") - return controlPointDao.setTestControlPoint(dslContext, userId, controlPoint) + fun setTestControlPoint(userId: String, tag: String, controlPoint: QualityControlPoint): Long { + logger.info("QUALITY|setTestControlPoint userId: $userId, controlPoint: ${controlPoint.type} | tag:$tag") + return controlPointDao.setTestControlPoint( + dslContext = dslContext, + userId = userId, + controlPoint = controlPoint, + tag = tag + ) } fun refreshControlPoint(elementType: String): Int { @@ -245,9 +250,9 @@ class QualityControlPointService @Autowired constructor( return controlPointDao.refreshControlPoint(dslContext, elementType) } - fun deleteTestControlPoint(elementType: String): Int { - logger.info("QUALITY|deleteTestControlPoint controlPoint: $elementType") - return controlPointDao.deleteTestControlPoint(dslContext, elementType) + fun deleteTestControlPoint(elementType: String, tag: String): Int { + logger.info("QUALITY|deleteTestControlPoint controlPoint: $elementType | tag:$tag") + return controlPointDao.deleteTestControlPoint(dslContext, elementType, tag) } fun deleteControlPoint(id: Long): Int { diff --git a/src/backend/ci/core/quality/biz-quality/src/main/kotlin/com/tencent/devops/quality/service/v2/QualityIndicatorService.kt b/src/backend/ci/core/quality/biz-quality/src/main/kotlin/com/tencent/devops/quality/service/v2/QualityIndicatorService.kt index 1c785807ed5..294cfa06b7e 100644 --- a/src/backend/ci/core/quality/biz-quality/src/main/kotlin/com/tencent/devops/quality/service/v2/QualityIndicatorService.kt +++ b/src/backend/ci/core/quality/biz-quality/src/main/kotlin/com/tencent/devops/quality/service/v2/QualityIndicatorService.kt @@ -30,6 +30,7 @@ package com.tencent.devops.quality.service.v2 import com.fasterxml.jackson.core.type.TypeReference import com.google.common.collect.Maps import com.tencent.devops.common.api.constant.DEVELOP +import com.tencent.devops.common.api.constant.IN_READY_TEST import com.tencent.devops.common.api.exception.OperationException import com.tencent.devops.common.api.pojo.Page import com.tencent.devops.common.api.util.HashUtil @@ -515,10 +516,15 @@ class QualityIndicatorService @Autowired constructor( return convertRecord(record, metadata) } - fun setTestIndicator(userId: String, elementType: String, indicatorUpdateList: Collection): Int { + fun setTestIndicator( + userId: String, + elementType: String, + tag: String, + indicatorUpdateList: Collection + ): Int { logger.info("QUALITY|setTestIndicator userId: $userId, elementType: $elementType") val testIndicatorList = indicatorDao.listByElementType(dslContext, elementType, IndicatorType.MARKET) - ?.filter { isTestIndicator(it) } ?: listOf() + ?.filter { isTestIndicator(tag, it) } ?: listOf() val testIndicatorMap = testIndicatorList.map { it.enName to it }.toMap() val lastIndicatorName = testIndicatorList.map { it.enName } val newIndicatorName = indicatorUpdateList.map { it.enName } @@ -544,8 +550,8 @@ class QualityIndicatorService @Autowired constructor( fun serviceRefreshIndicator(elementType: String, metadataMap: Map): Int { logger.info("QUALITY|refreshIndicator elementType: $elementType") val data = indicatorDao.listByElementType(dslContext, elementType, IndicatorType.MARKET) - val testData = data?.filter { isTestIndicator(it) } ?: listOf() - val prodData = data?.filter { !isTestIndicator(it) } ?: listOf() + val testData = data?.filter { isTestIndicator(IN_READY_TEST, it) } ?: listOf() + val prodData = data?.filter { !isTestIndicator(IN_READY_TEST, it) } ?: listOf() val userId = testData.firstOrNull()?.createUser ?: "" // 有则update @@ -615,10 +621,10 @@ class QualityIndicatorService @Autowired constructor( return testData.size } - fun serviceDeleteTestIndicator(elementType: String): Int { + fun serviceDeleteTestIndicator(elementType: String, extra: String): Int { logger.info("QUALITY|deleteTestIndicator elementType: $elementType") val data = indicatorDao.listByElementType(dslContext, elementType) - val testData = data?.filter { isTestIndicator(it) } ?: listOf() + val testData = data?.filter { isTestIndicator(extra, it) } ?: listOf() return indicatorDao.delete(testData.map { it.id }, dslContext) } @@ -649,8 +655,8 @@ class QualityIndicatorService @Autowired constructor( return result.filter { it.enable } } - private fun isTestIndicator(qualityIndicator: TQualityIndicatorRecord): Boolean { - return qualityIndicator.type == IndicatorType.MARKET.name && qualityIndicator.tag == "IN_READY_TEST" + private fun isTestIndicator(tag: String, qualityIndicator: TQualityIndicatorRecord): Boolean { + return qualityIndicator.type == IndicatorType.MARKET.name && qualityIndicator.tag == tag } private fun convertRecord( @@ -872,4 +878,8 @@ class QualityIndicatorService @Autowired constructor( "BKCHECK-CPP" to I18nUtil.getCodeLanMessage(BK_TOOL_NAME_BKCHECK_CPP), "BKCHECK-OC" to I18nUtil.getCodeLanMessage(BK_TOOL_NAME_BKCHECK_OC)) } + + private fun isTestIndicator(qualityIndicator: TQualityIndicatorRecord): Boolean { + return qualityIndicator.type == IndicatorType.MARKET.name && qualityIndicator.tag.startsWith(IN_READY_TEST) + } } diff --git a/src/backend/ci/core/quality/biz-quality/src/main/kotlin/com/tencent/devops/quality/service/v2/QualityMetadataService.kt b/src/backend/ci/core/quality/biz-quality/src/main/kotlin/com/tencent/devops/quality/service/v2/QualityMetadataService.kt index 5309c9dbefc..b1b3dcddd23 100644 --- a/src/backend/ci/core/quality/biz-quality/src/main/kotlin/com/tencent/devops/quality/service/v2/QualityMetadataService.kt +++ b/src/backend/ci/core/quality/biz-quality/src/main/kotlin/com/tencent/devops/quality/service/v2/QualityMetadataService.kt @@ -28,6 +28,7 @@ package com.tencent.devops.quality.service.v2 import com.fasterxml.jackson.core.type.TypeReference +import com.tencent.devops.common.api.constant.IN_READY_TEST import com.tencent.devops.common.api.pojo.Page import com.tencent.devops.common.api.util.HashUtil import com.tencent.devops.common.api.util.JsonUtil @@ -185,10 +186,11 @@ class QualityMetadataService @Autowired constructor( fun serviceSetTestMetadata( userId: String, elementType: String, + extra: String, metadataList: List ): Map { logger.info("QUALITY|setTestMetadata userId: $userId, elementType: $elementType") - val data = metadataDao.listByElementType(dslContext, elementType)?.filter { it.extra == "IN_READY_TEST" } + val data = metadataDao.listByElementType(dslContext, elementType)?.filter { it.extra == extra } val lastMetadataIdMap = data?.map { it.dataId to it.id }?.toMap() ?: mapOf() val newDataId = metadataList.map { it.dataId!! } val lastDataId = lastMetadataIdMap.keys @@ -213,8 +215,8 @@ class QualityMetadataService @Autowired constructor( fun serviceRefreshMetadata(elementType: String): Map { logger.info("QUALITY|refreshMetadata elementType: $elementType") val data = metadataDao.listByElementType(dslContext, elementType) - val testData = data?.filter { it.extra == "IN_READY_TEST" } ?: listOf() - val prodData = data?.filter { it.extra != "IN_READY_TEST" } ?: listOf() + val testData = data?.filter { it.extra == IN_READY_TEST } ?: listOf() + val prodData = data?.filter { it.extra != IN_READY_TEST } ?: listOf() val userId = testData.firstOrNull()?.createUser ?: "" val resultMap = mutableMapOf() @@ -266,10 +268,10 @@ class QualityMetadataService @Autowired constructor( return resultMap } - fun serviceDeleteTestMetadata(elementType: String): Int { - logger.info("QUALITY|deleteTestMetadata elementType: $elementType") + fun serviceDeleteTestMetadata(elementType: String, extra: String): Int { + logger.info("QUALITY|deleteTestMetadata elementType: $elementType | extra:$extra") val data = metadataDao.listByElementType(dslContext, elementType) - val testData = data?.filter { it.extra == "IN_READY_TEST" } ?: listOf() + val testData = data?.filter { it.extra == extra } ?: listOf() return metadataDao.delete(testData.map { it.id }, dslContext) } diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomQualityServiceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomQualityServiceImpl.kt index a5cc1ec067d..0d7926a79d7 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomQualityServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomQualityServiceImpl.kt @@ -27,6 +27,7 @@ package com.tencent.devops.store.service.atom.impl +import com.tencent.devops.common.api.constant.IN_READY_TEST import com.tencent.devops.common.client.Client import com.tencent.devops.common.redis.RedisLock import com.tencent.devops.common.redis.RedisOperation @@ -71,8 +72,8 @@ class AtomQualityServiceImpl @Autowired constructor( client.get(ServiceQualityControlPointMarketResource::class).refreshControlPoint(atomCode) } // 删除测试数据 - client.get(ServiceQualityMetadataMarketResource::class).deleteTestMetadata(atomCode) - client.get(ServiceQualityIndicatorMarketResource::class).deleteTestIndicator(atomCode) + client.get(ServiceQualityMetadataMarketResource::class).deleteTestMetadata(atomCode, IN_READY_TEST) + client.get(ServiceQualityIndicatorMarketResource::class).deleteTestIndicator(atomCode, IN_READY_TEST) client.get(ServiceQualityControlPointMarketResource::class).deleteTestControlPoint(atomCode) } finally { lock.unlock() diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt index 855082b8e08..96541842dfa 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt @@ -31,6 +31,7 @@ import com.fasterxml.jackson.core.type.TypeReference import com.tencent.devops.common.api.constant.CommonMessageCode import com.tencent.devops.common.api.constant.DEPLOY import com.tencent.devops.common.api.constant.DEVELOP +import com.tencent.devops.common.api.constant.IN_READY_TEST import com.tencent.devops.common.api.constant.KEY_DEFAULT_LOCALE_LANGUAGE import com.tencent.devops.common.api.constant.KEY_REPOSITORY_HASH_ID import com.tencent.devops.common.api.constant.MASTER @@ -724,7 +725,8 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ userId = userId, atomCode = atomCode, atomName = atomName, - indicators = indicators + indicators = indicators, + version = if (branch == MASTER) null else atomVersion ) // 再注册指标 @@ -751,10 +753,12 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ GetAtomQualityConfigResult("0", arrayOf("")) } else { + val extra = if (atomVersion.startsWith(TEST)) "$IN_READY_TEST($atomVersion)" else IN_READY_TEST try { - client.get(ServiceQualityIndicatorMarketResource::class).deleteTestIndicator(atomCode) - client.get(ServiceQualityMetadataMarketResource::class).deleteTestMetadata(atomCode) - client.get(ServiceQualityControlPointMarketResource::class).deleteTestControlPoint(atomCode) + client.get(ServiceQualityIndicatorMarketResource::class) + .deleteTestIndicator(atomCode, extra) + client.get(ServiceQualityMetadataMarketResource::class).deleteTestMetadata(atomCode, extra) + client.get(ServiceQualityControlPointMarketResource::class).deleteTestControlPoint(atomCode, extra) } catch (ignored: Throwable) { logger.warn("clear atom:$atomCode test quality data fail", ignored) } @@ -794,10 +798,12 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ projectId: String ) { client.get(ServiceQualityControlPointMarketResource::class).setTestControlPoint( - userId, QualityControlPoint( + userId = userId, + tag = if (atomVersion.startsWith(TEST)) "$IN_READY_TEST($atomVersion)" else IN_READY_TEST, + controlPoint = QualityControlPoint( hashId = "", type = atomCode, - name = atomName, + name = if (atomVersion.startsWith(TEST)) "$atomName($atomVersion)" else atomName, stage = stage, availablePos = listOf( ControlPointPosition.create(BEFORE_POSITION), @@ -822,13 +828,14 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ metadataResultMap: Map, indicators: Map ) { + val tag = if (atomVersion.startsWith(TEST)) "$IN_READY_TEST($atomVersion)" else IN_READY_TEST val indicatorsList = indicators.map { val map = it.value as Map val type = map["type"] as String? val valueType = map["valueType"] as String? IndicatorUpdate( elementType = atomCode, - elementName = atomName, + elementName = if (atomVersion.startsWith(TEST)) "$atomName($atomVersion)" else atomName, elementDetail = if (type.isNullOrBlank()) atomCode else type, elementVersion = atomVersion, enName = it.key, @@ -842,13 +849,18 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ readOnly = map["readOnly"] as Boolean? ?: false, stage = stage, range = projectId, - tag = "IN_READY_TEST", + tag = tag, enable = true, type = IndicatorType.MARKET, logPrompt = map["logPrompt"] as? String ?: "" ) } - client.get(ServiceQualityIndicatorMarketResource::class).setTestIndicator(userId, atomCode, indicatorsList) + client.get(ServiceQualityIndicatorMarketResource::class).setTestIndicator( + userId = userId, + atomCode = atomCode, + tag = tag, + indicatorUpdateList = indicatorsList + ) } @Suppress("UNCHECKED_CAST") @@ -856,8 +868,11 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ userId: String, atomCode: String, atomName: String, - indicators: Map + indicators: Map, + version: String? ): Map { + val extra = version?.let { "$IN_READY_TEST($version)" } ?: IN_READY_TEST // 标注是正在测试中的 + val name = version?.let { "$atomName($version)" } ?: atomName val metadataList = indicators.map { val map = it.value as Map val type = map["type"] as String? @@ -866,16 +881,17 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ dataId = it.key, dataName = map["label"] as String, elementType = atomCode, - elementName = atomName, + elementName = name, elementDetail = if (type.isNullOrBlank()) atomCode else type, valueType = map["valueType"] as String? ?: "INT", desc = map["desc"] as String? ?: "", - extra = "IN_READY_TEST" // 标注是正在测试中的 + extra = extra ) } return client.get(ServiceQualityMetadataMarketResource::class).setTestMetadata( userId = userId, atomCode = atomCode, + extra = extra, metadataList = metadataList ).data ?: mapOf() } @@ -1058,9 +1074,9 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ // 通过websocket推送状态变更消息 storeWebsocketService.sendWebsocketMessage(userId, atomId) // 删除质量红线相关数据 - client.get(ServiceQualityIndicatorMarketResource::class).deleteTestIndicator(atomCode) - client.get(ServiceQualityMetadataMarketResource::class).deleteTestMetadata(atomCode) - client.get(ServiceQualityControlPointMarketResource::class).deleteTestControlPoint(atomCode) + client.get(ServiceQualityIndicatorMarketResource::class).deleteTestIndicator(atomCode, IN_READY_TEST) + client.get(ServiceQualityMetadataMarketResource::class).deleteTestMetadata(atomCode, IN_READY_TEST) + client.get(ServiceQualityControlPointMarketResource::class).deleteTestControlPoint(atomCode, IN_READY_TEST) return Result(true) } From 1f700dbd20f7509338496936a40b5d26185383b1 Mon Sep 17 00:00:00 2001 From: yjieliang Date: Tue, 24 Oct 2023 18:34:21 +0800 Subject: [PATCH 25/73] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../v2/ServiceQualityControlPointMarketResourceImpl.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/ci/core/quality/biz-quality/src/main/kotlin/com/tencent/devops/quality/resources/v2/ServiceQualityControlPointMarketResourceImpl.kt b/src/backend/ci/core/quality/biz-quality/src/main/kotlin/com/tencent/devops/quality/resources/v2/ServiceQualityControlPointMarketResourceImpl.kt index 5b56af3daf5..339d526fdfc 100644 --- a/src/backend/ci/core/quality/biz-quality/src/main/kotlin/com/tencent/devops/quality/resources/v2/ServiceQualityControlPointMarketResourceImpl.kt +++ b/src/backend/ci/core/quality/biz-quality/src/main/kotlin/com/tencent/devops/quality/resources/v2/ServiceQualityControlPointMarketResourceImpl.kt @@ -39,7 +39,7 @@ class ServiceQualityControlPointMarketResourceImpl @Autowired constructor( private val controlPointService: QualityControlPointService ) : ServiceQualityControlPointMarketResource { - override fun setTestControlPoint(userId: String, tag: String, controlPoint: QualityControlPoint): Result { + override fun setTestControlPoint(userId: String, tag: String, controlPoint: QualityControlPoint): Result { return Result(controlPointService.setTestControlPoint(userId, tag, controlPoint)) } From 764b389f4a0fc18c53a88c94761c1ddd75f48482 Mon Sep 17 00:00:00 2001 From: yjieliang Date: Wed, 25 Oct 2023 10:32:14 +0800 Subject: [PATCH 26/73] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../devops/store/service/atom/impl/AtomQualityServiceImpl.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomQualityServiceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomQualityServiceImpl.kt index 0d7926a79d7..fc027fc096f 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomQualityServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomQualityServiceImpl.kt @@ -74,7 +74,7 @@ class AtomQualityServiceImpl @Autowired constructor( // 删除测试数据 client.get(ServiceQualityMetadataMarketResource::class).deleteTestMetadata(atomCode, IN_READY_TEST) client.get(ServiceQualityIndicatorMarketResource::class).deleteTestIndicator(atomCode, IN_READY_TEST) - client.get(ServiceQualityControlPointMarketResource::class).deleteTestControlPoint(atomCode) + client.get(ServiceQualityControlPointMarketResource::class).deleteTestControlPoint(atomCode, IN_READY_TEST) } finally { lock.unlock() } From 7631b0af3ecb071863a63cd903e860bfa24ca4e5 Mon Sep 17 00:00:00 2001 From: yjieliang Date: Wed, 25 Oct 2023 14:55:32 +0800 Subject: [PATCH 27/73] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../devops/quality/service/v2/QualityControlPointService.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/backend/ci/core/quality/biz-quality/src/main/kotlin/com/tencent/devops/quality/service/v2/QualityControlPointService.kt b/src/backend/ci/core/quality/biz-quality/src/main/kotlin/com/tencent/devops/quality/service/v2/QualityControlPointService.kt index 0815b447ffe..7bd19c8a408 100644 --- a/src/backend/ci/core/quality/biz-quality/src/main/kotlin/com/tencent/devops/quality/service/v2/QualityControlPointService.kt +++ b/src/backend/ci/core/quality/biz-quality/src/main/kotlin/com/tencent/devops/quality/service/v2/QualityControlPointService.kt @@ -166,6 +166,7 @@ class QualityControlPointService @Autowired constructor( val elements = ElementUtils.getProjectElement(projectId).keys val recordList = controlPointDao.list(dslContext, elements) val controlPointList = serviceListFilter(recordList, projectId) ?: return listOf() + logger.info("serviceList projectId:$projectId controlPointList:$controlPointList") return controlPointList.filter { it.elementType in elements } .map { QualityControlPoint( From 3d23ea80ef1d367d73bf681135392b189fb4bdc8 Mon Sep 17 00:00:00 2001 From: yjieliang Date: Wed, 25 Oct 2023 15:18:10 +0800 Subject: [PATCH 28/73] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../devops/quality/service/v2/QualityControlPointService.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/src/backend/ci/core/quality/biz-quality/src/main/kotlin/com/tencent/devops/quality/service/v2/QualityControlPointService.kt b/src/backend/ci/core/quality/biz-quality/src/main/kotlin/com/tencent/devops/quality/service/v2/QualityControlPointService.kt index 7bd19c8a408..0815b447ffe 100644 --- a/src/backend/ci/core/quality/biz-quality/src/main/kotlin/com/tencent/devops/quality/service/v2/QualityControlPointService.kt +++ b/src/backend/ci/core/quality/biz-quality/src/main/kotlin/com/tencent/devops/quality/service/v2/QualityControlPointService.kt @@ -166,7 +166,6 @@ class QualityControlPointService @Autowired constructor( val elements = ElementUtils.getProjectElement(projectId).keys val recordList = controlPointDao.list(dslContext, elements) val controlPointList = serviceListFilter(recordList, projectId) ?: return listOf() - logger.info("serviceList projectId:$projectId controlPointList:$controlPointList") return controlPointList.filter { it.elementType in elements } .map { QualityControlPoint( From aed410305aaea4f1ec8f0aa3f9af0073e11ffd99 Mon Sep 17 00:00:00 2001 From: yjieliang Date: Wed, 25 Oct 2023 15:23:29 +0800 Subject: [PATCH 29/73] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../devops/quality/service/v2/QualityControlPointService.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/backend/ci/core/quality/biz-quality/src/main/kotlin/com/tencent/devops/quality/service/v2/QualityControlPointService.kt b/src/backend/ci/core/quality/biz-quality/src/main/kotlin/com/tencent/devops/quality/service/v2/QualityControlPointService.kt index 0815b447ffe..dd46f7d0be4 100644 --- a/src/backend/ci/core/quality/biz-quality/src/main/kotlin/com/tencent/devops/quality/service/v2/QualityControlPointService.kt +++ b/src/backend/ci/core/quality/biz-quality/src/main/kotlin/com/tencent/devops/quality/service/v2/QualityControlPointService.kt @@ -166,6 +166,7 @@ class QualityControlPointService @Autowired constructor( val elements = ElementUtils.getProjectElement(projectId).keys val recordList = controlPointDao.list(dslContext, elements) val controlPointList = serviceListFilter(recordList, projectId) ?: return listOf() + logger.info("serviceList projectId:$projectId controlPointList:${controlPointList.map { it.elementType }}") return controlPointList.filter { it.elementType in elements } .map { QualityControlPoint( From 60c6ef04f087551e7ccb1c53d67d6bfbb15b2384 Mon Sep 17 00:00:00 2001 From: yjieliang Date: Wed, 25 Oct 2023 15:48:18 +0800 Subject: [PATCH 30/73] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../quality/service/v2/QualityControlPointService.kt | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/backend/ci/core/quality/biz-quality/src/main/kotlin/com/tencent/devops/quality/service/v2/QualityControlPointService.kt b/src/backend/ci/core/quality/biz-quality/src/main/kotlin/com/tencent/devops/quality/service/v2/QualityControlPointService.kt index dd46f7d0be4..bcf63e5def2 100644 --- a/src/backend/ci/core/quality/biz-quality/src/main/kotlin/com/tencent/devops/quality/service/v2/QualityControlPointService.kt +++ b/src/backend/ci/core/quality/biz-quality/src/main/kotlin/com/tencent/devops/quality/service/v2/QualityControlPointService.kt @@ -113,13 +113,11 @@ class QualityControlPointService @Autowired constructor( ): List? { val filterResult = mutableListOf() // 获取生产跑的,或者测试项目对应的 - controlPointRecords.groupBy { it.elementType }.forEach { elementType, list -> - val testControlPoint = list.firstOrNull { it.testProject == projectId } - val prodControlPoint = list.firstOrNull { it.testProject.isNullOrBlank() } - if (testControlPoint != null) { - filterResult.add(testControlPoint) + controlPointRecords.forEach { + if (it.testProject == projectId) { + filterResult.add(it) } else { - if (prodControlPoint != null) filterResult.add(prodControlPoint) + if (it.testProject.isNullOrBlank()) filterResult.add(it) } } return filterResult From 7b9961246cebc3eb8ffe72514dff1c2f292ac1dd Mon Sep 17 00:00:00 2001 From: yjieliang Date: Wed, 25 Oct 2023 21:31:46 +0800 Subject: [PATCH 31/73] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../quality/service/v2/QualityControlPointService.kt | 1 - .../tencent/devops/store/api/atom/BuildAtomResource.kt | 8 ++++---- .../tencent/devops/store/pojo/common/StoreConstants.kt | 1 - .../com/tencent/devops/store/dao/atom/AtomBaseDao.kt | 3 +-- .../com/tencent/devops/store/dao/atom/MarketAtomDao.kt | 5 ++--- .../store/service/atom/impl/AtomReleaseServiceImpl.kt | 7 +++---- 6 files changed, 10 insertions(+), 15 deletions(-) diff --git a/src/backend/ci/core/quality/biz-quality/src/main/kotlin/com/tencent/devops/quality/service/v2/QualityControlPointService.kt b/src/backend/ci/core/quality/biz-quality/src/main/kotlin/com/tencent/devops/quality/service/v2/QualityControlPointService.kt index bcf63e5def2..04cd379569e 100644 --- a/src/backend/ci/core/quality/biz-quality/src/main/kotlin/com/tencent/devops/quality/service/v2/QualityControlPointService.kt +++ b/src/backend/ci/core/quality/biz-quality/src/main/kotlin/com/tencent/devops/quality/service/v2/QualityControlPointService.kt @@ -164,7 +164,6 @@ class QualityControlPointService @Autowired constructor( val elements = ElementUtils.getProjectElement(projectId).keys val recordList = controlPointDao.list(dslContext, elements) val controlPointList = serviceListFilter(recordList, projectId) ?: return listOf() - logger.info("serviceList projectId:$projectId controlPointList:${controlPointList.map { it.elementType }}") return controlPointList.filter { it.elementType in elements } .map { QualityControlPoint( diff --git a/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/api/atom/BuildAtomResource.kt b/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/api/atom/BuildAtomResource.kt index 9237112d9b9..cfd6a60fa35 100644 --- a/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/api/atom/BuildAtomResource.kt +++ b/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/api/atom/BuildAtomResource.kt @@ -65,8 +65,8 @@ interface BuildAtomResource { @ApiOperation("使用分支创建插件测试版本") @POST - @Path("/creat/test/version") - fun creatAtomBranchTestVersion( + @Path("/test/version/creat") + fun createAtomBranchTestVersion( @ApiParam("userId", required = true) @HeaderParam(AUTH_HEADER_USER_ID) userId: String, @@ -76,7 +76,7 @@ interface BuildAtomResource { @ApiOperation("结束插件分支测试版本测试") @GET - @Path("/end/atoms/{atomCode}/test/version") + @Path("/atoms/{atomCode}/test/version/end") fun endBranchVersionTest( @ApiParam("userId", required = true) @HeaderParam(AUTH_HEADER_USER_ID) @@ -91,7 +91,7 @@ interface BuildAtomResource { @ApiOperation("根据插件版本ID获取插件版本进度") @GET - @Path("/desk/atom/release/process/{atomId}") + @Path("/desk/atom/release/Ids/{atomId}") fun getProcessInfo( @ApiParam("userId", required = true) @HeaderParam(AUTH_HEADER_USER_ID) diff --git a/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/pojo/common/StoreConstants.kt b/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/pojo/common/StoreConstants.kt index f83b7653f7c..c2ae548dbce 100644 --- a/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/pojo/common/StoreConstants.kt +++ b/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/pojo/common/StoreConstants.kt @@ -172,4 +172,3 @@ const val BK_CODE_QUALITY = "bkCodeQuality" // codecc代码质量 const val BK_TRUSTWORTHY = "bkTrustworthy" // 可信插件 const val BK_TRIGGER = "bkTrigger" // 触发器 const val BK_NORMAL = "bkNormal" // 无编译环境 -const val BRANCH_TEST_VERSION = "branch-test-version" diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomBaseDao.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomBaseDao.kt index e96ff8d83e0..3cf712ba166 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomBaseDao.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomBaseDao.kt @@ -27,7 +27,6 @@ package com.tencent.devops.store.dao.atom -import com.tencent.devops.common.api.constant.TEST import com.tencent.devops.common.db.utils.JooqUtils import com.tencent.devops.model.store.tables.TAtom import com.tencent.devops.model.store.tables.records.TAtomRecord @@ -78,7 +77,7 @@ abstract class AtomBaseDao { fun getNewestAtomByCode(dslContext: DSLContext, atomCode: String): TAtomRecord? { return with(TAtom.T_ATOM) { dslContext.selectFrom(this) - .where(ATOM_CODE.eq(atomCode).and(VERSION.notContains(TEST))) + .where(ATOM_CODE.eq(atomCode).and(BRANCH_TEST_FLAG.eq(false))) .orderBy(CREATE_TIME.desc()) .limit(1) .fetchOne() diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/MarketAtomDao.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/MarketAtomDao.kt index f5cdfec183b..363abcd3948 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/MarketAtomDao.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/MarketAtomDao.kt @@ -28,7 +28,6 @@ package com.tencent.devops.store.dao.atom import com.tencent.devops.common.api.constant.INIT_VERSION -import com.tencent.devops.common.api.constant.TEST import com.tencent.devops.common.api.util.JsonUtil import com.tencent.devops.model.store.tables.TAtom import com.tencent.devops.model.store.tables.TAtomEnvInfo @@ -580,7 +579,7 @@ class MarketAtomDao : AtomBaseDao() { return with(TAtom.T_ATOM) { val baseStep = dslContext.selectFrom(this) .where(ATOM_CODE.eq(atomCode)) - .and(VERSION.notContains(TEST)) + .and(BRANCH_TEST_FLAG.eq(false)) .orderBy(CREATE_TIME.desc()) if (null != page && null != pageSize) { baseStep.limit((page - 1) * pageSize, pageSize).fetch() @@ -613,7 +612,7 @@ class MarketAtomDao : AtomBaseDao() { } } - fun getAtomRecordByVersionPrefix( + fun getAtomBranchTestVersion( dslContext: DSLContext, atomCode: String, versionPrefix: String diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt index 96541842dfa..f445960148a 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt @@ -803,7 +803,7 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ controlPoint = QualityControlPoint( hashId = "", type = atomCode, - name = if (atomVersion.startsWith(TEST)) "$atomName($atomVersion)" else atomName, + name = atomName, stage = stage, availablePos = listOf( ControlPointPosition.create(BEFORE_POSITION), @@ -835,7 +835,7 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ val valueType = map["valueType"] as String? IndicatorUpdate( elementType = atomCode, - elementName = if (atomVersion.startsWith(TEST)) "$atomName($atomVersion)" else atomName, + elementName = atomName, elementDetail = if (type.isNullOrBlank()) atomCode else type, elementVersion = atomVersion, enName = it.key, @@ -872,7 +872,6 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ version: String? ): Map { val extra = version?.let { "$IN_READY_TEST($version)" } ?: IN_READY_TEST // 标注是正在测试中的 - val name = version?.let { "$atomName($version)" } ?: atomName val metadataList = indicators.map { val map = it.value as Map val type = map["type"] as String? @@ -881,7 +880,7 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ dataId = it.key, dataName = map["label"] as String, elementType = atomCode, - elementName = name, + elementName = atomName, elementDetail = if (type.isNullOrBlank()) atomCode else type, valueType = map["valueType"] as String? ?: "INT", desc = map["desc"] as String? ?: "", From 07ef8b64094fab85ae981a0096b97cfabccffa46 Mon Sep 17 00:00:00 2001 From: yjieliang Date: Wed, 25 Oct 2023 21:55:32 +0800 Subject: [PATCH 32/73] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- support-files/sql/1001_ci_store_ddl_mysql.sql | 1 + .../sql/2003_v2.x/2020_ci_store-update_v2.0_mysql.sql | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/support-files/sql/1001_ci_store_ddl_mysql.sql b/support-files/sql/1001_ci_store_ddl_mysql.sql index cab6900e934..1b7c8c24057 100644 --- a/support-files/sql/1001_ci_store_ddl_mysql.sql +++ b/support-files/sql/1001_ci_store_ddl_mysql.sql @@ -84,6 +84,7 @@ CREATE TABLE IF NOT EXISTS `T_ATOM` ( `PRIVATE_REASON` varchar(256) DEFAULT NULL COMMENT '插件代码库不开源原因', `DELETE_FLAG` bit(1) DEFAULT b'0' COMMENT '是否删除', `BRANCH` VARCHAR(128) DEFAULT 'master' COMMENT '代码库分支', + `BRANCH_TEST_FLAG` bit(1) DEFAULT b'0' COMMENT '是否是分支测试版本', PRIMARY KEY (`ID`), UNIQUE KEY `uni_inx_tpca_code_version` (`ATOM_CODE`,`VERSION`), KEY `inx_tpca_service_code` (`SERVICE_SCOPE`(255)), diff --git a/support-files/sql/2003_v2.x/2020_ci_store-update_v2.0_mysql.sql b/support-files/sql/2003_v2.x/2020_ci_store-update_v2.0_mysql.sql index 2c3260b1517..3088090ae9a 100644 --- a/support-files/sql/2003_v2.x/2020_ci_store-update_v2.0_mysql.sql +++ b/support-files/sql/2003_v2.x/2020_ci_store-update_v2.0_mysql.sql @@ -20,6 +20,14 @@ BEGIN ALTER TABLE T_ATOM MODIFY COLUMN VERSION varchar(30) NOT NULL; END IF; + IF NOT EXISTS(SELECT 1 + FROM information_schema.COLUMNS + WHERE TABLE_SCHEMA = db + AND TABLE_NAME = 'T_ATOM' + AND COLUMN_NAME = 'BRANCH_TEST_FLAG') THEN + ALTER TABLE T_ATOM ADD BRANCH_TEST_FLAG bit(1) DEFAULT b'0' NULL COMMENT '是否是分支测试版本'; + END IF; + COMMIT; END DELIMITER ; From f3c0e3565bed6ddf6cc8e50daed2cc7dce443038 Mon Sep 17 00:00:00 2001 From: yjieliang Date: Wed, 25 Oct 2023 22:14:46 +0800 Subject: [PATCH 33/73] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../devops/store/resources/atom/BuildAtomResourceImpl.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/resources/atom/BuildAtomResourceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/resources/atom/BuildAtomResourceImpl.kt index b08f8e1f04a..917c9142e85 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/resources/atom/BuildAtomResourceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/resources/atom/BuildAtomResourceImpl.kt @@ -46,7 +46,7 @@ class BuildAtomResourceImpl @Autowired constructor( return atomService.getAtomDefaultValidVersion(projectCode, atomCode) } - override fun creatAtomBranchTestVersion( + override fun createAtomBranchTestVersion( userId: String, marketAtomUpdateRequest: MarketAtomUpdateRequest ): Result { From 5a895cbb23375a8ca6102f9de469490be0ad6548 Mon Sep 17 00:00:00 2001 From: yjieliang Date: Thu, 26 Oct 2023 15:03:08 +0800 Subject: [PATCH 34/73] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/tencent/devops/store/api/atom/BuildAtomResource.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/api/atom/BuildAtomResource.kt b/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/api/atom/BuildAtomResource.kt index cfd6a60fa35..29568f2a5d4 100644 --- a/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/api/atom/BuildAtomResource.kt +++ b/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/api/atom/BuildAtomResource.kt @@ -65,7 +65,7 @@ interface BuildAtomResource { @ApiOperation("使用分支创建插件测试版本") @POST - @Path("/test/version/creat") + @Path("/test/version/create") fun createAtomBranchTestVersion( @ApiParam("userId", required = true) @HeaderParam(AUTH_HEADER_USER_ID) From df5851d6337a1912f711f754e34405bb3cb26506 Mon Sep 17 00:00:00 2001 From: yjieliang Date: Fri, 3 Nov 2023 16:26:00 +0800 Subject: [PATCH 35/73] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../store/pojo/atom/UpdateAtomPackageInfo.kt | 44 +++++ .../atom/impl/SampleAtomReleaseServiceImpl.kt | 2 +- .../atom/impl/AtomReleaseServiceImpl.kt | 163 +++++++++++++++++- 3 files changed, 206 insertions(+), 3 deletions(-) create mode 100644 src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/pojo/atom/UpdateAtomPackageInfo.kt diff --git a/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/pojo/atom/UpdateAtomPackageInfo.kt b/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/pojo/atom/UpdateAtomPackageInfo.kt new file mode 100644 index 00000000000..3913188b68c --- /dev/null +++ b/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/pojo/atom/UpdateAtomPackageInfo.kt @@ -0,0 +1,44 @@ +/* + * 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.store.pojo.atom + +import com.tencent.devops.store.pojo.common.enums.PackageSourceTypeEnum +import io.swagger.annotations.ApiModel +import io.swagger.annotations.ApiModelProperty + +@ApiModel("升级插件包信息") +data class UpdateAtomPackageInfo( + @ApiModelProperty("插件ID") + val atomId: String, + @ApiModelProperty("国际化资源目录路径") + val i18nDir: String, + @ApiModelProperty("包路径") + val packagePath: String, + @ApiModelProperty("插件包资源类型)") + val atomPackageSourceType: PackageSourceTypeEnum +) diff --git a/src/backend/ci/core/store/biz-store-sample/src/main/kotlin/com/tencent/devops/store/service/atom/impl/SampleAtomReleaseServiceImpl.kt b/src/backend/ci/core/store/biz-store-sample/src/main/kotlin/com/tencent/devops/store/service/atom/impl/SampleAtomReleaseServiceImpl.kt index 1ea881de42c..5fe42c17259 100644 --- a/src/backend/ci/core/store/biz-store-sample/src/main/kotlin/com/tencent/devops/store/service/atom/impl/SampleAtomReleaseServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store-sample/src/main/kotlin/com/tencent/devops/store/service/atom/impl/SampleAtomReleaseServiceImpl.kt @@ -95,7 +95,7 @@ class SampleAtomReleaseServiceImpl : SampleAtomReleaseService, AtomReleaseServic override fun validateUpdateMarketAtomReq( userId: String, marketAtomUpdateRequest: MarketAtomUpdateRequest, - atomRecord: TAtomRecord + repositoryHashId: String? ): Result { // 开源版升级插件暂无特殊参数需要校验 return Result(true) diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt index b3124d0fa98..842a2aea0bb 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt @@ -86,6 +86,7 @@ import com.tencent.devops.store.pojo.atom.GetAtomQualityConfigResult import com.tencent.devops.store.pojo.atom.MarketAtomCreateRequest import com.tencent.devops.store.pojo.atom.MarketAtomUpdateRequest import com.tencent.devops.store.pojo.atom.UpdateAtomInfo +import com.tencent.devops.store.pojo.atom.UpdateAtomPackageInfo import com.tencent.devops.store.pojo.atom.enums.AtomStatusEnum import com.tencent.devops.store.pojo.common.ATOM_POST_VERSION_TEST_FLAG_KEY_PREFIX import com.tencent.devops.store.pojo.common.ATOM_UPLOAD_ID_KEY_PREFIX @@ -430,7 +431,7 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ taskDataMap = taskDataMap, fieldCheckConfirmFlag = convertUpdateRequest.fieldCheckConfirmFlag ) - val validateResult = validateUpdateMarketAtomReq(userId, convertUpdateRequest, atomRecord) + val validateResult = validateUpdateMarketAtomReq(userId, convertUpdateRequest, atomRecord.repositoryHashId) logger.info("validateUpdateMarketAtomReq validateResult is :$validateResult") if (validateResult.isNotOk()) { return Result(validateResult.status, validateResult.message, null) @@ -568,7 +569,7 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ abstract fun validateUpdateMarketAtomReq( userId: String, marketAtomUpdateRequest: MarketAtomUpdateRequest, - atomRecord: TAtomRecord + repositoryHashId: String? ): Result /** @@ -1381,4 +1382,162 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ } } } + + fun updateAtomVersionInfo( + userId: String, + projectCode: String, + newVersionFlag: Boolean, + updateAtomPackageInfo: UpdateAtomPackageInfo, + convertUpdateRequest: MarketAtomUpdateRequest, + getAtomConfResult: GetAtomConfigResult + ): Result { + val atomId = updateAtomPackageInfo.atomId + val atomCode = convertUpdateRequest.atomCode + val version = convertUpdateRequest.version + val branch = convertUpdateRequest.branch + val atomRecord = atomDao.getMaxVersionAtomByCode(dslContext, atomCode)!! + val releaseType = convertUpdateRequest.releaseType + val taskDataMap = storeI18nMessageService.parseJsonMapI18nInfo( + userId = userId, + projectCode = projectCode, + jsonMap = getAtomConfResult.taskDataMap.toMutableMap(), + fileDir = "$atomCode/$version", + i18nDir = updateAtomPackageInfo.i18nDir, + dbKeyPrefix = StoreUtils.getStoreFieldKeyPrefix(StoreTypeEnum.ATOM, atomCode, version), + repositoryHashId = atomRecord.repositoryHashId, + branch = branch, + version = version + ) + // 校验插件发布类型 + marketAtomCommonService.validateReleaseType( + atomId = atomRecord.id, + atomCode = atomCode, + version = version, + releaseType = releaseType, + taskDataMap = taskDataMap, + fieldCheckConfirmFlag = convertUpdateRequest.fieldCheckConfirmFlag + ) + val validateResult = validateUpdateMarketAtomReq(userId, convertUpdateRequest, atomRecord.repositoryHashId) + logger.info("validateUpdateMarketAtomReq validateResult is :$validateResult") + if (validateResult.isNotOk()) { + return Result(validateResult.status, validateResult.message, null) + } + + // 解析quality.json + val getAtomQualityResult = getAtomQualityConfig( + projectCode = projectCode, + atomCode = atomCode, + atomName = convertUpdateRequest.name, + atomVersion = version, + userId = userId, + i18nDir = updateAtomPackageInfo.i18nDir, + repositoryHashId = atomRecord.repositoryHashId, + branch = branch + ) + logger.info("update market atom, getAtomQualityResult: $getAtomQualityResult") + if (getAtomQualityResult.errorCode == StoreMessageCode.USER_REPOSITORY_PULL_QUALITY_JSON_FILE_FAIL) { + logger.info("quality.json not found , skip...") + } else if (getAtomQualityResult.errorCode != "0") { + return I18nUtil.generateResponseDataObject( + messageCode = getAtomQualityResult.errorCode, + params = getAtomQualityResult.errorParams, + language = I18nUtil.getLanguage(userId) + ) + } + + val atomEnvRequests = getAtomConfResult.atomEnvRequests ?: return I18nUtil.generateResponseDataObject( + messageCode = StoreMessageCode.USER_REPOSITORY_TASK_JSON_FIELD_IS_NULL, + params = arrayOf(KEY_EXECUTION), + language = I18nUtil.getLanguage(userId) + ) + val packagePath = updateAtomPackageInfo.packagePath + val atomPackageSourceType = updateAtomPackageInfo.atomPackageSourceType + val classType = if (packagePath.isNullOrBlank() && atomPackageSourceType == PackageSourceTypeEnum.UPLOAD) { + // 没有可执行文件的插件是老的内置插件,插件的classType为插件标识 + atomCode + } else if (convertUpdateRequest.os.isEmpty()) { + MarketBuildLessAtomElement.classType + } else { + MarketBuildAtomElement.classType + } + val propsMap = mutableMapOf() + val inputDataMap = taskDataMap[KEY_INPUT] as? Map + if (convertUpdateRequest.frontendType == FrontendTypeEnum.HISTORY) { + inputDataMap?.let { propsMap.putAll(inputDataMap) } + } else { + propsMap[KEY_INPUT_GROUPS] = taskDataMap[KEY_INPUT_GROUPS] + propsMap[KEY_INPUT] = inputDataMap + propsMap[KEY_OUTPUT] = taskDataMap[KEY_OUTPUT] + propsMap[KEY_CONFIG] = taskDataMap[KEY_CONFIG] + } + convertUpdateRequest.os.sort() // 给操作系统排序 + val atomStatus = + if (atomPackageSourceType == PackageSourceTypeEnum.REPO) { + AtomStatusEnum.COMMITTING + } else AtomStatusEnum.TESTING + dslContext.transaction { t -> + val context = DSL.using(t) + val props = JsonUtil.toJson(propsMap, formatted = false) + if (newVersionFlag) { + updateMarketAtom( + context = context, + userId = userId, + atomId = atomId, + atomStatus = atomStatus, + classType = classType, + props = props, + releaseType = releaseType.releaseType.toByte(), + marketAtomUpdateRequest = convertUpdateRequest, + atomEnvRequests = atomEnvRequests, + repositoryHashId = atomRecord.repositoryHashId + ) + } else { + // 升级插件 + upgradeMarketAtom( + marketAtomUpdateRequest = convertUpdateRequest, + context = context, + userId = userId, + atomId = atomId, + atomStatus = atomStatus, + classType = classType, + props = props, + atomEnvRequests = atomEnvRequests, + atomRecord = atomRecord + ) + } + if (atomStatus == AtomStatusEnum.TESTING) { + // 插件大版本内有测试版本则写入缓存 + redisOperation.hset( + key = "$ATOM_POST_VERSION_TEST_FLAG_KEY_PREFIX:$atomCode", + hashKey = VersionUtils.convertLatestVersion(version), + values = "true" + ) + } + // 更新标签信息 + val labelIdList = convertUpdateRequest.labelIdList?.filter { !it.isNullOrBlank() } + if (null != labelIdList) { + atomLabelRelDao.deleteByAtomId(context, atomId) + if (labelIdList.isNotEmpty()) { + atomLabelRelDao.batchAdd(context, userId = userId, atomId = atomId, labelIdList = labelIdList) + } + } + + // 更新红线标识 + val qualityFlag = getAtomQualityResult.errorCode == "0" + marketAtomFeatureDao.updateAtomFeature( + dslContext = context, + userId = userId, + atomFeatureRequest = AtomFeatureRequest(atomCode = atomCode, qualityFlag = qualityFlag) + ) + asyncHandleUpdateAtom( + context = context, + atomId = atomId, + userId = userId, + branch = branch, + validOsNameFlag = marketAtomCommonService.getValidOsNameFlag(atomEnvRequests), + validOsArchFlag = marketAtomCommonService.getValidOsArchFlag(atomEnvRequests) + ) + } + return Result(atomId) + } } From 2b595ffd604e59b9ca0bea0175ac27e79bd1ef32 Mon Sep 17 00:00:00 2001 From: yjieliang Date: Mon, 6 Nov 2023 09:56:34 +0800 Subject: [PATCH 36/73] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../devops/store/pojo/atom/StoreI18nConfig.kt | 4 +++- .../service/atom/impl/AtomReleaseServiceImpl.kt | 14 ++++++++------ .../common/impl/StoreI18nMessageServiceImpl.kt | 11 ++--------- 3 files changed, 13 insertions(+), 16 deletions(-) diff --git a/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/pojo/atom/StoreI18nConfig.kt b/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/pojo/atom/StoreI18nConfig.kt index 48518cf997d..7cc0e69c701 100644 --- a/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/pojo/atom/StoreI18nConfig.kt +++ b/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/pojo/atom/StoreI18nConfig.kt @@ -43,5 +43,7 @@ data class StoreI18nConfig( @ApiModelProperty("map字段在db中key的前缀") val dbKeyPrefix: String? = null, @ApiModelProperty("代码库哈希ID") - val repositoryHashId: String? = null + val repositoryHashId: String? = null, + @ApiModelProperty("代码库分支") + val branch: String? = null ) diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt index a09f93d3452..95c5afd8578 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt @@ -1406,13 +1406,15 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ val releaseType = convertUpdateRequest.releaseType val taskDataMap = storeI18nMessageService.parseJsonMapI18nInfo( userId = userId, - projectCode = projectCode, jsonMap = getAtomConfResult.taskDataMap.toMutableMap(), - fileDir = "$atomCode/$version", - i18nDir = updateAtomPackageInfo.i18nDir, - dbKeyPrefix = StoreUtils.getStoreFieldKeyPrefix(StoreTypeEnum.ATOM, atomCode, version), - repositoryHashId = atomRecord.repositoryHashId, - branch = branch, + storeI18nConfig = StoreI18nConfig( + projectCode = projectCode, + fileDir = "$atomCode/$version", + i18nDir = updateAtomPackageInfo.i18nDir, + dbKeyPrefix = StoreUtils.getStoreFieldKeyPrefix(StoreTypeEnum.ATOM, atomCode, version), + repositoryHashId = atomRecord.repositoryHashId, + branch = branch + ), version = version ) // 校验插件发布类型 diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/common/impl/StoreI18nMessageServiceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/common/impl/StoreI18nMessageServiceImpl.kt index 50a50032173..c5bceb68408 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/common/impl/StoreI18nMessageServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/common/impl/StoreI18nMessageServiceImpl.kt @@ -108,7 +108,7 @@ abstract class StoreI18nMessageServiceImpl : StoreI18nMessageService { i18nDir = i18nDir, fileName = fileName, repositoryHashId = repositoryHashId, - branch = branch + branch = storeI18nConfig.branch ) val fieldLocaleInfos = if (jsonLocaleLanguage == devopsDefaultLocaleLanguage) { // 如果map集合中默认字段值对应的语言和蓝盾默认语言一致,则无需替换 @@ -137,14 +137,7 @@ abstract class StoreI18nMessageServiceImpl : StoreI18nMessageService { userId = userId, version = version, fieldLocaleInfos = fieldLocaleInfos, - storeI18nConfig = StoreI18nConfig( - projectCode = projectCode, - fileDir = fileDir, - i18nDir = i18nDir, - repositoryHashId = repositoryHashId, - dbKeyPrefix = dbKeyPrefix, - branch = branch, - ) + storeI18nConfig = storeI18nConfig ) } return jsonMap From 6f2d79654735a587413c3faeea03ea1653a4829d Mon Sep 17 00:00:00 2001 From: yjieliang Date: Mon, 6 Nov 2023 10:09:11 +0800 Subject: [PATCH 37/73] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../store/service/atom/impl/SampleAtomReleaseServiceImpl.kt | 1 - .../devops/store/service/atom/impl/AtomReleaseServiceImpl.kt | 2 +- .../store/service/common/impl/StoreI18nMessageServiceImpl.kt | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/backend/ci/core/store/biz-store-sample/src/main/kotlin/com/tencent/devops/store/service/atom/impl/SampleAtomReleaseServiceImpl.kt b/src/backend/ci/core/store/biz-store-sample/src/main/kotlin/com/tencent/devops/store/service/atom/impl/SampleAtomReleaseServiceImpl.kt index 5fe42c17259..7ae9503de5a 100644 --- a/src/backend/ci/core/store/biz-store-sample/src/main/kotlin/com/tencent/devops/store/service/atom/impl/SampleAtomReleaseServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store-sample/src/main/kotlin/com/tencent/devops/store/service/atom/impl/SampleAtomReleaseServiceImpl.kt @@ -42,7 +42,6 @@ import com.tencent.devops.common.api.constant.TEST import com.tencent.devops.common.api.constant.UNDO import com.tencent.devops.common.api.pojo.Result import com.tencent.devops.common.web.utils.I18nUtil -import com.tencent.devops.model.store.tables.records.TAtomRecord import com.tencent.devops.store.constant.StoreMessageCode import com.tencent.devops.store.constant.StoreMessageCode.NO_COMPONENT_ADMIN_AND_CREATETOR_PERMISSION import com.tencent.devops.store.pojo.atom.AtomReleaseRequest diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt index 95c5afd8578..daacfd4c3a9 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt @@ -384,7 +384,7 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ propertiesKeyPrefix = KEY_RELEASE_INFO, dbKeyPrefix = StoreUtils.getStoreFieldKeyPrefix(StoreTypeEnum.ATOM, atomCode, version), repositoryHashId = atomRecord.repositoryHashId, - branch = branch, + branch = branch ), version = version ).toMutableMap() diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/common/impl/StoreI18nMessageServiceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/common/impl/StoreI18nMessageServiceImpl.kt index c5bceb68408..df5da753adf 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/common/impl/StoreI18nMessageServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/common/impl/StoreI18nMessageServiceImpl.kt @@ -172,7 +172,7 @@ abstract class StoreI18nMessageServiceImpl : StoreI18nMessageService { i18nDir = i18nDir, repositoryHashId = repositoryHashId, dbKeyPrefix = keyPrefix, - branch = branch, + branch = branch ) ) } From 18ca8657d2ef12ff54c65906c2040109a90886ab Mon Sep 17 00:00:00 2001 From: yjieliang Date: Mon, 6 Nov 2023 10:11:57 +0800 Subject: [PATCH 38/73] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../devops/store/service/atom/impl/AtomReleaseServiceImpl.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt index daacfd4c3a9..f7db7353919 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt @@ -423,7 +423,7 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ i18nDir = i18nDir, dbKeyPrefix = StoreUtils.getStoreFieldKeyPrefix(StoreTypeEnum.ATOM, atomCode, version), repositoryHashId = atomRecord.repositoryHashId, - branch = branch, + branch = branch ), version = version ) From 7a069d2ca1a9ceb653cf59ec75b3102e674f649f Mon Sep 17 00:00:00 2001 From: yjieliang Date: Mon, 6 Nov 2023 10:14:07 +0800 Subject: [PATCH 39/73] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../devops/store/service/atom/impl/AtomReleaseServiceImpl.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt index f7db7353919..0995bf4807f 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt @@ -719,7 +719,7 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ i18nDir = i18nDir, dbKeyPrefix = StoreUtils.getStoreFieldKeyPrefix(StoreTypeEnum.ATOM, atomCode, atomVersion), repositoryHashId = repositoryHashId, - branch = branch, + branch = branch ), version = atomVersion ) From 940f240c857147fee1c929e4973fa1ba57964131 Mon Sep 17 00:00:00 2001 From: yjieliang Date: Mon, 6 Nov 2023 15:22:21 +0800 Subject: [PATCH 40/73] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../store/pojo/atom/UpdateAtomPackageInfo.kt | 8 +- .../atom/impl/AtomReleaseServiceImpl.kt | 182 +++--------------- 2 files changed, 32 insertions(+), 158 deletions(-) diff --git a/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/pojo/atom/UpdateAtomPackageInfo.kt b/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/pojo/atom/UpdateAtomPackageInfo.kt index 3913188b68c..c775f862e68 100644 --- a/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/pojo/atom/UpdateAtomPackageInfo.kt +++ b/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/pojo/atom/UpdateAtomPackageInfo.kt @@ -38,7 +38,9 @@ data class UpdateAtomPackageInfo( @ApiModelProperty("国际化资源目录路径") val i18nDir: String, @ApiModelProperty("包路径") - val packagePath: String, - @ApiModelProperty("插件包资源类型)") - val atomPackageSourceType: PackageSourceTypeEnum + val packagePath: String?, + @ApiModelProperty("插件包资源类型") + val atomPackageSourceType: PackageSourceTypeEnum, + @ApiModelProperty("是否属于分支测试版本)") + val isBranchTestVersion: Boolean ) diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt index 0995bf4807f..ae094d386bf 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt @@ -414,158 +414,28 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ if (validateAtomVersionResult.isNotOk()) { return Result(status = validateAtomVersionResult.status, message = validateAtomVersionResult.message ?: "") } - val taskDataMap = storeI18nMessageService.parseJsonMapI18nInfo( - userId = userId, - jsonMap = getAtomConfResult.taskDataMap.toMutableMap(), - storeI18nConfig = StoreI18nConfig( - projectCode = projectCode, - fileDir = "$atomCode/$version", - i18nDir = i18nDir, - dbKeyPrefix = StoreUtils.getStoreFieldKeyPrefix(StoreTypeEnum.ATOM, atomCode, version), - repositoryHashId = atomRecord.repositoryHashId, - branch = branch - ), - version = version - ) - // 校验插件发布类型 - marketAtomCommonService.validateReleaseType( - atomId = atomRecord.id, - atomCode = atomCode, - version = version, - releaseType = releaseType, - taskDataMap = taskDataMap, - fieldCheckConfirmFlag = convertUpdateRequest.fieldCheckConfirmFlag - ) - val validateResult = validateUpdateMarketAtomReq(userId, convertUpdateRequest, atomRecord.repositoryHashId) - logger.info("validateUpdateMarketAtomReq validateResult is :$validateResult") - if (validateResult.isNotOk()) { - return Result(validateResult.status, validateResult.message, null) - } var atomId = if (atomPackageSourceType == PackageSourceTypeEnum.UPLOAD) { redisOperation.get("$ATOM_UPLOAD_ID_KEY_PREFIX:$atomCode:$version") ?: throw ErrorCodeException(errorCode = USER_UPLOAD_PACKAGE_INVALID) } else { UUIDUtil.generate() } + val newVersionFlag = !(releaseType == ReleaseTypeEnum.NEW || releaseType == ReleaseTypeEnum.CANCEL_RE_RELEASE) - // 解析quality.json - val getAtomQualityResult = getAtomQualityConfig( - projectCode = projectCode, - atomCode = atomCode, - atomName = convertUpdateRequest.name, - atomVersion = version, + return updateAtomVersionInfo( userId = userId, - i18nDir = i18nDir, - repositoryHashId = atomRecord.repositoryHashId, - branch = branch - ) - logger.info("update market atom, getAtomQualityResult: $getAtomQualityResult") - if (getAtomQualityResult.errorCode == StoreMessageCode.USER_REPOSITORY_PULL_QUALITY_JSON_FILE_FAIL) { - logger.info("quality.json not found , skip...") - } else if (getAtomQualityResult.errorCode != "0") { - return I18nUtil.generateResponseDataObject( - messageCode = getAtomQualityResult.errorCode, - params = getAtomQualityResult.errorParams, - language = I18nUtil.getLanguage(userId) - ) - } - - val atomEnvRequests = getAtomConfResult.atomEnvRequests ?: return I18nUtil.generateResponseDataObject( - messageCode = StoreMessageCode.USER_REPOSITORY_TASK_JSON_FIELD_IS_NULL, - params = arrayOf(KEY_EXECUTION), - language = I18nUtil.getLanguage(userId) + projectCode = projectCode, + newVersionFlag = newVersionFlag, + updateAtomPackageInfo = UpdateAtomPackageInfo( + atomId = if (newVersionFlag) atomId else newestAtomRecord.id, + i18nDir = i18nDir, + packagePath = executionInfoMap[KEY_PACKAGE_PATH] as? String, + atomPackageSourceType = atomPackageSourceType, + isBranchTestVersion = false + ), + convertUpdateRequest = convertUpdateRequest, + getAtomConfResult = getAtomConfResult ) - - val packagePath = executionInfoMap[KEY_PACKAGE_PATH] as? String - val classType = if (packagePath.isNullOrBlank() && atomPackageSourceType == PackageSourceTypeEnum.UPLOAD) { - // 没有可执行文件的插件是老的内置插件,插件的classType为插件标识 - atomCode - } else if (convertUpdateRequest.os.isEmpty()) { - MarketBuildLessAtomElement.classType - } else { - MarketBuildAtomElement.classType - } - val propsMap = mutableMapOf() - val inputDataMap = taskDataMap[KEY_INPUT] as? Map - if (convertUpdateRequest.frontendType == FrontendTypeEnum.HISTORY) { - inputDataMap?.let { propsMap.putAll(inputDataMap) } - } else { - propsMap[KEY_INPUT_GROUPS] = taskDataMap[KEY_INPUT_GROUPS] - propsMap[KEY_INPUT] = inputDataMap - propsMap[KEY_OUTPUT] = taskDataMap[KEY_OUTPUT] - propsMap[KEY_CONFIG] = taskDataMap[KEY_CONFIG] - } - convertUpdateRequest.os.sort() // 给操作系统排序 - val atomStatus = - if (atomPackageSourceType == PackageSourceTypeEnum.REPO) { - AtomStatusEnum.COMMITTING - } else AtomStatusEnum.TESTING - dslContext.transaction { t -> - val context = DSL.using(t) - val props = JsonUtil.toJson(propsMap, formatted = false) - if (releaseType == ReleaseTypeEnum.NEW || releaseType == ReleaseTypeEnum.CANCEL_RE_RELEASE) { - // 首次创建版本或者取消发布后不变更版本号重新上架,则在该版本的记录上做更新操作 - atomId = newestAtomRecord.id - updateMarketAtom( - context = context, - userId = userId, - atomId = atomId, - atomStatus = atomStatus, - classType = classType, - props = props, - releaseType = releaseType.releaseType.toByte(), - marketAtomUpdateRequest = convertUpdateRequest, - atomEnvRequests = atomEnvRequests, - repositoryHashId = atomRecord.repositoryHashId - ) - } else { - // 升级插件 - upgradeMarketAtom( - marketAtomUpdateRequest = convertUpdateRequest, - context = context, - userId = userId, - atomId = atomId, - atomStatus = atomStatus, - classType = classType, - props = props, - atomEnvRequests = atomEnvRequests, - atomRecord = atomRecord - ) - } - if (atomStatus == AtomStatusEnum.TESTING) { - // 插件大版本内有测试版本则写入缓存 - redisOperation.hset( - key = "$ATOM_POST_VERSION_TEST_FLAG_KEY_PREFIX:$atomCode", - hashKey = VersionUtils.convertLatestVersion(version), - values = "true" - ) - } - // 更新标签信息 - val labelIdList = convertUpdateRequest.labelIdList?.filter { !it.isNullOrBlank() } - if (null != labelIdList) { - atomLabelRelDao.deleteByAtomId(context, atomId) - if (labelIdList.isNotEmpty()) { - atomLabelRelDao.batchAdd(context, userId = userId, atomId = atomId, labelIdList = labelIdList) - } - } - - // 更新红线标识 - val qualityFlag = getAtomQualityResult.errorCode == "0" - marketAtomFeatureDao.updateAtomFeature( - dslContext = context, - userId = userId, - atomFeatureRequest = AtomFeatureRequest(atomCode = atomCode, qualityFlag = qualityFlag) - ) - asyncHandleUpdateAtom( - context = context, - atomId = atomId, - userId = userId, - branch = branch, - validOsNameFlag = marketAtomCommonService.getValidOsNameFlag(atomEnvRequests), - validOsArchFlag = marketAtomCommonService.getValidOsArchFlag(atomEnvRequests) - ) - } - return Result(atomId) } /** @@ -1390,7 +1260,7 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ } } - fun updateAtomVersionInfo( + private fun updateAtomVersionInfo( userId: String, projectCode: String, newVersionFlag: Boolean, @@ -1417,15 +1287,17 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ ), version = version ) - // 校验插件发布类型 - marketAtomCommonService.validateReleaseType( - atomId = atomRecord.id, - atomCode = atomCode, - version = version, - releaseType = releaseType, - taskDataMap = taskDataMap, - fieldCheckConfirmFlag = convertUpdateRequest.fieldCheckConfirmFlag - ) + if (!updateAtomPackageInfo.isBranchTestVersion) { + // 校验插件发布类型 + marketAtomCommonService.validateReleaseType( + atomId = atomRecord.id, + atomCode = atomCode, + version = version, + releaseType = releaseType, + taskDataMap = taskDataMap, + fieldCheckConfirmFlag = convertUpdateRequest.fieldCheckConfirmFlag + ) + } val validateResult = validateUpdateMarketAtomReq(userId, convertUpdateRequest, atomRecord.repositoryHashId) logger.info("validateUpdateMarketAtomReq validateResult is :$validateResult") if (validateResult.isNotOk()) { @@ -1514,7 +1386,7 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ atomRecord = atomRecord ) } - if (atomStatus == AtomStatusEnum.TESTING) { + if (!updateAtomPackageInfo.isBranchTestVersion && atomStatus == AtomStatusEnum.TESTING) { // 插件大版本内有测试版本则写入缓存 redisOperation.hset( key = "$ATOM_POST_VERSION_TEST_FLAG_KEY_PREFIX:$atomCode", @@ -1524,7 +1396,7 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ } // 更新标签信息 val labelIdList = convertUpdateRequest.labelIdList?.filter { !it.isNullOrBlank() } - if (null != labelIdList) { + if (!updateAtomPackageInfo.isBranchTestVersion && null != labelIdList) { atomLabelRelDao.deleteByAtomId(context, atomId) if (labelIdList.isNotEmpty()) { atomLabelRelDao.batchAdd(context, userId = userId, atomId = atomId, labelIdList = labelIdList) From 15cf27d74c41e0e3bc788c78e9b58e76db69673a Mon Sep 17 00:00:00 2001 From: yjieliang Date: Mon, 6 Nov 2023 15:27:02 +0800 Subject: [PATCH 41/73] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../devops/store/service/atom/impl/AtomReleaseServiceImpl.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt index ae094d386bf..075971793bb 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt @@ -414,7 +414,7 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ if (validateAtomVersionResult.isNotOk()) { return Result(status = validateAtomVersionResult.status, message = validateAtomVersionResult.message ?: "") } - var atomId = if (atomPackageSourceType == PackageSourceTypeEnum.UPLOAD) { + val atomId = if (atomPackageSourceType == PackageSourceTypeEnum.UPLOAD) { redisOperation.get("$ATOM_UPLOAD_ID_KEY_PREFIX:$atomCode:$version") ?: throw ErrorCodeException(errorCode = USER_UPLOAD_PACKAGE_INVALID) } else { @@ -1260,7 +1260,7 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ } } - private fun updateAtomVersionInfo( + protected fun updateAtomVersionInfo( userId: String, projectCode: String, newVersionFlag: Boolean, From e4444108c2c91e3310531aaadeecac97d075dd2e Mon Sep 17 00:00:00 2001 From: yjieliang Date: Mon, 6 Nov 2023 15:35:21 +0800 Subject: [PATCH 42/73] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../devops/store/pojo/atom/MarketAtomUpdateRequest.kt | 4 +++- .../devops/store/pojo/atom/UpdateAtomPackageInfo.kt | 4 +--- .../store/service/atom/impl/AtomReleaseServiceImpl.kt | 10 ++++------ 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/pojo/atom/MarketAtomUpdateRequest.kt b/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/pojo/atom/MarketAtomUpdateRequest.kt index 1cd7e6e1ad6..b15eb881091 100644 --- a/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/pojo/atom/MarketAtomUpdateRequest.kt +++ b/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/pojo/atom/MarketAtomUpdateRequest.kt @@ -74,5 +74,7 @@ data class MarketAtomUpdateRequest( @ApiModelProperty(value = "插件字段校验确认标识", required = false) val fieldCheckConfirmFlag: Boolean? = false, @ApiModelProperty("分支", required = false) - val branch: String? = null + val branch: String? = null, + @ApiModelProperty("是否属于分支测试版本", required = false) + var isBranchTestVersion: Boolean = false ) diff --git a/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/pojo/atom/UpdateAtomPackageInfo.kt b/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/pojo/atom/UpdateAtomPackageInfo.kt index c775f862e68..ead4559f600 100644 --- a/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/pojo/atom/UpdateAtomPackageInfo.kt +++ b/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/pojo/atom/UpdateAtomPackageInfo.kt @@ -40,7 +40,5 @@ data class UpdateAtomPackageInfo( @ApiModelProperty("包路径") val packagePath: String?, @ApiModelProperty("插件包资源类型") - val atomPackageSourceType: PackageSourceTypeEnum, - @ApiModelProperty("是否属于分支测试版本)") - val isBranchTestVersion: Boolean + val atomPackageSourceType: PackageSourceTypeEnum ) diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt index 075971793bb..e4a6e04d6f5 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt @@ -421,7 +421,6 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ UUIDUtil.generate() } val newVersionFlag = !(releaseType == ReleaseTypeEnum.NEW || releaseType == ReleaseTypeEnum.CANCEL_RE_RELEASE) - return updateAtomVersionInfo( userId = userId, projectCode = projectCode, @@ -430,8 +429,7 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ atomId = if (newVersionFlag) atomId else newestAtomRecord.id, i18nDir = i18nDir, packagePath = executionInfoMap[KEY_PACKAGE_PATH] as? String, - atomPackageSourceType = atomPackageSourceType, - isBranchTestVersion = false + atomPackageSourceType = atomPackageSourceType ), convertUpdateRequest = convertUpdateRequest, getAtomConfResult = getAtomConfResult @@ -1287,7 +1285,7 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ ), version = version ) - if (!updateAtomPackageInfo.isBranchTestVersion) { + if (!convertUpdateRequest.isBranchTestVersion) { // 校验插件发布类型 marketAtomCommonService.validateReleaseType( atomId = atomRecord.id, @@ -1386,7 +1384,7 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ atomRecord = atomRecord ) } - if (!updateAtomPackageInfo.isBranchTestVersion && atomStatus == AtomStatusEnum.TESTING) { + if (!convertUpdateRequest.isBranchTestVersion && atomStatus == AtomStatusEnum.TESTING) { // 插件大版本内有测试版本则写入缓存 redisOperation.hset( key = "$ATOM_POST_VERSION_TEST_FLAG_KEY_PREFIX:$atomCode", @@ -1396,7 +1394,7 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ } // 更新标签信息 val labelIdList = convertUpdateRequest.labelIdList?.filter { !it.isNullOrBlank() } - if (!updateAtomPackageInfo.isBranchTestVersion && null != labelIdList) { + if (!convertUpdateRequest.isBranchTestVersion && null != labelIdList) { atomLabelRelDao.deleteByAtomId(context, atomId) if (labelIdList.isNotEmpty()) { atomLabelRelDao.batchAdd(context, userId = userId, atomId = atomId, labelIdList = labelIdList) From 54077cfdafca37844cf1ae5900813419cfaf8b3b Mon Sep 17 00:00:00 2001 From: yjieliang Date: Mon, 6 Nov 2023 15:39:14 +0800 Subject: [PATCH 43/73] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/tencent/devops/store/dao/atom/MarketAtomDao.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/MarketAtomDao.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/MarketAtomDao.kt index 363abcd3948..a883abf559a 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/MarketAtomDao.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/MarketAtomDao.kt @@ -509,7 +509,8 @@ class MarketAtomDao : AtomBaseDao() { PUBLISHER, WEIGHT, CREATOR, - MODIFIER + MODIFIER, + BRANCH_TEST_FLAG ) .values(id, atomRequest.name, @@ -542,7 +543,8 @@ class MarketAtomDao : AtomBaseDao() { atomRequest.publisher, atomRecord.weight, userId, - userId + userId, + atomRequest.isBranchTestVersion ) .execute() } From 63051e9ba59c47646b48e7bef32eedb00c11176a Mon Sep 17 00:00:00 2001 From: yjieliang Date: Mon, 6 Nov 2023 16:14:10 +0800 Subject: [PATCH 44/73] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../devops/common/api/constant/CommonConstants.kt | 1 + .../com/tencent/devops/store/dao/atom/AtomDao.kt | 7 ++++--- .../service/atom/impl/AtomReleaseServiceImpl.kt | 14 ++++++++++---- .../store/service/atom/impl/AtomServiceImpl.kt | 3 ++- .../service/atom/impl/MarketAtomServiceImpl.kt | 2 +- 5 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/backend/ci/core/common/common-api/src/main/kotlin/com/tencent/devops/common/api/constant/CommonConstants.kt b/src/backend/ci/core/common/common-api/src/main/kotlin/com/tencent/devops/common/api/constant/CommonConstants.kt index 58865e82dd3..2e9ddb9a417 100644 --- a/src/backend/ci/core/common/common-api/src/main/kotlin/com/tencent/devops/common/api/constant/CommonConstants.kt +++ b/src/backend/ci/core/common/common-api/src/main/kotlin/com/tencent/devops/common/api/constant/CommonConstants.kt @@ -154,6 +154,7 @@ const val KEY_UPDATED_TIME = "updatedTime" const val KEY_DEFAULT_LOCALE_LANGUAGE = "defaultLocaleLanguage" const val KEY_PROJECT_ID = "projectId" const val KEY_PIPELINE_NUM = "pipelineNum" +const val KEY_BRANCH_TEST_FLAG = "branchTestFlag" const val BK_BUILD_ENV_START_FAILED = "bkBuildEnvStartFailed" // 构建环境启动失败 const val BK_START_PULL_IMAGE = "bkStartPullImage" // 开始拉取镜像,镜像名称: diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt index 9aa66608726..3d6f408ea0b 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt @@ -29,6 +29,7 @@ package com.tencent.devops.store.dao.atom import com.tencent.devops.common.api.constant.INIT_VERSION import com.tencent.devops.common.api.constant.KEY_ALL +import com.tencent.devops.common.api.constant.KEY_BRANCH_TEST_FLAG import com.tencent.devops.common.api.constant.KEY_DESCRIPTION import com.tencent.devops.common.api.constant.KEY_DOCSLINK import com.tencent.devops.common.api.constant.KEY_OS @@ -36,7 +37,6 @@ import com.tencent.devops.common.api.constant.KEY_SUMMARY import com.tencent.devops.common.api.constant.KEY_VERSION import com.tencent.devops.common.api.constant.KEY_WEIGHT import com.tencent.devops.common.api.constant.NAME -import com.tencent.devops.common.api.constant.TEST import com.tencent.devops.common.api.constant.VERSION import com.tencent.devops.common.api.util.JsonUtil import com.tencent.devops.common.db.utils.JooqUtils @@ -482,7 +482,8 @@ class AtomDao : AtomBaseDao() { val tStoreProjectRel = TStoreProjectRel.T_STORE_PROJECT_REL val baseStep = dslContext.select( tAtom.VERSION.`as`(KEY_VERSION), - tAtom.ATOM_STATUS.`as`(KEY_ATOM_STATUS) + tAtom.ATOM_STATUS.`as`(KEY_ATOM_STATUS), + tAtom.BRANCH_TEST_FLAG.`as`(KEY_BRANCH_TEST_FLAG) ).from(tAtom) val t = if (defaultFlag) { val conditions = generateGetPipelineAtomCondition( @@ -524,7 +525,7 @@ class AtomDao : AtomBaseDao() { delim = ".", count = -1 ) - val field = DSL.`when`((t.field(KEY_VERSION) as Field).startsWith(TEST), 1) + val field = DSL.`when`((t.field(KEY_BRANCH_TEST_FLAG) as Field).eq(true), 1) .otherwise(0) as Field val queryStep = dslContext.select( t.field(KEY_VERSION), diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt index e4a6e04d6f5..0f098087bbd 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt @@ -633,7 +633,11 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ GetAtomQualityConfigResult("0", arrayOf("")) } else { - val extra = if (atomVersion.startsWith(TEST)) "$IN_READY_TEST($atomVersion)" else IN_READY_TEST + val extra = if (atomVersion.startsWith("$TEST-$atomVersion-")) { + "$IN_READY_TEST($atomVersion)" + } else { + IN_READY_TEST + } try { client.get(ServiceQualityIndicatorMarketResource::class) .deleteTestIndicator(atomCode, extra) @@ -679,7 +683,8 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ ) { client.get(ServiceQualityControlPointMarketResource::class).setTestControlPoint( userId = userId, - tag = if (atomVersion.startsWith(TEST)) "$IN_READY_TEST($atomVersion)" else IN_READY_TEST, + tag = + if (atomVersion.startsWith("$TEST-$atomVersion-")) "$IN_READY_TEST($atomVersion)" else IN_READY_TEST, controlPoint = QualityControlPoint( hashId = "", type = atomCode, @@ -708,7 +713,8 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ metadataResultMap: Map, indicators: Map ) { - val tag = if (atomVersion.startsWith(TEST)) "$IN_READY_TEST($atomVersion)" else IN_READY_TEST + val tag = + if (atomVersion.startsWith("$TEST-$atomVersion-")) "$IN_READY_TEST($atomVersion)" else IN_READY_TEST val indicatorsList = indicators.map { val map = it.value as Map val type = map["type"] as String? @@ -1357,7 +1363,7 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ dslContext.transaction { t -> val context = DSL.using(t) val props = JsonUtil.toJson(propsMap, formatted = false) - if (newVersionFlag) { + if (!newVersionFlag) { updateMarketAtom( context = context, userId = userId, diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomServiceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomServiceImpl.kt index 04a0ac21783..340e38ef0ec 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomServiceImpl.kt @@ -29,6 +29,7 @@ package com.tencent.devops.store.service.atom.impl import com.github.benmanes.caffeine.cache.Caffeine import com.tencent.devops.common.api.constant.CommonMessageCode +import com.tencent.devops.common.api.constant.KEY_BRANCH_TEST_FLAG import com.tencent.devops.common.api.constant.KEY_DESCRIPTION import com.tencent.devops.common.api.constant.KEY_DOCSLINK import com.tencent.devops.common.api.constant.KEY_OS @@ -714,7 +715,7 @@ abstract class AtomServiceImpl @Autowired constructor() : AtomService { versionName = "$atomVersion ($atomStatusMsg)" latestVersionName = "$latestVersionName ($atomStatusMsg)" } - if (tmpVersionPrefix != versionPrefix && !atomVersion.startsWith(TEST)) { + if (tmpVersionPrefix != versionPrefix && !(it[KEY_BRANCH_TEST_FLAG] as Boolean)) { versionList.add(VersionInfo(latestVersionName, "$versionPrefix*")) // 添加大版本号的通用最新模式(如1.*) tmpVersionPrefix = versionPrefix } diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/MarketAtomServiceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/MarketAtomServiceImpl.kt index 4f9342f83f3..160b08661f8 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/MarketAtomServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/MarketAtomServiceImpl.kt @@ -585,7 +585,7 @@ abstract class MarketAtomServiceImpl @Autowired constructor() : MarketAtomServic var processingVersionInfoMap: MutableMap>? = null processingAtomRecords?.forEach { processingAtomRecord -> if (processingAtomRecord.version == INIT_VERSION || processingAtomRecord.version.isNullOrBlank() || - processingAtomRecord.version.startsWith(TEST)) { + processingAtomRecord.branchTestFlag) { return@forEach } if (processingVersionInfoMap == null) { From b012b2ae9edaa90e54c8ee6776d5164e9ba531f9 Mon Sep 17 00:00:00 2001 From: yjieliang Date: Mon, 6 Nov 2023 16:15:46 +0800 Subject: [PATCH 45/73] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../devops/store/service/atom/impl/MarketAtomServiceImpl.kt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/MarketAtomServiceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/MarketAtomServiceImpl.kt index 160b08661f8..6067ac6f29f 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/MarketAtomServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/MarketAtomServiceImpl.kt @@ -42,7 +42,6 @@ import com.tencent.devops.common.api.constant.OR import com.tencent.devops.common.api.constant.OUTPUT_DESC import com.tencent.devops.common.api.constant.REQUIRED import com.tencent.devops.common.api.constant.SINGLE_SELECTOR -import com.tencent.devops.common.api.constant.TEST import com.tencent.devops.common.api.constant.TIMETOSELECT import com.tencent.devops.common.api.enums.FrontendTypeEnum import com.tencent.devops.common.api.exception.ErrorCodeException @@ -70,8 +69,8 @@ import com.tencent.devops.repository.pojo.Repository import com.tencent.devops.repository.pojo.enums.TokenTypeEnum import com.tencent.devops.repository.pojo.enums.VisibilityLevelEnum import com.tencent.devops.store.constant.StoreMessageCode -import com.tencent.devops.store.constant.StoreMessageCode.NO_COMPONENT_ADMIN_PERMISSION import com.tencent.devops.store.constant.StoreMessageCode.GET_INFO_NO_PERMISSION +import com.tencent.devops.store.constant.StoreMessageCode.NO_COMPONENT_ADMIN_PERMISSION import com.tencent.devops.store.constant.StoreMessageCode.TASK_JSON_CONFIGURE_FORMAT_ERROR import com.tencent.devops.store.dao.atom.AtomApproveRelDao import com.tencent.devops.store.dao.atom.AtomDao From 15ba8fe8b11517388942f93cdcf10389cd6e6609 Mon Sep 17 00:00:00 2001 From: yjieliang Date: Mon, 6 Nov 2023 20:53:19 +0800 Subject: [PATCH 46/73] =?UTF-8?q?pref:=E6=8F=92=E4=BB=B6=E5=9B=BD=E9=99=85?= =?UTF-8?q?=E5=8C=96properties=E6=96=87=E4=BB=B6value=E5=80=BC=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E5=BC=95=E5=85=A5=E6=96=87=E4=BB=B6=20#9366?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt index 3d6f408ea0b..2ff331dcc84 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt @@ -525,18 +525,16 @@ class AtomDao : AtomBaseDao() { delim = ".", count = -1 ) - val field = DSL.`when`((t.field(KEY_BRANCH_TEST_FLAG) as Field).eq(true), 1) - .otherwise(0) as Field val queryStep = dslContext.select( t.field(KEY_VERSION), t.field(KEY_ATOM_STATUS), firstVersion, secondVersion, thirdVersion, - field + tAtom.BRANCH_TEST_FLAG.`as`(KEY_BRANCH_TEST_FLAG) ).from(t) .orderBy( - field.desc(), + tAtom.BRANCH_TEST_FLAG.`as`(KEY_BRANCH_TEST_FLAG).desc(), firstVersion.plus(0).desc(), secondVersion.plus(0).desc(), thirdVersion.plus(0).desc() From 1694ad5282ec7eb8b5a75dbaec1428dff529f682 Mon Sep 17 00:00:00 2001 From: yjieliang Date: Mon, 6 Nov 2023 21:12:35 +0800 Subject: [PATCH 47/73] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt index 2ff331dcc84..020dffd8370 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt @@ -525,16 +525,17 @@ class AtomDao : AtomBaseDao() { delim = ".", count = -1 ) + val field = t.field(KEY_BRANCH_TEST_FLAG) as Field val queryStep = dslContext.select( t.field(KEY_VERSION), t.field(KEY_ATOM_STATUS), firstVersion, secondVersion, thirdVersion, - tAtom.BRANCH_TEST_FLAG.`as`(KEY_BRANCH_TEST_FLAG) + field ).from(t) .orderBy( - tAtom.BRANCH_TEST_FLAG.`as`(KEY_BRANCH_TEST_FLAG).desc(), + field.desc(), firstVersion.plus(0).desc(), secondVersion.plus(0).desc(), thirdVersion.plus(0).desc() From 57cdd73f56c1ff352901e9a5d88bdd6f1f33f841 Mon Sep 17 00:00:00 2001 From: yjieliang Date: Tue, 7 Nov 2023 15:46:11 +0800 Subject: [PATCH 48/73] =?UTF-8?q?pref:=E6=8F=92=E4=BB=B6=E5=9B=BD=E9=99=85?= =?UTF-8?q?=E5=8C=96properties=E6=96=87=E4=BB=B6value=E5=80=BC=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E5=BC=95=E5=85=A5=E6=96=87=E4=BB=B6=20#9366?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../devops/store/pojo/atom/StoreI18nConfig.kt | 2 + .../TextReferenceFileDownloadRequest.kt | 2 + .../common/impl/SampleStoreFileServiceImpl.kt | 25 ++++++++---- .../atom/impl/MarketAtomArchiveServiceImpl.kt | 1 + .../store/service/common/StoreFileService.kt | 34 ++++++++++++++--- .../service/common/StoreI18nMessageService.kt | 9 +---- .../impl/StoreI18nMessageServiceImpl.kt | 38 +++++-------------- .../utils/TextReferenceFileAnalysisUtil.kt | 10 +++++ 8 files changed, 71 insertions(+), 50 deletions(-) diff --git a/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/pojo/atom/StoreI18nConfig.kt b/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/pojo/atom/StoreI18nConfig.kt index 7cc0e69c701..465e2be0fc1 100644 --- a/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/pojo/atom/StoreI18nConfig.kt +++ b/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/pojo/atom/StoreI18nConfig.kt @@ -34,6 +34,8 @@ import io.swagger.annotations.ApiModelProperty data class StoreI18nConfig( @ApiModelProperty("项目标识") val projectCode: String, + @ApiModelProperty("组件标识") + val storeCode: String, @ApiModelProperty("资源文件目录") val fileDir: String, @ApiModelProperty("国际化目录") diff --git a/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/pojo/common/TextReferenceFileDownloadRequest.kt b/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/pojo/common/TextReferenceFileDownloadRequest.kt index ae0a57b42b4..feb6a4f6594 100644 --- a/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/pojo/common/TextReferenceFileDownloadRequest.kt +++ b/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/pojo/common/TextReferenceFileDownloadRequest.kt @@ -34,6 +34,8 @@ import io.swagger.annotations.ApiModelProperty data class TextReferenceFileDownloadRequest( @ApiModelProperty("项目代码", required = true) val projectCode: String, + @ApiModelProperty("组件标识") + val storeCode: String, @ApiModelProperty("插件包文件路径", required = true) val fileDir: String, @ApiModelProperty("仓库哈希ID", required = false) diff --git a/src/backend/ci/core/store/biz-store-sample/src/main/kotlin/com/tencent/devops/store/service/common/impl/SampleStoreFileServiceImpl.kt b/src/backend/ci/core/store/biz-store-sample/src/main/kotlin/com/tencent/devops/store/service/common/impl/SampleStoreFileServiceImpl.kt index 0cbeebf7bda..3d8f3fa9b12 100644 --- a/src/backend/ci/core/store/biz-store-sample/src/main/kotlin/com/tencent/devops/store/service/common/impl/SampleStoreFileServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store-sample/src/main/kotlin/com/tencent/devops/store/service/common/impl/SampleStoreFileServiceImpl.kt @@ -36,9 +36,11 @@ import com.tencent.devops.artifactory.pojo.LocalDirectoryInfo import com.tencent.devops.artifactory.pojo.enums.FileChannelTypeEnum import com.tencent.devops.common.api.util.OkhttpUtils import com.tencent.devops.common.service.utils.CommonUtils +import com.tencent.devops.common.service.utils.ZipUtil import com.tencent.devops.common.web.utils.I18nUtil import com.tencent.devops.store.pojo.common.TextReferenceFileDownloadRequest import com.tencent.devops.store.service.common.StoreFileService +import com.tencent.devops.store.utils.TextReferenceFileAnalysisUtil.isDirectoryNotEmpty import java.io.File import java.net.URLEncoder import org.slf4j.LoggerFactory @@ -58,10 +60,13 @@ class SampleStoreFileServiceImpl : StoreFileService() { branch: String?, format: String? ) { - val url = client.getServiceUrl(ServiceArchiveAtomResource::class) + - "/service/artifactories/atom/file/download?filePath=${URLEncoder.encode(filePath, "UTF-8")}" - logger.info("downloadFile filePath:$filePath") - OkhttpUtils.downloadFile(url, file) + try { + val url = client.getServiceUrl(ServiceArchiveAtomResource::class) + + "/service/artifactories/atom/file/download?filePath=${URLEncoder.encode(filePath, "UTF-8")}" + OkhttpUtils.downloadFile(url, file) + } catch (ignore: Throwable) { + logger.warn("FAIL|Download file from $filePath") + } } override fun getFileNames( @@ -87,22 +92,26 @@ class SampleStoreFileServiceImpl : StoreFileService() { fileDirPath: String, request: TextReferenceFileDownloadRequest ): String? { - val separator = File.separator val fileNameList = getFileNames( projectCode = request.projectCode, - fileDir = "${request.fileDir}${separator}file" + fileDir = "${request.fileDir}${fileSeparator}file" ) if (fileNameList.isNullOrEmpty()) { logger.warn("get text reference file list fail") return null } - val downloadPath = "$fileDirPath${separator}file" + val downloadPath = "$fileDirPath${fileSeparator}file" fileNameList.forEach { downloadFile( - "${request.projectCode}$separator${request.fileDir}${separator}file$separator$it", + "${request.projectCode}$fileSeparator${request.fileDir}${fileSeparator}file$fileSeparator$it", File(downloadPath, it) ) } + if (!isDirectoryNotEmpty(downloadPath)) { + logger.warn(" FAIL|Download file from ${request.storeCode} fail") + return null + } + ZipUtil.zipDir(File(downloadPath), "$fileDirPath${fileSeparator}file.zip") return downloadPath } diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/MarketAtomArchiveServiceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/MarketAtomArchiveServiceImpl.kt index f607244fcc5..fad1637d1fa 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/MarketAtomArchiveServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/MarketAtomArchiveServiceImpl.kt @@ -270,6 +270,7 @@ class MarketAtomArchiveServiceImpl : MarketAtomArchiveService { jsonMap = taskDataMap.toMutableMap(), storeI18nConfig = StoreI18nConfig( projectCode = projectCode, + storeCode = atomCode, fileDir = "$atomCode/$version", i18nDir = i18nDir, dbKeyPrefix = StoreUtils.getStoreFieldKeyPrefix(StoreTypeEnum.ATOM, atomCode, version) diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/common/StoreFileService.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/common/StoreFileService.kt index 762622aa470..58e26a714a7 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/common/StoreFileService.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/common/StoreFileService.kt @@ -28,8 +28,10 @@ package com.tencent.devops.store.service.common import com.tencent.devops.artifactory.pojo.LocalDirectoryInfo import com.tencent.devops.artifactory.pojo.LocalFileInfo +import com.tencent.devops.common.api.factory.BkDiskLruFileCacheFactory import com.tencent.devops.common.api.util.UUIDUtil import com.tencent.devops.common.client.Client +import com.tencent.devops.common.service.utils.ZipUtil import com.tencent.devops.store.pojo.common.TextReferenceFileDownloadRequest import com.tencent.devops.store.utils.TextReferenceFileAnalysisUtil import java.io.File @@ -58,11 +60,15 @@ abstract class StoreFileService { companion object { const val BK_CI_PATH_REGEX = "(\\\$\\{\\{indexFile\\()(\"[^\"]*\")" - val fileSeparator: String = System.getProperty("file.separator") + val fileSeparator: String = File.separator private val logger = LoggerFactory.getLogger(StoreFileService::class.java) private const val FILE_DEFAULT_SIZE = 1024 + private const val DEFAULT_PUBLIC_HOST_MAX_FILE_CACHE_SIZE = 209715200L } + fun getFileCachePath(path: String) = "${System.getProperty("java.io.tmpdir")}${fileSeparator}cache" + + "$fileSeparator$path" + fun getTextReferenceFileDir( userId: String, version: String, @@ -72,11 +78,27 @@ abstract class StoreFileService { userId = userId, atomDir = request.fileDir ) + File.separator + UUIDUtil.generate() - return textReferenceFileDownload( - userId = userId, - fileDirPath = fileDirPath, - request = request + val fileCachePath = getFileCachePath("${request.storeCode}$fileSeparator$version") + val bkDiskLruFileCache = BkDiskLruFileCacheFactory.getDiskLruFileCache( + fileCachePath, + DEFAULT_PUBLIC_HOST_MAX_FILE_CACHE_SIZE ) + val fileZip = File("$fileDirPath${fileSeparator}file.zip") + val cacheKey = getFileCacheKey(request.storeCode, version) + bkDiskLruFileCache.get(cacheKey, fileZip) + val fileDir: String? + if (!fileZip.exists() || fileZip.length() < 1) { + fileDir = textReferenceFileDownload( + userId = userId, + fileDirPath = fileDirPath, + request = request + ) + bkDiskLruFileCache.put(cacheKey, File("$fileDirPath${fileSeparator}file.zip")) + } else { + fileDir = "$fileDirPath${fileSeparator}file" + ZipUtil.unZipFile(fileZip, fileDir) + } + return fileDir } abstract fun getFileNames( @@ -93,7 +115,7 @@ abstract class StoreFileService { request: TextReferenceFileDownloadRequest ): String? - private fun getFileCacheKey(projectCode: String, version: String) = "$projectCode-$version-TextReference" + private fun getFileCacheKey(storeCode: String, version: String) = "$storeCode-$version-TextReference" @Suppress("NestedBlockDepth") fun textReferenceFileAnalysis( diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/common/StoreI18nMessageService.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/common/StoreI18nMessageService.kt index 60a64b2292a..53fda888446 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/common/StoreI18nMessageService.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/common/StoreI18nMessageService.kt @@ -64,14 +64,9 @@ interface StoreI18nMessageService { */ fun parseErrorCodeI18nInfo( userId: String, - projectCode: String, errorCodes: Set, - fileDir: String, - i18nDir: String, - keyPrefix: String? = null, - repositoryHashId: String? = null, - branch: String? = null, - version: String + version: String, + storeI18nConfig: StoreI18nConfig ) /** diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/common/impl/StoreI18nMessageServiceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/common/impl/StoreI18nMessageServiceImpl.kt index df5da753adf..bfea1c0fc93 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/common/impl/StoreI18nMessageServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/common/impl/StoreI18nMessageServiceImpl.kt @@ -44,9 +44,8 @@ import com.tencent.devops.store.pojo.common.TextReferenceFileDownloadRequest import com.tencent.devops.store.service.common.StoreFileService import com.tencent.devops.store.service.common.StoreFileService.Companion.BK_CI_PATH_REGEX import com.tencent.devops.store.service.common.StoreI18nMessageService +import com.tencent.devops.store.utils.TextReferenceFileAnalysisUtil.isDirectoryNotEmpty import java.io.File -import java.nio.file.Files -import java.nio.file.Paths import java.util.Properties import java.util.concurrent.Executors import java.util.regex.Matcher @@ -145,18 +144,13 @@ abstract class StoreI18nMessageServiceImpl : StoreI18nMessageService { override fun parseErrorCodeI18nInfo( userId: String, - projectCode: String, errorCodes: Set, - fileDir: String, - i18nDir: String, - keyPrefix: String?, - repositoryHashId: String?, - branch: String?, - version: String + version: String, + storeI18nConfig: StoreI18nConfig ) { - logger.info( - "parseErrorCode params:[$userId|$projectCode|$fileDir|$i18nDir|$keyPrefix|$repositoryHashId|$branch]" - ) + logger.info("parseErrorCode params:[$userId|${storeI18nConfig.projectCode}" + + "|${storeI18nConfig.fileDir}|${storeI18nConfig.i18nDir}|${storeI18nConfig.dbKeyPrefix}" + + "|${storeI18nConfig.repositoryHashId}]") val fieldLocaleInfos = mutableListOf() errorCodes.forEach { errorCode -> fieldLocaleInfos.add(FieldLocaleInfo(fieldName = errorCode.toString(), fieldValue = "")) @@ -166,14 +160,7 @@ abstract class StoreI18nMessageServiceImpl : StoreI18nMessageService { userId = userId, fieldLocaleInfos = fieldLocaleInfos, version = version, - storeI18nConfig = StoreI18nConfig( - projectCode = projectCode, - fileDir = fileDir, - i18nDir = i18nDir, - repositoryHashId = repositoryHashId, - dbKeyPrefix = keyPrefix, - branch = branch - ) + storeI18nConfig = storeI18nConfig ) } @@ -251,7 +238,8 @@ abstract class StoreI18nMessageServiceImpl : StoreI18nMessageService { request = TextReferenceFileDownloadRequest( projectCode = storeI18nConfig.projectCode, fileDir = storeI18nConfig.fileDir, - repositoryHashId = storeI18nConfig.repositoryHashId + repositoryHashId = storeI18nConfig.repositoryHashId, + storeCode = storeI18nConfig.storeCode ) ) } @@ -402,12 +390,4 @@ abstract class StoreI18nMessageServiceImpl : StoreI18nMessageService { } return result } - - private fun isDirectoryNotEmpty(path: String?): Boolean { - if (path == null) { - return false - } - val directory = Paths.get(path) - return Files.isDirectory(directory) && Files.list(directory).findFirst().isPresent - } } diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/utils/TextReferenceFileAnalysisUtil.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/utils/TextReferenceFileAnalysisUtil.kt index 58df8623e1e..968384a07a4 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/utils/TextReferenceFileAnalysisUtil.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/utils/TextReferenceFileAnalysisUtil.kt @@ -36,6 +36,8 @@ import com.tencent.devops.common.client.Client import com.tencent.devops.common.web.utils.I18nUtil import com.tencent.devops.store.constant.StoreMessageCode import java.io.File +import java.nio.file.Files +import java.nio.file.Paths import java.util.regex.Matcher import java.util.regex.Pattern @@ -147,4 +149,12 @@ object TextReferenceFileAnalysisUtil { fun buildAtomArchivePath(userId: String, atomDir: String) = "${getAtomBasePath()}$fileSeparator$BK_CI_ATOM_DIR$fileSeparator" + "$userId$fileSeparator$atomDir" + + fun isDirectoryNotEmpty(path: String?): Boolean { + if (path == null) { + return false + } + val directory = Paths.get(path) + return Files.isDirectory(directory) && Files.list(directory).findFirst().isPresent + } } From 17c3c1abc85b1450a9ddb656c7c05252f1b56572 Mon Sep 17 00:00:00 2001 From: yjieliang Date: Tue, 7 Nov 2023 16:05:04 +0800 Subject: [PATCH 49/73] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../atom/impl/AtomReleaseServiceImpl.kt | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt index 0f098087bbd..e44eea420d2 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt @@ -379,6 +379,7 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ jsonMap = jsonMap, storeI18nConfig = StoreI18nConfig( projectCode = projectCode, + storeCode = atomCode, fileDir = "$atomCode/$version", i18nDir = i18nDir, propertiesKeyPrefix = KEY_RELEASE_INFO, @@ -536,14 +537,17 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ ) storeI18nMessageService.parseErrorCodeI18nInfo( userId = userId, - projectCode = projectCode, errorCodes = errorCodes, - fileDir = "$atomCode/$atomVersion", - i18nDir = StoreUtils.getStoreI18nDir(atomLanguage, getAtomPackageSourceType(repositoryHashId)), - keyPrefix = "${StoreTypeEnum.ATOM.name}.$atomCode.$atomVersion", - repositoryHashId = repositoryHashId, - branch = branch, - version = atomVersion + version = atomVersion, + storeI18nConfig = StoreI18nConfig( + projectCode = projectCode, + storeCode = atomCode, + fileDir = "$atomCode/$atomVersion", + i18nDir = StoreUtils.getStoreI18nDir(atomLanguage, getAtomPackageSourceType(repositoryHashId)), + dbKeyPrefix = "${StoreTypeEnum.ATOM.name}.$atomCode.$atomVersion", + repositoryHashId = repositoryHashId, + branch = branch + ) ) val storeErrorCodeInfo = StoreErrorCodeInfo( storeCode = atomCode, @@ -583,6 +587,7 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ jsonMap = JsonUtil.toMutableMap(qualityJsonStr), storeI18nConfig = StoreI18nConfig( projectCode = projectCode, + storeCode = atomCode, fileDir = "$atomCode/$atomVersion", i18nDir = i18nDir, dbKeyPrefix = StoreUtils.getStoreFieldKeyPrefix(StoreTypeEnum.ATOM, atomCode, atomVersion), @@ -1283,6 +1288,7 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ jsonMap = getAtomConfResult.taskDataMap.toMutableMap(), storeI18nConfig = StoreI18nConfig( projectCode = projectCode, + storeCode = atomCode, fileDir = "$atomCode/$version", i18nDir = updateAtomPackageInfo.i18nDir, dbKeyPrefix = StoreUtils.getStoreFieldKeyPrefix(StoreTypeEnum.ATOM, atomCode, version), From a37e3b388d58ebbce879ede5a2cc718e725b609f Mon Sep 17 00:00:00 2001 From: yjieliang Date: Mon, 13 Nov 2023 16:01:21 +0800 Subject: [PATCH 50/73] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../store/service/common/impl/StoreI18nMessageServiceImpl.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/common/impl/StoreI18nMessageServiceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/common/impl/StoreI18nMessageServiceImpl.kt index 44435306975..0756fb353f4 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/common/impl/StoreI18nMessageServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/common/impl/StoreI18nMessageServiceImpl.kt @@ -231,7 +231,8 @@ abstract class StoreI18nMessageServiceImpl : StoreI18nMessageService { projectCode = storeI18nConfig.projectCode, properties = fileProperties, repositoryHashId = storeI18nConfig.repositoryHashId, - fileDir = storeI18nConfig.fileDir + fileDir = storeI18nConfig.fileDir, + branch = storeI18nConfig.branch ) var textReferenceFileDirPath: String? = null val allFileNames = textReferenceContentMap.values.flatten().toSet() From fadbe5684e670b5aae37ea33cf58fcd70b356eba Mon Sep 17 00:00:00 2001 From: yjieliang Date: Thu, 16 Nov 2023 15:56:49 +0800 Subject: [PATCH 51/73] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/tencent/devops/store/constant/StoreMessageCode.kt | 4 +++- support-files/i18n/store/message_en_US.properties | 2 ++ support-files/i18n/store/message_zh_CN.properties | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/constant/StoreMessageCode.kt b/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/constant/StoreMessageCode.kt index 8437fa3792a..b7fb40a045c 100644 --- a/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/constant/StoreMessageCode.kt +++ b/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/constant/StoreMessageCode.kt @@ -150,7 +150,9 @@ object StoreMessageCode { const val BUILD_VISIT_NO_PERMISSION = "2120923" // 接口请求中的插件【{0}】不是当前当前构建运行的插件 const val VERSION_PUBLISHED = "2120924" // 组件{0}版本({1})已发布 const val NO_COMPONENT_ADMIN_AND_CREATETOR_PERMISSION = "2120925" // 无组件{0}管理员或当前版本创建者权限,请联系组件管理员。 - const val USER_NOT_IS_STORE_MEMBE = "2120926" // 研发商店:用户{0}不是组件成员 + const val USER_NOT_IS_STORE_MEMBER = "2120926" // 研发商店:用户{0}不是组件成员 + const val GET_BRANCH_COMMIT_INFO_ERROR = "2120927" // 获取分支提交信息异常 + const val STORE_BRANCH_NO_NEW_COMMIT = "2120928" // 代码未变更,分支测试版本生成失败 const val BK_OTHER = "bkOther" // 其他 const val BK_PIPELINED_JOB = "bkPipelinedJob" // 流水线Job diff --git a/support-files/i18n/store/message_en_US.properties b/support-files/i18n/store/message_en_US.properties index ea1d395eaf0..c0909068968 100644 --- a/support-files/i18n/store/message_en_US.properties +++ b/support-files/i18n/store/message_en_US.properties @@ -94,6 +94,8 @@ 2120924=Component {0} version ({1}) has been published. 2120925=You do not have admin or current version creator permissions for component {0}. Please contact the component admin. 2120926=store:The user {0} is not a member of the component +2120927=Failed to retrieve branch commit information. +2120928=The branch test version generation failed without any code changes. ATOM.classify.common=Others ATOM.classify.compileBuild=Compile ATOM.classify.deploy=Deploy diff --git a/support-files/i18n/store/message_zh_CN.properties b/support-files/i18n/store/message_zh_CN.properties index 8f4512ede5f..86b36f8c8e7 100644 --- a/support-files/i18n/store/message_zh_CN.properties +++ b/support-files/i18n/store/message_zh_CN.properties @@ -94,6 +94,8 @@ 2120924=组件{0}版本({1})已发布 2120925=无组件{0}管理员或当前版本创建者权限,请联系组件管理员。 2120926=研发商店:用户{0}不是组件成员 +2120927=获取分支提交信息失败 +2120928=代码未变更,分支测试版本生成失败 ATOM.classify.common=其它 ATOM.classify.compileBuild=编译 ATOM.classify.deploy=部署 From b9d1505247af27328f7cf24932dea537a09d890a Mon Sep 17 00:00:00 2001 From: yjieliang Date: Thu, 16 Nov 2023 17:03:01 +0800 Subject: [PATCH 52/73] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt index 020dffd8370..8e2c33be617 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt @@ -255,7 +255,7 @@ class AtomDao : AtomBaseDao() { return with(TAtom.T_ATOM) { dslContext.selectFrom(this) .where(ATOM_CODE.eq(atomCode).and(VERSION.like(VersionUtils.generateQueryVersion(version)))) - .orderBy(CREATE_TIME.desc()) + .orderBy(UPDATE_TIME.desc()) .limit(1) .fetchOne() } From bb4cf8b501269694a6e5b0a7a5d38f1bf8b466c6 Mon Sep 17 00:00:00 2001 From: yjieliang Date: Thu, 16 Nov 2023 17:03:42 +0800 Subject: [PATCH 53/73] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt index 8e2c33be617..79aa24acdeb 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt @@ -255,7 +255,7 @@ class AtomDao : AtomBaseDao() { return with(TAtom.T_ATOM) { dslContext.selectFrom(this) .where(ATOM_CODE.eq(atomCode).and(VERSION.like(VersionUtils.generateQueryVersion(version)))) - .orderBy(UPDATE_TIME.desc()) + .orderBy(CREATE_TIME.desc()) .limit(1) .fetchOne() } @@ -265,7 +265,7 @@ class AtomDao : AtomBaseDao() { return with(TAtom.T_ATOM) { dslContext.selectFrom(this) .where(ATOM_CODE.eq(atomCode).and(VERSION.startsWith(versionPrefix))) - .orderBy(CREATE_TIME.desc()) + .orderBy(UPDATE_TIME.desc()) .limit(1) .fetchOne() } From 02bf17a17a0fb19a3d4ea58fe560bfe1311cdd2d Mon Sep 17 00:00:00 2001 From: yjieliang Date: Thu, 16 Nov 2023 18:15:58 +0800 Subject: [PATCH 54/73] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tencent/devops/store/api/atom/BuildAtomResource.kt | 2 +- .../devops/store/pojo/{atom => common}/StoreI18nConfig.kt | 2 +- .../kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt | 8 ++++---- .../store/service/atom/impl/AtomReleaseServiceImpl.kt | 2 +- .../devops/store/service/atom/impl/AtomServiceImpl.kt | 2 +- .../service/atom/impl/MarketAtomArchiveServiceImpl.kt | 2 +- .../store/service/common/StoreI18nMessageService.kt | 2 +- .../service/common/impl/StoreI18nMessageServiceImpl.kt | 2 +- 8 files changed, 11 insertions(+), 11 deletions(-) rename src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/pojo/{atom => common}/StoreI18nConfig.kt (98%) diff --git a/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/api/atom/BuildAtomResource.kt b/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/api/atom/BuildAtomResource.kt index 29568f2a5d4..d1341737c90 100644 --- a/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/api/atom/BuildAtomResource.kt +++ b/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/api/atom/BuildAtomResource.kt @@ -91,7 +91,7 @@ interface BuildAtomResource { @ApiOperation("根据插件版本ID获取插件版本进度") @GET - @Path("/desk/atom/release/Ids/{atomId}") + @Path("/desk/atom/release/ids/{atomId}") fun getProcessInfo( @ApiParam("userId", required = true) @HeaderParam(AUTH_HEADER_USER_ID) diff --git a/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/pojo/atom/StoreI18nConfig.kt b/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/pojo/common/StoreI18nConfig.kt similarity index 98% rename from src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/pojo/atom/StoreI18nConfig.kt rename to src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/pojo/common/StoreI18nConfig.kt index 465e2be0fc1..21db2947634 100644 --- a/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/pojo/atom/StoreI18nConfig.kt +++ b/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/pojo/common/StoreI18nConfig.kt @@ -25,7 +25,7 @@ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -package com.tencent.devops.store.pojo.atom +package com.tencent.devops.store.pojo.common import io.swagger.annotations.ApiModel import io.swagger.annotations.ApiModelProperty diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt index 79aa24acdeb..5842d163650 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt @@ -261,7 +261,7 @@ class AtomDao : AtomBaseDao() { } } - fun getAtomTestVersion(dslContext: DSLContext, atomCode: String, versionPrefix: String): TAtomRecord? { + fun getAtomByVersionPrefix(dslContext: DSLContext, atomCode: String, versionPrefix: String): TAtomRecord? { return with(TAtom.T_ATOM) { dslContext.selectFrom(this) .where(ATOM_CODE.eq(atomCode).and(VERSION.startsWith(versionPrefix))) @@ -525,17 +525,17 @@ class AtomDao : AtomBaseDao() { delim = ".", count = -1 ) - val field = t.field(KEY_BRANCH_TEST_FLAG) as Field + val branchTestFlagField = t.field(KEY_BRANCH_TEST_FLAG) as Field val queryStep = dslContext.select( t.field(KEY_VERSION), t.field(KEY_ATOM_STATUS), firstVersion, secondVersion, thirdVersion, - field + branchTestFlagField ).from(t) .orderBy( - field.desc(), + branchTestFlagField.desc(), firstVersion.plus(0).desc(), secondVersion.plus(0).desc(), thirdVersion.plus(0).desc() diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt index 662b0b40983..97dcba6e905 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt @@ -86,7 +86,7 @@ import com.tencent.devops.store.pojo.atom.GetAtomConfigResult import com.tencent.devops.store.pojo.atom.GetAtomQualityConfigResult import com.tencent.devops.store.pojo.atom.MarketAtomCreateRequest import com.tencent.devops.store.pojo.atom.MarketAtomUpdateRequest -import com.tencent.devops.store.pojo.atom.StoreI18nConfig +import com.tencent.devops.store.pojo.common.StoreI18nConfig import com.tencent.devops.store.pojo.atom.UpdateAtomInfo import com.tencent.devops.store.pojo.atom.UpdateAtomPackageInfo import com.tencent.devops.store.pojo.atom.enums.AtomStatusEnum diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomServiceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomServiceImpl.kt index 340e38ef0ec..e9a238ad86f 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomServiceImpl.kt @@ -715,7 +715,7 @@ abstract class AtomServiceImpl @Autowired constructor() : AtomService { versionName = "$atomVersion ($atomStatusMsg)" latestVersionName = "$latestVersionName ($atomStatusMsg)" } - if (tmpVersionPrefix != versionPrefix && !(it[KEY_BRANCH_TEST_FLAG] as Boolean)) { + if (tmpVersionPrefix != versionPrefix && (it[KEY_BRANCH_TEST_FLAG] as Boolean) != true) { versionList.add(VersionInfo(latestVersionName, "$versionPrefix*")) // 添加大版本号的通用最新模式(如1.*) tmpVersionPrefix = versionPrefix } diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/MarketAtomArchiveServiceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/MarketAtomArchiveServiceImpl.kt index fad1637d1fa..af04ee704b6 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/MarketAtomArchiveServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/MarketAtomArchiveServiceImpl.kt @@ -46,7 +46,7 @@ import com.tencent.devops.store.pojo.atom.AtomConfigInfo import com.tencent.devops.store.pojo.atom.AtomPkgInfoUpdateRequest import com.tencent.devops.store.pojo.atom.GetAtomConfigResult import com.tencent.devops.store.pojo.atom.ReleaseInfo -import com.tencent.devops.store.pojo.atom.StoreI18nConfig +import com.tencent.devops.store.pojo.common.StoreI18nConfig import com.tencent.devops.store.pojo.common.KEY_CONFIG import com.tencent.devops.store.pojo.common.KEY_EXECUTION import com.tencent.devops.store.pojo.common.KEY_INPUT diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/common/StoreI18nMessageService.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/common/StoreI18nMessageService.kt index 53fda888446..b603bbe3289 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/common/StoreI18nMessageService.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/common/StoreI18nMessageService.kt @@ -27,7 +27,7 @@ package com.tencent.devops.store.service.common -import com.tencent.devops.store.pojo.atom.StoreI18nConfig +import com.tencent.devops.store.pojo.common.StoreI18nConfig @Suppress("LongParameterList") interface StoreI18nMessageService { diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/common/impl/StoreI18nMessageServiceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/common/impl/StoreI18nMessageServiceImpl.kt index 0756fb353f4..8f9f19409ee 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/common/impl/StoreI18nMessageServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/common/impl/StoreI18nMessageServiceImpl.kt @@ -39,7 +39,7 @@ import com.tencent.devops.common.client.Client import com.tencent.devops.common.service.config.CommonConfig import com.tencent.devops.common.web.service.ServiceI18nMessageResource import com.tencent.devops.common.web.utils.I18nUtil -import com.tencent.devops.store.pojo.atom.StoreI18nConfig +import com.tencent.devops.store.pojo.common.StoreI18nConfig import com.tencent.devops.store.pojo.common.TextReferenceFileDownloadRequest import com.tencent.devops.store.service.common.StoreFileService import com.tencent.devops.store.service.common.StoreFileService.Companion.BK_CI_PATH_REGEX From 65c7db8c58cc074f3f8062c8e885cab95743b205 Mon Sep 17 00:00:00 2001 From: yjieliang Date: Mon, 20 Nov 2023 15:54:48 +0800 Subject: [PATCH 55/73] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/v2/ServiceQualityControlPointMarketResource.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/backend/ci/core/quality/api-quality/src/main/kotlin/com/tencent/devops/quality/api/v2/ServiceQualityControlPointMarketResource.kt b/src/backend/ci/core/quality/api-quality/src/main/kotlin/com/tencent/devops/quality/api/v2/ServiceQualityControlPointMarketResource.kt index 50a16fb8d07..6235904fb82 100644 --- a/src/backend/ci/core/quality/api-quality/src/main/kotlin/com/tencent/devops/quality/api/v2/ServiceQualityControlPointMarketResource.kt +++ b/src/backend/ci/core/quality/api-quality/src/main/kotlin/com/tencent/devops/quality/api/v2/ServiceQualityControlPointMarketResource.kt @@ -27,6 +27,7 @@ package com.tencent.devops.quality.api.v2 +import com.tencent.devops.common.api.constant.IN_READY_TEST import com.tencent.devops.common.api.pojo.Result import com.tencent.devops.quality.api.v2.pojo.QualityControlPoint import io.swagger.annotations.Api @@ -53,7 +54,7 @@ interface ServiceQualityControlPointMarketResource { @QueryParam("userId") userId: String, @QueryParam("tag") - tag: String, + tag: String = IN_READY_TEST, controlPoint: QualityControlPoint ): Result @@ -72,6 +73,6 @@ interface ServiceQualityControlPointMarketResource { @QueryParam("elementType") elementType: String, @QueryParam("tag") - tag: String + tag: String = IN_READY_TEST ): Result } From 522f7d34a5bea5aba2fde3ce0ecbb159800d6aca Mon Sep 17 00:00:00 2001 From: yjieliang Date: Mon, 20 Nov 2023 16:21:06 +0800 Subject: [PATCH 56/73] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../store/dao/atom/MarketAtomVersionLogDao.kt | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/MarketAtomVersionLogDao.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/MarketAtomVersionLogDao.kt index 3f84b6ea8d5..9d39243ea03 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/MarketAtomVersionLogDao.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/MarketAtomVersionLogDao.kt @@ -32,10 +32,10 @@ import com.tencent.devops.model.store.tables.TAtom import com.tencent.devops.model.store.tables.TAtomVersionLog import com.tencent.devops.model.store.tables.records.TAtomVersionLogRecord import com.tencent.devops.store.pojo.common.enums.ReleaseTypeEnum +import java.time.LocalDateTime import org.jooq.DSLContext import org.jooq.Result import org.springframework.stereotype.Repository -import java.time.LocalDateTime @Suppress("ALL") @Repository @@ -82,12 +82,18 @@ class MarketAtomVersionLogDao { } } - fun getAtomVersions(dslContext: DSLContext, atomIds: List): Result? { + fun getAtomVersions( + dslContext: DSLContext, + atomIds: List, + getTestVersionFlag: Boolean = false + ): Result? { with(TAtomVersionLog.T_ATOM_VERSION_LOG) { - return dslContext.selectFrom(this) + val step = dslContext.selectFrom(this) .where(ATOM_ID.`in`(atomIds)) - .and(RELEASE_TYPE.notEqual(ReleaseTypeEnum.BRANCH_TEST.releaseType.toByte())) - .fetch() + val conditionStep = if (!getTestVersionFlag) { + step.and(RELEASE_TYPE.notEqual(ReleaseTypeEnum.BRANCH_TEST.releaseType.toByte())) + } else { step } + return conditionStep.fetch() } } From 94e19f208b069f0cbb64a24dd432430bbb0ed358 Mon Sep 17 00:00:00 2001 From: yjieliang Date: Mon, 20 Nov 2023 16:41:18 +0800 Subject: [PATCH 57/73] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt index 5842d163650..b203b51c6b9 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt @@ -649,8 +649,8 @@ class AtomDao : AtomBaseDao() { .join(tspr) .on(ta.ATOM_CODE.eq(tspr.STORE_CODE)) .where(initTestAtomCondition) - .groupBy(ta.ATOM_CODE) - .orderBy(ta.CREATE_TIME.desc()) +// .groupBy(ta.ATOM_CODE) +// .orderBy(ta.CREATE_TIME.desc()) ) } val t = queryAtomStep.asTable("t") From 93caa2f734331522d7c1c84b3e7d8c1ad41b6b1b Mon Sep 17 00:00:00 2001 From: yjieliang Date: Mon, 20 Nov 2023 17:43:02 +0800 Subject: [PATCH 58/73] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../quality/api/v2/ServiceQualityIndicatorMarketResource.kt | 5 +++-- .../quality/api/v2/ServiceQualityMetadataMarketResource.kt | 5 +++-- .../main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/backend/ci/core/quality/api-quality/src/main/kotlin/com/tencent/devops/quality/api/v2/ServiceQualityIndicatorMarketResource.kt b/src/backend/ci/core/quality/api-quality/src/main/kotlin/com/tencent/devops/quality/api/v2/ServiceQualityIndicatorMarketResource.kt index 571e38c4773..8721816b807 100644 --- a/src/backend/ci/core/quality/api-quality/src/main/kotlin/com/tencent/devops/quality/api/v2/ServiceQualityIndicatorMarketResource.kt +++ b/src/backend/ci/core/quality/api-quality/src/main/kotlin/com/tencent/devops/quality/api/v2/ServiceQualityIndicatorMarketResource.kt @@ -27,6 +27,7 @@ package com.tencent.devops.quality.api.v2 +import com.tencent.devops.common.api.constant.IN_READY_TEST import com.tencent.devops.common.api.pojo.Result import com.tencent.devops.quality.api.v2.pojo.op.IndicatorUpdate import io.swagger.annotations.Api @@ -55,7 +56,7 @@ interface ServiceQualityIndicatorMarketResource { @QueryParam("atomCode") atomCode: String, @QueryParam("tag") - tag: String, + tag: String = IN_READY_TEST, indicatorUpdateList: Collection ): Result @@ -75,6 +76,6 @@ interface ServiceQualityIndicatorMarketResource { @QueryParam("elementType") elementType: String, @QueryParam("extra") - extra: String + extra: String = IN_READY_TEST ): Result } diff --git a/src/backend/ci/core/quality/api-quality/src/main/kotlin/com/tencent/devops/quality/api/v2/ServiceQualityMetadataMarketResource.kt b/src/backend/ci/core/quality/api-quality/src/main/kotlin/com/tencent/devops/quality/api/v2/ServiceQualityMetadataMarketResource.kt index ebdf485b0f5..f04497d7b82 100644 --- a/src/backend/ci/core/quality/api-quality/src/main/kotlin/com/tencent/devops/quality/api/v2/ServiceQualityMetadataMarketResource.kt +++ b/src/backend/ci/core/quality/api-quality/src/main/kotlin/com/tencent/devops/quality/api/v2/ServiceQualityMetadataMarketResource.kt @@ -27,6 +27,7 @@ package com.tencent.devops.quality.api.v2 +import com.tencent.devops.common.api.constant.IN_READY_TEST import com.tencent.devops.common.api.pojo.Result import com.tencent.devops.quality.api.v2.pojo.op.QualityMetaData import io.swagger.annotations.Api @@ -55,7 +56,7 @@ interface ServiceQualityMetadataMarketResource { @QueryParam("atomCode") atomCode: String, @QueryParam("extra") - extra: String, + extra: String = IN_READY_TEST, metadataList: List ): Result> @@ -74,6 +75,6 @@ interface ServiceQualityMetadataMarketResource { @QueryParam("elementType") elementType: String, @QueryParam("extra") - extra: String + extra: String = IN_READY_TEST ): Result } diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt index b203b51c6b9..5842d163650 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt @@ -649,8 +649,8 @@ class AtomDao : AtomBaseDao() { .join(tspr) .on(ta.ATOM_CODE.eq(tspr.STORE_CODE)) .where(initTestAtomCondition) -// .groupBy(ta.ATOM_CODE) -// .orderBy(ta.CREATE_TIME.desc()) + .groupBy(ta.ATOM_CODE) + .orderBy(ta.CREATE_TIME.desc()) ) } val t = queryAtomStep.asTable("t") From 28a43d30c33d73f6297e5367fbb82be96298d0e8 Mon Sep 17 00:00:00 2001 From: yjieliang Date: Mon, 20 Nov 2023 18:01:36 +0800 Subject: [PATCH 59/73] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sql/2003_v2.x/2020_ci_process-update_v2.0_mysql.sql | 2 +- .../sql/2003_v2.x/2020_ci_quality-update_v2.0_mysql.sql | 4 ++-- .../sql/2003_v2.x/2020_ci_store-update_v2.0_mysql.sql | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/support-files/sql/2003_v2.x/2020_ci_process-update_v2.0_mysql.sql b/support-files/sql/2003_v2.x/2020_ci_process-update_v2.0_mysql.sql index 2a0a3facc0f..c8259f61bf5 100644 --- a/support-files/sql/2003_v2.x/2020_ci_process-update_v2.0_mysql.sql +++ b/support-files/sql/2003_v2.x/2020_ci_process-update_v2.0_mysql.sql @@ -90,7 +90,7 @@ BEGIN WHERE TABLE_SCHEMA = db AND TABLE_NAME = 'T_PIPELINE_MODEL_TASK' AND COLUMN_NAME = 'ATOM_VERSION') THEN - ALTER TABLE T_PIPELINE_MODEL_TASK MODIFY COLUMN ATOM_VERSION varchar(30) NULL; + ALTER TABLE T_PIPELINE_MODEL_TASK MODIFY COLUMN ATOM_VERSION varchar(30) NULL COMMENT '插件版本号'; END IF; COMMIT; diff --git a/support-files/sql/2003_v2.x/2020_ci_quality-update_v2.0_mysql.sql b/support-files/sql/2003_v2.x/2020_ci_quality-update_v2.0_mysql.sql index 595c5157fb9..2b4a68d6f48 100644 --- a/support-files/sql/2003_v2.x/2020_ci_quality-update_v2.0_mysql.sql +++ b/support-files/sql/2003_v2.x/2020_ci_quality-update_v2.0_mysql.sql @@ -17,14 +17,14 @@ BEGIN WHERE TABLE_SCHEMA = db AND TABLE_NAME = 'T_QUALITY_CONTROL_POINT' AND COLUMN_NAME = 'ATOM_VERSION') THEN - ALTER TABLE T_QUALITY_CONTROL_POINT MODIFY COLUMN ATOM_VERSION varchar(30) DEFAULT '1.0.0' NULL; + ALTER TABLE T_QUALITY_CONTROL_POINT MODIFY COLUMN ATOM_VERSION varchar(30) DEFAULT '1.0.0' COMMENT '插件版本'; END IF; IF EXISTS(SELECT 1 FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = db AND TABLE_NAME = 'T_QUALITY_INDICATOR' AND COLUMN_NAME = 'ATOM_VERSION') THEN - ALTER TABLE T_QUALITY_INDICATOR MODIFY COLUMN ATOM_VERSION varchar(30) DEFAULT '1.0.0' NOT NULL; + ALTER TABLE T_QUALITY_INDICATOR MODIFY COLUMN ATOM_VERSION varchar(30) DEFAULT '1.0.0' COMMENT '插件版本号'; END IF; COMMIT; diff --git a/support-files/sql/2003_v2.x/2020_ci_store-update_v2.0_mysql.sql b/support-files/sql/2003_v2.x/2020_ci_store-update_v2.0_mysql.sql index 3088090ae9a..657038b60f7 100644 --- a/support-files/sql/2003_v2.x/2020_ci_store-update_v2.0_mysql.sql +++ b/support-files/sql/2003_v2.x/2020_ci_store-update_v2.0_mysql.sql @@ -17,7 +17,7 @@ BEGIN WHERE TABLE_SCHEMA = db AND TABLE_NAME = 'T_ATOM' AND COLUMN_NAME = 'VERSION') THEN - ALTER TABLE T_ATOM MODIFY COLUMN VERSION varchar(30) NOT NULL; + ALTER TABLE T_ATOM MODIFY COLUMN VERSION varchar(30) NOT NULL COMMENT '版本号'; END IF; IF NOT EXISTS(SELECT 1 From 61ec0da34f6ce8f76fdd1e30983a4119e9ade308 Mon Sep 17 00:00:00 2001 From: yjieliang Date: Tue, 21 Nov 2023 14:14:47 +0800 Subject: [PATCH 60/73] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt index 5842d163650..58485cf7f0f 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt @@ -650,7 +650,6 @@ class AtomDao : AtomBaseDao() { .on(ta.ATOM_CODE.eq(tspr.STORE_CODE)) .where(initTestAtomCondition) .groupBy(ta.ATOM_CODE) - .orderBy(ta.CREATE_TIME.desc()) ) } val t = queryAtomStep.asTable("t") From 7e0d19aef29a531855243218796c1a3ce878f2a5 Mon Sep 17 00:00:00 2001 From: yjieliang Date: Tue, 21 Nov 2023 20:30:32 +0800 Subject: [PATCH 61/73] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../store/pojo/common/StoreConstants.kt | 1 + .../tencent/devops/store/dao/atom/AtomDao.kt | 11 +---- .../devops/store/dao/atom/MarketAtomDao.kt | 40 +++++++++++++++++-- .../impl/AtomHandleBuildResultServiceImpl.kt | 14 +++++++ .../atom/impl/AtomReleaseServiceImpl.kt | 28 ++++++++++++- 5 files changed, 79 insertions(+), 15 deletions(-) diff --git a/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/pojo/common/StoreConstants.kt b/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/pojo/common/StoreConstants.kt index c2ae548dbce..1951eb9134b 100644 --- a/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/pojo/common/StoreConstants.kt +++ b/src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/pojo/common/StoreConstants.kt @@ -67,6 +67,7 @@ const val ATOM_NAMESPACE = "namespace" // 插件命名空间 const val ATOM_UPLOAD_ID_KEY_PREFIX = "ATOM_UPLOAD_ID" // 插件包上传ID值Key前缀 const val STORE_PUBLIC_FLAG_KEY_PREFIX = "STORE_PUBLIC_FLAG_KEY" // 公共组件Key前缀 const val STORE_NORMAL_PROJECT_RUN_INFO_KEY_PREFIX = "STORE_NORMAL_PROJECT_RUN_INFO_KEY" // 组件对应普通项目的运行时信息Key前缀 +const val STORE_LATEST_TEST_FLAG_KEY_PREFIX = "STORE_LATEST_TEST_FLAG" const val SERVICE_COLLABORATOR_APPLY_MOA_TEMPLATE = "SERIVCE_COLLABORATOR_APPLY_MOA_TEMPLATE" // 扩展服务协作开发申请MOA审批消息通知模板 const val SERVICE_COLLABORATOR_APPLY_REFUSE_TEMPLATE = "SERIVCE_COLLABORATOR_APPLY_REFUSE" // 扩展服务协作开发申请被拒的消息通知模板 diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt index 58485cf7f0f..ce7166dd2c1 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt @@ -649,7 +649,6 @@ class AtomDao : AtomBaseDao() { .join(tspr) .on(ta.ATOM_CODE.eq(tspr.STORE_CODE)) .where(initTestAtomCondition) - .groupBy(ta.ATOM_CODE) ) } val t = queryAtomStep.asTable("t") @@ -991,14 +990,8 @@ class AtomDao : AtomBaseDao() { fitOsFlag = fitOsFlag, queryFitAgentBuildLessAtomFlag = queryFitAgentBuildLessAtomFlag ) - conditions.add( - ta.ATOM_STATUS.`in`( - listOf( - AtomStatusEnum.TESTING.status.toByte(), - AtomStatusEnum.AUDITING.status.toByte() - ) - ) - ) // 只查测试中和审核中的插件 + // 只查最新的测试中和审核中的插件 + conditions.add(ta.LATEST_TEST_FLAG.eq(true)) conditions.add(tspr.PROJECT_CODE.eq(projectCode)) conditions.add(tspr.TYPE.`in`(listOf(StoreProjectTypeEnum.TEST.type.toByte()))) // 调试项目 conditions.add(tspr.STORE_TYPE.eq(StoreTypeEnum.ATOM.type.toByte())) diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/MarketAtomDao.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/MarketAtomDao.kt index a883abf559a..6ec6178f42e 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/MarketAtomDao.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/MarketAtomDao.kt @@ -618,13 +618,14 @@ class MarketAtomDao : AtomBaseDao() { dslContext: DSLContext, atomCode: String, versionPrefix: String - ): Result { - return with(TAtom.T_ATOM) { - dslContext.selectFrom(this) + ): TAtomRecord? { + with(TAtom.T_ATOM) { + return dslContext.selectFrom(this) .where(ATOM_CODE.eq(atomCode)) .and(VERSION.startsWith(versionPrefix)) .and(ATOM_STATUS.eq(AtomStatusEnum.TESTING.status.toByte())) - .fetch() + .orderBy(UPDATE_TIME.desc()) + .fetchOne() } } @@ -730,6 +731,37 @@ class MarketAtomDao : AtomBaseDao() { } } + fun setupAtomLatestTestFlagByAtomId(dslContext: DSLContext, userId: String, atomId: String) { + with(TAtom.T_ATOM) { + dslContext.update(this) + .set(LATEST_TEST_FLAG, DSL.case_() + .`when`(ID.eq(atomId), true) + .otherwise(false)) + .set(MODIFIER, userId) + .execute() + } + } + + fun queryAtomLatestTestVersionId(dslContext: DSLContext,atomCode: String): String? { + with(TAtom.T_ATOM) { + return dslContext.select(ID).from(this) + .where(ATOM_CODE.eq(atomCode)) + .and(ATOM_STATUS.`in`( + listOf(AtomStatusEnum.TESTING.status.toByte(), AtomStatusEnum.AUDITING.status.toByte()) + )) + .orderBy(UPDATE_TIME.desc()) + .limit(1) + .fetchOne(0, String::class.java) + } + } + + fun isAtomLatestTestVersion(dslContext: DSLContext,atomId: String): Int { + with(TAtom.T_ATOM) { + return dslContext.select(ID).from(this) + .where(ID.eq(atomId).and(LATEST_TEST_FLAG.eq(true))).execute() + } + } + fun updateAtomInfoByCode(dslContext: DSLContext, userId: String, atomCode: String, updateAtomInfo: UpdateAtomInfo) { with(TAtom.T_ATOM) { val baseStep = dslContext.update(this) diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomHandleBuildResultServiceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomHandleBuildResultServiceImpl.kt index def642f852d..4c2b6e6abeb 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomHandleBuildResultServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomHandleBuildResultServiceImpl.kt @@ -30,11 +30,13 @@ package com.tencent.devops.store.service.atom.impl import com.tencent.devops.common.api.constant.CommonMessageCode import com.tencent.devops.common.api.pojo.Result import com.tencent.devops.common.pipeline.enums.BuildStatus +import com.tencent.devops.common.redis.RedisLock import com.tencent.devops.common.redis.RedisOperation import com.tencent.devops.common.web.utils.I18nUtil import com.tencent.devops.store.dao.atom.MarketAtomDao import com.tencent.devops.store.pojo.atom.enums.AtomStatusEnum import com.tencent.devops.store.pojo.common.ATOM_POST_VERSION_TEST_FLAG_KEY_PREFIX +import com.tencent.devops.store.pojo.common.STORE_LATEST_TEST_FLAG_KEY_PREFIX import com.tencent.devops.store.pojo.common.StoreBuildResultRequest import com.tencent.devops.store.service.atom.AtomReleaseService import com.tencent.devops.store.service.atom.MarketAtomService @@ -84,6 +86,18 @@ class AtomHandleBuildResultServiceImpl @Autowired constructor( msg = null ) if (atomStatus == AtomStatusEnum.TESTING) { + RedisLock( + redisOperation, + "$STORE_LATEST_TEST_FLAG_KEY_PREFIX:$atomCode", + 60L + ).use { redisLock -> + redisLock.lock() + marketAtomDao.setupAtomLatestTestFlagByAtomId( + dslContext = dslContext, + userId = storeBuildResultRequest.userId, + atomId = atomId + ) + } // 插件errorCodes.json文件数据入库 atomReleaseService.syncAtomErrorCodeConfig( atomCode = atomCode, diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt index 97dcba6e905..86f130ad52b 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt @@ -47,6 +47,7 @@ import com.tencent.devops.common.api.util.UUIDUtil import com.tencent.devops.common.client.Client import com.tencent.devops.common.pipeline.pojo.element.market.MarketBuildAtomElement import com.tencent.devops.common.pipeline.pojo.element.market.MarketBuildLessAtomElement +import com.tencent.devops.common.redis.RedisLock import com.tencent.devops.common.redis.RedisOperation import com.tencent.devops.common.service.prometheus.BkTimed import com.tencent.devops.common.web.utils.I18nUtil @@ -86,7 +87,6 @@ import com.tencent.devops.store.pojo.atom.GetAtomConfigResult import com.tencent.devops.store.pojo.atom.GetAtomQualityConfigResult import com.tencent.devops.store.pojo.atom.MarketAtomCreateRequest import com.tencent.devops.store.pojo.atom.MarketAtomUpdateRequest -import com.tencent.devops.store.pojo.common.StoreI18nConfig import com.tencent.devops.store.pojo.atom.UpdateAtomInfo import com.tencent.devops.store.pojo.atom.UpdateAtomPackageInfo import com.tencent.devops.store.pojo.atom.enums.AtomStatusEnum @@ -105,7 +105,9 @@ import com.tencent.devops.store.pojo.common.KEY_RELEASE_INFO import com.tencent.devops.store.pojo.common.KEY_VERSION_INFO import com.tencent.devops.store.pojo.common.QUALITY_JSON_NAME import com.tencent.devops.store.pojo.common.ReleaseProcessItem +import com.tencent.devops.store.pojo.common.STORE_LATEST_TEST_FLAG_KEY_PREFIX import com.tencent.devops.store.pojo.common.StoreErrorCodeInfo +import com.tencent.devops.store.pojo.common.StoreI18nConfig import com.tencent.devops.store.pojo.common.StoreProcessInfo import com.tencent.devops.store.pojo.common.StoreReleaseCreateRequest import com.tencent.devops.store.pojo.common.TASK_JSON_NAME @@ -845,7 +847,7 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ return flag } - protected fun upgradeMarketAtom( + private fun upgradeMarketAtom( marketAtomUpdateRequest: MarketAtomUpdateRequest, context: DSLContext, userId: String, @@ -965,6 +967,7 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ hashKey = VersionUtils.convertLatestVersion(record.version), values = "false" ) + checkUpdateAtomLatestTestFlag(userId, atomCode, atomId) doCancelReleaseBus(userId, atomId) // 通过websocket推送状态变更消息 storeWebsocketService.sendWebsocketMessage(userId, atomId) @@ -1039,6 +1042,7 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ doAtomReleaseBus(userId, atomReleaseRequest) // 更新质量红线信息 atomQualityService.updateQualityInApprove(atomCode, atomStatus) + checkUpdateAtomLatestTestFlag(userId, atomCode, atomId) dslContext.transaction { t -> val context = DSL.using(t) // 记录发布信息 @@ -1437,4 +1441,24 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ } return Result(atomId) } + + fun checkUpdateAtomLatestTestFlag(userId: String, atomCode: String, atomId: String) { + RedisLock( + redisOperation, + "$STORE_LATEST_TEST_FLAG_KEY_PREFIX:$atomCode", + 60L + ).use { redisLock -> + redisLock.lock() + if (marketAtomDao.isAtomLatestTestVersion(dslContext, atomId) > 0) { + val latestTestVersionId = marketAtomDao.queryAtomLatestTestVersionId(dslContext, atomCode) + latestTestVersionId?.let { + marketAtomDao.setupAtomLatestTestFlagByAtomId( + dslContext = dslContext, + userId = userId, + atomId = latestTestVersionId + ) + } + } + } + } } From 5e3b652febc962a8743dcea0f653309605a42679 Mon Sep 17 00:00:00 2001 From: yjieliang Date: Tue, 21 Nov 2023 20:44:59 +0800 Subject: [PATCH 62/73] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- support-files/sql/1001_ci_store_ddl_mysql.sql | 1 + .../sql/2003_v2.x/2020_ci_store-update_v2.0_mysql.sql | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/support-files/sql/1001_ci_store_ddl_mysql.sql b/support-files/sql/1001_ci_store_ddl_mysql.sql index 1b7c8c24057..ba7ab06f66c 100644 --- a/support-files/sql/1001_ci_store_ddl_mysql.sql +++ b/support-files/sql/1001_ci_store_ddl_mysql.sql @@ -85,6 +85,7 @@ CREATE TABLE IF NOT EXISTS `T_ATOM` ( `DELETE_FLAG` bit(1) DEFAULT b'0' COMMENT '是否删除', `BRANCH` VARCHAR(128) DEFAULT 'master' COMMENT '代码库分支', `BRANCH_TEST_FLAG` bit(1) DEFAULT b'0' COMMENT '是否是分支测试版本', + `LATEST_TEST_FLAG` bit(1) DEFAULT b'0' COMMENT '是否为最新测试版本原子, TRUE:最新 FALSE:非最新', PRIMARY KEY (`ID`), UNIQUE KEY `uni_inx_tpca_code_version` (`ATOM_CODE`,`VERSION`), KEY `inx_tpca_service_code` (`SERVICE_SCOPE`(255)), diff --git a/support-files/sql/2003_v2.x/2020_ci_store-update_v2.0_mysql.sql b/support-files/sql/2003_v2.x/2020_ci_store-update_v2.0_mysql.sql index 657038b60f7..4a5ab839a88 100644 --- a/support-files/sql/2003_v2.x/2020_ci_store-update_v2.0_mysql.sql +++ b/support-files/sql/2003_v2.x/2020_ci_store-update_v2.0_mysql.sql @@ -28,6 +28,14 @@ BEGIN ALTER TABLE T_ATOM ADD BRANCH_TEST_FLAG bit(1) DEFAULT b'0' NULL COMMENT '是否是分支测试版本'; END IF; + IF NOT EXISTS(SELECT 1 + FROM information_schema.COLUMNS + WHERE TABLE_SCHEMA = db + AND TABLE_NAME = 'T_ATOM' + AND COLUMN_NAME = 'LATEST_TEST_FLAG') THEN + ALTER TABLE T_ATOM ADD LATEST_TEST_FLAG bit(1) DEFAULT b'0' NULL COMMENT '是否为最新测试版本原子, TRUE:最新 FALSE:非最新'; + END IF; + COMMIT; END DELIMITER ; From 74a7648515922e2eb9c797fbb8730070f9c672bb Mon Sep 17 00:00:00 2001 From: yjieliang Date: Tue, 21 Nov 2023 20:58:21 +0800 Subject: [PATCH 63/73] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kotlin/com/tencent/devops/store/dao/atom/MarketAtomDao.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/MarketAtomDao.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/MarketAtomDao.kt index 6ec6178f42e..26861de84d2 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/MarketAtomDao.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/MarketAtomDao.kt @@ -742,7 +742,7 @@ class MarketAtomDao : AtomBaseDao() { } } - fun queryAtomLatestTestVersionId(dslContext: DSLContext,atomCode: String): String? { + fun queryAtomLatestTestVersionId(dslContext: DSLContext, atomCode: String): String? { with(TAtom.T_ATOM) { return dslContext.select(ID).from(this) .where(ATOM_CODE.eq(atomCode)) @@ -755,7 +755,7 @@ class MarketAtomDao : AtomBaseDao() { } } - fun isAtomLatestTestVersion(dslContext: DSLContext,atomId: String): Int { + fun isAtomLatestTestVersion(dslContext: DSLContext, atomId: String): Int { with(TAtom.T_ATOM) { return dslContext.select(ID).from(this) .where(ID.eq(atomId).and(LATEST_TEST_FLAG.eq(true))).execute() From 6951f9c759d99954a28bfb7bee61f3eb8b2b3700 Mon Sep 17 00:00:00 2001 From: yjieliang Date: Tue, 21 Nov 2023 21:47:04 +0800 Subject: [PATCH 64/73] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt index ce7166dd2c1..ae566e314c9 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt @@ -990,6 +990,14 @@ class AtomDao : AtomBaseDao() { fitOsFlag = fitOsFlag, queryFitAgentBuildLessAtomFlag = queryFitAgentBuildLessAtomFlag ) + conditions.add( + ta.ATOM_STATUS.`in`( + listOf( + AtomStatusEnum.TESTING.status.toByte(), + AtomStatusEnum.AUDITING.status.toByte() + ) + ) + ) // 只查最新的测试中和审核中的插件 conditions.add(ta.LATEST_TEST_FLAG.eq(true)) conditions.add(tspr.PROJECT_CODE.eq(projectCode)) From faf53b095ffcbc7d2d39d5920bfecda13625dea6 Mon Sep 17 00:00:00 2001 From: yjieliang Date: Tue, 21 Nov 2023 22:08:25 +0800 Subject: [PATCH 65/73] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt index ae566e314c9..ef9a05aacd5 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt @@ -644,6 +644,7 @@ class AtomDao : AtomBaseDao() { getPipelineAtomBaseStep(dslContext, ta, tc, taf, tst).where(defaultAtomCondition) ) if (queryInitTestAtomStep != null && initTestAtomCondition != null) { + initTestAtomCondition.add(ta.LATEST_TEST_FLAG.eq(true)) queryAtomStep.union( getPipelineAtomBaseStep(dslContext, ta, tc, taf, tst) .join(tspr) @@ -997,9 +998,7 @@ class AtomDao : AtomBaseDao() { AtomStatusEnum.AUDITING.status.toByte() ) ) - ) - // 只查最新的测试中和审核中的插件 - conditions.add(ta.LATEST_TEST_FLAG.eq(true)) + ) // 只查测试中和审核中的插件 conditions.add(tspr.PROJECT_CODE.eq(projectCode)) conditions.add(tspr.TYPE.`in`(listOf(StoreProjectTypeEnum.TEST.type.toByte()))) // 调试项目 conditions.add(tspr.STORE_TYPE.eq(StoreTypeEnum.ATOM.type.toByte())) From 7945ff62117b5f78c7b436fbaa3e7c6b9e68907b Mon Sep 17 00:00:00 2001 From: yjieliang Date: Wed, 22 Nov 2023 14:58:51 +0800 Subject: [PATCH 66/73] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt | 1 + .../devops/store/service/atom/impl/AtomServiceImpl.kt | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt index ef9a05aacd5..c76aa87d431 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt @@ -697,6 +697,7 @@ class AtomDao : AtomBaseDao() { ta.BUILD_LESS_RUN_FLAG.`as`(KEY_BUILD_LESS_RUN_FLAG), ta.WEIGHT.`as`(KEY_WEIGHT), ta.HTML_TEMPLATE_VERSION.`as`(KEY_HTML_TEMPLATE_VERSION), + ta.BRANCH_TEST_FLAG, taf.RECOMMEND_FLAG.`as`(KEY_RECOMMEND_FLAG), tsst.SCORE_AVERAGE.`as`(KEY_AVG_SCORE), tsst.RECENT_EXECUTE_NUM.`as`(KEY_RECENT_EXECUTE_NUM), diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomServiceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomServiceImpl.kt index e9a238ad86f..1fb93e55383 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomServiceImpl.kt @@ -344,7 +344,12 @@ abstract class AtomServiceImpl @Autowired constructor() : AtomService { val name = it[NAME] as String val atomCode = it[KEY_ATOM_CODE] as String val version = it[VERSION] as String - val defaultVersion = VersionUtils.convertLatestVersion(version) + val branchTestFlag = it[KEY_BRANCH_TEST_FLAG] as Boolean + val defaultVersion = if (branchTestFlag) { + version + } else { + VersionUtils.convertLatestVersion(version) + } val classType = it[KEY_CLASS_TYPE] as String val serviceScopeStr = it[KEY_SERVICE_SCOPE] as? String val honorInfos = atomHonorInfoMap[atomCode] From accea08a3c102b201bf05fa44151fbc0cc1aabed Mon Sep 17 00:00:00 2001 From: yjieliang Date: Wed, 22 Nov 2023 15:30:25 +0800 Subject: [PATCH 67/73] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt index c76aa87d431..ad74a390d1c 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt @@ -697,7 +697,7 @@ class AtomDao : AtomBaseDao() { ta.BUILD_LESS_RUN_FLAG.`as`(KEY_BUILD_LESS_RUN_FLAG), ta.WEIGHT.`as`(KEY_WEIGHT), ta.HTML_TEMPLATE_VERSION.`as`(KEY_HTML_TEMPLATE_VERSION), - ta.BRANCH_TEST_FLAG, + ta.BRANCH_TEST_FLAG.`as`(KEY_BRANCH_TEST_FLAG), taf.RECOMMEND_FLAG.`as`(KEY_RECOMMEND_FLAG), tsst.SCORE_AVERAGE.`as`(KEY_AVG_SCORE), tsst.RECENT_EXECUTE_NUM.`as`(KEY_RECENT_EXECUTE_NUM), From d433e3d3fccb75ef972d3abacc627ae101363f0f Mon Sep 17 00:00:00 2001 From: yjieliang Date: Wed, 22 Nov 2023 16:02:33 +0800 Subject: [PATCH 68/73] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt index ad74a390d1c..7b70f8d0e80 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomDao.kt @@ -807,6 +807,7 @@ class AtomDao : AtomBaseDao() { .where(defaultAtomCondition).fetchOne(0, Long::class.java)!! val normalAtomCount = queryNormalAtomStep.where(normalAtomConditions).fetchOne(0, Long::class.java)!! val initTestAtomCount = if (initTestAtomCondition != null && queryInitTestAtomStep != null) { + initTestAtomCondition.add(ta.LATEST_TEST_FLAG.eq(true)) queryInitTestAtomStep.where(initTestAtomCondition).fetchOne(0, Long::class.java)!! } else { 0 From a864db2ffc9e4d3599d0a23f4e7093d2e8c40e92 Mon Sep 17 00:00:00 2001 From: yjieliang Date: Thu, 23 Nov 2023 12:07:46 +0800 Subject: [PATCH 69/73] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kotlin/com/tencent/devops/store/dao/atom/MarketAtomDao.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/MarketAtomDao.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/MarketAtomDao.kt index 26861de84d2..bc502abb42e 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/MarketAtomDao.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/MarketAtomDao.kt @@ -738,6 +738,7 @@ class MarketAtomDao : AtomBaseDao() { .`when`(ID.eq(atomId), true) .otherwise(false)) .set(MODIFIER, userId) + .where(ID.eq(atomId)) .execute() } } From 81ed6b5685fd6da12eee618c3857721cf872ce1a Mon Sep 17 00:00:00 2001 From: yjieliang Date: Thu, 23 Nov 2023 14:26:35 +0800 Subject: [PATCH 70/73] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/tencent/devops/store/dao/atom/MarketAtomDao.kt | 6 +++--- .../service/atom/impl/AtomHandleBuildResultServiceImpl.kt | 4 ++-- .../store/service/atom/impl/AtomReleaseServiceImpl.kt | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/MarketAtomDao.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/MarketAtomDao.kt index bc502abb42e..a807baec182 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/MarketAtomDao.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/MarketAtomDao.kt @@ -731,14 +731,14 @@ class MarketAtomDao : AtomBaseDao() { } } - fun setupAtomLatestTestFlagByAtomId(dslContext: DSLContext, userId: String, atomId: String) { + fun setupAtomLatestTestFlag(dslContext: DSLContext, userId: String, atomCode: String) { with(TAtom.T_ATOM) { dslContext.update(this) .set(LATEST_TEST_FLAG, DSL.case_() - .`when`(ID.eq(atomId), true) + .`when`(ID.eq(atomCode), true) .otherwise(false)) .set(MODIFIER, userId) - .where(ID.eq(atomId)) + .where(ATOM_CODE.eq(atomCode)) .execute() } } diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomHandleBuildResultServiceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomHandleBuildResultServiceImpl.kt index 4c2b6e6abeb..c6ecc3536fd 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomHandleBuildResultServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomHandleBuildResultServiceImpl.kt @@ -92,10 +92,10 @@ class AtomHandleBuildResultServiceImpl @Autowired constructor( 60L ).use { redisLock -> redisLock.lock() - marketAtomDao.setupAtomLatestTestFlagByAtomId( + marketAtomDao.setupAtomLatestTestFlag( dslContext = dslContext, userId = storeBuildResultRequest.userId, - atomId = atomId + atomCode = atomCode ) } // 插件errorCodes.json文件数据入库 diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt index 86f130ad52b..e28d6583e1d 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt @@ -1452,10 +1452,10 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ if (marketAtomDao.isAtomLatestTestVersion(dslContext, atomId) > 0) { val latestTestVersionId = marketAtomDao.queryAtomLatestTestVersionId(dslContext, atomCode) latestTestVersionId?.let { - marketAtomDao.setupAtomLatestTestFlagByAtomId( + marketAtomDao.setupAtomLatestTestFlag( dslContext = dslContext, userId = userId, - atomId = latestTestVersionId + atomCode = atomCode ) } } From 61facb94102d23874996797cbcd342238680c170 Mon Sep 17 00:00:00 2001 From: yjieliang Date: Thu, 23 Nov 2023 14:26:58 +0800 Subject: [PATCH 71/73] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/tencent/devops/store/dao/atom/MarketAtomDao.kt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/MarketAtomDao.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/MarketAtomDao.kt index a807baec182..e2ee88c1282 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/MarketAtomDao.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/MarketAtomDao.kt @@ -734,9 +734,10 @@ class MarketAtomDao : AtomBaseDao() { fun setupAtomLatestTestFlag(dslContext: DSLContext, userId: String, atomCode: String) { with(TAtom.T_ATOM) { dslContext.update(this) - .set(LATEST_TEST_FLAG, DSL.case_() - .`when`(ID.eq(atomCode), true) - .otherwise(false)) + .set( + LATEST_TEST_FLAG, + DSL.case_().`when`(ID.eq(atomCode), true).otherwise(false) + ) .set(MODIFIER, userId) .where(ATOM_CODE.eq(atomCode)) .execute() From bd0223c83829b301b4d3447170bc4ce5e9f3b428 Mon Sep 17 00:00:00 2001 From: yjieliang Date: Thu, 23 Nov 2023 14:53:54 +0800 Subject: [PATCH 72/73] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kotlin/com/tencent/devops/store/dao/atom/MarketAtomDao.kt | 4 ++-- .../service/atom/impl/AtomHandleBuildResultServiceImpl.kt | 3 ++- .../devops/store/service/atom/impl/AtomReleaseServiceImpl.kt | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/MarketAtomDao.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/MarketAtomDao.kt index e2ee88c1282..6576304ddff 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/MarketAtomDao.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/MarketAtomDao.kt @@ -731,12 +731,12 @@ class MarketAtomDao : AtomBaseDao() { } } - fun setupAtomLatestTestFlag(dslContext: DSLContext, userId: String, atomCode: String) { + fun setupAtomLatestTestFlag(dslContext: DSLContext, userId: String, atomCode: String, atomId: String) { with(TAtom.T_ATOM) { dslContext.update(this) .set( LATEST_TEST_FLAG, - DSL.case_().`when`(ID.eq(atomCode), true).otherwise(false) + DSL.case_().`when`(ID.eq(atomId), true).otherwise(false) ) .set(MODIFIER, userId) .where(ATOM_CODE.eq(atomCode)) diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomHandleBuildResultServiceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomHandleBuildResultServiceImpl.kt index c6ecc3536fd..5aed1bd4fa6 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomHandleBuildResultServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomHandleBuildResultServiceImpl.kt @@ -95,7 +95,8 @@ class AtomHandleBuildResultServiceImpl @Autowired constructor( marketAtomDao.setupAtomLatestTestFlag( dslContext = dslContext, userId = storeBuildResultRequest.userId, - atomCode = atomCode + atomCode = atomCode, + atomId = atomId ) } // 插件errorCodes.json文件数据入库 diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt index e28d6583e1d..4f0328eff23 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/service/atom/impl/AtomReleaseServiceImpl.kt @@ -1455,7 +1455,8 @@ abstract class AtomReleaseServiceImpl @Autowired constructor() : AtomReleaseServ marketAtomDao.setupAtomLatestTestFlag( dslContext = dslContext, userId = userId, - atomCode = atomCode + atomCode = atomCode, + atomId = atomId ) } } From b5d50942258262f0b9f5fe4a0eb772a93f131643 Mon Sep 17 00:00:00 2001 From: yjieliang Date: Thu, 23 Nov 2023 16:49:11 +0800 Subject: [PATCH 73/73] =?UTF-8?q?feat:=E5=B8=8C=E6=9C=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E6=94=AF=E8=BF=9B=E8=A1=8C=E4=B8=8A=E6=9E=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20#4780?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kotlin/com/tencent/devops/store/dao/atom/AtomBaseDao.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomBaseDao.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomBaseDao.kt index 3cf712ba166..54c245b2a19 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomBaseDao.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/dao/atom/AtomBaseDao.kt @@ -74,10 +74,10 @@ abstract class AtomBaseDao { } } - fun getNewestAtomByCode(dslContext: DSLContext, atomCode: String): TAtomRecord? { + fun getNewestAtomByCode(dslContext: DSLContext, atomCode: String, branchTestFlag: Boolean = false): TAtomRecord? { return with(TAtom.T_ATOM) { dslContext.selectFrom(this) - .where(ATOM_CODE.eq(atomCode).and(BRANCH_TEST_FLAG.eq(false))) + .where(ATOM_CODE.eq(atomCode).and(BRANCH_TEST_FLAG.eq(branchTestFlag))) .orderBy(CREATE_TIME.desc()) .limit(1) .fetchOne()