Skip to content

feat: 支持通过环境变量配置 Agent 安装前置脚本 #2236

@ZhuoZhuoCrayon

Description

@ZhuoZhuoCrayon

背景

为什么需要

功能

你想要什么功能

支持通过环境变量配置 Agent 安装前置脚本,安装 Agent 时先执行这部分脚本

功能实现

建议的方案

  1. 新增环境变量:BKAPP_SCRIPT_HOOKS,hook 间使用逗号进行分隔,例如 active_firewall_policy,firewall_off
  2. 在 /apps/node_man/serializers/job.py InstallSerializer进行安装前判断,如果存在环境变量,将内置 hooks 置于已有的script_hooks` 前
  3. 新增 ieod_active_firewall_policy.bat 到 apps/core/script_manage/data.py,增加 support_cloud_ids,因为该需求只在直连区域生效

前置脚本执行原理,可参考:#1195

新增环境变量参考 commit:0498ea5

实现方案

功能自测

代码变更覆盖功能点需要自测并截图

功能点 1

描述代码变更涉及功能点及自测截图

功能点 2

描述代码变更涉及功能点及自测截图

...

Metadata

Metadata

Labels

tested已经在测试环境验收通过

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions