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 devopsnow 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_buildbk-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_idbk-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。 pipelinein the subcommand,projectIdis the BlueKing project English name, not a numeric ID.pipelineIdis the pipeline ID, usually with thep-prefix;buildIdis the build ID, usually with theb-prefix.codeccFor related commands, first distinguish the query entry point: if there istaskIdprioritize querying by task; if there ispipelineIduse the pipeline dimension; if there isgongfengIduse the Gongfeng open source governance dimension.stream get_pipelines_list_infouses the path parametergitProjectId, whose value is the Gongfeng project numeric ID.- In the remaining Stream interfaces,
projectIdis not an English name, but a fixed formatgit_${工蜂项目ID}。 start_buildWhen--bodyis not passed, an empty JSON object is sent{}; if the user has already prepared the startup parameters, pass through directly--body。stream triggermust 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_listis often used withstatus、trigger、page、pageSizetogether.get_view_pipelinesis used to query the pipeline list by view; if the user mentions view, filtering pipeline names, or filtering by creator, prioritize it.start_buildsupports--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:
toolNameanddimensionoften 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/pageSizeis a common pagination parameter for this set of CodeCC APIs; do not mistakenly write it aspage。
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:
gitProjectIdandprojectId=git_<id>are easily confused; first distinguish the parameter names by action before generating commands.yamlPathis usually.ci/*.ymlor.ci/*.yaml。trigger's--bodymust be consistent with the upstream trigger contract; if the user only provides scattered fields, do not arbitrarily fill in missing fields.