From 2753813d9ad24f14625d6a746c27ce9e37cfed8c Mon Sep 17 00:00:00 2001 From: v_zkggzhou <2198773846@qq.com> Date: Wed, 4 Dec 2024 18:47:06 +0800 Subject: [PATCH] =?UTF-8?q?pref:=E5=AE=8C=E5=96=84=E7=A0=94=E5=8F=91?= =?UTF-8?q?=E5=95=86=E5=BA=97=E7=BB=84=E4=BB=B6=E9=85=8D=E7=BD=AE=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=8F=82=E6=95=B0=E6=A0=A1=E9=AA=8C=20#11269?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../devops/store/constant/StoreMessageCode.kt | 1 + .../service/impl/MarketAtomCommonServiceImpl.kt | 16 +++++----------- .../i18n/store/message_en_US.properties | 1 + .../i18n/store/message_zh_CN.properties | 1 + 4 files changed, 8 insertions(+), 11 deletions(-) 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 13620f86d27..445726f67ba 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 @@ -95,6 +95,7 @@ object StoreMessageCode { const val USER_PULL_FILE_FAIL = "2120041" // 插件包文件[{0}]不存在,请检查文件所在路径是否正确 const val ATOM_PACKAGE_FILE_NOT_FOUND = "2120042" + const val USER_REPOSITORY_TASK_JSON_FIELD_IS_NOT_SUPPORT = "2120043"//研发商店:插件配置文件[task.json]{0}字段暂时只支持{1},{2},{3},{4} const val USER_TEMPLATE_VERSION_IS_NOT_FINISH = "2120201" // 研发商店:模板{0}的{1}版本发布未结束,请稍后再试 const val USER_TEMPLATE_RELEASE_STEPS_ERROR = "2120202" // 研发商店:模板发布流程状态变更顺序不正确 diff --git a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/MarketAtomCommonServiceImpl.kt b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/MarketAtomCommonServiceImpl.kt index cbe6557889d..576856d10ab 100644 --- a/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/MarketAtomCommonServiceImpl.kt +++ b/src/backend/ci/core/store/biz-store/src/main/kotlin/com/tencent/devops/store/atom/service/impl/MarketAtomCommonServiceImpl.kt @@ -27,14 +27,7 @@ package com.tencent.devops.store.atom.service.impl -import com.tencent.devops.common.api.constant.COMPONENT -import com.tencent.devops.common.api.constant.CommonMessageCode -import com.tencent.devops.common.api.constant.INIT_VERSION -import com.tencent.devops.common.api.constant.KEY_OS -import com.tencent.devops.common.api.constant.KEY_OS_ARCH -import com.tencent.devops.common.api.constant.KEY_OS_NAME -import com.tencent.devops.common.api.constant.REQUIRED -import com.tencent.devops.common.api.constant.TYPE +import com.tencent.devops.common.api.constant.* import com.tencent.devops.common.api.enums.FrontendTypeEnum import com.tencent.devops.common.api.exception.ErrorCodeException import com.tencent.devops.common.api.pojo.Result @@ -389,19 +382,20 @@ class MarketAtomCommonServiceImpl : MarketAtomCommonService { ) } //pref:完善研发商店组件配置文件参数校验 #11269 - val atomLanguage = marketAtomEnvInfoDao.getAtomLanguage(dslContext, atomCode, version) + val supportedLanguages = setOf(JAVA, PYTHON, GOLANG, NODEJS) val language = executionInfoMap[KEY_LANGUAGE]?.let { language -> when (language) { is String -> { - if (StringUtils.equals(atomLanguage, language)) { + if (language in supportedLanguages) { language } else { throw ErrorCodeException( - errorCode = StoreMessageCode.USER_REPOSITORY_TASK_JSON_FIELD_IS_NOT_MATCH, + errorCode = StoreMessageCode.USER_REPOSITORY_TASK_JSON_FIELD_IS_NOT_SUPPORT, params = arrayOf(KEY_LANGUAGE) ) } } + else -> throw ErrorCodeException( errorCode = StoreMessageCode.USER_REPOSITORY_TASK_JSON_FIELD_IS_INVALID, params = arrayOf(KEY_LANGUAGE) diff --git a/support-files/i18n/store/message_en_US.properties b/support-files/i18n/store/message_en_US.properties index bc666d3da4a..2565005cfd3 100644 --- a/support-files/i18n/store/message_en_US.properties +++ b/support-files/i18n/store/message_en_US.properties @@ -108,6 +108,7 @@ 2120934=store: Failed to delete the component repository file 2120935=When the queryProjectComponentFlag, installed, or updateFlag parameters are not empty, the projectCode parameter must be non-empty 2120936=store: Unreleased versions are not allowed to be removed from the shelves +2120043=store: The [task.json] file's {0} field currently only supports {1}, {2}, {3}, {4} 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 b77e0e8e91a..1b8a4113801 100644 --- a/support-files/i18n/store/message_zh_CN.properties +++ b/support-files/i18n/store/message_zh_CN.properties @@ -40,6 +40,7 @@ 2120040=研发商店:插件配置文件[task.json]config配置格式不正确,{0} 2120041=研发商店: 拉取文件[{0}]失败,失败原因:{1} 2120042=插件包文件[{0}]不存在,请检查文件所在路径是否正确 +2120043=研发商店:插件配置文件[task.json]{0}字段暂时只支持{1},{2},{3},{4} 2120201=研发商店: 模板{0}的{1}版本发布未结束,请稍后再试 2120202=研发商店: 模板发布流程状态变更顺序不正确 2120203=研发商店: 模板的可见范围不在插件{0}的可见范围之内,如有需要请联系插件的发布者