SuperAPI AI Directory

bk-cli-paas

General & other

View repository

Updated 10-16 08:45

About this skill

bk-cli paas — BlueKing PaaS application deployment capabilities

Used to call BlueKing PaaS application, module, deployment, log, process, environment variable, and enhanced service related APIs via bk-cli paas .

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 paas the command's own semantics and input conventions.

Current coverage

This skill currently covers the following commands:

  • get_minimal_app_list
  • get_app_info
  • list_app_modules
  • get_repo_branches
  • get_deployments_list
  • streams_history_events
  • list_processes
  • module_env_released_info
  • module_env_released_state
  • search_standard_log_with_post
  • create_module
  • get_deployment_result
  • deploy_with_module
  • create_cloud_native_app
  • list_config_vars
  • get_config_var
  • set_config_var_value
  • list_module_services
  • bind_service
  • get_service_instance_by_module
  • unbind_service

Input conventions

  • These APIs all require application authentication + user authentication + API resource permissions. Before calling, ensure that the credentials of the current context satisfy both the application identity and the user identity, and that the corresponding application has applied for the API permissions for these APIs.
  • The application ID uses the PaaS application app_code; some APIs use the upstream original parameter name code。
  • The module name uses the PaaS module name; when no module is specified, the default module defaultis usually used. The related commands have set the default value of module or module_name to default。
  • Environment parameters use the API's original parameter names:env or environment, with common values being stag or prod. Write operations default to using stagfirst, unless the user explicitly requests prod。
  • deploy_with_module、create_module、create_cloud_native_app、set_config_var_value、bind_service and other complex request bodies are passed in via the shared --body '<json>' ; to view the complete structure, run bk-cli paas <action> -h --body-schema。

Common workflows

  1. Use get_minimal_app_list to locate the application ID.
  2. Use get_app_info to confirm the application type, language, modules, and most recent deployment time.
  3. Use list_app_modules to confirm the module name; when the user does not specify one, prefer default。
  4. Before deploying from a code repository, use get_repo_branches to obtain name / type / revision, and fill it into deploy_with_module of --body。
  5. After deployment, use get_deployments_list to find the deployment task, then use streams_history_events to view the log stream.
  6. When you need to view the runtime state, use module_env_released_state、list_processes or search_standard_log_with_post。
  7. When you need to manage environment variables, use list_config_vars、get_config_var、set_config_var_value。
  8. When you need to manage enhanced service bindings, use list_module_services、bind_service、get_service_instance_by_module、unbind_service。
  9. When you need to create a cloud-native application or module, use create_cloud_native_app or create_module。

Commands

get_minimal_app_list

bk-cli paas get_minimal_app_list
bk-cli paas get_minimal_app_list --app_status normal --source_origin 1
  • Get a concise list of Apps that the current user has permission for.
  • Call path:GET /bkapps/applications/lists/minimal
  • Commonly viewed fields:results[].application.code、results[].application.name。

get_app_info

bk-cli paas get_app_info --app_code bk-demo
  • View application information. Before write operations, call it once to confirm app_code; before creating a module, confirm that application.type is cloud_native。
  • Call path:GET /bkapps/applications/{app_code}/
  • Commonly viewed fields:application.type、application.language、application.modules、application.last_deployed_date。

list_app_modules

bk-cli paas list_app_modules --app_code bk-demo
bk-cli paas list_app_modules --app_code bk-demo --source_origin 1
  • View all modules under the application.
  • Call path:GET /bkapps/applications/{app_code}/modules/
  • For multi-module applications, first confirm whether to use default or another module;is_default=true indicates the default module.

get_repo_branches

bk-cli paas get_repo_branches --app_code bk-demo
bk-cli paas get_repo_branches --app_code bk-demo --module default
  • Get the code repository branch information for the application module.
  • Call path:GET /bkapps/applications/{app_code}/modules/{module}/repo/branches/
  • In the response, results[].name corresponds to the deployment body's version_name,results[].type corresponds to version_type,results[].revision can be filled into revision。
  • A pure image application has no repository; when encountering repository-related errors, switch to the image deployment path and do not repeatedly retry that API.

get_deployments_list

bk-cli paas get_deployments_list --app_code bk-demo
bk-cli paas get_deployments_list --app_code bk-demo --environment prod --limit 12 --offset 0
  • Get the application module deployment history; the default module is default。
  • Call path:GET /bkapps/applications/{app_code}/modules/{module}/deployments/lists/
  • Optional query:environment、operator、limit、offset。
  • In the response, results[].id or results[].deployment_id can be used as the streams_history_events of channel_id。

streams_history_events

bk-cli paas streams_history_events --channel_id 22d0e9c8-9cfc-45a5-b5a8-718137c515db
bk-cli paas streams_history_events --channel_id 22d0e9c8-9cfc-45a5-b5a8-718137c515db --last_event_id 10
  • Get the deployment log stream;channel_id is usually the deployment task ID.
  • Call path:GET /streams/{channel_id}/history_events
  • There is rate limiting, about 10 times per 60 seconds per user; do not tight loop.

list_processes

bk-cli paas list_processes --app_code bk-demo --env stag
bk-cli paas list_processes --app_code bk-demo --module default --env prod --release_id 123
  • Get information about all processes and instances in the application environment.
  • Call path:GET /bkapps/applications/{app_code}/modules/{module}/envs/{env}/processes/list/
  • Commonly viewed fields: replica, instance Running / ready, restart count.

module_env_released_info

bk-cli paas module_env_released_info \
  --code bk-demo \
  --environment prod
  • Query the environment deployment information of an application module; the default module is default。
  • Call path:GET /bkapps/applications/{code}/modules/{module_name}/envs/{environment}/released_info/

module_env_released_state

bk-cli paas module_env_released_state \
  --code bk-demo \
  --environment prod
  • Query the environment deployment status of an application module; compared with module_env_released_info , it has more is_offlined, default access entry, and other information.
  • Call path:GET /bkapps/applications/{code}/modules/{module_name}/envs/{environment}/released_state/
  • Commonly viewed fields:is_offlined、exposed_link.url、default_access_entrance.url. If it has never been published, the upstream may return APP_NOT_RELEASED。

search_standard_log_with_post

bk-cli paas search_standard_log_with_post \
  --app_code bk-demo \
  --body '{"query":{"query_string":"","terms":{"environment":["stag"]}}}'

bk-cli paas search_standard_log_with_post \
  --app_code bk-demo \
  --module default \
  --time_range customized \
  --start_time '2026-08-24 10:00:00' \
  --end_time '2026-08-24 11:00:00' \
  --body '{"query":{"query_string":"error","terms":{"environment":["prod"],"process_id":["web"]}}}'
  • Query the application standard output logs; the default module is default, and by default it queries the most recent 1h。
  • Call path:POST /bkapps/applications/{app_code}/modules/{module}/log/standard_output/list/
  • Optional query:time_range、start_time、end_time、limit、scroll_id。
  • When filtering by environment and process, put them in the body's query.terms , for example environment or process_id。

create_module

bk-cli paas create_module \
  --app_code bk-demo \
  --body '{"name":"api","source_config":{"source_init_template":"dj2_with_auth","source_origin":2},"bkapp_spec":{"build_config":{"build_method":"buildpack"}}}'
  • Create a module for a cloud-native application. Before calling, first use get_app_info to confirm that the application type is cloud_native。
  • Call path:POST /bkapps/applications/{app_code}/modules/
  • Required fields in the request body:name、source_config、bkapp_spec; common buildpack scenarios also require filling in bkapp_spec.build_config.build_method with buildpack. For the complete structure, see bk-cli paas create_module -h --body-schema。

get_deployment_result

bk-cli paas get_deployment_result \
  --app_code bk-demo \
  --deployment_id 12345
  • Query the deployment task result; the default module is default。
  • Call path:GET /bkapps/applications/{app_code}/modules/{module}/deployments/{deployment_id}/result/

deploy_with_module

bk-cli paas deploy_with_module \
  --app_code bk-demo \
  --env prod \
  --body '{"revision":"{commit_id}","version_type":"branch","version_name":"master"}'
  • Trigger an App deployment that supports multiple modules; the default module is default。
  • Call path:POST /bkapps/applications/{app_code}/modules/{module}/envs/{env}/deployments/
  • Request body fields:revision is the source code repository version number, optional;version_name is the branch or tag name, required;version_type is the version type, required; svn supports trunk/tag, git supports branch。

create_cloud_native_app

bk-cli paas create_cloud_native_app \
  --body '{"code":"bk-demo","name":"bk-demo","source_config":{"source_origin":1,"source_repo_url":"https://github.com/octocat/helloWorld.git","source_repo_auth_info":{},"source_dir":"","source_init_template":"docker"},"bkapp_spec":{"build_config":{"build_method":"dockerfile","dockerfile_path":"Dockerfile"}}}'
  • Create a cloud-native application.
  • Call path:POST /bkapps/cloud-native/
  • Root fields of the request body:code、name、source_config、bkapp_spec is required;app_tenant_mode、auth_code、is_plugin_app、advanced_options is passed as needed.
  • source_config.source_origin indicates the source code origin; common values:1 is an authorized code repository;6 corresponds to the upstream SourceOrigin.CNATIVE_IMAGE, indicating a cloud-native application that only hosts images.
  • bkapp_spec.build_config.build_method supports buildpack、dockerfile、custom_image;dockerfile scenarios usually require dockerfile_path,custom_image scenarios require image_repository and usually require processes。

list_config_vars

bk-cli paas list_config_vars --app_code bk-demo
bk-cli paas list_config_vars --app_code bk-demo --module default
  • View the environment variable list of an application module; the default module is default。
  • Call path:GET /bkapps/applications/{app_code}/modules/{module}/config_vars/

get_config_var

bk-cli paas get_config_var --app_code bk-demo --config_var_key FOO
bk-cli paas get_config_var --app_code bk-demo --module default --config_var_key FOO
  • Query a single environment variable by key; the default module is default。
  • Call path:GET /bkapps/applications/{app_code}/modules/{module}/config_vars/{config_var_key}/

set_config_var_value

bk-cli paas set_config_var_value \
  --app_code bk-demo \
  --config_var_key FOO \
  --body '{"environment_name":"stag","value":"bar","description":"demo config","is_sensitive":false}'
  • Create or update an environment variable by key; the default module is default。
  • Call path:POST /bkapps/applications/{app_code}/modules/{module}/config_vars/{config_var_key}/
  • Required fields in the request body:environment_name; common values are stag、prod or _global_. When creating a new variable, also pass value。
  • For sensitive variables, set is_sensitive=true; values in query results may be masked by the upstream.

list_module_services

bk-cli paas list_module_services --app_code bk-demo
bk-cli paas list_module_services --app_code bk-demo --module default
  • View the enhanced services of an application module; the default module is default。
  • Call path:GET /bkapps/applications/{app_code}/modules/{module}/services/
  • The response is usually grouped by bound, shared, and unbound services; before binding, you can confirm from the unbound services service_id。

bind_service

bk-cli paas bind_service \
  --body '{"code":"bk-demo","service_id":"svc-uuid","module_name":"default"}'
  • Bind the application module and the enhanced service.
  • Call path:POST /services/service-attachments/
  • Required request body fields:code、service_id;module_name If not passed, it will be handled by the upstream according to the default module; it is recommended to pass it explicitly default。
  • Pass this when you need to specify a service plan plan_id, and pass this when you need a per-environment plan env_plan_id_map。

get_service_instance_by_module

bk-cli paas get_service_instance_by_module \
  --app_code bk-demo \
  --service_id svc-uuid
  • View the details of the binding relationship between the application module and the enhanced service; the default module is default。
  • Call path:GET /bkapps/applications/{app_code}/modules/{module}/services/{service_id}/

unbind_service

bk-cli paas unbind_service \
  --app_code bk-demo \
  --service_id svc-uuid
  • Unbind the application module and the enhanced service; the default module is default。
  • Call path:DELETE /bkapps/applications/{app_code}/modules/{module}/services/{service_id}/
  • Unbinding is a write operation; before actual execution, it is recommended to first add --dry-run to confirm app, module, and service_id.