From 23498463c7eb5865fb51ecde61c2622597afde42 Mon Sep 17 00:00:00 2001 From: waylon <1158341873@qq.com> Date: Fri, 28 Jul 2023 11:46:03 +0800 Subject: [PATCH 01/23] =?UTF-8?q?minor:=203.29.0=20=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- version_logs_md/V3.29.0_2023-07-04.md | 6 ++-- version_logs_md_en/V3.29.0_2023-07-04.md | 35 ++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 version_logs_md_en/V3.29.0_2023-07-04.md diff --git a/version_logs_md/V3.29.0_2023-07-04.md b/version_logs_md/V3.29.0_2023-07-04.md index 82a4d176c7..2f75a2c3d5 100644 --- a/version_logs_md/V3.29.0_2023-07-04.md +++ b/version_logs_md/V3.29.0_2023-07-04.md @@ -8,7 +8,7 @@ - [ 优化 ] 移除「节点管理(Nodeman)-插件操作」里的主机 ID 选项 -- [ 优化 ] 新建职能化任务添加复制认领链接 +- [ 优化 ] 创建职能化任务时增加通知认领的引导交互 ### 修复 @@ -26,10 +26,10 @@ - [ 修复 ] 修复使用「蓝鲸监控告警屏蔽(按范围」 插件屏蔽业务时,还需再选业务的问题 -- [ 修复 ] 修复<作业平台(JOB)-执行作业>插件,拉取执行方案时,变量值多了双引号问题 +- [ 修复 ] 修复「作业平台(JOB)-执行作业」插件,拉取执行方案时,变量值多了双引号问题 - [ 修复 ] 修复任务列表还在加载时,切换 TAB 返回空数据的问题 - [ 修复 ] 修复重新执行时,下拉框选项无法重用和粘贴文本自动选中的问题 -- [ 修复 ] 修复第三方插件日志获取异常的问题(Note: 依赖 PaaS 版本 v1.1.0-beta.38+) +- [ 修复 ] 修复第三方插件日志获取异常问题(依赖 Paas v1.1.0-beta.38 版本) diff --git a/version_logs_md_en/V3.29.0_2023-07-04.md b/version_logs_md_en/V3.29.0_2023-07-04.md new file mode 100644 index 0000000000..95f33c2431 --- /dev/null +++ b/version_logs_md_en/V3.29.0_2023-07-04.md @@ -0,0 +1,35 @@ +# V3.29.0 Release Note + +### Improved + +- [Improved] Optimized the layout of the task parameter filling page + +- [Improved] Optimized the interaction of the node-group + +- [Improved] Removed the host ID field in "NodeMan-Plugin Operation" plugin + +- [Improved] Added guide interaction for taking task when assigning task to helper-team + +### Fixed + +- [Fixed] Fixed the problem of abnormal node size and operation panel position when zooming the canvas + +- [Fixed] Fixed the authentication issue of cloned flow without new creation permission when viewing flow + +- [Fixed] Fixed the problem of missing global variables during YAML import + +- [Fixed] Fixed the problem of some nodes being covered after clicking "View Subflow that need to be updated" + +- [Fixed] Fixed the problem of remote data source for select variables not supporting URL parameters + +- [Fixed] Fixed the problem of can't terminate task when subflow is paused + +- [Fixed] Fixed the problem of duplicate selection business when using "BKMonitor-Alarm Shield of BlueKing Monitor (Based on Range)" plugin to shield business + +- [Fixed] Fixed the problem of extra double quotes in variable values when using "JOB-Execution JOB" plugin + +- [Fixed] Fixed the problem of returning empty data when switching TAB while task list is still loading + +- [Fixed] Fixed the problem of unable to reuse drop-down box options and automatically selecting pasted text when using redo task + +- [Fixed] Fixed the issue of abnormal third-party plugin log retrieval (dependent on Paas v1.1.0-beta.38 version) From 7477ed1f9a195b2b368c91ab8c19c00d72cf7a8a Mon Sep 17 00:00:00 2001 From: waylon <1158341873@qq.com> Date: Fri, 28 Jul 2023 16:14:42 +0800 Subject: [PATCH 02/23] =?UTF-8?q?bugfix:=20=E4=BF=AE=E5=A4=8D=E5=BF=AB?= =?UTF-8?q?=E9=80=9F=E6=89=A7=E8=A1=8C=E8=84=9A=E6=9C=AC=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=E5=9B=BD=E9=99=85=E5=8C=96=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../static/components/atoms/job/job_fast_execute_script.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pipeline_plugins/components/static/components/atoms/job/job_fast_execute_script.js b/pipeline_plugins/components/static/components/atoms/job/job_fast_execute_script.js index d50d848db7..1075735b3d 100644 --- a/pipeline_plugins/components/static/components/atoms/job/job_fast_execute_script.js +++ b/pipeline_plugins/components/static/components/atoms/job/job_fast_execute_script.js @@ -99,7 +99,7 @@ REM 可在脚本执行失败的逻辑分支处调用,打印当时的时间戳 exit 1 `) } else if (language === "3") { - return gettext(#!/usr/bin/perl + return gettext(`#!/usr/bin/perl use strict; @@ -131,7 +131,7 @@ job_start; ###### 如果返回值为0,则认为此脚本执行成功,如果非0,则认为脚本执行失败 ###### 可在此处开始编写您的脚本逻辑代码 -) +`) } else if (language === "4") { return gettext(`#!/usr/bin/env python # -*- coding: utf8 -*- From 4602fe9b709714b0071bd649570eab76fe87044b Mon Sep 17 00:00:00 2001 From: waylon <1158341873@qq.com> Date: Tue, 1 Aug 2023 15:08:51 +0800 Subject: [PATCH 03/23] =?UTF-8?q?bugfix:=20=E4=BF=AE=E5=A4=8D=E5=A4=9A?= =?UTF-8?q?=E7=8E=AF=E5=A2=83=E7=94=A8=E6=88=B7=E7=99=BB=E5=BD=95=20500=20?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gcloud/core/views.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/gcloud/core/views.py b/gcloud/core/views.py index 27b79e2df8..a25cc3ac41 100644 --- a/gcloud/core/views.py +++ b/gcloud/core/views.py @@ -36,19 +36,21 @@ def page_not_found(request, exception): user = LoginRequiredMiddleware().authenticate(request) + if user: + request.user = user + rotate_token(request) + # not home url enter + user_enter.send(username=user.username, sender=user.username) + return render(request, "core/base_vue.html", {}) + # 未登录重定向到首页,跳到登录页面 - if not user: + if hasattr(LoginRequiredMiddleware(), "is_user_forbidden"): user_forbidden, msg = LoginRequiredMiddleware().is_user_forbidden(request) if user_forbidden: handler = ResponseHandler(ConfFixture, settings) return handler.build_403_response(msg) - refer_url = quote(request.build_absolute_uri()) - return HttpResponseRedirect(settings.SITE_URL + "?{}={}".format(settings.PAGE_NOT_FOUND_URL_KEY, refer_url)) - request.user = user - rotate_token(request) - # not home url enter - user_enter.send(username=user.username, sender=user.username) - return render(request, "core/base_vue.html", {}) + refer_url = quote(request.build_absolute_uri()) + return HttpResponseRedirect(settings.SITE_URL + "?{}={}".format(settings.PAGE_NOT_FOUND_URL_KEY, refer_url)) def home(request): From fb26f86e36dd418862065ae1be7ba8b5eb1466e2 Mon Sep 17 00:00:00 2001 From: waylon <1158341873@qq.com> Date: Tue, 1 Aug 2023 15:10:33 +0800 Subject: [PATCH 04/23] minor: release V3.29.1 --- app.yml | 2 +- app_desc.yaml | 2 +- config/default.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app.yml b/app.yml index 526153d32c..1ccc0944d6 100644 --- a/app.yml +++ b/app.yml @@ -6,7 +6,7 @@ is_use_celery: True author: 蓝鲸智云 introduction: 标准运维是通过一套成熟稳定的任务调度引擎,把在多系统间的工作整合到一个流程,助力运维实现跨系统调度自动化的SaaS应用。 introduction_en: SOPS is a SaaS application that utilizes a set of mature and stable task scheduling engines to help realize cross-system scheduling automation, and integrates the work among multiple systems into a single process. -version: 3.29.0 +version: 3.29.1 category: 运维工具 language_support: 中文 desktop: diff --git a/app_desc.yaml b/app_desc.yaml index 3cfd0e1a66..eb47f2d7ec 100644 --- a/app_desc.yaml +++ b/app_desc.yaml @@ -1,5 +1,5 @@ spec_version: 2 -app_version: "3.29.0" +app_version: "3.29.1" app: region: default bk_app_code: bk_sops diff --git a/config/default.py b/config/default.py index ff9eef01e0..812f315609 100644 --- a/config/default.py +++ b/config/default.py @@ -207,7 +207,7 @@ # mako模板中: # 如果静态资源修改了以后,上线前改这个版本号即可 -STATIC_VERSION = "3.29.0" +STATIC_VERSION = "3.29.1" DEPLOY_DATETIME = datetime.datetime.now().strftime("%Y%m%d%H%M%S") STATICFILES_DIRS = [os.path.join(BASE_DIR, "static")] From 4a19f669cb9fec64c4a3c12a15021f00ab8549ae Mon Sep 17 00:00:00 2001 From: v_xugzhou <941071842@qq.com> Date: Wed, 9 Aug 2023 09:47:06 +0800 Subject: [PATCH 05/23] =?UTF-8?q?optimization:=20=E8=BD=BB=E5=BA=94?= =?UTF-8?q?=E7=94=A8=E6=89=BE=E4=B8=8D=E5=88=B0=E6=89=A7=E8=A1=8C=E6=96=B9?= =?UTF-8?q?=E6=A1=88=E5=85=A5=E5=8F=A3=E9=97=AE=E9=A2=98=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/desktop/src/config/i18n/en.js | 4 ++-- .../desktop/src/pages/task/TaskCreate/TaskScheme.vue | 11 +++++++---- .../src/pages/task/TaskCreate/TaskSelectNode.vue | 4 +--- .../pages/template/TemplateEdit/TemplateHeader.vue | 2 +- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/frontend/desktop/src/config/i18n/en.js b/frontend/desktop/src/config/i18n/en.js index bade580faf..87da068c89 100644 --- a/frontend/desktop/src/config/i18n/en.js +++ b/frontend/desktop/src/config/i18n/en.js @@ -1775,8 +1775,8 @@ const en = { '导入选择节点': 'Import the Selection Node', '管理执行方案': 'Manage Node-Group', '使用临时方案': 'Use Temporary Node-Group', - '前往新增方案': 'Go to add plan', - '暂无方案': 'No plan', + '前往新增方案': 'Go To Add Node-Group', + '暂无方案': 'No Node-Group', '方案修改成功': 'Node Group Modified', '默认方案': 'Default', '添加默认方案成功': 'Default Node-Group Added', diff --git a/frontend/desktop/src/pages/task/TaskCreate/TaskScheme.vue b/frontend/desktop/src/pages/task/TaskCreate/TaskScheme.vue index 750d769045..8d181da7d3 100644 --- a/frontend/desktop/src/pages/task/TaskCreate/TaskScheme.vue +++ b/frontend/desktop/src/pages/task/TaskCreate/TaskScheme.vue @@ -9,7 +9,7 @@ {{$t('执行方案')}} -
+
@@ -190,9 +191,6 @@ } }, created () { - if (this.viewMode === 'appmaker') { - this.isPreviewMode = true - } this.getTemplateData() }, methods: { diff --git a/frontend/desktop/src/pages/template/TemplateEdit/TemplateHeader.vue b/frontend/desktop/src/pages/template/TemplateEdit/TemplateHeader.vue index dd794f1728..d0da6af244 100644 --- a/frontend/desktop/src/pages/template/TemplateEdit/TemplateHeader.vue +++ b/frontend/desktop/src/pages/template/TemplateEdit/TemplateHeader.vue @@ -83,7 +83,7 @@
- {{ '关闭预览' }} + {{ $t('关闭预览') }}
Date: Wed, 9 Aug 2023 11:36:52 +0800 Subject: [PATCH 06/23] =?UTF-8?q?bugfix:=20=E4=BF=AE=E5=A4=8D=20ip=20?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E5=99=A8=20topo=20=E8=BF=87=E6=BB=A4?= =?UTF-8?q?=E6=89=80=E6=9C=89=E8=8A=82=E7=82=B9=E9=83=BD=E5=A4=B1=E6=95=88?= =?UTF-8?q?=E6=97=B6=E9=80=89=E4=B8=AD=E6=89=80=E6=9C=89=20ip=20=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pipeline_plugins/cmdb_ip_picker/utils.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pipeline_plugins/cmdb_ip_picker/utils.py b/pipeline_plugins/cmdb_ip_picker/utils.py index bdac41364e..8d6b4e9f93 100644 --- a/pipeline_plugins/cmdb_ip_picker/utils.py +++ b/pipeline_plugins/cmdb_ip_picker/utils.py @@ -250,6 +250,7 @@ def _inject_topo_params(self, topo_list): self.property_filters["module_property_filter"]["rules"].append( {"field": "bk_module_id", "operator": "in", "value": list(module_ids)} ) + return module_ids def dispatch(self, params): handle_func = getattr(self, f"{self.selector}_picker_handler") @@ -271,7 +272,10 @@ def topo_picker_handler(self, inputted_topo): topo选择情况 :params inputted_topo: 拓扑结构信息列表, list """ - self._inject_topo_params(inputted_topo) + module_ids = self._inject_topo_params(inputted_topo) + if not module_ids: + logger.warning(f"[topo_picker_handler] no module_ids, inputted_topo: {inputted_topo}") + return {"result": True, "data": [], "message": ""} host_info_result = self.fetch_host_ip_with_property_filter() if not host_info_result["result"]: return host_info_result From 0fe7f7f2f5cb7e3c9fdf9e3d032edc40e5921610 Mon Sep 17 00:00:00 2001 From: hanshuaikang <1758504262@qq.com> Date: Tue, 8 Aug 2023 19:36:18 +0800 Subject: [PATCH 07/23] =?UTF-8?q?bugfix:=20=E4=BF=AE=E5=A4=8Djob=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=E6=97=B6=E6=8F=90=E5=8F=96=E5=8F=98=E9=87=8F=E5=8F=96?= =?UTF-8?q?=E4=B8=8D=E5=88=B0step=5Fip=5Fresult=5Flist=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pipeline_plugins/components/collections/sites/open/job/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pipeline_plugins/components/collections/sites/open/job/base.py b/pipeline_plugins/components/collections/sites/open/job/base.py index 7b33e3f2a6..0861b6a00a 100644 --- a/pipeline_plugins/components/collections/sites/open/job/base.py +++ b/pipeline_plugins/components/collections/sites/open/job/base.py @@ -350,7 +350,7 @@ def get_job_tagged_ip_dict_complex( step_instance = result["data"]["step_instance_list"][-1] - step_ip_result_list = step_instance["step_ip_result_list"] + step_ip_result_list = step_instance.get("step_ip_result_list", []) success_tags_dict = {} success_ips = [] From efed02fbcacc47f111b024a2353c5c052dd00496 Mon Sep 17 00:00:00 2001 From: waylon <1158341873@qq.com> Date: Wed, 9 Aug 2023 11:59:45 +0800 Subject: [PATCH 08/23] minor: release V3.29.2 --- app.yml | 2 +- app_desc.yaml | 2 +- config/default.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app.yml b/app.yml index 1ccc0944d6..eb54b38775 100644 --- a/app.yml +++ b/app.yml @@ -6,7 +6,7 @@ is_use_celery: True author: 蓝鲸智云 introduction: 标准运维是通过一套成熟稳定的任务调度引擎,把在多系统间的工作整合到一个流程,助力运维实现跨系统调度自动化的SaaS应用。 introduction_en: SOPS is a SaaS application that utilizes a set of mature and stable task scheduling engines to help realize cross-system scheduling automation, and integrates the work among multiple systems into a single process. -version: 3.29.1 +version: 3.29.2 category: 运维工具 language_support: 中文 desktop: diff --git a/app_desc.yaml b/app_desc.yaml index eb47f2d7ec..24cc0c11cd 100644 --- a/app_desc.yaml +++ b/app_desc.yaml @@ -1,5 +1,5 @@ spec_version: 2 -app_version: "3.29.1" +app_version: "3.29.2" app: region: default bk_app_code: bk_sops diff --git a/config/default.py b/config/default.py index 812f315609..6c0efb473e 100644 --- a/config/default.py +++ b/config/default.py @@ -207,7 +207,7 @@ # mako模板中: # 如果静态资源修改了以后,上线前改这个版本号即可 -STATIC_VERSION = "3.29.1" +STATIC_VERSION = "3.29.2" DEPLOY_DATETIME = datetime.datetime.now().strftime("%Y%m%d%H%M%S") STATICFILES_DIRS = [os.path.join(BASE_DIR, "static")] From c1b065dc96119afb492f7cfa5a7b87fb91935070 Mon Sep 17 00:00:00 2001 From: v_xugzhou <941071842@qq.com> Date: Wed, 9 Aug 2023 15:12:09 +0800 Subject: [PATCH 09/23] =?UTF-8?q?optimization:=20=E8=BD=BB=E5=BA=94?= =?UTF-8?q?=E7=94=A8=E6=A8=A1=E5=BC=8F=E4=B8=8B=E7=94=BB=E5=B8=83=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E8=BF=9B=E5=85=A5=E9=A2=84=E8=A7=88=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/desktop/src/pages/task/TaskCreate/TaskScheme.vue | 6 +++++- .../desktop/src/pages/task/TaskCreate/TaskSelectNode.vue | 7 +++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/frontend/desktop/src/pages/task/TaskCreate/TaskScheme.vue b/frontend/desktop/src/pages/task/TaskCreate/TaskScheme.vue index 8d181da7d3..ed43932710 100644 --- a/frontend/desktop/src/pages/task/TaskCreate/TaskScheme.vue +++ b/frontend/desktop/src/pages/task/TaskCreate/TaskScheme.vue @@ -9,7 +9,7 @@ {{$t('执行方案')}} -
+
Date: Wed, 9 Aug 2023 16:11:26 +0800 Subject: [PATCH 10/23] =?UTF-8?q?bugfix:=20=E8=BD=BB=E5=BA=94=E7=94=A8?= =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=E6=94=AF=E6=8C=81=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E6=89=A7=E8=A1=8C=E6=96=B9=E6=A1=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../desktop/src/pages/task/TaskCreate/TaskSelectNode.vue | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/frontend/desktop/src/pages/task/TaskCreate/TaskSelectNode.vue b/frontend/desktop/src/pages/task/TaskCreate/TaskSelectNode.vue index 75c2b1f8f3..0a56e795ff 100644 --- a/frontend/desktop/src/pages/task/TaskCreate/TaskSelectNode.vue +++ b/frontend/desktop/src/pages/task/TaskCreate/TaskSelectNode.vue @@ -485,7 +485,6 @@ * 设置默认勾选值 */ setCanvasSelected (selectNodes = []) { - if (this.isPreviewMode) return if (selectNodes.length) { // 使用传进来的选中节点,取消画布默认全选 this.selectedNodes = selectNodes @@ -493,7 +492,9 @@ } else { this.selectedNodes = Object.keys(this.activities) } - this.updateDataAndCanvas() + if (!this.isPreviewMode) { + this.updateDataAndCanvas() + } }, /** * 批量选择执行方案 From d298e2c681b624cdfb22af12c62e8c9ac7f4bc2a Mon Sep 17 00:00:00 2001 From: hanshuaikang <1758504262@qq.com> Date: Fri, 4 Aug 2023 17:55:18 +0800 Subject: [PATCH 11/23] =?UTF-8?q?bugfix:=20=E4=BF=AE=E5=A4=8Djob=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A=E8=B7=B3=E8=BD=ACid=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/static/components/atoms/job/execute_task/v1_0.js | 2 +- .../components/static/components/atoms/job/execute_task/v1_1.js | 2 +- .../components/static/components/atoms/job/execute_task/v1_2.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pipeline_plugins/components/static/components/atoms/job/execute_task/v1_0.js b/pipeline_plugins/components/static/components/atoms/job/execute_task/v1_0.js index 58134aaa53..0fc7c110c6 100644 --- a/pipeline_plugins/components/static/components/atoms/job/execute_task/v1_0.js +++ b/pipeline_plugins/components/static/components/atoms/job/execute_task/v1_0.js @@ -66,7 +66,7 @@ } let biz_cc_id = this.get_parent && this.get_parent().get_child('biz_cc_id')._get_value(); let bk_job_host = window.BK_JOB_HOST; - let url = bk_job_host + '/' + biz_cc_id + "/api_plan/" + this.value; + let url = bk_job_host + "/api_plan/" + this.value; window.open(url, '_blank') }, validation: [ diff --git a/pipeline_plugins/components/static/components/atoms/job/execute_task/v1_1.js b/pipeline_plugins/components/static/components/atoms/job/execute_task/v1_1.js index 2abcb8d670..91b9f152a1 100644 --- a/pipeline_plugins/components/static/components/atoms/job/execute_task/v1_1.js +++ b/pipeline_plugins/components/static/components/atoms/job/execute_task/v1_1.js @@ -67,7 +67,7 @@ let biz_cc_id = this.get_parent && this.get_parent().get_child('biz_cc_id')._get_value(); let bk_job_host = window.BK_JOB_HOST; if (bk_job_host.charAt(bk_job_host.length - 1) == "/") bk_job_host = bk_job_host.substr(0, bk_job_host.length - 1); - let url = bk_job_host + '/' + biz_cc_id + "/api_plan/" + this.value; + let url = bk_job_host + "/api_plan/" + this.value; window.open(url, '_blank') }, validation: [ diff --git a/pipeline_plugins/components/static/components/atoms/job/execute_task/v1_2.js b/pipeline_plugins/components/static/components/atoms/job/execute_task/v1_2.js index 77df052ab1..9d9d9bde1e 100644 --- a/pipeline_plugins/components/static/components/atoms/job/execute_task/v1_2.js +++ b/pipeline_plugins/components/static/components/atoms/job/execute_task/v1_2.js @@ -67,7 +67,7 @@ let biz_cc_id = this.get_parent && this.get_parent().get_child('biz_cc_id')._get_value(); let bk_job_host = window.BK_JOB_HOST; if (bk_job_host.charAt(bk_job_host.length - 1) == "/") bk_job_host = bk_job_host.substr(0, bk_job_host.length - 1); - let url = bk_job_host + '/' + biz_cc_id + "/api_plan/" + this.value; + let url = bk_job_host + "/api_plan/" + this.value; window.open(url, '_blank') }, validation: [ From 5087d326e79f59d29dc2adbc9914910147233ad5 Mon Sep 17 00:00:00 2001 From: hanshuaikang <1758504262@qq.com> Date: Tue, 15 Aug 2023 18:09:17 +0800 Subject: [PATCH 12/23] =?UTF-8?q?bugfix:=20=E4=BF=AE=E5=A4=8Djob=20?= =?UTF-8?q?=E6=89=A7=E8=A1=8C=E6=96=B9=E6=A1=88=20=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E8=B7=B3=E8=BD=AC=E8=BF=9E=E6=8E=A5=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/static/components/atoms/job/job_execute_task.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pipeline_plugins/components/static/components/atoms/job/job_execute_task.js b/pipeline_plugins/components/static/components/atoms/job/job_execute_task.js index 8b4876a9c6..0df336b1a9 100644 --- a/pipeline_plugins/components/static/components/atoms/job/job_execute_task.js +++ b/pipeline_plugins/components/static/components/atoms/job/job_execute_task.js @@ -66,7 +66,7 @@ } let biz_cc_id = this.get_parent && this.get_parent().get_child('biz_cc_id')._get_value(); let bk_job_host = window.BK_JOB_HOST; - let url = bk_job_host + '/' + biz_cc_id + "/api_plan/" + this.value; + let url = bk_job_host + "/api_plan/" + this.value; window.open(url, '_blank') }, validation: [ From 7e06d18fc109e7d1162c2df56396f01ac108e293 Mon Sep 17 00:00:00 2001 From: hanshuaikang <1758504262@qq.com> Date: Wed, 16 Aug 2023 11:24:09 +0800 Subject: [PATCH 13/23] =?UTF-8?q?bugfix:=20=E4=BF=AE=E5=A4=8Djob=20?= =?UTF-8?q?=E6=89=A7=E8=A1=8C=E6=96=B9=E6=A1=88=20=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E8=B7=B3=E8=BD=AC=E8=BF=9E=E6=8E=A5=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98=EF=BC=8C=E5=A4=84=E7=90=86job=20host=20?= =?UTF-8?q?=E4=B8=8B=E5=88=92=E7=BA=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/static/components/atoms/job/execute_task/v1_0.js | 1 + .../components/static/components/atoms/job/job_execute_task.js | 1 + 2 files changed, 2 insertions(+) diff --git a/pipeline_plugins/components/static/components/atoms/job/execute_task/v1_0.js b/pipeline_plugins/components/static/components/atoms/job/execute_task/v1_0.js index 0fc7c110c6..4142a6f4b1 100644 --- a/pipeline_plugins/components/static/components/atoms/job/execute_task/v1_0.js +++ b/pipeline_plugins/components/static/components/atoms/job/execute_task/v1_0.js @@ -66,6 +66,7 @@ } let biz_cc_id = this.get_parent && this.get_parent().get_child('biz_cc_id')._get_value(); let bk_job_host = window.BK_JOB_HOST; + if (bk_job_host.charAt(bk_job_host.length - 1) == "/") bk_job_host = bk_job_host.substr(0, bk_job_host.length - 1); let url = bk_job_host + "/api_plan/" + this.value; window.open(url, '_blank') }, diff --git a/pipeline_plugins/components/static/components/atoms/job/job_execute_task.js b/pipeline_plugins/components/static/components/atoms/job/job_execute_task.js index 0df336b1a9..c049489e33 100644 --- a/pipeline_plugins/components/static/components/atoms/job/job_execute_task.js +++ b/pipeline_plugins/components/static/components/atoms/job/job_execute_task.js @@ -66,6 +66,7 @@ } let biz_cc_id = this.get_parent && this.get_parent().get_child('biz_cc_id')._get_value(); let bk_job_host = window.BK_JOB_HOST; + if (bk_job_host.charAt(bk_job_host.length - 1) == "/") bk_job_host = bk_job_host.substr(0, bk_job_host.length - 1); let url = bk_job_host + "/api_plan/" + this.value; window.open(url, '_blank') }, From d537de1d308967a4ef5fd322362d65938aaee0f8 Mon Sep 17 00:00:00 2001 From: hanshuaikang <1758504262@qq.com> Date: Wed, 16 Aug 2023 11:47:44 +0800 Subject: [PATCH 14/23] minor: release 3.29.3 --- app.yml | 2 +- app_desc.yaml | 2 +- config/default.py | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app.yml b/app.yml index eb54b38775..3bb95c59ec 100644 --- a/app.yml +++ b/app.yml @@ -6,7 +6,7 @@ is_use_celery: True author: 蓝鲸智云 introduction: 标准运维是通过一套成熟稳定的任务调度引擎,把在多系统间的工作整合到一个流程,助力运维实现跨系统调度自动化的SaaS应用。 introduction_en: SOPS is a SaaS application that utilizes a set of mature and stable task scheduling engines to help realize cross-system scheduling automation, and integrates the work among multiple systems into a single process. -version: 3.29.2 +version: 3.29.3 category: 运维工具 language_support: 中文 desktop: diff --git a/app_desc.yaml b/app_desc.yaml index 24cc0c11cd..23037a0a8d 100644 --- a/app_desc.yaml +++ b/app_desc.yaml @@ -1,5 +1,5 @@ spec_version: 2 -app_version: "3.29.2" +app_version: "3.29.3" app: region: default bk_app_code: bk_sops diff --git a/config/default.py b/config/default.py index 6c0efb473e..89dcb40af6 100644 --- a/config/default.py +++ b/config/default.py @@ -207,7 +207,7 @@ # mako模板中: # 如果静态资源修改了以后,上线前改这个版本号即可 -STATIC_VERSION = "3.29.2" +STATIC_VERSION = "3.29.3" DEPLOY_DATETIME = datetime.datetime.now().strftime("%Y%m%d%H%M%S") STATICFILES_DIRS = [os.path.join(BASE_DIR, "static")] @@ -672,6 +672,7 @@ def monitor_report_config(): from bk_monitor_report import MonitorReporter # noqa from bk_monitor_report.contrib.celery import MonitorReportStep # noqa + from blueapps.core.celery import celery_app # noqa reporter = MonitorReporter( From 98124a7864c0edca4a20855c41d96d0dd675f235 Mon Sep 17 00:00:00 2001 From: v_xugzhou <941071842@qq.com> Date: Wed, 30 Aug 2023 11:34:28 +0800 Subject: [PATCH 15/23] =?UTF-8?q?bugfix:=20=E8=8A=82=E7=82=B9=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E8=8A=82=E7=82=B9=E6=A0=91=E7=AE=97=E6=B3=95=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/task/TaskExecute/TaskOperation.vue | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/frontend/desktop/src/pages/task/TaskExecute/TaskOperation.vue b/frontend/desktop/src/pages/task/TaskExecute/TaskOperation.vue index c086f5b2f0..f5bd9156cc 100644 --- a/frontend/desktop/src/pages/task/TaskExecute/TaskOperation.vue +++ b/frontend/desktop/src/pages/task/TaskExecute/TaskOperation.vue @@ -1467,7 +1467,8 @@ outgoing.forEach(line => { this.retrieveLines(data, line, ordered) }) - if (ordered[ordered.findLastIndex(order => order.type !== 'ServiceActivity')]) { + const lastIndex = this.findLastIndex(ordered, (order) => order.type !== 'ServiceActivity') + if (ordered[lastIndex]) { renderNodelist = [] renderNodeOutgoing = [] this.nodeIds.forEach(item => { @@ -1521,7 +1522,8 @@ outgoing.forEach(line => { this.retrieveLines(data, line, ordered) }) - if (ordered[ordered.findLastIndex(order => order.type === 'ParallelGateway')]) { + const lastIndex = this.findLastIndex(ordered, (order) => order.type === 'ParallelGateway') + if (ordered[lastIndex]) { renderNodelist = [] renderNodeOutgoing = [] this.nodeIds.forEach(item => { @@ -1570,7 +1572,8 @@ }) if (gateway.incoming.every(item => outgoingList.concat(this.conditionOutgoing).includes(item))) { // 汇聚网关push在最近的条件网关下 - const prev = ordered[ordered.findLastIndex(order => order.type !== 'ServiceActivity' && order.type !== 'ConvergeGateway')] + const lastIndex = this.findLastIndex(ordered, (order) => order.type !== 'ServiceActivity' && order.type !== 'ConvergeGateway') + const prev = ordered[lastIndex] // 独立子流程的children为 subChildren this.nodeIds.push(gateway.id) if (prev && prev.children && !prev.children.find(item => item.id === gateway.id) && !this.converNodeList.includes(gateway.id)) { @@ -1608,6 +1611,15 @@ } } }, + findLastIndex (arr, callback, thisArg) { + for (let index = arr.length - 1; index >= 0; index--) { + const value = arr[index] + if (callback.call(thisArg, value, index, arr)) { + return index + } + } + return -1 + }, renderConverGateway (ids, ordered, data) { const allNode = Object.assign({}, data.activities, data.gateways) ids.forEach(id => { @@ -1616,7 +1628,7 @@ const node = Object.keys(allNode).find(item => Array.isArray(allNode[item].outgoing) ? allNode[item].outgoing.includes(incoming) : allNode[item].outgoing === incoming) ordered.forEach(item => { if (item.id === node && allNode[node].type !== 'ServiceActivity' && allNode[node].type !== 'ConvergeGateway') { - if (!item.children.map(chd => chd.id).includes(data.gateways[id].id) && !this.renderedCoverNode.includes(id)) { + if (item.children && !item.children.map(chd => chd.id).includes(data.gateways[id].id) && !this.renderedCoverNode.includes(id)) { this.renderedCoverNode.push(id) item.children.push(Object.assign(data.gateways[id], { name: this.$t('汇聚网关') })) } From e82326a73cb7beada90270d616fb5333b596682b Mon Sep 17 00:00:00 2001 From: waylon <1158341873@qq.com> Date: Wed, 30 Aug 2023 11:49:12 +0800 Subject: [PATCH 16/23] minor: release V3.29.4 --- app.yml | 2 +- app_desc.yaml | 2 +- config/default.py | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/app.yml b/app.yml index 3bb95c59ec..74e64f6e50 100644 --- a/app.yml +++ b/app.yml @@ -6,7 +6,7 @@ is_use_celery: True author: 蓝鲸智云 introduction: 标准运维是通过一套成熟稳定的任务调度引擎,把在多系统间的工作整合到一个流程,助力运维实现跨系统调度自动化的SaaS应用。 introduction_en: SOPS is a SaaS application that utilizes a set of mature and stable task scheduling engines to help realize cross-system scheduling automation, and integrates the work among multiple systems into a single process. -version: 3.29.3 +version: 3.29.4 category: 运维工具 language_support: 中文 desktop: diff --git a/app_desc.yaml b/app_desc.yaml index 23037a0a8d..39f4a07bee 100644 --- a/app_desc.yaml +++ b/app_desc.yaml @@ -1,5 +1,5 @@ spec_version: 2 -app_version: "3.29.3" +app_version: "3.29.4" app: region: default bk_app_code: bk_sops diff --git a/config/default.py b/config/default.py index 89dcb40af6..e87f800caa 100644 --- a/config/default.py +++ b/config/default.py @@ -207,7 +207,7 @@ # mako模板中: # 如果静态资源修改了以后,上线前改这个版本号即可 -STATIC_VERSION = "3.29.3" +STATIC_VERSION = "3.29.4" DEPLOY_DATETIME = datetime.datetime.now().strftime("%Y%m%d%H%M%S") STATICFILES_DIRS = [os.path.join(BASE_DIR, "static")] @@ -672,7 +672,6 @@ def monitor_report_config(): from bk_monitor_report import MonitorReporter # noqa from bk_monitor_report.contrib.celery import MonitorReportStep # noqa - from blueapps.core.celery import celery_app # noqa reporter = MonitorReporter( From a2ad300296fa69b35a92ecc0a2346ea088232683 Mon Sep 17 00:00:00 2001 From: hanshuaikang <1758504262@qq.com> Date: Thu, 31 Aug 2023 11:23:12 +0800 Subject: [PATCH 17/23] =?UTF-8?q?feature:=20=E6=94=AF=E6=8C=81gse2.0?= =?UTF-8?q?=E5=8D=95=E7=8B=AC=E4=BD=9C=E4=B8=BA=E5=BC=80=E5=85=B3=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/default.py | 5 +- env.py | 2 +- pipeline_plugins/cmdb_ip_picker/query.py | 20 ++--- .../variables/collections/sites/open/cc.py | 30 ++++--- .../collections/sites/open/ip_filter_base.py | 84 ++++++++++++++++--- 5 files changed, 105 insertions(+), 36 deletions(-) diff --git a/config/default.py b/config/default.py index e87f800caa..aac4748ba0 100644 --- a/config/default.py +++ b/config/default.py @@ -155,7 +155,9 @@ ENABLE_IPV6 = env.ENABLE_IPV6 # paasv3 和 开启了ipv6 才会尝试加载 BK_API_URL_TMPL 这个变量 -if env.IS_PAAS_V3 or ENABLE_IPV6: +ENABLE_GSE_V2 = env.ENABLE_GSE_V2 + +if env.IS_PAAS_V3 or ENABLE_IPV6 or ENABLE_GSE_V2: BK_API_URL_TMPL = env.BK_APIGW_URL_TMPL if env.IS_PAAS_V3: @@ -672,6 +674,7 @@ def monitor_report_config(): from bk_monitor_report import MonitorReporter # noqa from bk_monitor_report.contrib.celery import MonitorReportStep # noqa + from blueapps.core.celery import celery_app # noqa reporter = MonitorReporter( diff --git a/env.py b/env.py index 3b89e971f1..f77124aabd 100644 --- a/env.py +++ b/env.py @@ -98,7 +98,7 @@ ENABLE_SWAGGER_UI = os.getenv("BKAPP_ENABLE_SWAGGER_UI", False) ENABLE_IPV6 = False if os.getenv("BKAPP_ENABLE_IPV6") is None else True - +ENABLE_GSE_V2 = int(os.getenv("BKAPP_ENABLE_GSE_V2", 0)) == 1 # 流程最高嵌套层数 TEMPLATE_MAX_RECURSIVE_NUMBER = int(os.getenv("BKAPP_TEMPLATE_MAX_RECURSIVE_NUMBER", 200)) diff --git a/pipeline_plugins/cmdb_ip_picker/query.py b/pipeline_plugins/cmdb_ip_picker/query.py index 27c2e7e07f..f08a732ead 100644 --- a/pipeline_plugins/cmdb_ip_picker/query.py +++ b/pipeline_plugins/cmdb_ip_picker/query.py @@ -16,24 +16,23 @@ import ujson as json from django.http import JsonResponse from django.utils.translation import ugettext_lazy as _ - -from api.utils.request import batch_request from iam.contrib.http import HTTP_AUTH_FORBIDDEN_CODE from iam.exceptions import RawAuthFailedException +from api.utils.request import batch_request from gcloud.conf import settings from gcloud.utils import cmdb -from gcloud.utils.ip import format_sundry_ip from gcloud.utils.handlers import handle_api_error +from gcloud.utils.ip import format_sundry_ip +from .constants import ERROR_CODES, NO_ERROR from .utils import ( get_cmdb_topo_tree, - get_objects_of_topo_tree, - get_modules_of_bk_obj, - get_modules_id, get_ges_agent_status_ipv6, + get_modules_id, + get_modules_of_bk_obj, + get_objects_of_topo_tree, ) -from .constants import NO_ERROR, ERROR_CODES logger = logging.getLogger("root") get_client_by_user = settings.ESB_GET_CLIENT_BY_USER @@ -63,8 +62,8 @@ def cmdb_search_host(request, bk_biz_id, bk_supplier_account="", bk_supplier_id= @return: """ default_host_fields = ["bk_host_id", "bk_host_name", "bk_cloud_id", "bk_host_innerip"] - if settings.ENABLE_IPV6: - # IPV6环境下才会尝试去拿agent主机 + if settings.ENABLE_IPV6 or settings.ENABLE_GSE_V2: + # IPV6环境下或者开启了GSE 2.0 版本 default_host_fields.append("bk_agent_id") fields = set(default_host_fields + json.loads(request.GET.get("fields", "[]"))) client = get_client_by_user(request.user.username) @@ -130,7 +129,7 @@ def cmdb_search_host(request, bk_biz_id, bk_supplier_account="", bk_supplier_id= data.append(host_detail) if "agent" in fields: - if settings.ENABLE_IPV6: + if settings.ENABLE_IPV6 or settings.ENABLE_GSE_V2: # 开启IPV6将会调用网关进行查询 bk_agent_id_list = [] for host in data: @@ -156,6 +155,7 @@ def cmdb_search_host(request, bk_biz_id, bk_supplier_account="", bk_supplier_id= if not host["bk_host_innerip"]: # 如果既没有如果bk_agent_id,又没有ipv4地址,说明这个主机石台没有安装agent的ipv6主机,忽略,不再查询agent状态, 直接重置为未知 host["agent"] = -1 + continue bk_agent_id = "{}:{}".format(host["bk_cloud_id"], host["bk_host_innerip"]) host["agent"] = agent_id_status_map.get(bk_agent_id, -1) else: diff --git a/pipeline_plugins/variables/collections/sites/open/cc.py b/pipeline_plugins/variables/collections/sites/open/cc.py index 1cb182c205..b7c5f8ee09 100644 --- a/pipeline_plugins/variables/collections/sites/open/cc.py +++ b/pipeline_plugins/variables/collections/sites/open/cc.py @@ -225,7 +225,9 @@ def _self_explain(cls, **kwargs) -> List[FieldExplain]: FieldExplain(key="${KEY._module}", type=Type.LIST, description="集群下的模块信息列表,元素类型为字典,键为模块名,值为模块下的主机列"), FieldExplain(key="${KEY.flat__ip_list}", type=Type.STRING, description="本次操作创建的所有集群下的主机(去重后),用 ',' 连接"), FieldExplain( - key="${KEY.flat__verbose_ip_list}", type=Type.STRING, description="返回的是本次操作创建的所有集群下的主机(未去重),用 ',' 连接", + key="${KEY.flat__verbose_ip_list}", + type=Type.STRING, + description="返回的是本次操作创建的所有集群下的主机(未去重),用 ',' 连接", ), FieldExplain( key="${KEY.flat__verbose_ip_module_list}", @@ -304,7 +306,13 @@ def _handle_value_with_ipv4(username, bk_biz_id, bk_supplier_account, host_field if not ip_list: return [] - hosts_list = get_business_host(username, bk_biz_id, bk_supplier_account, host_fields, ip_list,) + hosts_list = get_business_host( + username, + bk_biz_id, + bk_supplier_account, + host_fields, + ip_list, + ) return hosts_list @staticmethod @@ -408,15 +416,7 @@ def get_value(self): origin_ip_list = get_plat_ip_by_regex(origin_ips) filter_data = {**self.value, **self.pipeline_data} - if not settings.ENABLE_IPV6: - # 进行gse agent状态过滤 - gse_agent_status_filter = GseAgentStatusIpFilter(origin_ip_list, filter_data) - match_result_ip = gse_agent_status_filter.get_match_ip() - if not ip_cloud: - return ip_separator.join(["{}".format(host["ip"]) for host in match_result_ip]) - - return ip_separator.join(["{}:{}".format(host["bk_cloud_id"], host["ip"]) for host in match_result_ip]) - else: + if settings.ENABLE_IPV6: gse_agent_status_ipv6_filter = GseAgentStatusIpV6Filter(origin_ips, filter_data) match_result_ip = gse_agent_status_ipv6_filter.get_match_ip() if not ip_cloud: @@ -430,3 +430,11 @@ def get_value(self): else: result.append("{}:{}".format(host["bk_cloud_id"], host["ip"])) return ip_separator.join(result) + else: + # 进行gse agent状态过滤 + gse_agent_status_filter = GseAgentStatusIpFilter(origin_ip_list, filter_data) + match_result_ip = gse_agent_status_filter.get_match_ip() + if not ip_cloud: + return ip_separator.join(["{}".format(host["ip"]) for host in match_result_ip]) + + return ip_separator.join(["{}:{}".format(host["bk_cloud_id"], host["ip"]) for host in match_result_ip]) diff --git a/pipeline_plugins/variables/collections/sites/open/ip_filter_base.py b/pipeline_plugins/variables/collections/sites/open/ip_filter_base.py index 53c4f54910..9d129b2874 100644 --- a/pipeline_plugins/variables/collections/sites/open/ip_filter_base.py +++ b/pipeline_plugins/variables/collections/sites/open/ip_filter_base.py @@ -13,15 +13,17 @@ import logging from abc import ABCMeta, abstractmethod +from django.conf import settings from django.utils.translation import ugettext_lazy as _ -from gcloud.constants import GseAgentStatus from gcloud.conf import settings as gcloud_settings +from gcloud.constants import GseAgentStatus from gcloud.core.models import Project from gcloud.exceptions import ApiRequestError +from gcloud.utils import cmdb from gcloud.utils.handlers import handle_api_error -from gcloud.utils.ip import extract_ip_from_ip_str, get_ip_by_regex_type, IpRegexType -from pipeline_plugins.base.utils.inject import supplier_id_for_project, supplier_account_for_business +from gcloud.utils.ip import IpRegexType, extract_ip_from_ip_str, get_ip_by_regex_type +from pipeline_plugins.base.utils.inject import supplier_account_for_business, supplier_id_for_project from pipeline_plugins.cmdb_ip_picker.utils import get_ges_agent_status_ipv6 from pipeline_plugins.components.collections.sites.open.cc.base import cc_get_host_by_innerip_with_ipv6 @@ -40,18 +42,57 @@ def get_match_ip(self): class GseAgentStatusIpFilter(IpFilterBase): - def get_match_ip(self): + def match_ges_v2(self, gse_agent_status, username, bk_biz_id, bk_supplier_id, origin_ip_list): - origin_ip_list = self.origin_ip_list - gse_agent_status = self.data.get("gse_agent_status", "") - username = self.data["executor"] - project_id = self.data["project_id"] - project = Project.objects.get(id=project_id) - bk_biz_id = project.bk_biz_id if project.from_cmdb else "" - bk_supplier_id = supplier_id_for_project(project_id) - if not origin_ip_list: - return [] + fields = ["bk_host_id", "bk_cloud_id", "bk_host_innerip", "bk_agent_id"] + # 生成一个host列表 + origin_hosts = { + "{}:{}".format(origin_host["bk_cloud_id"], origin_host["ip"]): origin_host for origin_host in origin_ip_list + } + + ip_list = [host["ip"] for host in origin_ip_list] + # 先去查出来所有host的gse_agent_id + hosts = cmdb.get_business_host(username, bk_biz_id, bk_supplier_id, host_fields=fields, ip_list=ip_list) + + # 构造一个{bk_agent_id: bk_cloud_id:ip}的字典 + remote_hosts = {} + + for host in hosts: + remote_host_value = "{}:{}".format(host["bk_cloud_id"], host["bk_host_innerip"]) + if remote_host_value in origin_hosts.keys(): + bk_agent_id = host.get("bk_agent_id") + if not bk_agent_id: + # 没有agent_id 使用 云区域+ip 组成 agent_id + bk_agent_id = remote_host_value + remote_hosts[bk_agent_id] = remote_host_value + + # 去查询agent状态 + agent_map = get_ges_agent_status_ipv6(bk_agent_id_list=list(remote_hosts.keys())) + + agent_online_ip_list = [] # 在线的ip的列表 + agent_offline_ip_list = [] # 不在线的ip的列表 + match_ip = [] # 过滤失败将不返回任何i + for bk_agent_id, agent_code in agent_map.items(): + origin_host_key = remote_hosts.get(bk_agent_id) + if not origin_host_key: + continue + origin_host = origin_hosts.get(origin_host_key) + if not origin_host: + continue + + if agent_code == GseAgentStatus.ONlINE.value: + agent_online_ip_list.append(origin_host) + if agent_code == GseAgentStatus.OFFLINE.value: + agent_offline_ip_list.append(origin_host) + + if gse_agent_status == GseAgentStatus.ONlINE.value: + match_ip = agent_online_ip_list + if gse_agent_status == GseAgentStatus.OFFLINE.value: + match_ip = agent_offline_ip_list + return match_ip + + def match_gse_v1(self, gse_agent_status, username, bk_biz_id, bk_supplier_id, origin_ip_list): match_ip = origin_ip_list if gse_agent_status in [GseAgentStatus.ONlINE.value, GseAgentStatus.OFFLINE.value]: client = get_client_by_user(username) @@ -81,6 +122,23 @@ def get_match_ip(self): return match_ip + def get_match_ip(self): + + origin_ip_list = self.origin_ip_list + gse_agent_status = self.data.get("gse_agent_status", "") + username = self.data["executor"] + project_id = self.data["project_id"] + project = Project.objects.get(id=project_id) + bk_biz_id = project.bk_biz_id if project.from_cmdb else "" + bk_supplier_id = supplier_id_for_project(project_id) + if not origin_ip_list: + return [] + + if settings.ENABLE_GSE_V2: + return self.match_ges_v2(gse_agent_status, username, bk_biz_id, bk_supplier_id, origin_ip_list) + else: + return self.match_gse_v1(gse_agent_status, username, bk_biz_id, bk_supplier_id, origin_ip_list) + class GseAgentStatusIpV6Filter: def __init__(self, ip_str, data): From b474b557907ab3be2302958e28f88e6e55884099 Mon Sep 17 00:00:00 2001 From: hanshuaikang <1758504262@qq.com> Date: Thu, 31 Aug 2023 15:28:45 +0800 Subject: [PATCH 18/23] =?UTF-8?q?minor:=20=E4=BF=AE=E6=94=B9=E6=8B=BC?= =?UTF-8?q?=E5=86=99=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pipeline_plugins/cmdb_ip_picker/query.py | 4 ++-- pipeline_plugins/cmdb_ip_picker/utils.py | 16 ++++++++++------ .../collections/sites/open/ip_filter_base.py | 6 +++--- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/pipeline_plugins/cmdb_ip_picker/query.py b/pipeline_plugins/cmdb_ip_picker/query.py index f08a732ead..d77aa3f9ff 100644 --- a/pipeline_plugins/cmdb_ip_picker/query.py +++ b/pipeline_plugins/cmdb_ip_picker/query.py @@ -28,7 +28,7 @@ from .constants import ERROR_CODES, NO_ERROR from .utils import ( get_cmdb_topo_tree, - get_ges_agent_status_ipv6, + get_gse_agent_status_ipv6, get_modules_id, get_modules_of_bk_obj, get_objects_of_topo_tree, @@ -143,7 +143,7 @@ def cmdb_search_host(request, bk_biz_id, bk_supplier_account="", bk_supplier_id= bk_agent_id_list.append(bk_agent_id) try: - agent_id_status_map = get_ges_agent_status_ipv6(bk_agent_id_list) + agent_id_status_map = get_gse_agent_status_ipv6(bk_agent_id_list) except Exception as e: result = {"result": False, "code": ERROR_CODES.API_GSE_ERROR, "message": e} return JsonResponse(result) diff --git a/pipeline_plugins/cmdb_ip_picker/utils.py b/pipeline_plugins/cmdb_ip_picker/utils.py index 8d6b4e9f93..89ba5838bc 100644 --- a/pipeline_plugins/cmdb_ip_picker/utils.py +++ b/pipeline_plugins/cmdb_ip_picker/utils.py @@ -328,7 +328,11 @@ def fetch_host_ip_with_property_filter(self): fields.append("bk_host_innerip_v6") host_info = cmdb.get_business_host_topo( - self.username, self.bk_biz_id, self.bk_supplier_account, fields, property_filters=self.property_filters, + self.username, + self.bk_biz_id, + self.bk_supplier_account, + fields, + property_filters=self.property_filters, ) logger.info("[fetch_host_info] cmdb.get_business_host_topo return: {host_info}".format(host_info=host_info)) @@ -702,27 +706,27 @@ def get_bk_cloud_id_for_host(host_info, cloud_key="cloud"): return host_info[cloud_key][0]["id"] -def get_ges_agent_status_ipv6(bk_agent_id_list): +def get_gse_agent_status_ipv6(bk_agent_id_list): if not bk_agent_id_list: return {} ENV_MAP = {"PRODUCT": "prod", "STAGING": "stag"} gse_url = settings.BK_API_URL_TMPL.format(api_name="bk-gse") get_agent_status_url = "{}/{}/api/v2/cluster/list_agent_state".format( - gse_url, ENV_MAP.get(settings.RUN_MODE, "stag") + gse_url, ENV_MAP.get(settings.RUN_MODE, "prod") ) params = {"bk_app_code": settings.APP_CODE, "bk_app_secret": settings.SECRET_KEY, "agent_id_list": bk_agent_id_list} resp = requests.post(url=get_agent_status_url, json=params) if resp.status_code != 200: - raise Exception("[get_ges_agent_status_ipv6] 查询agent状态错误,返回值非200, content = {}".format(resp.content)) + raise Exception("[get_gse_agent_status_ipv6] 查询agent状态错误,返回值非200, content = {}".format(resp.content)) try: data = resp.json() except Exception as e: - raise Exception("[get_ges_agent_status_ipv6] 查询agent状态错误,返回值非Json, err={}".format(e)) + raise Exception("[get_gse_agent_status_ipv6] 查询agent状态错误,返回值非Json, err={}".format(e)) if data["code"] != 0: - raise Exception("[get_ges_agent_status_ipv6] 查询agent状态错误,返回值非code非0") + raise Exception("[get_gse_agent_status_ipv6] 查询agent状态错误,返回值非code非0") agent_id_status_map = {} for item in data.get("data", []): diff --git a/pipeline_plugins/variables/collections/sites/open/ip_filter_base.py b/pipeline_plugins/variables/collections/sites/open/ip_filter_base.py index 9d129b2874..affd51d9c6 100644 --- a/pipeline_plugins/variables/collections/sites/open/ip_filter_base.py +++ b/pipeline_plugins/variables/collections/sites/open/ip_filter_base.py @@ -24,7 +24,7 @@ from gcloud.utils.handlers import handle_api_error from gcloud.utils.ip import IpRegexType, extract_ip_from_ip_str, get_ip_by_regex_type from pipeline_plugins.base.utils.inject import supplier_account_for_business, supplier_id_for_project -from pipeline_plugins.cmdb_ip_picker.utils import get_ges_agent_status_ipv6 +from pipeline_plugins.cmdb_ip_picker.utils import get_gse_agent_status_ipv6 from pipeline_plugins.components.collections.sites.open.cc.base import cc_get_host_by_innerip_with_ipv6 logger = logging.getLogger("root") @@ -67,7 +67,7 @@ def match_ges_v2(self, gse_agent_status, username, bk_biz_id, bk_supplier_id, or remote_hosts[bk_agent_id] = remote_host_value # 去查询agent状态 - agent_map = get_ges_agent_status_ipv6(bk_agent_id_list=list(remote_hosts.keys())) + agent_map = get_gse_agent_status_ipv6(bk_agent_id_list=list(remote_hosts.keys())) agent_online_ip_list = [] # 在线的ip的列表 agent_offline_ip_list = [] # 不在线的ip的列表 @@ -179,7 +179,7 @@ def get_match_ip(self): bk_agent_id_list.append(bk_agent_id) try: - agent_id_status_map = get_ges_agent_status_ipv6(bk_agent_id_list) + agent_id_status_map = get_gse_agent_status_ipv6(bk_agent_id_list) except Exception as e: raise ApiRequestError(f"ERROR:{e}") From 04ba1572198a636173d6be3def75ef596ebc4f7c Mon Sep 17 00:00:00 2001 From: luofann Date: Sat, 5 Aug 2023 11:28:54 +0800 Subject: [PATCH 19/23] =?UTF-8?q?minor:=20=E6=9B=B4=E6=96=B0bkui-form?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E6=94=AF=E6=8C=81=E5=AF=86=E7=A0=81=E6=A1=86?= =?UTF-8?q?=E5=8F=AA=E8=AF=BB=E6=80=81=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/desktop/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/desktop/package.json b/frontend/desktop/package.json index 235e329565..3fff3b3e8f 100644 --- a/frontend/desktop/package.json +++ b/frontend/desktop/package.json @@ -13,7 +13,7 @@ "dependencies": { "@blueking/bkcharts": "^2.0.11-alpha.5", "@blueking/user-selector": "^1.0.5-beta.2", - "@blueking/bkui-form": "0.0.11", + "@blueking/bkui-form": "0.0.35", "@vue/babel-preset-jsx": "^1.3.0", "ajv": "^6.10.2", "art-template": "^4.13.0", From f9b1925666710b7bb6e76a1f3690b52ffc10ff58 Mon Sep 17 00:00:00 2001 From: hanshuaikang <1758504262@qq.com> Date: Tue, 5 Sep 2023 16:09:25 +0800 Subject: [PATCH 20/23] =?UTF-8?q?bugfix:=20=E4=BF=AE=E5=A4=8Dipv6=E7=8E=AF?= =?UTF-8?q?=E5=A2=83=E4=B8=8Bip=E8=BF=87=E6=BB=A4=E5=99=A8=E5=A4=B1?= =?UTF-8?q?=E6=95=88=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../variables/collections/sites/open/ip_filter_base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pipeline_plugins/variables/collections/sites/open/ip_filter_base.py b/pipeline_plugins/variables/collections/sites/open/ip_filter_base.py index affd51d9c6..833d1c9c08 100644 --- a/pipeline_plugins/variables/collections/sites/open/ip_filter_base.py +++ b/pipeline_plugins/variables/collections/sites/open/ip_filter_base.py @@ -201,7 +201,7 @@ def get_match_ip(self): agent_online_ip_list.append(match_result) # agent 状态为 0 或者 未知 则认为 该主机 不在线 if agent_id_status_map.get(bk_agent_id, 0) in [0, -1]: - agent_online_ip_list.append(match_result) + agent_offline_ip_list.append(match_result) gse_agent_status = self.data.get("gse_agent_status", "") if gse_agent_status == GseAgentStatus.ONlINE.value: match_host = agent_online_ip_list From ceb4e54f5cd6285bfa84a60760889a6203a38bf6 Mon Sep 17 00:00:00 2001 From: hanshuaikang <1758504262@qq.com> Date: Tue, 5 Sep 2023 16:18:35 +0800 Subject: [PATCH 21/23] minor: release 3.29.5 --- app.yml | 2 +- app_desc.yaml | 2 +- config/default.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app.yml b/app.yml index 74e64f6e50..63f475dfb7 100644 --- a/app.yml +++ b/app.yml @@ -6,7 +6,7 @@ is_use_celery: True author: 蓝鲸智云 introduction: 标准运维是通过一套成熟稳定的任务调度引擎,把在多系统间的工作整合到一个流程,助力运维实现跨系统调度自动化的SaaS应用。 introduction_en: SOPS is a SaaS application that utilizes a set of mature and stable task scheduling engines to help realize cross-system scheduling automation, and integrates the work among multiple systems into a single process. -version: 3.29.4 +version: 3.29.5 category: 运维工具 language_support: 中文 desktop: diff --git a/app_desc.yaml b/app_desc.yaml index 39f4a07bee..841ec68097 100644 --- a/app_desc.yaml +++ b/app_desc.yaml @@ -1,5 +1,5 @@ spec_version: 2 -app_version: "3.29.4" +app_version: "3.29.5" app: region: default bk_app_code: bk_sops diff --git a/config/default.py b/config/default.py index aac4748ba0..8c01f8bdd3 100644 --- a/config/default.py +++ b/config/default.py @@ -209,7 +209,7 @@ # mako模板中: # 如果静态资源修改了以后,上线前改这个版本号即可 -STATIC_VERSION = "3.29.4" +STATIC_VERSION = "3.29.5" DEPLOY_DATETIME = datetime.datetime.now().strftime("%Y%m%d%H%M%S") STATICFILES_DIRS = [os.path.join(BASE_DIR, "static")] From 38c507f33add0b7fa58c7a84ee6aaf3a54076187 Mon Sep 17 00:00:00 2001 From: hanshuaikang <1758504262@qq.com> Date: Wed, 6 Sep 2023 16:51:14 +0800 Subject: [PATCH 22/23] =?UTF-8?q?bugfix:=20=E5=88=86=E6=89=B9=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2gse=E7=9A=84agent=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pipeline_plugins/cmdb_ip_picker/utils.py | 41 ++++++++++++++++-------- 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/pipeline_plugins/cmdb_ip_picker/utils.py b/pipeline_plugins/cmdb_ip_picker/utils.py index 89ba5838bc..3a7f8ecea4 100644 --- a/pipeline_plugins/cmdb_ip_picker/utils.py +++ b/pipeline_plugins/cmdb_ip_picker/utils.py @@ -709,27 +709,42 @@ def get_bk_cloud_id_for_host(host_info, cloud_key="cloud"): def get_gse_agent_status_ipv6(bk_agent_id_list): if not bk_agent_id_list: return {} - ENV_MAP = {"PRODUCT": "prod", "STAGING": "stag"} + ENV_MAP = {"PRODUCT": "prod", "STAGING": "stage"} gse_url = settings.BK_API_URL_TMPL.format(api_name="bk-gse") get_agent_status_url = "{}/{}/api/v2/cluster/list_agent_state".format( - gse_url, ENV_MAP.get(settings.RUN_MODE, "prod") + gse_url, ENV_MAP.get(settings.RUN_MODE, "stage") ) - params = {"bk_app_code": settings.APP_CODE, "bk_app_secret": settings.SECRET_KEY, "agent_id_list": bk_agent_id_list} - resp = requests.post(url=get_agent_status_url, json=params) + def send_request(agent_ids): + params = { + "bk_app_code": settings.APP_CODE, + "bk_app_secret": settings.SECRET_KEY, + "agent_id_list": agent_ids, + } + + resp = requests.post(url=get_agent_status_url, json=params) + + if resp.status_code != 200: + raise Exception("[get_gse_agent_status_ipv6] 查询agent状态错误,返回值非200, content = {}".format(resp.content)) + try: + resp_data = resp.json() + except Exception as e: + raise Exception("[get_gse_agent_status_ipv6] 查询agent状态错误,返回值非Json, err={}".format(e)) + if resp_data["code"] != 0: + raise Exception("[get_gse_agent_status_ipv6] 查询agent状态错误,返回值非code非0, {}".format(data)) + + return resp_data.get("data", []) + + # gse 请求最大支持1000个agent_id的同时查询,所以需要把agent_id分成1000份的单元 + multi_agent_id_list = [bk_agent_id_list[i : i + 1000] for i in range(0, len(bk_agent_id_list), 1000)] - if resp.status_code != 200: - raise Exception("[get_gse_agent_status_ipv6] 查询agent状态错误,返回值非200, content = {}".format(resp.content)) - try: - data = resp.json() - except Exception as e: - raise Exception("[get_gse_agent_status_ipv6] 查询agent状态错误,返回值非Json, err={}".format(e)) - if data["code"] != 0: - raise Exception("[get_gse_agent_status_ipv6] 查询agent状态错误,返回值非code非0") + data = [] + for agent_id_list in multi_agent_id_list: + data.extend(send_request(agent_id_list)) agent_id_status_map = {} - for item in data.get("data", []): + for item in data: # esb agent 状态规则 : agent在线状态,0为不在线,1为在线 # apigw agent 状态规则: Agent当前运行状态码, -1:未知 0:初始安装 1:启动中 2:运行中 3:有损状态 4:繁忙状态 5:升级中 6:停止中 7:解除安装 # 为了前端的显示/与过滤保持一致,所有需要对状态进行转换 From 248e903734ab15063a69ecceec0dcc4cb7bd361e Mon Sep 17 00:00:00 2001 From: hanshuaikang <1758504262@qq.com> Date: Thu, 7 Sep 2023 16:32:41 +0800 Subject: [PATCH 23/23] minor: release 3.29.6 --- app.yml | 2 +- app_desc.yaml | 2 +- config/default.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app.yml b/app.yml index 63f475dfb7..84df898aae 100644 --- a/app.yml +++ b/app.yml @@ -6,7 +6,7 @@ is_use_celery: True author: 蓝鲸智云 introduction: 标准运维是通过一套成熟稳定的任务调度引擎,把在多系统间的工作整合到一个流程,助力运维实现跨系统调度自动化的SaaS应用。 introduction_en: SOPS is a SaaS application that utilizes a set of mature and stable task scheduling engines to help realize cross-system scheduling automation, and integrates the work among multiple systems into a single process. -version: 3.29.5 +version: 3.29.6 category: 运维工具 language_support: 中文 desktop: diff --git a/app_desc.yaml b/app_desc.yaml index 841ec68097..49083c1035 100644 --- a/app_desc.yaml +++ b/app_desc.yaml @@ -1,5 +1,5 @@ spec_version: 2 -app_version: "3.29.5" +app_version: "3.29.6" app: region: default bk_app_code: bk_sops diff --git a/config/default.py b/config/default.py index 8c01f8bdd3..01eeca54f5 100644 --- a/config/default.py +++ b/config/default.py @@ -209,7 +209,7 @@ # mako模板中: # 如果静态资源修改了以后,上线前改这个版本号即可 -STATIC_VERSION = "3.29.5" +STATIC_VERSION = "3.29.6" DEPLOY_DATETIME = datetime.datetime.now().strftime("%Y%m%d%H%M%S") STATICFILES_DIRS = [os.path.join(BASE_DIR, "static")]