SuperAPI AI 工具集

bk-cli-job

部署与运维

查看项目

更新于 10-16 09:55

技能介绍

用途:通过 bk-cli job 调用蓝鲸作业平台(BK-JOB)API,覆盖脚本执行、文件分发与作业结果查询等场景。

使用前提:开始前必须先用 Read 工具读取 ../bk-cli-shared/SKILL.md,共享 skill 负责认证、context、tenant、stage、dry-run、verbose、header/body 及通用请求规则;本 skill 仅补充 job 命令自身的语义与输入约定。

覆盖命令:查询类 get_job_instance_status(GET /api/v3/get_job_instance_status,查询作业实例执行状态)、get_job_instance_ip_log(GET /api/v3/get_job_instance_ip_log,查询某台主机的作业执行日志);执行类 fast_execute_script(POST /api/v3/fast_execute_script,快速执行脚本)、fast_transfer_file(POST /api/v3/fast_transfer_file,快速分发文件)、push_config_file(POST /api/v3/push_config_file,分发本地配置文件)。

用法要点:fast_execute_script 的 script_content / script_file 必须二选一,未显式提供 --body 时至少提供一个且 target_server 须通过 --target_server 传 JSON 对象;从 --script_file 读取的脚本内容会与 script_param 一样在发送前做 Base64 编码;script_language 支持 shell、bat、perl、python、powershell;显式提供 --body 时需传完整请求体,不与其他 flag 做局部合并。fast_transfer_file 与 push_config_file 的 payload 较复杂,必须通过 --body 提供完整 JSON,push_config_file 中 file_list 的 content 字段须为 Base64 编码。

适用场景:快速执行脚本、分发文件、查询作业状态和执行日志。

限制:需调用的 Job API 不在上述列表内,或需要完全自定义 body/header 时,应退回 bk-cli api。其他细节资料暂未提供。