From a387d9c0dc5f9c0837536554665288777d1ff2c8 Mon Sep 17 00:00:00 2001 From: jsonwan Date: Tue, 28 May 2024 21:20:37 +0800 Subject: [PATCH 01/12] =?UTF-8?q?perf:=20=E5=8D=87=E7=BA=A7=E5=B7=A5?= =?UTF-8?q?=E5=85=B7=E6=94=AF=E6=8C=81=E8=BE=93=E5=87=BA=E5=B9=B3=E5=8F=B0?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E5=85=A8=E5=B1=80=E9=85=8D=E7=BD=AEJSON?= =?UTF-8?q?=E6=96=87=E4=BB=B6=20#2999?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../model/migration/BkPlatformInfo.java | 77 +++++++++++ .../ServiceGlobalSettingsResourceImpl.java | 2 +- .../api/migration/impl/MigrationResource.java | 16 ++- .../web/impl/WebFileUploadResourceImpl.java | 2 +- .../WebGlobalSettingsQueryResourceImpl.java | 2 +- .../impl/WebGlobalSettingsResourceImpl.java | 2 +- .../config/listener/NotifyInitListener.java | 2 +- .../globalsetting/BkPlatformInfoService.java | 36 +++++ .../GlobalSettingsService.java | 2 +- .../impl/BkPlatformInfoServiceImpl.java | 125 ++++++++++++++++++ .../impl/GlobalSettingsServiceImpl.java | 4 +- .../service/impl/AccountServiceImpl.java | 2 +- src/backend/upgrader/build.gradle | 1 + .../upgrader/client/AbstractJobClient.java | 90 ++++++++++++- .../bk/job/upgrader/client/JobClient.java | 97 ++------------ .../bk/job/upgrader/task/BaseUpgradeTask.java | 32 ++++- .../task/ExportGlobalSettingsTask.java | 96 ++++++++++++++ .../UseAccountPermissionMigrationTask.java | 24 +--- 18 files changed, 494 insertions(+), 118 deletions(-) create mode 100644 src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/model/migration/BkPlatformInfo.java create mode 100644 src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/globalsetting/BkPlatformInfoService.java rename src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/{ => globalsetting}/GlobalSettingsService.java (98%) create mode 100644 src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/globalsetting/impl/BkPlatformInfoServiceImpl.java rename src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/{ => globalsetting}/impl/GlobalSettingsServiceImpl.java (99%) create mode 100644 src/backend/upgrader/src/main/java/com/tencent/bk/job/upgrader/task/ExportGlobalSettingsTask.java diff --git a/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/model/migration/BkPlatformInfo.java b/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/model/migration/BkPlatformInfo.java new file mode 100644 index 0000000000..56e4d0d049 --- /dev/null +++ b/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/model/migration/BkPlatformInfo.java @@ -0,0 +1,77 @@ +/* + * Tencent is pleased to support the open source community by making BK-JOB蓝鲸智云作业平台 available. + * + * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. + * + * BK-JOB蓝鲸智云作业平台 is licensed under the MIT License. + * + * License for BK-JOB蓝鲸智云作业平台: + * -------------------------------------------------------------------- + * 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.bk.job.manage.model.migration; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@NoArgsConstructor +public class BkPlatformInfo { + + @JsonProperty("bk_app_code") + private String bkAppCode = "bk_job"; + + @JsonProperty("name") + private String name = "蓝鲸作业平台"; + + @JsonProperty("name_en") + private String nameEn = "JOB"; + + @JsonProperty("app_logo") + private String appLogo = "bk_job.png"; + + @JsonProperty("fav_icon") + private String favIcon = "bk_job.png"; + + @JsonProperty("helper_text") + private String helperText = "联系BK助手"; + + @JsonProperty("helper_text_en") + private String helperTextEn = "Contact BK Assistant"; + + @JsonProperty("helper_link") + private String helperLink = "wxwork://message/?username=BK%E5%8A%A9%E6%89%8B"; + + @JsonProperty("brand_img") + private String brandImg = "brand_img.png"; + + @JsonProperty("brand_img_en") + private String brandImgEn = "brand_img.png"; + + @JsonProperty("brand_name") + private String brandName = "腾讯蓝鲸智云"; + + @JsonProperty("brand_name_en") + private String brandNameEn = "BlueKing"; + + @JsonProperty("footer_info") + private String footerInfo = "[技术支持](https://wpa1.qq.com/KziXGWJs?_type=wpa&qidian=true) | [社区论坛](https://bk" + + ".tencent.com/s-mart/community/) | [产品官网](https://bk.tencent.com/index/)"; + + @JsonProperty("footer_copyright") + private String footerCopyright = "Copyright © 2012 Tencent BlueKing. All Rights Reserved. {{version}}"; +} diff --git a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/inner/impl/ServiceGlobalSettingsResourceImpl.java b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/inner/impl/ServiceGlobalSettingsResourceImpl.java index 6554359547..e714ce0789 100644 --- a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/inner/impl/ServiceGlobalSettingsResourceImpl.java +++ b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/inner/impl/ServiceGlobalSettingsResourceImpl.java @@ -28,7 +28,7 @@ import com.tencent.bk.job.manage.api.inner.ServiceGlobalSettingsResource; import com.tencent.bk.job.manage.model.inner.ServiceFileUploadSettingDTO; import com.tencent.bk.job.manage.model.web.vo.globalsetting.FileUploadSettingVO; -import com.tencent.bk.job.manage.service.GlobalSettingsService; +import com.tencent.bk.job.manage.service.globalsetting.GlobalSettingsService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RestController; diff --git a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/migration/impl/MigrationResource.java b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/migration/impl/MigrationResource.java index ed4f7f5a38..278be9e912 100644 --- a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/migration/impl/MigrationResource.java +++ b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/migration/impl/MigrationResource.java @@ -36,12 +36,15 @@ import com.tencent.bk.job.manage.migration.UpdateAppIdForWhiteIpMigrationTask; import com.tencent.bk.job.manage.model.dto.ResourceTagDTO; import com.tencent.bk.job.manage.model.migration.AddHostIdMigrationReq; +import com.tencent.bk.job.manage.model.migration.BkPlatformInfo; import com.tencent.bk.job.manage.model.migration.MigrationRecordsResult; import com.tencent.bk.job.manage.model.migration.SetBizSetMigrationStatusReq; import com.tencent.bk.job.manage.model.migration.UpdateAppIdForWhiteIpMigrationReq; +import com.tencent.bk.job.manage.service.globalsetting.BkPlatformInfoService; import com.tencent.bk.job.manage.service.impl.BizSetService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; @@ -65,6 +68,7 @@ public class MigrationResource { private final UpdateAppIdForWhiteIpMigrationTask updateAppIdForWhiteIpMigrationTask; private final AddHostIdForWhiteIpMigrationTask addHostIdForWhiteIpMigrationTask; private final AppScopeMappingService appScopeMappingService; + private final BkPlatformInfoService bkPlatformInfoService; @Autowired public MigrationResource( @@ -74,7 +78,8 @@ public MigrationResource( AddHostIdForTemplateAndPlanMigrationTask addHostIdForTemplateAndPlanMigrationTask, UpdateAppIdForWhiteIpMigrationTask updateAppIdForWhiteIpMigrationTask, AddHostIdForWhiteIpMigrationTask addHostIdForWhiteIpMigrationTask, - AppScopeMappingService appScopeMappingService) { + AppScopeMappingService appScopeMappingService, + BkPlatformInfoService bkPlatformInfoService) { this.encryptDbAccountPasswordMigrationTask = encryptDbAccountPasswordMigrationTask; this.resourceTagsMigrationTask = resourceTagsMigrationTask; this.bizSetService = bizSetService; @@ -82,6 +87,7 @@ public MigrationResource( this.updateAppIdForWhiteIpMigrationTask = updateAppIdForWhiteIpMigrationTask; this.addHostIdForWhiteIpMigrationTask = addHostIdForWhiteIpMigrationTask; this.appScopeMappingService = appScopeMappingService; + this.bkPlatformInfoService = bkPlatformInfoService; } /** @@ -151,4 +157,12 @@ public Response addHostIdMigrationTask(@RequestBody AddHostIdMigrationRe Response.buildCommonFailResp(ErrorCode.MIGRATION_FAIL, new String[]{"AddHostIdMigrationTask", JsonUtils.toJson(results)}); } + + /** + * 获取蓝鲸统一规范的平台配置信息 + */ + @GetMapping("/action/getBkPlatformInfo") + public Response getBkPlatformInfo() { + return Response.buildSuccessResp(bkPlatformInfoService.getCurrentBkPlatformInfo()); + } } diff --git a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/web/impl/WebFileUploadResourceImpl.java b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/web/impl/WebFileUploadResourceImpl.java index 21ad7fc0aa..952d74c8f5 100644 --- a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/web/impl/WebFileUploadResourceImpl.java +++ b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/web/impl/WebFileUploadResourceImpl.java @@ -45,7 +45,7 @@ import com.tencent.bk.job.manage.model.web.vo.UploadLocalFileResultVO; import com.tencent.bk.job.manage.model.web.vo.UploadTargetVO; import com.tencent.bk.job.manage.model.web.vo.globalsetting.FileUploadSettingVO; -import com.tencent.bk.job.manage.service.GlobalSettingsService; +import com.tencent.bk.job.manage.service.globalsetting.GlobalSettingsService; import io.netty.util.internal.StringUtil; import lombok.extern.slf4j.Slf4j; import org.apache.commons.codec.digest.DigestUtils; diff --git a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/web/impl/WebGlobalSettingsQueryResourceImpl.java b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/web/impl/WebGlobalSettingsQueryResourceImpl.java index cf1fffc0e0..c1f2e5c9fe 100644 --- a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/web/impl/WebGlobalSettingsQueryResourceImpl.java +++ b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/web/impl/WebGlobalSettingsQueryResourceImpl.java @@ -40,7 +40,7 @@ import com.tencent.bk.job.manage.model.web.vo.globalsetting.NotifyChannelWithIconVO; import com.tencent.bk.job.manage.model.web.vo.globalsetting.PlatformInfoVO; import com.tencent.bk.job.manage.service.ApplicationService; -import com.tencent.bk.job.manage.service.GlobalSettingsService; +import com.tencent.bk.job.manage.service.globalsetting.GlobalSettingsService; import com.tencent.bk.job.manage.service.PublicScriptService; import lombok.extern.slf4j.Slf4j; import org.jooq.tools.StringUtils; diff --git a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/web/impl/WebGlobalSettingsResourceImpl.java b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/web/impl/WebGlobalSettingsResourceImpl.java index 6fb3ce00c7..dcf57ec1ca 100644 --- a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/web/impl/WebGlobalSettingsResourceImpl.java +++ b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/web/impl/WebGlobalSettingsResourceImpl.java @@ -47,7 +47,7 @@ import com.tencent.bk.job.manage.model.web.vo.notify.ChannelTemplateStatusVO; import com.tencent.bk.job.manage.model.web.vo.notify.NotifyBlackUserInfoVO; import com.tencent.bk.job.manage.model.web.vo.notify.UserVO; -import com.tencent.bk.job.manage.service.GlobalSettingsService; +import com.tencent.bk.job.manage.service.globalsetting.GlobalSettingsService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RestController; diff --git a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/config/listener/NotifyInitListener.java b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/config/listener/NotifyInitListener.java index 6d04bf2e95..814df5150b 100644 --- a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/config/listener/NotifyInitListener.java +++ b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/config/listener/NotifyInitListener.java @@ -39,7 +39,7 @@ import com.tencent.bk.job.manage.model.web.request.notify.NotifyPoliciesCreateUpdateReq; import com.tencent.bk.job.manage.model.web.request.notify.ResourceStatusChannel; import com.tencent.bk.job.manage.model.web.request.notify.TriggerPolicy; -import com.tencent.bk.job.manage.service.GlobalSettingsService; +import com.tencent.bk.job.manage.service.globalsetting.GlobalSettingsService; import com.tencent.bk.job.manage.service.NotifyService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; diff --git a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/globalsetting/BkPlatformInfoService.java b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/globalsetting/BkPlatformInfoService.java new file mode 100644 index 0000000000..ec3f09f8aa --- /dev/null +++ b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/globalsetting/BkPlatformInfoService.java @@ -0,0 +1,36 @@ +/* + * Tencent is pleased to support the open source community by making BK-JOB蓝鲸智云作业平台 available. + * + * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. + * + * BK-JOB蓝鲸智云作业平台 is licensed under the MIT License. + * + * License for BK-JOB蓝鲸智云作业平台: + * -------------------------------------------------------------------- + * 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.bk.job.manage.service.globalsetting; + +import com.tencent.bk.job.manage.model.migration.BkPlatformInfo; + +public interface BkPlatformInfoService { + /** + * 获取当前使用的蓝鲸平台信息 + * + * @return 当前使用的蓝鲸平台信息 + */ + BkPlatformInfo getCurrentBkPlatformInfo(); +} diff --git a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/GlobalSettingsService.java b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/globalsetting/GlobalSettingsService.java similarity index 98% rename from src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/GlobalSettingsService.java rename to src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/globalsetting/GlobalSettingsService.java index fdb92a27ad..32cf30cd44 100644 --- a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/GlobalSettingsService.java +++ b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/globalsetting/GlobalSettingsService.java @@ -22,7 +22,7 @@ * IN THE SOFTWARE. */ -package com.tencent.bk.job.manage.service; +package com.tencent.bk.job.manage.service.globalsetting; import com.tencent.bk.job.manage.api.common.constants.OSTypeEnum; import com.tencent.bk.job.manage.model.web.request.globalsetting.AccountNameRule; diff --git a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/globalsetting/impl/BkPlatformInfoServiceImpl.java b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/globalsetting/impl/BkPlatformInfoServiceImpl.java new file mode 100644 index 0000000000..ae25666d16 --- /dev/null +++ b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/globalsetting/impl/BkPlatformInfoServiceImpl.java @@ -0,0 +1,125 @@ +/* + * Tencent is pleased to support the open source community by making BK-JOB蓝鲸智云作业平台 available. + * + * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. + * + * BK-JOB蓝鲸智云作业平台 is licensed under the MIT License. + * + * License for BK-JOB蓝鲸智云作业平台: + * -------------------------------------------------------------------- + * 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.bk.job.manage.service.globalsetting.impl; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.tencent.bk.job.common.i18n.locale.LocaleUtils; +import com.tencent.bk.job.common.util.json.JsonUtils; +import com.tencent.bk.job.manage.api.common.constants.globalsetting.GlobalSettingKeys; +import com.tencent.bk.job.manage.dao.globalsetting.GlobalSettingDAO; +import com.tencent.bk.job.manage.model.dto.GlobalSettingDTO; +import com.tencent.bk.job.manage.model.dto.globalsetting.HelperInfo; +import com.tencent.bk.job.manage.model.dto.globalsetting.TitleFooter; +import com.tencent.bk.job.manage.model.dto.globalsetting.TitleFooterDTO; +import com.tencent.bk.job.manage.model.migration.BkPlatformInfo; +import com.tencent.bk.job.manage.service.globalsetting.BkPlatformInfoService; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.Map; + +/** + * 将全局配置中的平台信息导出为蓝鲸统一规范的平台信息数据 + */ +@Slf4j +@Service +public class BkPlatformInfoServiceImpl implements BkPlatformInfoService { + + private final GlobalSettingDAO globalSettingDAO; + + @Autowired + public BkPlatformInfoServiceImpl(GlobalSettingDAO globalSettingDAO) { + this.globalSettingDAO = globalSettingDAO; + } + + @Override + public BkPlatformInfo getCurrentBkPlatformInfo() { + GlobalSettingDTO titleFooterSettingDTO = globalSettingDAO.getGlobalSetting(GlobalSettingKeys.KEY_TITLE_FOOTER); + TitleFooterDTO titleFooterDTO = null; + if (titleFooterSettingDTO != null) { + titleFooterDTO = JsonUtils.fromJson(titleFooterSettingDTO.getValue(), new TypeReference() { + }); + } + GlobalSettingDTO bkHelperSettingDTO = globalSettingDAO.getGlobalSetting(GlobalSettingKeys.KEY_BK_HELPER); + log.info("titleFooterSettingDTO={}, bkHelperSettingDTO={}", titleFooterSettingDTO, bkHelperSettingDTO); + HelperInfo helperInfo = null; + if (bkHelperSettingDTO != null && StringUtils.isNotEmpty(bkHelperSettingDTO.getValue())) { + helperInfo = JsonUtils.fromJson(bkHelperSettingDTO.getValue(), HelperInfo.class); + } + BkPlatformInfo bkPlatformInfo = buildBkPlatformInfo(titleFooterDTO, helperInfo); + log.info("bkPlatformInfo={}", JsonUtils.toJson(bkPlatformInfo)); + return bkPlatformInfo; + } + + private BkPlatformInfo buildBkPlatformInfo(TitleFooterDTO titleFooterDTO, HelperInfo helperInfo) { + BkPlatformInfo bkPlatformInfo = new BkPlatformInfo(); + if (titleFooterDTO != null) { + Map titleFooterLanguageMap = titleFooterDTO.getTitleFooterLanguageMap(); + if (titleFooterLanguageMap != null) { + TitleFooter englishTitleFooter = getEnglishTitleFooter(titleFooterLanguageMap); + TitleFooter chineseTitleFooter = getChineseTitleFooter(titleFooterLanguageMap); + if (englishTitleFooter == null) { + englishTitleFooter = chineseTitleFooter; + } + if (chineseTitleFooter == null) { + chineseTitleFooter = englishTitleFooter; + } + if (englishTitleFooter != null) { + bkPlatformInfo.setNameEn(englishTitleFooter.getTitleHead()); + bkPlatformInfo.setFooterInfo(englishTitleFooter.getFooterLink()); + bkPlatformInfo.setFooterCopyright(englishTitleFooter.getFooterCopyRight()); + } + if (chineseTitleFooter != null) { + bkPlatformInfo.setName(chineseTitleFooter.getTitleHead()); + bkPlatformInfo.setFooterInfo(chineseTitleFooter.getFooterLink()); + bkPlatformInfo.setFooterCopyright(chineseTitleFooter.getFooterCopyRight()); + } + } + } + if (helperInfo != null) { + String contactLink = helperInfo.getContactLink(); + bkPlatformInfo.setHelperLink(contactLink); + } + return bkPlatformInfo; + } + + private TitleFooter getEnglishTitleFooter(Map titleFooterLanguageMap) { + TitleFooter titleFooter = titleFooterLanguageMap.get(LocaleUtils.LANG_EN); + if (titleFooter == null) { + titleFooter = titleFooterLanguageMap.get(LocaleUtils.LANG_EN_US); + } + return titleFooter; + } + + private TitleFooter getChineseTitleFooter(Map titleFooterLanguageMap) { + TitleFooter titleFooter = titleFooterLanguageMap.get(LocaleUtils.LANG_ZH_CN); + if (titleFooter == null) { + titleFooter = titleFooterLanguageMap.get(LocaleUtils.LANG_ZH); + } + return titleFooter; + } +} diff --git a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/impl/GlobalSettingsServiceImpl.java b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/globalsetting/impl/GlobalSettingsServiceImpl.java similarity index 99% rename from src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/impl/GlobalSettingsServiceImpl.java rename to src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/globalsetting/impl/GlobalSettingsServiceImpl.java index ed2d63137d..ae4782d910 100644 --- a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/impl/GlobalSettingsServiceImpl.java +++ b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/globalsetting/impl/GlobalSettingsServiceImpl.java @@ -22,7 +22,7 @@ * IN THE SOFTWARE. */ -package com.tencent.bk.job.manage.service.impl; +package com.tencent.bk.job.manage.service.globalsetting.impl; import com.fasterxml.jackson.core.type.TypeReference; import com.tencent.bk.audit.annotations.ActionAuditRecord; @@ -85,8 +85,8 @@ import com.tencent.bk.job.manage.model.web.vo.notify.NotifyBlackUserInfoVO; import com.tencent.bk.job.manage.model.web.vo.notify.TemplateBasicInfo; import com.tencent.bk.job.manage.model.web.vo.notify.UserVO; -import com.tencent.bk.job.manage.service.GlobalSettingsService; import com.tencent.bk.job.manage.service.NotifyService; +import com.tencent.bk.job.manage.service.globalsetting.GlobalSettingsService; import com.tencent.bk.job.manage.service.impl.notify.NotifySendService; import com.tencent.bk.job.manage.service.impl.notify.NotifyUserService; import lombok.extern.slf4j.Slf4j; diff --git a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/impl/AccountServiceImpl.java b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/impl/AccountServiceImpl.java index 5fec038a14..c7a22c44b5 100644 --- a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/impl/AccountServiceImpl.java +++ b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/impl/AccountServiceImpl.java @@ -60,7 +60,7 @@ import com.tencent.bk.job.manage.model.web.request.AccountCreateUpdateReq; import com.tencent.bk.job.manage.model.web.request.globalsetting.AccountNameRule; import com.tencent.bk.job.manage.service.AccountService; -import com.tencent.bk.job.manage.service.GlobalSettingsService; +import com.tencent.bk.job.manage.service.globalsetting.GlobalSettingsService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; diff --git a/src/backend/upgrader/build.gradle b/src/backend/upgrader/build.gradle index 375eb5cfdb..4805659a1d 100644 --- a/src/backend/upgrader/build.gradle +++ b/src/backend/upgrader/build.gradle @@ -42,6 +42,7 @@ dependencies { api project(":commons:common-jwt") api project(":commons:esb-sdk") api project(":commons:artifactory-sdk") + api(project(":job-manage:api-job-manage")) compileOnly 'org.projectlombok:lombok' annotationProcessor 'org.projectlombok:lombok' implementation 'ch.qos.logback:logback-core' diff --git a/src/backend/upgrader/src/main/java/com/tencent/bk/job/upgrader/client/AbstractJobClient.java b/src/backend/upgrader/src/main/java/com/tencent/bk/job/upgrader/client/AbstractJobClient.java index b7ea9a001b..b033bb47a7 100644 --- a/src/backend/upgrader/src/main/java/com/tencent/bk/job/upgrader/client/AbstractJobClient.java +++ b/src/backend/upgrader/src/main/java/com/tencent/bk/job/upgrader/client/AbstractJobClient.java @@ -24,8 +24,20 @@ package com.tencent.bk.job.upgrader.client; +import com.fasterxml.jackson.core.type.TypeReference; +import com.tencent.bk.job.common.constant.ErrorCode; +import com.tencent.bk.job.common.exception.InternalException; +import com.tencent.bk.job.common.model.Response; +import com.tencent.bk.job.common.util.StringUtil; +import com.tencent.bk.job.common.util.http.BasicHttpReq; +import com.tencent.bk.job.common.util.http.HttpHelper; +import com.tencent.bk.job.common.util.json.JsonMapper; +import com.tencent.bk.job.common.util.json.JsonUtils; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; import org.apache.http.Header; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpPost; import org.apache.http.message.BasicHeader; import java.util.ArrayList; @@ -33,7 +45,14 @@ @Slf4j public abstract class AbstractJobClient extends AbstractHttpClient { - private String jobAuthToken; + + /** + * Job API 处理请求成功 + */ + private static final int RESULT_OK = 0; + private static final JsonMapper JSON_MAPPER = JsonMapper.nonDefaultMapper(); + + private final String jobAuthToken; public AbstractJobClient(String jobHostUrl, String jobAuthToken) { super(jobHostUrl); @@ -48,4 +67,73 @@ protected List
getBasicHeaders() { return headerList; } + protected R getJobRespByReq(String method, String uri, BasicHttpReq reqBody, + TypeReference typeReference) { + return getJobRespByReq(method, uri, reqBody, typeReference, null); + } + + @SuppressWarnings("all") + protected R getJobRespByReq( + String method, + String uri, + BasicHttpReq reqBody, + TypeReference typeReference, + HttpHelper httpHelper + ) { + // URL模板变量替换 + uri = StringUtil.replacePathVariables(uri, reqBody); + String reqStr = JsonUtils.toJsonWithoutSkippedFields(reqBody); + String respStr = null; + try { + if (method.equals(HttpGet.METHOD_NAME)) { + respStr = doHttpGet(uri, reqBody, httpHelper); + } else if (method.equals(HttpPost.METHOD_NAME)) { + respStr = doHttpPost(uri, reqBody, httpHelper); + } + if (StringUtils.isBlank(respStr)) { + log.error("fail:response is blank|method={}|uri={}|reqStr={}", method, uri, reqStr); + throw new InternalException("response is blank", ErrorCode.API_ERROR); + } else { + log.debug("success|method={}|uri={}|reqStr={}|respStr={}", method, uri, reqStr, respStr); + } + R result = + JSON_MAPPER.fromJson(respStr, typeReference); + Response jobResp = (Response) result; + if (jobResp == null) { + log.error("fail:jobResp is null after parse|method={}|uri={}|reqStr={}|respStr={}", method, uri, + reqStr, respStr); + throw new InternalException("jobResp is null after parse", ErrorCode.API_ERROR); + } else if (jobResp.getCode() != RESULT_OK) { + log.error( + "fail:jobResp code!=0|jobResp.code={}|jobResp" + + ".errorMessage={}|method={}|uri={}|reqStr={}|respStr={}", + jobResp.getCode(), + jobResp.getErrorMsg(), + method, + uri, + reqStr, + respStr + ); + throw new InternalException("jobResp code!=0", ErrorCode.API_ERROR); + } + if (jobResp.getData() == null) { + log.warn( + "warn:jobResp.getData() == null|jobResp.code={}|jobResp" + + ".errorMessage={}|method={}|uri={}|reqStr={}|respStr={}", + jobResp.getCode(), + jobResp.getErrorMsg(), + method, + uri, + reqStr, + respStr + ); + } + return result; + } catch (Exception e) { + String errorMsg = "Fail to request JOB data|method=" + method + "|uri=" + uri + "|reqStr=" + reqStr; + log.error(errorMsg, e); + throw new InternalException("Fail to request JOB data", ErrorCode.API_ERROR); + } + } + } diff --git a/src/backend/upgrader/src/main/java/com/tencent/bk/job/upgrader/client/JobClient.java b/src/backend/upgrader/src/main/java/com/tencent/bk/job/upgrader/client/JobClient.java index f5bbb9b27e..51dce280ec 100644 --- a/src/backend/upgrader/src/main/java/com/tencent/bk/job/upgrader/client/JobClient.java +++ b/src/backend/upgrader/src/main/java/com/tencent/bk/job/upgrader/client/JobClient.java @@ -25,19 +25,13 @@ package com.tencent.bk.job.upgrader.client; import com.fasterxml.jackson.core.type.TypeReference; -import com.tencent.bk.job.common.constant.ErrorCode; -import com.tencent.bk.job.common.exception.InternalException; import com.tencent.bk.job.common.model.Response; -import com.tencent.bk.job.common.util.StringUtil; import com.tencent.bk.job.common.util.http.BasicHttpReq; -import com.tencent.bk.job.common.util.http.HttpHelper; -import com.tencent.bk.job.common.util.json.JsonMapper; -import com.tencent.bk.job.common.util.json.JsonUtils; +import com.tencent.bk.job.manage.model.migration.BkPlatformInfo; import com.tencent.bk.job.upgrader.model.AppInfo; import com.tencent.bk.job.upgrader.model.BasicAppInfo; import com.tencent.bk.job.upgrader.model.job.SetBizSetMigrationStatusReq; import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpPost; @@ -49,92 +43,19 @@ @Slf4j public class JobClient extends AbstractJobClient { - /** - * Job API 处理请求成功 - */ - private static final int RESULT_OK = 0; - private static final String URL_LIST_NORMAL_APPS = "/service/app/list/normal"; private static final String URL_LIST_BIZ_SET_APPS = "/service/app/list/bizSet"; private static final String URL_SET_BIZ_SET_MIGRATION_STATUS = "/manage/migration/action/setBizSetMigrationStatus"; - private static final JsonMapper JSON_MAPPER = JsonMapper.nonDefaultMapper(); + private static final String URL_GET_BK_PLATFORM_INFO = "/manage/migration/action/getBkPlatformInfo"; + public JobClient(String jobHostUrl, String jobAuthToken) { super(jobHostUrl, jobAuthToken); } - private R getJobRespByReq(String method, String uri, BasicHttpReq reqBody, - TypeReference typeReference) { - return getJobRespByReq(method, uri, reqBody, typeReference, null); - } - - @SuppressWarnings("all") - private R getJobRespByReq( - String method, - String uri, - BasicHttpReq reqBody, - TypeReference typeReference, - HttpHelper httpHelper - ) { - // URL模板变量替换 - uri = StringUtil.replacePathVariables(uri, reqBody); - String reqStr = JsonUtils.toJsonWithoutSkippedFields(reqBody); - String respStr = null; - try { - if (method.equals(HttpGet.METHOD_NAME)) { - respStr = doHttpGet(uri, reqBody, httpHelper); - } else if (method.equals(HttpPost.METHOD_NAME)) { - respStr = doHttpPost(uri, reqBody, httpHelper); - } - if (StringUtils.isBlank(respStr)) { - log.error("fail:response is blank|method={}|uri={}|reqStr={}", method, uri, reqStr); - throw new InternalException("response is blank", ErrorCode.API_ERROR); - } else { - log.debug("success|method={}|uri={}|reqStr={}|respStr={}", method, uri, reqStr, respStr); - } - R result = - JSON_MAPPER.fromJson(respStr, typeReference); - Response jobResp = (Response) result; - if (jobResp == null) { - log.error("fail:jobResp is null after parse|method={}|uri={}|reqStr={}|respStr={}", method, uri, - reqStr, respStr); - throw new InternalException("jobResp is null after parse", ErrorCode.API_ERROR); - } else if (jobResp.getCode() != RESULT_OK) { - log.error( - "fail:jobResp code!=0|jobResp.code={}|jobResp" + - ".errorMessage={}|method={}|uri={}|reqStr={}|respStr={}", - jobResp.getCode(), - jobResp.getErrorMsg(), - method, - uri, - reqStr, - respStr - ); - throw new InternalException("jobResp code!=0", ErrorCode.API_ERROR); - } - if (jobResp.getData() == null) { - log.warn( - "warn:jobResp.getData() == null|jobResp.code={}|jobResp" + - ".errorMessage={}|method={}|uri={}|reqStr={}|respStr={}", - jobResp.getCode(), - jobResp.getErrorMsg(), - method, - uri, - reqStr, - respStr - ); - } - return result; - } catch (Exception e) { - String errorMsg = "Fail to request JOB data|method=" + method + "|uri=" + uri + "|reqStr=" + reqStr; - log.error(errorMsg, e); - throw new InternalException("Fail to request JOB data", ErrorCode.API_ERROR); - } - } - public List listNormalApps() { Response> resp = getJobRespByReq( HttpGet.METHOD_NAME, @@ -169,6 +90,16 @@ public boolean setBizSetMigrationStatus(boolean isMigrated) { req, new TypeReference>() { }); - return resp.getData() == null ? false : resp.getData(); + return resp.getData() != null && resp.getData(); + } + + public BkPlatformInfo getBkPlatformInfo() { + Response resp = getJobRespByReq( + HttpGet.METHOD_NAME, + URL_GET_BK_PLATFORM_INFO, + new BasicHttpReq(), + new TypeReference>() { + }); + return resp.getData(); } } diff --git a/src/backend/upgrader/src/main/java/com/tencent/bk/job/upgrader/task/BaseUpgradeTask.java b/src/backend/upgrader/src/main/java/com/tencent/bk/job/upgrader/task/BaseUpgradeTask.java index 4c1b6a1c8d..9f3a90c85b 100644 --- a/src/backend/upgrader/src/main/java/com/tencent/bk/job/upgrader/task/BaseUpgradeTask.java +++ b/src/backend/upgrader/src/main/java/com/tencent/bk/job/upgrader/task/BaseUpgradeTask.java @@ -29,6 +29,8 @@ import com.tencent.bk.job.common.constant.HttpMethodEnum; import com.tencent.bk.job.common.exception.InternalException; import com.tencent.bk.job.common.exception.InvalidParamException; +import com.tencent.bk.job.common.jwt.BasicJwtManager; +import com.tencent.bk.job.common.jwt.JwtManager; import com.tencent.bk.job.common.model.Response; import com.tencent.bk.job.common.util.Base64Util; import com.tencent.bk.job.common.util.http.BaseHttpHelper; @@ -36,6 +38,7 @@ import com.tencent.bk.job.common.util.http.HttpRequest; import com.tencent.bk.job.common.util.json.JsonUtils; import com.tencent.bk.job.upgrader.anotation.UpgradeTask; +import com.tencent.bk.job.upgrader.client.JobClient; import com.tencent.bk.job.upgrader.task.param.ParamNameConsts; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; @@ -78,6 +81,33 @@ public Properties getProperties() { return properties; } + private String getJobHostUrlByAddress(String address) { + if (!address.startsWith("http://") && !address.startsWith("https://")) { + address = "http://" + address; + } + return address; + } + + public JobClient getJobManageClient() { + String securityPublicKeyBase64 = + (String) getProperties().get(ParamNameConsts.CONFIG_PROPERTY_JOB_SECURITY_PUBLIC_KEY_BASE64); + String securityPrivateKeyBase64 = + (String) getProperties().get(ParamNameConsts.CONFIG_PROPERTY_JOB_SECURITY_PRIVATE_KEY_BASE64); + JwtManager jwtManager; + try { + jwtManager = new BasicJwtManager(securityPrivateKeyBase64, securityPublicKeyBase64); + } catch (Exception e) { + String msg = "Fail to generate jwt auth token"; + log.error(msg, e); + throw new InternalException(msg, e, ErrorCode.INTERNAL_ERROR); + } + String jobAuthToken = jwtManager.generateToken(60 * 60 * 1000); + return new JobClient( + getJobHostUrlByAddress((String) getProperties().get(ParamNameConsts.INPUT_PARAM_JOB_MANAGE_SERVER_ADDRESS)), + jobAuthToken + ); + } + @Override public void init() { } @@ -100,7 +130,7 @@ public Response post(String url, String content) throws InternalException try { String respStr = HTTP_HELPER.requestForSuccessResp( - HttpRequest.builder(HttpMethodEnum.POST, url).setStringEntity(content).setHeaders(headers).build()) + HttpRequest.builder(HttpMethodEnum.POST, url).setStringEntity(content).setHeaders(headers).build()) .getEntity(); log.info("Post {}, content: {}, response: {}", url, content, respStr); if (StringUtils.isBlank(respStr)) { diff --git a/src/backend/upgrader/src/main/java/com/tencent/bk/job/upgrader/task/ExportGlobalSettingsTask.java b/src/backend/upgrader/src/main/java/com/tencent/bk/job/upgrader/task/ExportGlobalSettingsTask.java new file mode 100644 index 0000000000..a13db853f6 --- /dev/null +++ b/src/backend/upgrader/src/main/java/com/tencent/bk/job/upgrader/task/ExportGlobalSettingsTask.java @@ -0,0 +1,96 @@ +/* + * Tencent is pleased to support the open source community by making BK-JOB蓝鲸智云作业平台 available. + * + * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. + * + * BK-JOB蓝鲸智云作业平台 is licensed under the MIT License. + * + * License for BK-JOB蓝鲸智云作业平台: + * -------------------------------------------------------------------- + * 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.bk.job.upgrader.task; + +import com.tencent.bk.job.common.util.json.JsonUtils; +import com.tencent.bk.job.manage.model.migration.BkPlatformInfo; +import com.tencent.bk.job.upgrader.anotation.ExecuteTimeEnum; +import com.tencent.bk.job.upgrader.anotation.RequireTaskParam; +import com.tencent.bk.job.upgrader.anotation.UpgradeTask; +import com.tencent.bk.job.upgrader.anotation.UpgradeTaskInputParam; +import com.tencent.bk.job.upgrader.client.JobClient; +import com.tencent.bk.job.upgrader.task.param.JobManageServerAddress; +import lombok.extern.slf4j.Slf4j; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileWriter; +import java.util.Properties; + +/** + * 3.9.3版本开始,改为使用基于BK-REPO的全局配置统一方案,该任务输出平台信息全局配置JSON文件,以便于让用户迁移之前已配置的数据: + * 将该任务生成的base.json文件导入BK-REPO的blueking项目下bk-config仓库下的bk_job目录下,覆盖原有的base.json即可。 + */ +@SuppressWarnings("unused") +@Slf4j +@RequireTaskParam(value = { + @UpgradeTaskInputParam(value = JobManageServerAddress.class), +}) +@UpgradeTask( + dataStartVersion = "3.0.0.0", + targetVersion = "3.9.3-alpha.1", + targetExecuteTime = ExecuteTimeEnum.AFTER_UPDATE_JOB) +public class ExportGlobalSettingsTask extends BaseUpgradeTask { + + private JobClient jobManageClient; + + @SuppressWarnings("unused") + public ExportGlobalSettingsTask(Properties properties) { + super(properties); + } + + @Override + public void init() { + super.init(); + jobManageClient = getJobManageClient(); + } + + @Override + public boolean execute(String[] args) { + log.info(getName() + " for version " + getTargetVersion() + " begin to run..."); + try { + BkPlatformInfo bkPlatformInfo = jobManageClient.getBkPlatformInfo(); + log.info("Exported BkPlatformInfo:"); + String bkPlatformInfoStr = JsonUtils.toJson(bkPlatformInfo); + log.info(bkPlatformInfoStr); + String fileName = "base.json"; + File outputFile = new File(fileName); + if (!outputFile.exists()) { + boolean result = outputFile.createNewFile(); + if (!result) { + log.error("Fail to create file {}", fileName); + } + } + try (BufferedWriter bw = new BufferedWriter(new FileWriter(outputFile))) { + bw.write(bkPlatformInfoStr); + } + log.info("BkPlatformInfo has been export to file {}, please check current dir", fileName); + return true; + } catch (Throwable e) { + log.error("ExportGlobalSettingsTask fail", e); + return false; + } + } +} diff --git a/src/backend/upgrader/src/main/java/com/tencent/bk/job/upgrader/task/UseAccountPermissionMigrationTask.java b/src/backend/upgrader/src/main/java/com/tencent/bk/job/upgrader/task/UseAccountPermissionMigrationTask.java index 520c44e3b3..ceff229c79 100644 --- a/src/backend/upgrader/src/main/java/com/tencent/bk/job/upgrader/task/UseAccountPermissionMigrationTask.java +++ b/src/backend/upgrader/src/main/java/com/tencent/bk/job/upgrader/task/UseAccountPermissionMigrationTask.java @@ -84,12 +84,6 @@ public class UseAccountPermissionMigrationTask extends BaseUpgradeTask { private List basicAppInfoList; private Map appInfoMap; - private String getJobHostUrlByAddress(String address) { - if (!address.startsWith("http://") && !address.startsWith("https://")) { - address = "http://" + address; - } - return address; - } public UseAccountPermissionMigrationTask(Properties properties) { super(properties); @@ -103,23 +97,7 @@ public void init() { (String) getProperties().get(ParamNameConsts.CONFIG_PROPERTY_IAM_BASE_URL), (String) getProperties().get(ParamNameConsts.CONFIG_PROPERTY_ESB_SERVICE_URL) ); - String securityPublicKeyBase64 = - (String) getProperties().get(ParamNameConsts.CONFIG_PROPERTY_JOB_SECURITY_PUBLIC_KEY_BASE64); - String securityPrivateKeyBase64 = - (String) getProperties().get(ParamNameConsts.CONFIG_PROPERTY_JOB_SECURITY_PRIVATE_KEY_BASE64); - JwtManager jwtManager; - try { - jwtManager = new BasicJwtManager(securityPrivateKeyBase64, securityPublicKeyBase64); - } catch (Exception e) { - String msg = "Fail to generate jwt auth token"; - log.error(msg, e); - throw new InternalException(msg, e, ErrorCode.INTERNAL_ERROR); - } - String jobAuthToken = jwtManager.generateToken(60 * 60 * 1000); - jobManageClient = new JobClient( - getJobHostUrlByAddress((String) getProperties().get(ParamNameConsts.INPUT_PARAM_JOB_MANAGE_SERVER_ADDRESS)), - jobAuthToken - ); + jobManageClient = getJobManageClient(); this.basicAppInfoList = getAllNormalAppInfoFromManage(); appInfoMap = new HashMap<>(); basicAppInfoList.forEach(basicAppInfo -> appInfoMap.put(basicAppInfo.getAppId(), basicAppInfo.getName())); From 6a524ffa545aa4370255dfcc17782c232da8fed4 Mon Sep 17 00:00:00 2001 From: jsonwan Date: Thu, 13 Jun 2024 18:20:34 +0800 Subject: [PATCH 02/12] =?UTF-8?q?perf:=20=E5=8D=87=E7=BA=A7=E5=B7=A5?= =?UTF-8?q?=E5=85=B7=E6=94=AF=E6=8C=81=E8=BE=93=E5=87=BA=E5=B9=B3=E5=8F=B0?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E5=85=A8=E5=B1=80=E9=85=8D=E7=BD=AEJSON?= =?UTF-8?q?=E6=96=87=E4=BB=B6=20#2999?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 从制品库的base.json文件中默认全局配置默认值 --- .../artifactory/sdk/ArtifactoryClient.java | 2 + .../bk/job/common/constant/ErrorCode.java | 2 + .../bk/job/manage/config/JobManageConfig.java | 3 + .../impl/BkPlatformInfoServiceImpl.java | 91 ++++++++++++++++--- .../kubernetes/charts/bk-job/VALUES_LOG.md | 8 ++ .../templates/job-manage/configmap.yaml | 1 + .../kubernetes/charts/bk-job/values.yaml | 2 + 7 files changed, 97 insertions(+), 12 deletions(-) diff --git a/src/backend/commons/artifactory-sdk/src/main/java/com/tencent/bk/job/common/artifactory/sdk/ArtifactoryClient.java b/src/backend/commons/artifactory-sdk/src/main/java/com/tencent/bk/job/common/artifactory/sdk/ArtifactoryClient.java index 903aa0e6ee..3cb2ae2d5f 100644 --- a/src/backend/commons/artifactory-sdk/src/main/java/com/tencent/bk/job/common/artifactory/sdk/ArtifactoryClient.java +++ b/src/backend/commons/artifactory-sdk/src/main/java/com/tencent/bk/job/common/artifactory/sdk/ArtifactoryClient.java @@ -65,6 +65,7 @@ import com.tencent.bk.job.common.util.json.JsonUtils; import io.micrometer.core.instrument.MeterRegistry; import io.micrometer.core.instrument.Tag; +import lombok.Getter; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.tuple.Pair; @@ -108,6 +109,7 @@ public class ArtifactoryClient { public static final String URL_CREATE_REPO = "/repository/api/repo/create"; public static final String URL_CHECK_REPO_EXIST = "/repository/api/repo/exist/{projectId}/{repoName}"; + @Getter private final String baseUrl; private final String username; private final String password; diff --git a/src/backend/commons/common/src/main/java/com/tencent/bk/job/common/constant/ErrorCode.java b/src/backend/commons/common/src/main/java/com/tencent/bk/job/common/constant/ErrorCode.java index c086ef50f3..771b6ec022 100644 --- a/src/backend/commons/common/src/main/java/com/tencent/bk/job/common/constant/ErrorCode.java +++ b/src/backend/commons/common/src/main/java/com/tencent/bk/job/common/constant/ErrorCode.java @@ -279,6 +279,8 @@ public class ErrorCode { public static final int DELETE_REF_SCRIPT_FAIL = 1243054; // 凭证被引用不支持删除 public static final int DELETE_REF_CREDENTIAL_FAIL = 1243055; + // 从制品库读取base.json文件内容失败,请检查bkSharedResUrl配置项是否正确,并确认制品库对应路径下是否存在base.json文件 + public static final int FAIL_TO_GET_BASE_JSON_FROM_ARTIFACTORY = 1243056; // 作业管理 end // 作业执行 start diff --git a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/config/JobManageConfig.java b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/config/JobManageConfig.java index 58074e9f4e..be3312e2ae 100644 --- a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/config/JobManageConfig.java +++ b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/config/JobManageConfig.java @@ -56,6 +56,9 @@ public class JobManageConfig { @Value("${bk.feedback.root:}") private String bkFeedBackRoot; + @Value("${bk.sharedResUrl:}") + private String bkSharedResUrl; + @Value("${bk.ce.root:https://bk.tencent.com}") private String bkCERoot; diff --git a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/globalsetting/impl/BkPlatformInfoServiceImpl.java b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/globalsetting/impl/BkPlatformInfoServiceImpl.java index ae25666d16..e65c39d469 100644 --- a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/globalsetting/impl/BkPlatformInfoServiceImpl.java +++ b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/globalsetting/impl/BkPlatformInfoServiceImpl.java @@ -25,9 +25,13 @@ package com.tencent.bk.job.manage.service.globalsetting.impl; import com.fasterxml.jackson.core.type.TypeReference; +import com.tencent.bk.job.common.artifactory.sdk.ArtifactoryClient; +import com.tencent.bk.job.common.constant.ErrorCode; +import com.tencent.bk.job.common.exception.InternalException; import com.tencent.bk.job.common.i18n.locale.LocaleUtils; import com.tencent.bk.job.common.util.json.JsonUtils; import com.tencent.bk.job.manage.api.common.constants.globalsetting.GlobalSettingKeys; +import com.tencent.bk.job.manage.config.JobManageConfig; import com.tencent.bk.job.manage.dao.globalsetting.GlobalSettingDAO; import com.tencent.bk.job.manage.model.dto.GlobalSettingDTO; import com.tencent.bk.job.manage.model.dto.globalsetting.HelperInfo; @@ -37,9 +41,18 @@ import com.tencent.bk.job.manage.service.globalsetting.BkPlatformInfoService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.tuple.Pair; +import org.apache.http.client.methods.HttpRequestBase; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Service; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.URI; +import java.nio.charset.StandardCharsets; import java.util.Map; /** @@ -50,10 +63,17 @@ public class BkPlatformInfoServiceImpl implements BkPlatformInfoService { private final GlobalSettingDAO globalSettingDAO; + private final ArtifactoryClient adminArtifactoryClient; + private final JobManageConfig jobManageConfig; @Autowired - public BkPlatformInfoServiceImpl(GlobalSettingDAO globalSettingDAO) { + public BkPlatformInfoServiceImpl(GlobalSettingDAO globalSettingDAO, + @Qualifier("adminArtifactoryClient") + ArtifactoryClient adminArtifactoryClient, + JobManageConfig jobManageConfig) { this.globalSettingDAO = globalSettingDAO; + this.adminArtifactoryClient = adminArtifactoryClient; + this.jobManageConfig = jobManageConfig; } @Override @@ -70,13 +90,60 @@ public BkPlatformInfo getCurrentBkPlatformInfo() { if (bkHelperSettingDTO != null && StringUtils.isNotEmpty(bkHelperSettingDTO.getValue())) { helperInfo = JsonUtils.fromJson(bkHelperSettingDTO.getValue(), HelperInfo.class); } - BkPlatformInfo bkPlatformInfo = buildBkPlatformInfo(titleFooterDTO, helperInfo); + BkPlatformInfo defaultBkPlatformInfo = getDefaultBkPlatformInfo(); + BkPlatformInfo bkPlatformInfo = buildBkPlatformInfo(defaultBkPlatformInfo, titleFooterDTO, helperInfo); log.info("bkPlatformInfo={}", JsonUtils.toJson(bkPlatformInfo)); return bkPlatformInfo; } - private BkPlatformInfo buildBkPlatformInfo(TitleFooterDTO titleFooterDTO, HelperInfo helperInfo) { - BkPlatformInfo bkPlatformInfo = new BkPlatformInfo(); + private BkPlatformInfo getDefaultBkPlatformInfo() { + try { + return getBkPlatformInfoFromArtifactory(); + } catch (Exception e) { + log.warn("Fail to getBkPlatformInfoFromArtifactory, use local default", e); + return new BkPlatformInfo(); + } + } + + private BkPlatformInfo getBkPlatformInfoFromArtifactory() { + String bkSharedResUrl = jobManageConfig.getBkSharedResUrl(); + String baseJsonFilePath = buildBaseJsonFilePath(bkSharedResUrl); + Pair pair = adminArtifactoryClient.getFileInputStream(baseJsonFilePath); + String baseJsonStr = readBaseJsonStr(pair.getLeft(), adminArtifactoryClient.getBaseUrl() + baseJsonFilePath); + log.info("Got base.json content from artifactory: " + baseJsonStr); + return JsonUtils.fromJson(baseJsonStr, new TypeReference() { + }); + } + + private String readBaseJsonStr(InputStream ins, String url) { + BufferedReader br = new BufferedReader(new InputStreamReader(ins, StandardCharsets.UTF_8)); + StringBuilder contentBuilder = new StringBuilder(); + String line; + try { + while ((line = br.readLine()) != null) { + contentBuilder.append(line); + } + } catch (IOException e) { + String message = "Fail to get base.json from " + url; + throw new InternalException(message, e, ErrorCode.FAIL_TO_GET_BASE_JSON_FROM_ARTIFACTORY); + } + return contentBuilder.toString(); + } + + /** + * 解析出域名后的路径信息后拼接base.json得到文件路径 + * + * @param bkSharedResUrl 共享资源基础路径 + * @return base.json文件路径 + */ + private String buildBaseJsonFilePath(String bkSharedResUrl) { + URI uri = URI.create(bkSharedResUrl); + return uri.getPath() + "/base.json"; + } + + private BkPlatformInfo buildBkPlatformInfo(BkPlatformInfo defaultBkPlatformInfo, + TitleFooterDTO titleFooterDTO, + HelperInfo helperInfo) { if (titleFooterDTO != null) { Map titleFooterLanguageMap = titleFooterDTO.getTitleFooterLanguageMap(); if (titleFooterLanguageMap != null) { @@ -89,22 +156,22 @@ private BkPlatformInfo buildBkPlatformInfo(TitleFooterDTO titleFooterDTO, Helper chineseTitleFooter = englishTitleFooter; } if (englishTitleFooter != null) { - bkPlatformInfo.setNameEn(englishTitleFooter.getTitleHead()); - bkPlatformInfo.setFooterInfo(englishTitleFooter.getFooterLink()); - bkPlatformInfo.setFooterCopyright(englishTitleFooter.getFooterCopyRight()); + defaultBkPlatformInfo.setNameEn(englishTitleFooter.getTitleHead()); + defaultBkPlatformInfo.setFooterInfo(englishTitleFooter.getFooterLink()); + defaultBkPlatformInfo.setFooterCopyright(englishTitleFooter.getFooterCopyRight()); } if (chineseTitleFooter != null) { - bkPlatformInfo.setName(chineseTitleFooter.getTitleHead()); - bkPlatformInfo.setFooterInfo(chineseTitleFooter.getFooterLink()); - bkPlatformInfo.setFooterCopyright(chineseTitleFooter.getFooterCopyRight()); + defaultBkPlatformInfo.setName(chineseTitleFooter.getTitleHead()); + defaultBkPlatformInfo.setFooterInfo(chineseTitleFooter.getFooterLink()); + defaultBkPlatformInfo.setFooterCopyright(chineseTitleFooter.getFooterCopyRight()); } } } if (helperInfo != null) { String contactLink = helperInfo.getContactLink(); - bkPlatformInfo.setHelperLink(contactLink); + defaultBkPlatformInfo.setHelperLink(contactLink); } - return bkPlatformInfo; + return defaultBkPlatformInfo; } private TitleFooter getEnglishTitleFooter(Map titleFooterLanguageMap) { diff --git a/support-files/kubernetes/charts/bk-job/VALUES_LOG.md b/support-files/kubernetes/charts/bk-job/VALUES_LOG.md index 82b68e2287..4adec17289 100644 --- a/support-files/kubernetes/charts/bk-job/VALUES_LOG.md +++ b/support-files/kubernetes/charts/bk-job/VALUES_LOG.md @@ -1,5 +1,13 @@ # chart values 更新日志 +## 0.6.4 +1. 增加 全局配置(title/footer/name/logo/产品商标)相关的前端资源文件基础地址 + +```yaml +# 全局配置(title/footer/name/logo/产品商标)相关的前端资源文件基础地址 +bkSharedResUrl: "http://bkrepo.example.com/generic/blueking/bk-config" +``` + ## 0.6.2 1. 增加 GSE 脚本任务执行结果查询 API 请求参数配置 diff --git a/support-files/kubernetes/charts/bk-job/templates/job-manage/configmap.yaml b/support-files/kubernetes/charts/bk-job/templates/job-manage/configmap.yaml index a301910296..947ebdea00 100644 --- a/support-files/kubernetes/charts/bk-job/templates/job-manage/configmap.yaml +++ b/support-files/kubernetes/charts/bk-job/templates/job-manage/configmap.yaml @@ -72,6 +72,7 @@ data: root: {{ .Values.bkDocsCenterUrl }} feedback: root: {{ .Values.bkFeedBackUrl }} + sharedResUrl: {{ .Values.bkSharedResUrl }} job: manage: sync: diff --git a/support-files/kubernetes/charts/bk-job/values.yaml b/support-files/kubernetes/charts/bk-job/values.yaml index d52201e5e7..e5a83816d3 100644 --- a/support-files/kubernetes/charts/bk-job/values.yaml +++ b/support-files/kubernetes/charts/bk-job/values.yaml @@ -433,6 +433,8 @@ bkCmdbApiGatewayUrl: "http://bkapi.example.com/api/cmdb" bkDocsCenterUrl: "https://bk.tencent.com/docs" # 问题反馈 url bkFeedBackUrl: "https://bk.tencent.com/s-mart/community" +# 全局配置(title/footer/name/logo/产品商标)相关的前端资源文件基础地址 +bkSharedResUrl: "http://bkrepo.example.com/generic/blueking/bk-config" ## 蓝鲸GSE参数配置 gse: From 1701e53a98b6367c47c1698b161320ac6893a0e3 Mon Sep 17 00:00:00 2001 From: jsonwan Date: Thu, 13 Jun 2024 21:49:50 +0800 Subject: [PATCH 03/12] =?UTF-8?q?perf:=20=E5=8D=87=E7=BA=A7=E5=B7=A5?= =?UTF-8?q?=E5=85=B7=E6=94=AF=E6=8C=81=E8=BE=93=E5=87=BA=E5=B9=B3=E5=8F=B0?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E5=85=A8=E5=B1=80=E9=85=8D=E7=BD=AEJSON?= =?UTF-8?q?=E6=96=87=E4=BB=B6=20#2999?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 从制品库的base.json文件中默认全局配置默认值 --- .../impl/BkPlatformInfoServiceImpl.java | 62 ++++++------------- 1 file changed, 20 insertions(+), 42 deletions(-) diff --git a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/globalsetting/impl/BkPlatformInfoServiceImpl.java b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/globalsetting/impl/BkPlatformInfoServiceImpl.java index e65c39d469..611999b4c1 100644 --- a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/globalsetting/impl/BkPlatformInfoServiceImpl.java +++ b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/globalsetting/impl/BkPlatformInfoServiceImpl.java @@ -25,10 +25,13 @@ package com.tencent.bk.job.manage.service.globalsetting.impl; import com.fasterxml.jackson.core.type.TypeReference; -import com.tencent.bk.job.common.artifactory.sdk.ArtifactoryClient; -import com.tencent.bk.job.common.constant.ErrorCode; -import com.tencent.bk.job.common.exception.InternalException; +import com.tencent.bk.job.common.constant.HttpMethodEnum; import com.tencent.bk.job.common.i18n.locale.LocaleUtils; +import com.tencent.bk.job.common.util.StringUtil; +import com.tencent.bk.job.common.util.http.HttpHelper; +import com.tencent.bk.job.common.util.http.HttpHelperFactory; +import com.tencent.bk.job.common.util.http.HttpRequest; +import com.tencent.bk.job.common.util.http.HttpResponse; import com.tencent.bk.job.common.util.json.JsonUtils; import com.tencent.bk.job.manage.api.common.constants.globalsetting.GlobalSettingKeys; import com.tencent.bk.job.manage.config.JobManageConfig; @@ -41,18 +44,9 @@ import com.tencent.bk.job.manage.service.globalsetting.BkPlatformInfoService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.tuple.Pair; -import org.apache.http.client.methods.HttpRequestBase; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Service; -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.net.URI; -import java.nio.charset.StandardCharsets; import java.util.Map; /** @@ -63,16 +57,11 @@ public class BkPlatformInfoServiceImpl implements BkPlatformInfoService { private final GlobalSettingDAO globalSettingDAO; - private final ArtifactoryClient adminArtifactoryClient; private final JobManageConfig jobManageConfig; @Autowired - public BkPlatformInfoServiceImpl(GlobalSettingDAO globalSettingDAO, - @Qualifier("adminArtifactoryClient") - ArtifactoryClient adminArtifactoryClient, - JobManageConfig jobManageConfig) { + public BkPlatformInfoServiceImpl(GlobalSettingDAO globalSettingDAO, JobManageConfig jobManageConfig) { this.globalSettingDAO = globalSettingDAO; - this.adminArtifactoryClient = adminArtifactoryClient; this.jobManageConfig = jobManageConfig; } @@ -107,38 +96,27 @@ private BkPlatformInfo getDefaultBkPlatformInfo() { private BkPlatformInfo getBkPlatformInfoFromArtifactory() { String bkSharedResUrl = jobManageConfig.getBkSharedResUrl(); - String baseJsonFilePath = buildBaseJsonFilePath(bkSharedResUrl); - Pair pair = adminArtifactoryClient.getFileInputStream(baseJsonFilePath); - String baseJsonStr = readBaseJsonStr(pair.getLeft(), adminArtifactoryClient.getBaseUrl() + baseJsonFilePath); - log.info("Got base.json content from artifactory: " + baseJsonStr); + String baseJsonFileUrl = buildBaseJsonFileUrl(bkSharedResUrl); + HttpHelper httpHelper = HttpHelperFactory.getDefaultHttpHelper(); + HttpRequest request = HttpRequest.builder(HttpMethodEnum.GET, baseJsonFileUrl).build(); + HttpResponse resp = httpHelper.requestForSuccessResp(request); + String baseJsonStr = resp.getEntity(); + log.info("Got base.json content from bkSharedRes: " + baseJsonStr); return JsonUtils.fromJson(baseJsonStr, new TypeReference() { }); } - private String readBaseJsonStr(InputStream ins, String url) { - BufferedReader br = new BufferedReader(new InputStreamReader(ins, StandardCharsets.UTF_8)); - StringBuilder contentBuilder = new StringBuilder(); - String line; - try { - while ((line = br.readLine()) != null) { - contentBuilder.append(line); - } - } catch (IOException e) { - String message = "Fail to get base.json from " + url; - throw new InternalException(message, e, ErrorCode.FAIL_TO_GET_BASE_JSON_FROM_ARTIFACTORY); - } - return contentBuilder.toString(); - } - /** - * 解析出域名后的路径信息后拼接base.json得到文件路径 + * 构建获取base.json文件的URL * * @param bkSharedResUrl 共享资源基础路径 - * @return base.json文件路径 + * @return base.json文件对应的URL */ - private String buildBaseJsonFilePath(String bkSharedResUrl) { - URI uri = URI.create(bkSharedResUrl); - return uri.getPath() + "/base.json"; + private String buildBaseJsonFileUrl(String bkSharedResUrl) { + if (bkSharedResUrl.endsWith("/")) { + bkSharedResUrl = StringUtil.removeSuffix(bkSharedResUrl, "/"); + } + return bkSharedResUrl + "/bk-job/base.json"; } private BkPlatformInfo buildBkPlatformInfo(BkPlatformInfo defaultBkPlatformInfo, From 1f9f6ec638eb36259e4fbf948021c58b68d09268 Mon Sep 17 00:00:00 2001 From: jsonwan Date: Fri, 14 Jun 2024 15:59:40 +0800 Subject: [PATCH 04/12] =?UTF-8?q?perf:=20=E5=8D=87=E7=BA=A7=E5=B7=A5?= =?UTF-8?q?=E5=85=B7=E6=94=AF=E6=8C=81=E8=BE=93=E5=87=BA=E5=B9=B3=E5=8F=B0?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E5=85=A8=E5=B1=80=E9=85=8D=E7=BD=AEJSON?= =?UTF-8?q?=E6=96=87=E4=BB=B6=20#2999?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 从制品库的base.js文件中默认全局配置默认值,导出base.js文件 --- .../model/migration/BkPlatformInfo.java | 30 +++++++++-------- .../bk/job/manage/config/JobManageConfig.java | 3 ++ .../impl/BkPlatformInfoServiceImpl.java | 32 +++++++++++++------ .../task/ExportGlobalSettingsTask.java | 13 ++++---- .../kubernetes/charts/bk-job/VALUES_LOG.md | 4 ++- .../templates/job-manage/configmap.yaml | 1 + .../kubernetes/charts/bk-job/values.yaml | 2 ++ 7 files changed, 55 insertions(+), 30 deletions(-) diff --git a/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/model/migration/BkPlatformInfo.java b/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/model/migration/BkPlatformInfo.java index 56e4d0d049..0522c23c80 100644 --- a/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/model/migration/BkPlatformInfo.java +++ b/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/model/migration/BkPlatformInfo.java @@ -32,46 +32,50 @@ @NoArgsConstructor public class BkPlatformInfo { - @JsonProperty("bk_app_code") + @JsonProperty("bkAppCode") private String bkAppCode = "bk_job"; @JsonProperty("name") private String name = "蓝鲸作业平台"; - @JsonProperty("name_en") + @JsonProperty("nameEn") private String nameEn = "JOB"; - @JsonProperty("app_logo") + @JsonProperty("appLogo") private String appLogo = "bk_job.png"; - @JsonProperty("fav_icon") + @JsonProperty("favicon") private String favIcon = "bk_job.png"; - @JsonProperty("helper_text") + @JsonProperty("helperText") private String helperText = "联系BK助手"; - @JsonProperty("helper_text_en") + @JsonProperty("helperTextEn") private String helperTextEn = "Contact BK Assistant"; - @JsonProperty("helper_link") + @JsonProperty("helperLink") private String helperLink = "wxwork://message/?username=BK%E5%8A%A9%E6%89%8B"; - @JsonProperty("brand_img") + @JsonProperty("brandImg") private String brandImg = "brand_img.png"; - @JsonProperty("brand_img_en") + @JsonProperty("brandImgEn") private String brandImgEn = "brand_img.png"; - @JsonProperty("brand_name") + @JsonProperty("brandName") private String brandName = "腾讯蓝鲸智云"; - @JsonProperty("brand_name_en") + @JsonProperty("brandNameEn") private String brandNameEn = "BlueKing"; - @JsonProperty("footer_info") + @JsonProperty("footerInfo") private String footerInfo = "[技术支持](https://wpa1.qq.com/KziXGWJs?_type=wpa&qidian=true) | [社区论坛](https://bk" + ".tencent.com/s-mart/community/) | [产品官网](https://bk.tencent.com/index/)"; - @JsonProperty("footer_copyright") + @JsonProperty("footerInfoEn") + private String footerInfoEn = "[Support](https://wpa1.qq.com/KziXGWJs?_type=wpa&qidian=true) | [Forum](https://bk" + + ".tencent.com/s-mart/community/) | [Official](https://bk.tencent.com/index/)"; + + @JsonProperty("footerCopyright") private String footerCopyright = "Copyright © 2012 Tencent BlueKing. All Rights Reserved. {{version}}"; } diff --git a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/config/JobManageConfig.java b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/config/JobManageConfig.java index be3312e2ae..f4dcc23989 100644 --- a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/config/JobManageConfig.java +++ b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/config/JobManageConfig.java @@ -59,6 +59,9 @@ public class JobManageConfig { @Value("${bk.sharedResUrl:}") private String bkSharedResUrl; + @Value("${bk.sharedBaseJsPath:/bk_job/base.js}") + private String bkSharedBaseJsPath; + @Value("${bk.ce.root:https://bk.tencent.com}") private String bkCERoot; diff --git a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/globalsetting/impl/BkPlatformInfoServiceImpl.java b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/globalsetting/impl/BkPlatformInfoServiceImpl.java index 611999b4c1..58f23f5d10 100644 --- a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/globalsetting/impl/BkPlatformInfoServiceImpl.java +++ b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/globalsetting/impl/BkPlatformInfoServiceImpl.java @@ -96,27 +96,39 @@ private BkPlatformInfo getDefaultBkPlatformInfo() { private BkPlatformInfo getBkPlatformInfoFromArtifactory() { String bkSharedResUrl = jobManageConfig.getBkSharedResUrl(); - String baseJsonFileUrl = buildBaseJsonFileUrl(bkSharedResUrl); + String bkSharedBaseJsPath = jobManageConfig.getBkSharedBaseJsPath(); + String baseJsonFileUrl = buildBaseJsFileUrl(bkSharedResUrl, bkSharedBaseJsPath); HttpHelper httpHelper = HttpHelperFactory.getDefaultHttpHelper(); HttpRequest request = HttpRequest.builder(HttpMethodEnum.GET, baseJsonFileUrl).build(); HttpResponse resp = httpHelper.requestForSuccessResp(request); - String baseJsonStr = resp.getEntity(); - log.info("Got base.json content from bkSharedRes: " + baseJsonStr); - return JsonUtils.fromJson(baseJsonStr, new TypeReference() { + String baseJsStr = resp.getEntity(); + log.info("Got base.js content from bkSharedRes: " + baseJsStr); + String platformJsonStr = parsePlatformJsonStr(baseJsStr); + return JsonUtils.fromJson(platformJsonStr, new TypeReference() { }); } + private String parsePlatformJsonStr(String baseJsStr) { + int startIndex = baseJsStr.indexOf("{"); + int endIndex = baseJsStr.lastIndexOf("}"); + return baseJsStr.substring(startIndex, endIndex + 1); + } + /** - * 构建获取base.json文件的URL + * 构建获取base.js文件的URL * - * @param bkSharedResUrl 共享资源基础路径 - * @return base.json文件对应的URL + * @param bkSharedResUrl 共享资源基础路径 + * @param bkSharedBaseJsPath base.js文件路径 + * @return base.js文件对应的URL */ - private String buildBaseJsonFileUrl(String bkSharedResUrl) { + private String buildBaseJsFileUrl(String bkSharedResUrl, String bkSharedBaseJsPath) { if (bkSharedResUrl.endsWith("/")) { bkSharedResUrl = StringUtil.removeSuffix(bkSharedResUrl, "/"); } - return bkSharedResUrl + "/bk-job/base.json"; + if (bkSharedBaseJsPath.startsWith("/")) { + return bkSharedResUrl + bkSharedBaseJsPath; + } + return bkSharedResUrl + "/" + bkSharedBaseJsPath; } private BkPlatformInfo buildBkPlatformInfo(BkPlatformInfo defaultBkPlatformInfo, @@ -135,7 +147,7 @@ private BkPlatformInfo buildBkPlatformInfo(BkPlatformInfo defaultBkPlatformInfo, } if (englishTitleFooter != null) { defaultBkPlatformInfo.setNameEn(englishTitleFooter.getTitleHead()); - defaultBkPlatformInfo.setFooterInfo(englishTitleFooter.getFooterLink()); + defaultBkPlatformInfo.setFooterInfoEn(englishTitleFooter.getFooterLink()); defaultBkPlatformInfo.setFooterCopyright(englishTitleFooter.getFooterCopyRight()); } if (chineseTitleFooter != null) { diff --git a/src/backend/upgrader/src/main/java/com/tencent/bk/job/upgrader/task/ExportGlobalSettingsTask.java b/src/backend/upgrader/src/main/java/com/tencent/bk/job/upgrader/task/ExportGlobalSettingsTask.java index a13db853f6..325c86b996 100644 --- a/src/backend/upgrader/src/main/java/com/tencent/bk/job/upgrader/task/ExportGlobalSettingsTask.java +++ b/src/backend/upgrader/src/main/java/com/tencent/bk/job/upgrader/task/ExportGlobalSettingsTask.java @@ -40,8 +40,8 @@ import java.util.Properties; /** - * 3.9.3版本开始,改为使用基于BK-REPO的全局配置统一方案,该任务输出平台信息全局配置JSON文件,以便于让用户迁移之前已配置的数据: - * 将该任务生成的base.json文件导入BK-REPO的blueking项目下bk-config仓库下的bk_job目录下,覆盖原有的base.json即可。 + * 3.9.3版本开始,改为使用基于BK-REPO的全局配置统一方案,该任务输出平台信息全局配置base.js文件,以便于让用户迁移之前已配置的数据: + * 将该任务生成的base.js文件导入BK-REPO的blueking项目下bk-config仓库下的bk_job目录下,覆盖原有的base.js即可。 */ @SuppressWarnings("unused") @Slf4j @@ -72,10 +72,11 @@ public boolean execute(String[] args) { log.info(getName() + " for version " + getTargetVersion() + " begin to run..."); try { BkPlatformInfo bkPlatformInfo = jobManageClient.getBkPlatformInfo(); - log.info("Exported BkPlatformInfo:"); String bkPlatformInfoStr = JsonUtils.toJson(bkPlatformInfo); - log.info(bkPlatformInfoStr); - String fileName = "base.json"; + String fileName = "base.js"; + String baseJsStr = "__platCfgCallback__(" + bkPlatformInfoStr + ")"; + log.info("Exported " + fileName + ":"); + log.info(baseJsStr); File outputFile = new File(fileName); if (!outputFile.exists()) { boolean result = outputFile.createNewFile(); @@ -84,7 +85,7 @@ public boolean execute(String[] args) { } } try (BufferedWriter bw = new BufferedWriter(new FileWriter(outputFile))) { - bw.write(bkPlatformInfoStr); + bw.write(baseJsStr); } log.info("BkPlatformInfo has been export to file {}, please check current dir", fileName); return true; diff --git a/support-files/kubernetes/charts/bk-job/VALUES_LOG.md b/support-files/kubernetes/charts/bk-job/VALUES_LOG.md index 4adec17289..7df9f9bd5d 100644 --- a/support-files/kubernetes/charts/bk-job/VALUES_LOG.md +++ b/support-files/kubernetes/charts/bk-job/VALUES_LOG.md @@ -1,11 +1,13 @@ # chart values 更新日志 ## 0.6.4 -1. 增加 全局配置(title/footer/name/logo/产品商标)相关的前端资源文件基础地址 +1. 增加 全局配置(title/footer/name/logo/产品商标)相关的前端资源文件基础地址与base.js路径 ```yaml # 全局配置(title/footer/name/logo/产品商标)相关的前端资源文件基础地址 bkSharedResUrl: "http://bkrepo.example.com/generic/blueking/bk-config" +# 全局配置(title/footer/name/logo/产品商标)相关的前端资源文件base.js路径 +bkSharedBaseJsPath: "/bk_job/base.js" ``` ## 0.6.2 diff --git a/support-files/kubernetes/charts/bk-job/templates/job-manage/configmap.yaml b/support-files/kubernetes/charts/bk-job/templates/job-manage/configmap.yaml index 947ebdea00..ef311c8f9b 100644 --- a/support-files/kubernetes/charts/bk-job/templates/job-manage/configmap.yaml +++ b/support-files/kubernetes/charts/bk-job/templates/job-manage/configmap.yaml @@ -73,6 +73,7 @@ data: feedback: root: {{ .Values.bkFeedBackUrl }} sharedResUrl: {{ .Values.bkSharedResUrl }} + sharedBaseJsPath: {{ .Values.bkSharedBaseJsPath }} job: manage: sync: diff --git a/support-files/kubernetes/charts/bk-job/values.yaml b/support-files/kubernetes/charts/bk-job/values.yaml index e5a83816d3..dec4a526e9 100644 --- a/support-files/kubernetes/charts/bk-job/values.yaml +++ b/support-files/kubernetes/charts/bk-job/values.yaml @@ -435,6 +435,8 @@ bkDocsCenterUrl: "https://bk.tencent.com/docs" bkFeedBackUrl: "https://bk.tencent.com/s-mart/community" # 全局配置(title/footer/name/logo/产品商标)相关的前端资源文件基础地址 bkSharedResUrl: "http://bkrepo.example.com/generic/blueking/bk-config" +# 全局配置(title/footer/name/logo/产品商标)相关的前端资源文件base.js路径 +bkSharedBaseJsPath: "/bk_job/base.js" ## 蓝鲸GSE参数配置 gse: From 308547a32cbe83360aa3344a941e3f219f92e8d7 Mon Sep 17 00:00:00 2001 From: jsonwan Date: Fri, 14 Jun 2024 19:14:31 +0800 Subject: [PATCH 05/12] =?UTF-8?q?perf:=20=E5=8D=87=E7=BA=A7=E5=B7=A5?= =?UTF-8?q?=E5=85=B7=E6=94=AF=E6=8C=81=E8=BE=93=E5=87=BA=E5=B9=B3=E5=8F=B0?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E5=85=A8=E5=B1=80=E9=85=8D=E7=BD=AEJSON?= =?UTF-8?q?=E6=96=87=E4=BB=B6=20#2999?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 从制品库的base.js文件中默认全局配置默认值,导出base.js文件 --- .../tencent/bk/job/manage/model/migration/BkPlatformInfo.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/model/migration/BkPlatformInfo.java b/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/model/migration/BkPlatformInfo.java index 0522c23c80..a33b0f5ad2 100644 --- a/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/model/migration/BkPlatformInfo.java +++ b/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/model/migration/BkPlatformInfo.java @@ -44,7 +44,7 @@ public class BkPlatformInfo { @JsonProperty("appLogo") private String appLogo = "bk_job.png"; - @JsonProperty("favicon") + @JsonProperty("favIcon") private String favIcon = "bk_job.png"; @JsonProperty("helperText") From 7dd3795c7847f6d84af938ec6995e54901aacd94 Mon Sep 17 00:00:00 2001 From: jsonwan Date: Fri, 14 Jun 2024 19:20:26 +0800 Subject: [PATCH 06/12] =?UTF-8?q?perf:=20=E5=8D=87=E7=BA=A7=E5=B7=A5?= =?UTF-8?q?=E5=85=B7=E6=94=AF=E6=8C=81=E8=BE=93=E5=87=BA=E5=B9=B3=E5=8F=B0?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E5=85=A8=E5=B1=80=E9=85=8D=E7=BD=AEJSON?= =?UTF-8?q?=E6=96=87=E4=BB=B6=20#2999?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 从制品库的base.js文件中默认全局配置默认值,导出base.js文件 --- .../main/java/com/tencent/bk/job/common/constant/ErrorCode.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/backend/commons/common/src/main/java/com/tencent/bk/job/common/constant/ErrorCode.java b/src/backend/commons/common/src/main/java/com/tencent/bk/job/common/constant/ErrorCode.java index 771b6ec022..c086ef50f3 100644 --- a/src/backend/commons/common/src/main/java/com/tencent/bk/job/common/constant/ErrorCode.java +++ b/src/backend/commons/common/src/main/java/com/tencent/bk/job/common/constant/ErrorCode.java @@ -279,8 +279,6 @@ public class ErrorCode { public static final int DELETE_REF_SCRIPT_FAIL = 1243054; // 凭证被引用不支持删除 public static final int DELETE_REF_CREDENTIAL_FAIL = 1243055; - // 从制品库读取base.json文件内容失败,请检查bkSharedResUrl配置项是否正确,并确认制品库对应路径下是否存在base.json文件 - public static final int FAIL_TO_GET_BASE_JSON_FROM_ARTIFACTORY = 1243056; // 作业管理 end // 作业执行 start From f603044eaa608cbdbd9a679ade9553b850c91692 Mon Sep 17 00:00:00 2001 From: jsonwan Date: Sun, 16 Jun 2024 15:10:09 +0800 Subject: [PATCH 07/12] =?UTF-8?q?perf:=20=E5=8D=87=E7=BA=A7=E5=B7=A5?= =?UTF-8?q?=E5=85=B7=E6=94=AF=E6=8C=81=E8=BE=93=E5=87=BA=E5=B9=B3=E5=8F=B0?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E5=85=A8=E5=B1=80=E9=85=8D=E7=BD=AEJSON?= =?UTF-8?q?=E6=96=87=E4=BB=B6=20#2999?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将接口文档中所有10.x.x.x的IP改为127.x.x.x,避免触发CodeCC告警误告 --- .../v3/zh/batch_get_job_instance_ip_log.md | 14 +++++++------- ...in_batch_get_job_instance_execute_object_log.md | 6 +++--- .../v3/zh/bkci_plugin_fast_execute_script.md | 2 +- .../v3/zh/bkci_plugin_get_job_instance_status.md | 2 +- .../apidoc/bk-api-gateway/v3/zh/get_cron_detail.md | 4 ++-- .../v3/zh/get_job_instance_ip_log.md | 12 ++++++------ .../v3/zh/get_job_instance_status.md | 2 +- .../bk-api-gateway/v3/zh/get_job_plan_detail.md | 8 ++++---- docs/apidoc/bk-api-gateway/v3/zh/save_cron.md | 4 ++-- .../apidocs/en/batch_get_job_instance_ip_log.md | 14 +++++++------- .../jobv3-confapis/apidocs/en/get_cron_detail.md | 4 ++-- .../apidocs/en/get_job_instance_ip_log.md | 10 +++++----- .../apidocs/en/get_job_instance_status.md | 2 +- .../apidocs/en/get_job_plan_detail.md | 8 ++++---- .../esb/jobv3-confapis/apidocs/en/save_cron.md | 4 ++-- .../zh_hans/batch_get_job_instance_ip_log.md | 14 +++++++------- .../apidocs/zh_hans/get_cron_detail.md | 4 ++-- .../apidocs/zh_hans/get_job_instance_ip_log.md | 10 +++++----- .../apidocs/zh_hans/get_job_instance_status.md | 2 +- .../apidocs/zh_hans/get_job_plan_detail.md | 8 ++++---- .../jobv3-confapis/apidocs/zh_hans/save_cron.md | 4 ++-- .../apidocs/zh_hans/update_cron_status.md | 2 +- 22 files changed, 70 insertions(+), 70 deletions(-) diff --git a/docs/apidoc/bk-api-gateway/v3/zh/batch_get_job_instance_ip_log.md b/docs/apidoc/bk-api-gateway/v3/zh/batch_get_job_instance_ip_log.md index 2abd98dbdb..440ecd3bc0 100644 --- a/docs/apidoc/bk-api-gateway/v3/zh/batch_get_job_instance_ip_log.md +++ b/docs/apidoc/bk-api-gateway/v3/zh/batch_get_job_instance_ip_log.md @@ -62,13 +62,13 @@ "script_task_logs": [ { "bk_host_id": 101, - "ip": "10.0.0.1", + "ip": "127.0.0.1", "bk_cloud_id": 0, "log_content": "[2018-03-15 14:39:30][PID:56875] job_start\n" }, { "bk_host_id": 102, - "ip": "10.0.0.2", + "ip": "127.0.0.2", "bk_cloud_id": 0, "log_content": "[2018-03-15 14:39:30][PID:16789] job_start\n" } @@ -91,7 +91,7 @@ "file_task_logs": [ { "bk_host_id": 101, - "ip": "10.0.0.1", + "ip": "127.0.0.1", "bk_cloud_id": 0, "file_logs": [ { @@ -99,13 +99,13 @@ "src_ip": { "bk_host_id": 102, "bk_cloud_id": 0, - "ip": "10.0.0.2" + "ip": "127.0.0.2" }, "src_path": "/data/1.log", "dest_ip": { "bk_host_id": 101, "bk_cloud_id": 0, - "ip": "10.0.0.1" + "ip": "127.0.0.1" }, "dest_path": "/tmp/1.log", "status": 4, @@ -118,7 +118,7 @@ }, { "bk_host_id": 102, - "ip": "10.0.0.2", + "ip": "127.0.0.2", "bk_cloud_id": 0, "file_logs": [ { @@ -126,7 +126,7 @@ "src_ip": { "bk_host_id": 102, "bk_cloud_id": 0, - "ip": "10.0.0.2" + "ip": "127.0.0.2" }, "src_path": "/data/1.log", "status": 4, diff --git a/docs/apidoc/bk-api-gateway/v3/zh/bkci_plugin_batch_get_job_instance_execute_object_log.md b/docs/apidoc/bk-api-gateway/v3/zh/bkci_plugin_batch_get_job_instance_execute_object_log.md index 949c08df79..c16300beb4 100644 --- a/docs/apidoc/bk-api-gateway/v3/zh/bkci_plugin_batch_get_job_instance_execute_object_log.md +++ b/docs/apidoc/bk-api-gateway/v3/zh/bkci_plugin_batch_get_job_instance_execute_object_log.md @@ -70,7 +70,7 @@ "resource_id": "101", "host": { "bk_host_id": 101, - "ip": "10.0.0.1", + "ip": "127.0.0.1", "bk_cloud_id": 0 } }, @@ -109,7 +109,7 @@ "resource_id": "101", "host": { "bk_host_id": 101, - "ip": "10.0.0.1", + "ip": "127.0.0.1", "bk_cloud_id": 0 } }, @@ -131,7 +131,7 @@ "resource_id": "101", "host": { "bk_host_id": 101, - "ip": "10.0.0.1", + "ip": "127.0.0.1", "bk_cloud_id": 0 } }, diff --git a/docs/apidoc/bk-api-gateway/v3/zh/bkci_plugin_fast_execute_script.md b/docs/apidoc/bk-api-gateway/v3/zh/bkci_plugin_fast_execute_script.md index 0e50280165..c392514540 100644 --- a/docs/apidoc/bk-api-gateway/v3/zh/bkci_plugin_fast_execute_script.md +++ b/docs/apidoc/bk-api-gateway/v3/zh/bkci_plugin_fast_execute_script.md @@ -157,7 +157,7 @@ }, { "bk_cloud_id": 0, - "ip": "10.0.0.2" + "ip": "127.0.0.2" } ], "host_topo_node_list": [ diff --git a/docs/apidoc/bk-api-gateway/v3/zh/bkci_plugin_get_job_instance_status.md b/docs/apidoc/bk-api-gateway/v3/zh/bkci_plugin_get_job_instance_status.md index 73f438aa53..8d618a211c 100644 --- a/docs/apidoc/bk-api-gateway/v3/zh/bkci_plugin_get_job_instance_status.md +++ b/docs/apidoc/bk-api-gateway/v3/zh/bkci_plugin_get_job_instance_status.md @@ -73,7 +73,7 @@ "resource_id": "101", "host": { "bk_host_id": 101, - "ip": "10.0.0.1", + "ip": "127.0.0.1", "bk_cloud_id": 0 } }, diff --git a/docs/apidoc/bk-api-gateway/v3/zh/get_cron_detail.md b/docs/apidoc/bk-api-gateway/v3/zh/get_cron_detail.md index f4f697cdcb..b96e23a4b1 100644 --- a/docs/apidoc/bk-api-gateway/v3/zh/get_cron_detail.md +++ b/docs/apidoc/bk-api-gateway/v3/zh/get_cron_detail.md @@ -62,12 +62,12 @@ { "bk_host_id": 101, "bk_cloud_id": 0, - "ip": "10.0.0.1" + "ip": "127.0.0.1" }, { "bk_host_id": 102, "bk_cloud_id": 0, - "ip": "10.0.0.2" + "ip": "127.0.0.2" } ], "topo_node_list": [ diff --git a/docs/apidoc/bk-api-gateway/v3/zh/get_job_instance_ip_log.md b/docs/apidoc/bk-api-gateway/v3/zh/get_job_instance_ip_log.md index 2a89bf8b96..59cd6fc2ba 100644 --- a/docs/apidoc/bk-api-gateway/v3/zh/get_job_instance_ip_log.md +++ b/docs/apidoc/bk-api-gateway/v3/zh/get_job_instance_ip_log.md @@ -29,7 +29,7 @@ ### 请求参数示例 - GET ```json -/api/v3/get_job_instance_ip_log?bk_scope_type=biz&bk_scope_id=1&job_instance_id=50&step_instance_id=100&bk_cloud_id=0&ip=10.0.0.1 +/api/v3/get_job_instance_ip_log?bk_scope_type=biz&bk_scope_id=1&job_instance_id=50&step_instance_id=100&bk_cloud_id=0&ip=127.0.0.1 ``` ### 返回结果示例 @@ -43,7 +43,7 @@ "data": { "log_type": 1, "bk_host_id": 101, - "ip": "10.0.0.1", + "ip": "127.0.0.1", "bk_cloud_id": 0, "log_content": "[2018-03-15 14:39:30][PID:56875] job_start\n" } @@ -60,7 +60,7 @@ "data": { "log_type": 2, "bk_host_id": 101, - "ip": "10.0.0.1", + "ip": "127.0.0.1", "bk_cloud_id": 0, "file_logs": [ { @@ -68,13 +68,13 @@ "src_ip": { "host_id": 102, "bk_cloud_id": 0, - "ip": "10.0.0.2" + "ip": "127.0.0.2" }, "src_path": "/data/1.log", "dest_ip": { "bk_host_id": 101, "bk_cloud_id": 0, - "ip": "10.0.0.1" + "ip": "127.0.0.1" }, "dest_path": "/tmp/1.log", "status": 4, @@ -85,7 +85,7 @@ "src_ip": { "bk_host_id": 102, "bk_cloud_id": 0, - "ip": "10.0.0.2" + "ip": "127.0.0.2" }, "src_path": "/data/1.log", "status": 4, diff --git a/docs/apidoc/bk-api-gateway/v3/zh/get_job_instance_status.md b/docs/apidoc/bk-api-gateway/v3/zh/get_job_instance_status.md index 0e686ba241..f06010ea56 100644 --- a/docs/apidoc/bk-api-gateway/v3/zh/get_job_instance_status.md +++ b/docs/apidoc/bk-api-gateway/v3/zh/get_job_instance_status.md @@ -65,7 +65,7 @@ "step_ip_result_list": [ { "bk_host_id": 101, - "ip": "10.0.0.1", + "ip": "127.0.0.1", "bk_cloud_id": 0, "status": 9, "tag": "", diff --git a/docs/apidoc/bk-api-gateway/v3/zh/get_job_plan_detail.md b/docs/apidoc/bk-api-gateway/v3/zh/get_job_plan_detail.md index 7e907a100c..f5e4017123 100644 --- a/docs/apidoc/bk-api-gateway/v3/zh/get_job_plan_detail.md +++ b/docs/apidoc/bk-api-gateway/v3/zh/get_job_plan_detail.md @@ -73,12 +73,12 @@ { "bk_host_id": 101, "bk_cloud_id": 0, - "ip": "10.0.0.1" + "ip": "127.0.0.1" }, { "bk_host_id": 102, "bk_cloud_id": 0, - "ip": "10.0.0.2" + "ip": "127.0.0.2" } ], "topo_node_list": [ @@ -165,12 +165,12 @@ { "bk_host_id": 103, "bk_cloud_id": 0, - "ip": "10.0.0.3" + "ip": "127.0.0.3" }, { "bk_host_id": 104, "bk_cloud_id": 0, - "ip": "10.0.0.4" + "ip": "127.0.0.4" } ], "topo_node_list": [ diff --git a/docs/apidoc/bk-api-gateway/v3/zh/save_cron.md b/docs/apidoc/bk-api-gateway/v3/zh/save_cron.md index 1e19532478..84ed8958fc 100644 --- a/docs/apidoc/bk-api-gateway/v3/zh/save_cron.md +++ b/docs/apidoc/bk-api-gateway/v3/zh/save_cron.md @@ -214,7 +214,7 @@ { "bk_host_id": 101, "bk_cloud_id": 0, - "ip": "10.0.0.1" + "ip": "127.0.0.1" } ], "dynamic_group_list": null, @@ -300,7 +300,7 @@ { "bk_host_id": 101, "bk_cloud_id": 0, - "ip": "10.0.0.1" + "ip": "127.0.0.1" } ], "dynamic_group_list": null, diff --git a/docs/apidoc/esb/jobv3-confapis/apidocs/en/batch_get_job_instance_ip_log.md b/docs/apidoc/esb/jobv3-confapis/apidocs/en/batch_get_job_instance_ip_log.md index 6076c6465d..223453c3d1 100644 --- a/docs/apidoc/esb/jobv3-confapis/apidocs/en/batch_get_job_instance_ip_log.md +++ b/docs/apidoc/esb/jobv3-confapis/apidocs/en/batch_get_job_instance_ip_log.md @@ -56,13 +56,13 @@ Bulk query of job execution logs by host list "script_task_logs": [ { "bk_host_id": 101, - "ip": "10.0.0.1", + "ip": "127.0.0.1", "bk_cloud_id": 0, "log_content": "[2018-03-15 14:39:30][PID:56875] job_start\n" }, { "bk_host_id": 102, - "ip": "10.0.0.2", + "ip": "127.0.0.2", "bk_cloud_id": 0, "log_content": "[2018-03-15 14:39:30][PID:16789] job_start\n" } @@ -84,7 +84,7 @@ Bulk query of job execution logs by host list "file_task_logs": [ { "bk_host_id": 101, - "ip": "10.0.0.1", + "ip": "127.0.0.1", "bk_cloud_id": 0, "file_logs": [ { @@ -92,13 +92,13 @@ Bulk query of job execution logs by host list "src_ip": { "bk_host_id": 102, "bk_cloud_id": 0, - "ip": "10.0.0.2" + "ip": "127.0.0.2" }, "src_path": "/data/1.log", "dest_ip": { "bk_host_id": 101, "bk_cloud_id": 0, - "ip": "10.0.0.1" + "ip": "127.0.0.1" }, "dest_path": "/tmp/1.log", "status": 4, @@ -111,7 +111,7 @@ Bulk query of job execution logs by host list }, { "bk_host_id": 102, - "ip": "10.0.0.2", + "ip": "127.0.0.2", "bk_cloud_id": 0, "file_logs": [ { @@ -119,7 +119,7 @@ Bulk query of job execution logs by host list "src_ip": { "bk_host_id": 102, "bk_cloud_id": 0, - "ip": "10.0.0.2" + "ip": "127.0.0.2" }, "src_path": "/data/1.log", "status": 4, diff --git a/docs/apidoc/esb/jobv3-confapis/apidocs/en/get_cron_detail.md b/docs/apidoc/esb/jobv3-confapis/apidocs/en/get_cron_detail.md index bf6448bffc..ec7c0cf9ab 100644 --- a/docs/apidoc/esb/jobv3-confapis/apidocs/en/get_cron_detail.md +++ b/docs/apidoc/esb/jobv3-confapis/apidocs/en/get_cron_detail.md @@ -59,12 +59,12 @@ Query Cron job details { "bk_host_id": 101, "bk_cloud_id": 0, - "ip": "10.0.0.1" + "ip": "127.0.0.1" }, { "bk_host_id": 102, "bk_cloud_id": 0, - "ip": "10.0.0.2" + "ip": "127.0.0.2" } ], "topo_node_list": [ diff --git a/docs/apidoc/esb/jobv3-confapis/apidocs/en/get_job_instance_ip_log.md b/docs/apidoc/esb/jobv3-confapis/apidocs/en/get_job_instance_ip_log.md index ba1138351e..00a72c7686 100644 --- a/docs/apidoc/esb/jobv3-confapis/apidocs/en/get_job_instance_ip_log.md +++ b/docs/apidoc/esb/jobv3-confapis/apidocs/en/get_job_instance_ip_log.md @@ -44,7 +44,7 @@ Query job execution log by host "data": { "log_type": 1, "bk_host_id": 101, - "ip": "10.0.0.1", + "ip": "127.0.0.1", "bk_cloud_id": 0, "log_content": "[2018-03-15 14:39:30][PID:56875] job_start\n" } @@ -61,7 +61,7 @@ Query job execution log by host "data": { "log_type": 2, "bk_host_id": 101, - "ip": "10.0.0.1", + "ip": "127.0.0.1", "bk_cloud_id": 0, "file_logs": [ { @@ -69,13 +69,13 @@ Query job execution log by host "src_ip": { "host_id": 102, "bk_cloud_id": 0, - "ip": "10.0.0.2" + "ip": "127.0.0.2" }, "src_path": "/data/1.log", "dest_ip": { "bk_host_id": 101, "bk_cloud_id": 0, - "ip": "10.0.0.1" + "ip": "127.0.0.1" }, "dest_path": "/tmp/1.log", "status": 4, @@ -86,7 +86,7 @@ Query job execution log by host "src_ip": { "bk_host_id": 102, "bk_cloud_id": 0, - "ip": "10.0.0.2" + "ip": "127.0.0.2" }, "src_path": "/data/1.log", "status": 4, diff --git a/docs/apidoc/esb/jobv3-confapis/apidocs/en/get_job_instance_status.md b/docs/apidoc/esb/jobv3-confapis/apidocs/en/get_job_instance_status.md index c88f7f9654..ccdcd22982 100644 --- a/docs/apidoc/esb/jobv3-confapis/apidocs/en/get_job_instance_status.md +++ b/docs/apidoc/esb/jobv3-confapis/apidocs/en/get_job_instance_status.md @@ -62,7 +62,7 @@ Query job execution status based on job instance ID "step_ip_result_list": [ { "bk_host_id": 101, - "ip": "10.0.0.1", + "ip": "127.0.0.1", "bk_cloud_id": 0, "status": 9, "tag": "", diff --git a/docs/apidoc/esb/jobv3-confapis/apidocs/en/get_job_plan_detail.md b/docs/apidoc/esb/jobv3-confapis/apidocs/en/get_job_plan_detail.md index 4d06281ed8..6b5c3503b4 100644 --- a/docs/apidoc/esb/jobv3-confapis/apidocs/en/get_job_plan_detail.md +++ b/docs/apidoc/esb/jobv3-confapis/apidocs/en/get_job_plan_detail.md @@ -70,12 +70,12 @@ Check Job Plan details by Job Plan ID { "bk_host_id": 101, "bk_cloud_id": 0, - "ip": "10.0.0.1" + "ip": "127.0.0.1" }, { "bk_host_id": 102, "bk_cloud_id": 0, - "ip": "10.0.0.2" + "ip": "127.0.0.2" } ], "topo_node_list": [ @@ -162,12 +162,12 @@ Check Job Plan details by Job Plan ID { "bk_host_id": 103, "bk_cloud_id": 0, - "ip": "10.0.0.3" + "ip": "127.0.0.3" }, { "bk_host_id": 104, "bk_cloud_id": 0, - "ip": "10.0.0.4" + "ip": "127.0.0.4" } ], "topo_node_list": [ diff --git a/docs/apidoc/esb/jobv3-confapis/apidocs/en/save_cron.md b/docs/apidoc/esb/jobv3-confapis/apidocs/en/save_cron.md index 7de40b05e9..d0423758e9 100644 --- a/docs/apidoc/esb/jobv3-confapis/apidocs/en/save_cron.md +++ b/docs/apidoc/esb/jobv3-confapis/apidocs/en/save_cron.md @@ -210,7 +210,7 @@ Create or update Cron Job; Create Cron Job, Cron Job status is paused by default { "bk_host_id": 101, "bk_cloud_id": 0, - "ip": "10.0.0.1" + "ip": "127.0.0.1" } ], "dynamic_group_list": null, @@ -296,7 +296,7 @@ Create or update Cron Job; Create Cron Job, Cron Job status is paused by default { "bk_host_id": 101, "bk_cloud_id": 0, - "ip": "10.0.0.1" + "ip": "127.0.0.1" } ], "dynamic_group_list": null, diff --git a/docs/apidoc/esb/jobv3-confapis/apidocs/zh_hans/batch_get_job_instance_ip_log.md b/docs/apidoc/esb/jobv3-confapis/apidocs/zh_hans/batch_get_job_instance_ip_log.md index 906bf51387..f5a0a69d44 100644 --- a/docs/apidoc/esb/jobv3-confapis/apidocs/zh_hans/batch_get_job_instance_ip_log.md +++ b/docs/apidoc/esb/jobv3-confapis/apidocs/zh_hans/batch_get_job_instance_ip_log.md @@ -57,13 +57,13 @@ "script_task_logs": [ { "bk_host_id": 101, - "ip": "10.0.0.1", + "ip": "127.0.0.1", "bk_cloud_id": 0, "log_content": "[2018-03-15 14:39:30][PID:56875] job_start\n" }, { "bk_host_id": 102, - "ip": "10.0.0.2", + "ip": "127.0.0.2", "bk_cloud_id": 0, "log_content": "[2018-03-15 14:39:30][PID:16789] job_start\n" } @@ -85,7 +85,7 @@ "file_task_logs": [ { "bk_host_id": 101, - "ip": "10.0.0.1", + "ip": "127.0.0.1", "bk_cloud_id": 0, "file_logs": [ { @@ -93,13 +93,13 @@ "src_ip": { "bk_host_id": 102, "bk_cloud_id": 0, - "ip": "10.0.0.2" + "ip": "127.0.0.2" }, "src_path": "/data/1.log", "dest_ip": { "bk_host_id": 101, "bk_cloud_id": 0, - "ip": "10.0.0.1" + "ip": "127.0.0.1" }, "dest_path": "/tmp/1.log", "status": 4, @@ -112,7 +112,7 @@ }, { "bk_host_id": 102, - "ip": "10.0.0.2", + "ip": "127.0.0.2", "bk_cloud_id": 0, "file_logs": [ { @@ -120,7 +120,7 @@ "src_ip": { "bk_host_id": 102, "bk_cloud_id": 0, - "ip": "10.0.0.2" + "ip": "127.0.0.2" }, "src_path": "/data/1.log", "status": 4, diff --git a/docs/apidoc/esb/jobv3-confapis/apidocs/zh_hans/get_cron_detail.md b/docs/apidoc/esb/jobv3-confapis/apidocs/zh_hans/get_cron_detail.md index 8f0ec145b8..69ed0460bc 100644 --- a/docs/apidoc/esb/jobv3-confapis/apidocs/zh_hans/get_cron_detail.md +++ b/docs/apidoc/esb/jobv3-confapis/apidocs/zh_hans/get_cron_detail.md @@ -59,12 +59,12 @@ { "bk_host_id": 101, "bk_cloud_id": 0, - "ip": "10.0.0.1" + "ip": "127.0.0.1" }, { "bk_host_id": 102, "bk_cloud_id": 0, - "ip": "10.0.0.2" + "ip": "127.0.0.2" } ], "topo_node_list": [ diff --git a/docs/apidoc/esb/jobv3-confapis/apidocs/zh_hans/get_job_instance_ip_log.md b/docs/apidoc/esb/jobv3-confapis/apidocs/zh_hans/get_job_instance_ip_log.md index f24d3cb8e5..36fc7dad16 100644 --- a/docs/apidoc/esb/jobv3-confapis/apidocs/zh_hans/get_job_instance_ip_log.md +++ b/docs/apidoc/esb/jobv3-confapis/apidocs/zh_hans/get_job_instance_ip_log.md @@ -44,7 +44,7 @@ "data": { "log_type": 1, "bk_host_id": 101, - "ip": "10.0.0.1", + "ip": "127.0.0.1", "bk_cloud_id": 0, "log_content": "[2018-03-15 14:39:30][PID:56875] job_start\n" } @@ -61,7 +61,7 @@ "data": { "log_type": 2, "bk_host_id": 101, - "ip": "10.0.0.1", + "ip": "127.0.0.1", "bk_cloud_id": 0, "file_logs": [ { @@ -69,13 +69,13 @@ "src_ip": { "host_id": 102, "bk_cloud_id": 0, - "ip": "10.0.0.2" + "ip": "127.0.0.2" }, "src_path": "/data/1.log", "dest_ip": { "bk_host_id": 101, "bk_cloud_id": 0, - "ip": "10.0.0.1" + "ip": "127.0.0.1" }, "dest_path": "/tmp/1.log", "status": 4, @@ -86,7 +86,7 @@ "src_ip": { "bk_host_id": 102, "bk_cloud_id": 0, - "ip": "10.0.0.2" + "ip": "127.0.0.2" }, "src_path": "/data/1.log", "status": 4, diff --git a/docs/apidoc/esb/jobv3-confapis/apidocs/zh_hans/get_job_instance_status.md b/docs/apidoc/esb/jobv3-confapis/apidocs/zh_hans/get_job_instance_status.md index 2b80c25b7d..a22306836e 100644 --- a/docs/apidoc/esb/jobv3-confapis/apidocs/zh_hans/get_job_instance_status.md +++ b/docs/apidoc/esb/jobv3-confapis/apidocs/zh_hans/get_job_instance_status.md @@ -62,7 +62,7 @@ "step_ip_result_list": [ { "bk_host_id": 101, - "ip": "10.0.0.1", + "ip": "127.0.0.1", "bk_cloud_id": 0, "status": 9, "tag": "", diff --git a/docs/apidoc/esb/jobv3-confapis/apidocs/zh_hans/get_job_plan_detail.md b/docs/apidoc/esb/jobv3-confapis/apidocs/zh_hans/get_job_plan_detail.md index f7bbba5eb7..d6cb4c609f 100644 --- a/docs/apidoc/esb/jobv3-confapis/apidocs/zh_hans/get_job_plan_detail.md +++ b/docs/apidoc/esb/jobv3-confapis/apidocs/zh_hans/get_job_plan_detail.md @@ -70,12 +70,12 @@ { "bk_host_id": 101, "bk_cloud_id": 0, - "ip": "10.0.0.1" + "ip": "127.0.0.1" }, { "bk_host_id": 102, "bk_cloud_id": 0, - "ip": "10.0.0.2" + "ip": "127.0.0.2" } ], "topo_node_list": [ @@ -162,12 +162,12 @@ { "bk_host_id": 103, "bk_cloud_id": 0, - "ip": "10.0.0.3" + "ip": "127.0.0.3" }, { "bk_host_id": 104, "bk_cloud_id": 0, - "ip": "10.0.0.4" + "ip": "127.0.0.4" } ], "topo_node_list": [ diff --git a/docs/apidoc/esb/jobv3-confapis/apidocs/zh_hans/save_cron.md b/docs/apidoc/esb/jobv3-confapis/apidocs/zh_hans/save_cron.md index 7e573d8dde..e7e881a677 100644 --- a/docs/apidoc/esb/jobv3-confapis/apidocs/zh_hans/save_cron.md +++ b/docs/apidoc/esb/jobv3-confapis/apidocs/zh_hans/save_cron.md @@ -212,7 +212,7 @@ { "bk_host_id": 101, "bk_cloud_id": 0, - "ip": "10.0.0.1" + "ip": "127.0.0.1" } ], "dynamic_group_list": null, @@ -298,7 +298,7 @@ { "bk_host_id": 101, "bk_cloud_id": 0, - "ip": "10.0.0.1" + "ip": "127.0.0.1" } ], "dynamic_group_list": null, diff --git a/docs/apidoc/esb/jobv3-confapis/apidocs/zh_hans/update_cron_status.md b/docs/apidoc/esb/jobv3-confapis/apidocs/zh_hans/update_cron_status.md index ea124290d2..4ebb035293 100644 --- a/docs/apidoc/esb/jobv3-confapis/apidocs/zh_hans/update_cron_status.md +++ b/docs/apidoc/esb/jobv3-confapis/apidocs/zh_hans/update_cron_status.md @@ -100,7 +100,7 @@ "ip_list": [ { "bk_cloud_id": 0, - "ip": "10.0.0.1" + "ip": "127.0.0.1" } ], "dynamic_group_list": null, From 15fc2a387615e1ec61073819df930c5ed5e60e1a Mon Sep 17 00:00:00 2001 From: jsonwan Date: Mon, 17 Jun 2024 20:48:21 +0800 Subject: [PATCH 08/12] =?UTF-8?q?perf:=20=E5=8D=87=E7=BA=A7=E5=B7=A5?= =?UTF-8?q?=E5=85=B7=E6=94=AF=E6=8C=81=E8=BE=93=E5=87=BA=E5=B9=B3=E5=8F=B0?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E5=85=A8=E5=B1=80=E9=85=8D=E7=BD=AEJSON?= =?UTF-8?q?=E6=96=87=E4=BB=B6=20#2999?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将前端资源文件基础地址传递给前端 --- .../api/common/constants/globalsetting/RelatedUrlKeys.java | 2 ++ .../globalsetting/impl/GlobalSettingsServiceImpl.java | 5 +++++ support-files/kubernetes/charts/bk-job/VALUES_LOG.md | 4 ++-- support-files/kubernetes/charts/bk-job/values.yaml | 4 ++-- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/api/common/constants/globalsetting/RelatedUrlKeys.java b/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/api/common/constants/globalsetting/RelatedUrlKeys.java index d3d7767eac..79f394aabd 100644 --- a/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/api/common/constants/globalsetting/RelatedUrlKeys.java +++ b/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/api/common/constants/globalsetting/RelatedUrlKeys.java @@ -37,4 +37,6 @@ public class RelatedUrlKeys { public static final String KEY_BK_DOC_JOB_ROOT_URL = "BK_DOC_JOB_ROOT_URL"; // 问题反馈 public static final String KEY_BK_FEED_BACK_ROOT_URL = "BK_FEED_BACK_ROOT_URL"; + // 全局配置(title/footer/name/logo/产品商标)相关的前端资源文件基础地址 + public static final String KEY_BK_SHARED_RES_URL = "BK_SHARED_RES_URL"; } diff --git a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/globalsetting/impl/GlobalSettingsServiceImpl.java b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/globalsetting/impl/GlobalSettingsServiceImpl.java index ae4782d910..02b9385d02 100644 --- a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/globalsetting/impl/GlobalSettingsServiceImpl.java +++ b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/globalsetting/impl/GlobalSettingsServiceImpl.java @@ -633,6 +633,10 @@ private String getFeedBackRootUrl() { return url; } + private String getBkSharedResUrl() { + return jobManageConfig.getBkSharedResUrl(); + } + private String getNodemanRootUrl() { String url = jobManageConfig.getNodemanServerUrl(); if (StringUtils.isBlank(url)) { @@ -651,6 +655,7 @@ public Map getRelatedSystemUrls(String username) { urlMap.put(RelatedUrlKeys.KEY_BK_DOC_CENTER_ROOT_URL, getDocCenterBaseUrl()); urlMap.put(RelatedUrlKeys.KEY_BK_DOC_JOB_ROOT_URL, getDocCenterBaseUrl()); urlMap.put(RelatedUrlKeys.KEY_BK_FEED_BACK_ROOT_URL, getFeedBackRootUrl()); + urlMap.put(RelatedUrlKeys.KEY_BK_SHARED_RES_URL, getBkSharedResUrl()); return urlMap; } diff --git a/support-files/kubernetes/charts/bk-job/VALUES_LOG.md b/support-files/kubernetes/charts/bk-job/VALUES_LOG.md index 7df9f9bd5d..4a1af9e433 100644 --- a/support-files/kubernetes/charts/bk-job/VALUES_LOG.md +++ b/support-files/kubernetes/charts/bk-job/VALUES_LOG.md @@ -4,8 +4,8 @@ 1. 增加 全局配置(title/footer/name/logo/产品商标)相关的前端资源文件基础地址与base.js路径 ```yaml -# 全局配置(title/footer/name/logo/产品商标)相关的前端资源文件基础地址 -bkSharedResUrl: "http://bkrepo.example.com/generic/blueking/bk-config" +# 全局配置(title/footer/name/logo/产品商标)相关的前端资源文件基础地址,例如:http://bkrepo.example.com/generic/blueking/bk-config,留空则采用前端默认值 +bkSharedResUrl: "" # 全局配置(title/footer/name/logo/产品商标)相关的前端资源文件base.js路径 bkSharedBaseJsPath: "/bk_job/base.js" ``` diff --git a/support-files/kubernetes/charts/bk-job/values.yaml b/support-files/kubernetes/charts/bk-job/values.yaml index dec4a526e9..60bf95a9d2 100644 --- a/support-files/kubernetes/charts/bk-job/values.yaml +++ b/support-files/kubernetes/charts/bk-job/values.yaml @@ -433,8 +433,8 @@ bkCmdbApiGatewayUrl: "http://bkapi.example.com/api/cmdb" bkDocsCenterUrl: "https://bk.tencent.com/docs" # 问题反馈 url bkFeedBackUrl: "https://bk.tencent.com/s-mart/community" -# 全局配置(title/footer/name/logo/产品商标)相关的前端资源文件基础地址 -bkSharedResUrl: "http://bkrepo.example.com/generic/blueking/bk-config" +# 全局配置(title/footer/name/logo/产品商标)相关的前端资源文件基础地址,例如:http://bkrepo.example.com/generic/blueking/bk-config,留空则采用前端默认值 +bkSharedResUrl: "" # 全局配置(title/footer/name/logo/产品商标)相关的前端资源文件base.js路径 bkSharedBaseJsPath: "/bk_job/base.js" From 499a5b60d4cd77142b91690c87567bb01b7e1cdf Mon Sep 17 00:00:00 2001 From: jsonwan Date: Tue, 18 Jun 2024 10:29:29 +0800 Subject: [PATCH 09/12] =?UTF-8?q?perf:=20=E5=8D=87=E7=BA=A7=E5=B7=A5?= =?UTF-8?q?=E5=85=B7=E6=94=AF=E6=8C=81=E8=BE=93=E5=87=BA=E5=B9=B3=E5=8F=B0?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E5=85=A8=E5=B1=80=E9=85=8D=E7=BD=AEJSON?= =?UTF-8?q?=E6=96=87=E4=BB=B6=20#2999?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 清理老的修改接口实现,标记兼容接口 --- .../web/WebGlobalSettingsQueryResource.java | 4 + .../api/web/WebGlobalSettingsResource.java | 17 +--- .../impl/WebGlobalSettingsResourceImpl.java | 9 -- .../globalsetting/GlobalSettingsService.java | 8 -- .../impl/GlobalSettingsServiceImpl.java | 83 ------------------- 5 files changed, 8 insertions(+), 113 deletions(-) diff --git a/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/api/web/WebGlobalSettingsQueryResource.java b/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/api/web/WebGlobalSettingsQueryResource.java index 32fa2ba531..6a4ce42869 100644 --- a/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/api/web/WebGlobalSettingsQueryResource.java +++ b/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/api/web/WebGlobalSettingsQueryResource.java @@ -24,7 +24,9 @@ package com.tencent.bk.job.manage.api.web; +import com.tencent.bk.job.common.annotation.CompatibleImplementation; import com.tencent.bk.job.common.annotation.WebAPI; +import com.tencent.bk.job.common.constant.CompatibleType; import com.tencent.bk.job.common.model.Response; import com.tencent.bk.job.manage.model.web.vo.globalsetting.AccountNameRulesWithDefaultVO; import com.tencent.bk.job.manage.model.web.vo.globalsetting.NotifyChannelWithIconVO; @@ -113,6 +115,8 @@ Response getCMDBAppIndexUrl( ); + @CompatibleImplementation(name = "platform_info", deprecatedVersion = "3.10.x", type = CompatibleType.DEPLOY, + explain = "发布完成后可以删除") @ApiOperation(value = "获取渲染后的平台设置", produces = "application/json") @GetMapping("/platformInfo") Response getRenderedPlatformInfo(); diff --git a/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/api/web/WebGlobalSettingsResource.java b/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/api/web/WebGlobalSettingsResource.java index df601f65ed..93fb1832fe 100644 --- a/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/api/web/WebGlobalSettingsResource.java +++ b/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/api/web/WebGlobalSettingsResource.java @@ -24,7 +24,9 @@ package com.tencent.bk.job.manage.api.web; +import com.tencent.bk.job.common.annotation.CompatibleImplementation; import com.tencent.bk.job.common.annotation.WebAPI; +import com.tencent.bk.job.common.constant.CompatibleType; import com.tencent.bk.job.common.model.Response; import com.tencent.bk.job.manage.model.web.request.globalsetting.AccountNameRulesReq; import com.tencent.bk.job.manage.model.web.request.globalsetting.FileUploadSettingReq; @@ -36,7 +38,6 @@ import com.tencent.bk.job.manage.model.web.vo.globalsetting.AccountNameRulesWithDefaultVO; import com.tencent.bk.job.manage.model.web.vo.globalsetting.FileUploadSettingVO; import com.tencent.bk.job.manage.model.web.vo.globalsetting.NotifyChannelWithIconVO; -import com.tencent.bk.job.manage.model.web.vo.globalsetting.PlatformInfoVO; import com.tencent.bk.job.manage.model.web.vo.globalsetting.PlatformInfoWithDefaultVO; import com.tencent.bk.job.manage.model.web.vo.notify.ChannelTemplateDetailWithDefaultVO; import com.tencent.bk.job.manage.model.web.vo.notify.ChannelTemplateStatusVO; @@ -48,7 +49,6 @@ import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestMapping; @@ -233,17 +233,8 @@ Response getFileUploadSettings( String username ); - @ApiOperation(value = "设置平台信息", produces = "application/json") - @PutMapping("/platformInfo") - Response savePlatformInfo( - @ApiParam(value = "用户名,网关自动传入", required = true) - @RequestHeader("username") - String username, - @ApiParam(value = "设置平台信息请求体", required = true) - @RequestBody - PlatformInfoVO platformInfoVO - ); - + @CompatibleImplementation(name = "platform_info", deprecatedVersion = "3.10.x", type = CompatibleType.DEPLOY, + explain = "发布完成后可以删除") @ApiOperation(value = "获取平台信息-包含默认配置", produces = "application/json") @GetMapping("/platformInfoWithDefault") Response getPlatformInfoWithDefault( diff --git a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/web/impl/WebGlobalSettingsResourceImpl.java b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/web/impl/WebGlobalSettingsResourceImpl.java index dcf57ec1ca..e8cc2349bd 100644 --- a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/web/impl/WebGlobalSettingsResourceImpl.java +++ b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/web/impl/WebGlobalSettingsResourceImpl.java @@ -41,7 +41,6 @@ import com.tencent.bk.job.manage.model.web.vo.globalsetting.AccountNameRulesWithDefaultVO; import com.tencent.bk.job.manage.model.web.vo.globalsetting.FileUploadSettingVO; import com.tencent.bk.job.manage.model.web.vo.globalsetting.NotifyChannelWithIconVO; -import com.tencent.bk.job.manage.model.web.vo.globalsetting.PlatformInfoVO; import com.tencent.bk.job.manage.model.web.vo.globalsetting.PlatformInfoWithDefaultVO; import com.tencent.bk.job.manage.model.web.vo.notify.ChannelTemplateDetailWithDefaultVO; import com.tencent.bk.job.manage.model.web.vo.notify.ChannelTemplateStatusVO; @@ -197,14 +196,6 @@ public Response getFileUploadSettings(String username) { return Response.buildSuccessResp(globalSettingsService.getFileUploadSettings()); } - @Override - @AuditEntry(actionId = ActionId.GLOBAL_SETTINGS) - public Response savePlatformInfo(String username, - @AuditRequestBody PlatformInfoVO platformInfoVO) { - PlatformInfoVO updatedPlatformInfo = globalSettingsService.savePlatformInfo(username, platformInfoVO); - return Response.buildSuccessResp(updatedPlatformInfo); - } - @Override @AuditEntry(actionId = ActionId.GLOBAL_SETTINGS) @ActionAuditRecord( diff --git a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/globalsetting/GlobalSettingsService.java b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/globalsetting/GlobalSettingsService.java index 32cf30cd44..10f4fdb71a 100644 --- a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/globalsetting/GlobalSettingsService.java +++ b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/globalsetting/GlobalSettingsService.java @@ -75,14 +75,6 @@ public interface GlobalSettingsService { FileUploadSettingVO getFileUploadSettings(); - /** - * 全局设置-平台信息-保存 - * - * @param username 用户名 - * @param platformInfoVO 平台信息 - */ - PlatformInfoVO savePlatformInfo(String username, PlatformInfoVO platformInfoVO); - /** * 获取渲染之后的平台信息 * diff --git a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/globalsetting/impl/GlobalSettingsServiceImpl.java b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/globalsetting/impl/GlobalSettingsServiceImpl.java index 02b9385d02..71d0c34fa6 100644 --- a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/globalsetting/impl/GlobalSettingsServiceImpl.java +++ b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/globalsetting/impl/GlobalSettingsServiceImpl.java @@ -33,11 +33,9 @@ import com.tencent.bk.job.common.i18n.locale.LocaleUtils; import com.tencent.bk.job.common.i18n.service.MessageI18nService; import com.tencent.bk.job.common.iam.constant.ActionId; -import com.tencent.bk.job.common.mysql.JobTransactional; import com.tencent.bk.job.common.notice.config.BkNoticeProperties; import com.tencent.bk.job.common.util.JobContextUtil; import com.tencent.bk.job.common.util.StringUtil; -import com.tencent.bk.job.common.util.TimeUtil; import com.tencent.bk.job.common.util.date.DateUtils; import com.tencent.bk.job.common.util.feature.FeatureExecutionContext; import com.tencent.bk.job.common.util.feature.FeatureIdConstants; @@ -702,87 +700,6 @@ public Map getJobConfig(String username) { return configMap; } - @Override - @JobTransactional(transactionManager = "jobManageTransactionManager") - @ActionAuditRecord( - actionId = ActionId.GLOBAL_SETTINGS, - content = EventContentConstants.EDIT_GLOBAL_SETTINGS - ) - public PlatformInfoVO savePlatformInfo(String username, PlatformInfoVO platformInfoVO) { - // 设置页面 footer/title 信息 - saveTitleFooter(username, platformInfoVO); - // 设置助手信息 - saveHelperInfo(platformInfoVO); - return getPlatformInfoVO(); - } - - private void saveTitleFooter(String username, PlatformInfoVO platformInfoVO) { - //参数校验 - String lang = JobContextUtil.getUserLang(); - if (platformInfoVO.getTitleHead() == null) { - platformInfoVO.setTitleHead(""); - } - if (platformInfoVO.getTitleSeparator() == null) { - platformInfoVO.setTitleSeparator(""); - } - if (platformInfoVO.getFooterLink() == null) { - platformInfoVO.setFooterLink(""); - } - if (platformInfoVO.getFooterCopyRight() == null) { - platformInfoVO.setFooterCopyRight(""); - } - GlobalSettingDTO titleFooterDTO = globalSettingDAO.getGlobalSetting( - GlobalSettingKeys.KEY_TITLE_FOOTER); - if (titleFooterDTO == null) { - Map titleFooterLanguageMap = new HashMap<>(); - titleFooterLanguageMap.put( - LocaleUtils.getNormalLang(lang), new TitleFooter( - platformInfoVO.getTitleHead(), - platformInfoVO.getTitleSeparator(), - platformInfoVO.getFooterLink(), - platformInfoVO.getFooterCopyRight() - )); - titleFooterDTO = new GlobalSettingDTO( - GlobalSettingKeys.KEY_TITLE_FOOTER, JsonUtils.toJson( - new TitleFooterDTO( - titleFooterLanguageMap, - username, - TimeUtil.getCurrentTimeStr())), - String.format("Updated by %s at %s", username, DateUtils.defaultLocalDateTime(LocalDateTime.now()))); - globalSettingDAO.insertGlobalSetting(titleFooterDTO); - } else { - Map titleFooterLanguageMap = JsonUtils.fromJson(titleFooterDTO.getValue(), - new TypeReference() { - }).getTitleFooterLanguageMap(); - titleFooterLanguageMap.put( - LocaleUtils.getNormalLang(lang), new TitleFooter( - platformInfoVO.getTitleHead(), - platformInfoVO.getTitleSeparator(), - platformInfoVO.getFooterLink(), - platformInfoVO.getFooterCopyRight() - )); - titleFooterDTO.setValue(JsonUtils.toJson(new TitleFooterDTO(titleFooterLanguageMap, - username, TimeUtil.getCurrentTimeStr()))); - globalSettingDAO.updateGlobalSetting(titleFooterDTO); - } - } - - private void saveHelperInfo(PlatformInfoVO platformInfoVO) { - HelperInfo helperInfo = new HelperInfo(); - helperInfo.setContactLink(platformInfoVO.getHelperContactLink()); - - GlobalSettingDTO globalSetting = globalSettingDAO.getGlobalSetting( - GlobalSettingKeys.KEY_BK_HELPER); - if (globalSetting == null) { - globalSetting = new GlobalSettingDTO(GlobalSettingKeys.KEY_BK_HELPER, - JsonUtils.toJson(helperInfo), "helper info"); - globalSettingDAO.insertGlobalSetting(globalSetting); - } else { - globalSetting.setValue(JsonUtils.toJson(helperInfo)); - globalSettingDAO.updateGlobalSetting(globalSetting); - } - } - @Override public PlatformInfoVO getRenderedPlatformInfo() { TitleFooterVO titleFooterVO = getRenderedTitleFooter(); From ce503b8610e0def620eaef5a2c787914ba742f3c Mon Sep 17 00:00:00 2001 From: jsonwan Date: Wed, 19 Jun 2024 17:41:56 +0800 Subject: [PATCH 10/12] =?UTF-8?q?perf:=20=E5=8D=87=E7=BA=A7=E5=B7=A5?= =?UTF-8?q?=E5=85=B7=E6=94=AF=E6=8C=81=E8=BE=93=E5=87=BA=E5=B9=B3=E5=8F=B0?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E5=85=A8=E5=B1=80=E9=85=8D=E7=BD=AEJSON?= =?UTF-8?q?=E6=96=87=E4=BB=B6=20#2999?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将前端资源文件base.js完整地址传递给前端 --- .../constants/globalsetting/RelatedUrlKeys.java | 4 ++-- .../globalsetting/impl/GlobalSettingsServiceImpl.java | 11 ++++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/api/common/constants/globalsetting/RelatedUrlKeys.java b/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/api/common/constants/globalsetting/RelatedUrlKeys.java index 79f394aabd..1a66c52647 100644 --- a/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/api/common/constants/globalsetting/RelatedUrlKeys.java +++ b/src/backend/job-manage/api-job-manage/src/main/java/com/tencent/bk/job/manage/api/common/constants/globalsetting/RelatedUrlKeys.java @@ -37,6 +37,6 @@ public class RelatedUrlKeys { public static final String KEY_BK_DOC_JOB_ROOT_URL = "BK_DOC_JOB_ROOT_URL"; // 问题反馈 public static final String KEY_BK_FEED_BACK_ROOT_URL = "BK_FEED_BACK_ROOT_URL"; - // 全局配置(title/footer/name/logo/产品商标)相关的前端资源文件基础地址 - public static final String KEY_BK_SHARED_RES_URL = "BK_SHARED_RES_URL"; + // 全局配置(title/footer/name/logo/产品商标)相关的前端资源文件base.js基础地址 + public static final String KEY_BK_SHARED_RES_BASE_JS_URL = "BK_SHARED_RES_BASE_JS_URL"; } diff --git a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/globalsetting/impl/GlobalSettingsServiceImpl.java b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/globalsetting/impl/GlobalSettingsServiceImpl.java index 71d0c34fa6..2d62d19ff0 100644 --- a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/globalsetting/impl/GlobalSettingsServiceImpl.java +++ b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/globalsetting/impl/GlobalSettingsServiceImpl.java @@ -631,8 +631,13 @@ private String getFeedBackRootUrl() { return url; } - private String getBkSharedResUrl() { - return jobManageConfig.getBkSharedResUrl(); + private String getBkSharedResBaseJsUrl() { + String bkSharedResUrl = jobManageConfig.getBkSharedResUrl(); + if (StringUtils.isNotBlank(bkSharedResUrl)) { + // bkSharedResUrl配置了有效值才生效 + return jobManageConfig.getBkSharedResUrl() + jobManageConfig.getBkSharedBaseJsPath(); + } + return null; } private String getNodemanRootUrl() { @@ -653,7 +658,7 @@ public Map getRelatedSystemUrls(String username) { urlMap.put(RelatedUrlKeys.KEY_BK_DOC_CENTER_ROOT_URL, getDocCenterBaseUrl()); urlMap.put(RelatedUrlKeys.KEY_BK_DOC_JOB_ROOT_URL, getDocCenterBaseUrl()); urlMap.put(RelatedUrlKeys.KEY_BK_FEED_BACK_ROOT_URL, getFeedBackRootUrl()); - urlMap.put(RelatedUrlKeys.KEY_BK_SHARED_RES_URL, getBkSharedResUrl()); + urlMap.put(RelatedUrlKeys.KEY_BK_SHARED_RES_BASE_JS_URL, getBkSharedResBaseJsUrl()); return urlMap; } From 922a8af55b717cd2985ce4ff823ecbe2fed9f30c Mon Sep 17 00:00:00 2001 From: jsonwan Date: Wed, 19 Jun 2024 18:20:49 +0800 Subject: [PATCH 11/12] =?UTF-8?q?perf:=20=E5=8D=87=E7=BA=A7=E5=B7=A5?= =?UTF-8?q?=E5=85=B7=E6=94=AF=E6=8C=81=E8=BE=93=E5=87=BA=E5=B9=B3=E5=8F=B0?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E5=85=A8=E5=B1=80=E9=85=8D=E7=BD=AEJSON?= =?UTF-8?q?=E6=96=87=E4=BB=B6=20#2999?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加升级文档说明 --- UPGRADE.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/UPGRADE.md b/UPGRADE.md index e2ca897709..7c003c4c44 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -77,3 +77,9 @@ echo $BK_CMDB_MONGODB_补全。 ### 3.6.x -> 3.7.x 需要在更新Job后执行一次升级工具,用于为存量的作业模板/执行方案/定时任务/IP白名单中的主机数据添加hostId,以及迁移对所有业务生效的IP白名单数据。 + +### 3.7.x -> 3.8.x +无需执行升级工具。 + +### 3.8.x -> 3.9.x +需要在更新Job后执行一次升级工具,用于导出已配置的平台信息数据(title/footer/name/logo/产品商标等),从3.9.3版本开始,作业平台改为使用基于BK-REPO的全局配置统一方案,升级任务运行后会输出平台信息全局配置base.js文件,以便于迁移之前用户已通过页面【平台管理-全局设置-平台信息】配置的数据:将该任务生成的base.js文件导入BK-REPO中(若已存在则覆盖),路径取值与chart values的bkSharedResUrl、bkSharedBaseJsPath配置项保持一致,默认为:${当前环境部署的BK-REPO根地址}/generic/blueking/bk-config/bk_job/base.js。 From c43a99961d985e077aabf18c13d2d74594814a71 Mon Sep 17 00:00:00 2001 From: jsonwan Date: Thu, 20 Jun 2024 09:23:53 +0800 Subject: [PATCH 12/12] =?UTF-8?q?perf:=20=E5=8D=87=E7=BA=A7=E5=B7=A5?= =?UTF-8?q?=E5=85=B7=E6=94=AF=E6=8C=81=E8=BE=93=E5=87=BA=E5=B9=B3=E5=8F=B0?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E5=85=A8=E5=B1=80=E9=85=8D=E7=BD=AEJSON?= =?UTF-8?q?=E6=96=87=E4=BB=B6=20#2999?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加升级文档说明 --- UPGRADE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UPGRADE.md b/UPGRADE.md index 7c003c4c44..6ce290d89c 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -82,4 +82,4 @@ echo $BK_CMDB_MONGODB_补全。 无需执行升级工具。 ### 3.8.x -> 3.9.x -需要在更新Job后执行一次升级工具,用于导出已配置的平台信息数据(title/footer/name/logo/产品商标等),从3.9.3版本开始,作业平台改为使用基于BK-REPO的全局配置统一方案,升级任务运行后会输出平台信息全局配置base.js文件,以便于迁移之前用户已通过页面【平台管理-全局设置-平台信息】配置的数据:将该任务生成的base.js文件导入BK-REPO中(若已存在则覆盖),路径取值与chart values的bkSharedResUrl、bkSharedBaseJsPath配置项保持一致,默认为:${当前环境部署的BK-REPO根地址}/generic/blueking/bk-config/bk_job/base.js。 +需要在更新Job后执行一次升级工具,用于导出已配置的平台信息数据(title/footer/助手链接等),从3.9.3版本开始,作业平台改为使用基于BK-REPO的全局配置统一方案,升级任务运行后会输出平台信息全局配置base.js文件,以便于迁移之前用户已通过页面【平台管理-全局设置-平台信息】配置的数据:将该任务生成的base.js文件导入BK-REPO中(若已存在则覆盖),路径取值与chart values的bkSharedResUrl、bkSharedBaseJsPath配置项保持一致,默认为:${当前环境部署的BK-REPO根地址}/generic/blueking/bk-config/bk_job/base.js。