Skip to content

Conversation

@kaik-bit
Copy link
Collaborator

@kaik-bit kaik-bit commented Jan 4, 2026

feat: 新增蓝鲸插件框架集成蓝鲸可编程网关 && 插件部署优化功能

@tencentblueking-adm
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Xinkai Yi seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@codecov-commenter
Copy link

codecov-commenter commented Jan 4, 2026

Codecov Report

❌ Patch coverage is 97.82609% with 1 line in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (master@48bf0a7). Learn more about missing BASE report.

Files with missing lines Patch % Lines
...bk_plugin_framework/services/bpf_service/models.py 90.90% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #111   +/-   ##
=========================================
  Coverage          ?   90.97%           
=========================================
  Files             ?       38           
  Lines             ?     1330           
  Branches          ?        0           
=========================================
  Hits              ?     1210           
  Misses            ?      120           
  Partials          ?        0           
Files with missing lines Coverage Δ
...-plugin-framework/bk_plugin_framework/constants.py 100.00% <ø> (ø)
bk-plugin-framework/bk_plugin_framework/envs.py 75.00% <100.00%> (ø)
...ugin-framework/bk_plugin_framework/hub/__init__.py 97.36% <100.00%> (ø)
...ugin-framework/bk_plugin_framework/kit/__init__.py 60.00% <ø> (ø)
...plugin-framework/bk_plugin_framework/kit/plugin.py 87.09% <100.00%> (ø)
bk-plugin-framework/bk_plugin_framework/metrics.py 96.15% <100.00%> (ø)
...k/bk_plugin_framework/runtime/callback/__init__.py 100.00% <ø> (ø)
...mework/bk_plugin_framework/runtime/callback/api.py 65.30% <100.00%> (ø)
...ework/bk_plugin_framework/runtime/callback/apps.py 100.00% <ø> (ø)
..._plugin_framework/runtime/callback/celery/tasks.py 96.00% <100.00%> (ø)
... and 27 more

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 48bf0a7...6aea9f8. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.


from drf_yasg.utils import swagger_auto_schema
from apigw_manager.apigw.decorators import apigw_require
from bk_plugin_framework.runtime.callback.api import callback, parse_callback_token
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里bk_plugin_framework是本地模块吧,其他都是第三方依赖,应该分开的

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

其他应该也有类似的问题

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已修复这个问题

# DO NOT DELETE ANY PACKAGE IN base SECTION !!!
bk-plugin-framework==2.2.9
# opentelemetry
amqp==2.6.1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

本地用于测试增加的依赖包不应该放上来,正常安装runtime和framework就够了

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已修改

description: pip version control
- name: BK_APIGW_MANAGER_MAINTAINERS
value: {{cookiecutter.init_apigw_maintainer}}
value: simonyi
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里有名字

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已修改还原

procCommand: celery-prometheus-exporter --broker amqp://$RABBITMQ_USER:$RABBITMQ_PASSWORD@$RABBITMQ_HOST:$RABBITMQ_PORT/$RABBITMQ_VHOST --addr 0.0.0.0:5001 --queue-list plugin_schedule plugin_callback schedule_delete
configuration:
env:
- name: PYTHONPATH
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个文件的环境变量不应该改吧

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已修改回复为模板样例

from rest_framework import serializers


def enveloper(serializer_class, many: bool = False):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

最好有比较明确的含义,比如StandardResponse类似的

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已经修改为standard_response_enveloper

@kaik-bit kaik-bit changed the title Development feat: 新增蓝鲸插件框架集成蓝鲸可编程网关 && 插件部署优化功能 Jan 8, 2026
operation_summary="Get plugin execution log with trace_id",
responses={200: LogsResponseSerializer},
@extend_schema(
summary="Get plugin execution log with trace_id",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里需要确认下operation_id是否必填的,还有几个其他接口也有类似的

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

非必需的,不填 apigw 会自动命名为视图类名加上操作类型,类似 plugin_get、plugin_post 这种

user_verified_required=True,
app_verified_required=True,
resource_permission_required=True,
description_en="插件调用",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

描述不太准确吧,其他也有不准确的,一起看下


def _append_plugin_api_resource(self):
"""在 resources.yaml 的 paths 节点下追加 plugin_api 资源配置"""
filepath = "/app/bk_plugin_runtime/resources.yaml"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

最好用相对路径,这路是蓝鲸内部署的路径,如果paas构建环境换了,那这里就有问题了

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已修改为与 apigw 生成 resources.yaml 的路径保持一致

responses={200: ScheduleResponseSerializer},
@extend_schema(
summary="获取插件调度详情",
request=ScheduleParamsSerializer,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可编程网关的文档用的是parameters,可能需要确认下是不是get请求的旧用parameters,post请求的才用request

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是的,我修改一下

@dengyh dengyh merged commit cb88b1c into TencentBlueKing:master Jan 9, 2026
4 of 5 checks passed
@kaik-bit kaik-bit deleted the development branch January 15, 2026 03:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants