SuperAPI AI Directory

bk-cli-devops

Deployment & operations

View repository

Updated 10-16 08:45

About this skill

bk-cli devops — BlueKing DevOps / CodeCC / Stream capability usage instructions

Used to call the BlueKing DevOps platform API via bk-cli devops system subcommands.

CRITICAL — Before starting, you MUST first use the Read tool to read ../bk-cli-shared/SKILL.md. The shared skill handles authentication, context, tenant, stage, dry-run, verbose, header/body, and general request rules; this skill only supplements devops the command's own grouping, parameter semantics, and common usage.

First determine the command form

  • bk-cli devops now only handles grouping and has no direct action itself.
  • You must first determine which subsystem the requirement belongs to, then generate bk-cli devops <subsystem> <action>。
  • For "build, artifact, view, start/stop build", prioritize pipeline。
  • For "CodeCC, alarm, defect, statistics, taskId, gongfengId", prioritize codecc。
  • For "Stream, Gongfeng, YAML pipeline, manual trigger, gitProjectId", prioritize stream。

Current coverage

Currently devops system is organized into three subsystems:

  • bk-cli devops pipeline:get_build_list、get_build_status、get_build_start_info、get_artifactory_list、get_artifactory_user_download_url、get_artifactory_third_party_download_url、get_view_pipelines、start_build、stop_build
  • bk-cli devops codecc:get_task_detail、get_gf_defect_detail_by_task_id、get_defect_detail_by_task_id、get_pipeline_defect_detail、get_gf_defect_detail、get_pipeline_defect_statistic、get_gf_defect_statistic、get_gf_defect_statistic_by_task_id、get_defect_statistic_by_task_id
  • bk-cli devops stream:get_pipelines_list_info、get_name2pipeline_info、get_pipelines_manual_trigger_info、trigger

Input conventions and common pitfalls

  • CLI flag names remain the same as the upstream interface and are not locally rewritten to snake_case; pass them directly using the interface parameter names, for example projectId、pipelineId、buildNo、taskId、pageSize、yamlPath。
  • pipeline in the subcommand, projectId is the BlueKing project English name, not a numeric ID.
  • pipelineId is the pipeline ID, usually with the p- prefix;buildId is the build ID, usually with the b- prefix.
  • codecc For related commands, first distinguish the query entry point: if there is taskId prioritize querying by task; if there is pipelineId use the pipeline dimension; if there is gongfengId use the Gongfeng open source governance dimension.
  • stream get_pipelines_list_info uses the path parameter gitProjectId, whose value is the Gongfeng project numeric ID.
  • In the remaining Stream interfaces, projectId is not an English name, but a fixed format git_${工蜂项目ID}。
  • start_build When --body is not passed, an empty JSON object is sent {}; if the user has already prepared the startup parameters, pass through directly --body。
  • stream trigger must explicitly pass the complete JSON --body, and cannot be omitted.

Approach to choosing commands

Pipeline

Applicable scenarios: Query build history, view build status, get manual startup parameters, query artifacts, get download links, view pipelines under a view, start or stop builds.

Representative commands:

bk-cli devops pipeline get_build_list --projectId myproject --pipelineId p-xxx
bk-cli devops pipeline get_build_status --projectId myproject --buildId b-xxx
bk-cli devops pipeline get_build_start_info --projectId myproject --pipelineId p-xxx
bk-cli devops pipeline get_artifactory_list --projectId myproject --pipelineId p-xxx --buildId b-xxx --page 1 --pageSize 20
bk-cli devops pipeline get_artifactory_user_download_url --projectId myproject --artifactoryType PIPELINE --path /demo/pkg.tgz
bk-cli devops pipeline get_artifactory_third_party_download_url --projectId myproject --artifactoryType PIPELINE --path /demo/pkg.tgz --ttl 600
bk-cli devops pipeline get_view_pipelines --projectId myproject --viewId allPipeline --page 1 --pageSize 20
bk-cli devops pipeline start_build --projectId myproject --pipelineId p-xxx
bk-cli devops pipeline stop_build --projectId myproject --pipelineId p-xxx --buildId b-xxx

Additional notes:

  • get_build_list is often used with status、trigger、page、pageSize together.
  • get_view_pipelines is used to query the pipeline list by view; if the user mentions view, filtering pipeline names, or filtering by creator, prioritize it.
  • start_build supports --buildNo, and also supports passing the complete startup parameters via --body .

CodeCC

Applicable scenarios: Query task details, ordinary task alarm details, Gongfeng governance alarm details, query alarms by pipeline, query various statistics.

Representative commands:

bk-cli devops codecc get_task_detail --taskId 123456789
bk-cli devops codecc get_defect_detail_by_task_id --taskId 123456789 --pageNum 1 --pageSize 20
bk-cli devops codecc get_gf_defect_detail_by_task_id --taskId 123456789 --dimension SECURITY
bk-cli devops codecc get_pipeline_defect_detail --pipelineId p-xxx --dimension STANDARD
bk-cli devops codecc get_gf_defect_detail --gongfengId 12345 --toolName COVERITY
bk-cli devops codecc get_pipeline_defect_statistic --pipelineId p-xxx --dimension SECURITY
bk-cli devops codecc get_gf_defect_statistic --gongfengId 12345
bk-cli devops codecc get_gf_defect_statistic_by_task_id --taskId 123456789
bk-cli devops codecc get_defect_statistic_by_task_id --taskId 123456789

Additional notes:

  • toolName and dimension often appear together; if the user explicitly provides the tool name, pass it through directly.
  • Most detail interfaces support buildId, and when not passed, data is retrieved from the latest build by default.
  • pageNum / pageSize is a common pagination parameter for this set of CodeCC APIs; do not mistakenly write it as page。

Stream

Use cases: Query the Stream pipeline list under a Gongfeng project, query pipelines by YAML path, get manual trigger information, and trigger Stream pipelines.

Representative commands:

bk-cli devops stream get_pipelines_list_info --gitProjectId 12345
bk-cli devops stream get_name2pipeline_info --projectId git_12345 --yamlPath .ci/demo.yml
bk-cli devops stream get_pipelines_manual_trigger_info --projectId git_12345 --pipelineId p-xxx --branchName main
bk-cli devops stream trigger --projectId git_12345 --pipelineId p-xxx --body '{"path":".ci/demo.yml","branch":"main","projectId":"git_12345","customCommitMsg":"manual trigger"}'

Additional notes:

  • gitProjectId and projectId=git_<id> are easily confused; first distinguish the parameter names by action before generating commands.
  • yamlPath is usually .ci/*.yml or .ci/*.yaml。
  • trigger 's --body must be consistent with the upstream trigger contract; if the user only provides scattered fields, do not arbitrarily fill in missing fields.