Scenario-based encapsulation of Tencent Cloud Application Management Platform API to implement instance image updates.
secret_id Secret IDsecret_key Secret Keyaction Operation name,
ModifyComponentImages: Batch update instance imagesDeleteInstance: Destroy instance Use with cautioninstance_url Instance URL, if specified, the following parameters project_id, application_id,
instance_id, environment_name will not be used, instead they will be parsed from the URLproject_id Project IDapplication_id Application IDinstance_id Instance IDenvironment_name Environment nameresult_path If specified, the result will be output as a JSON format string to the specified fileThe following parameters are required for ModifyComponentImages
container_names Container name array, in the same order as container_imagescontainer_images Container image array, in the same order as container_namesmax_surge Maximum number of Pods allowed to exceed the desired scale in each workload during upgrade, default 0max_unavailable Maximum number of unavailable Pods allowed in each workload during upgrade, default 1in_place_update_flag Whether to update in place, default is truedocker run --rm -v $(pwd):$(pwd) -w $(pwd) \ -e PLUGIN_SECRET_ID="xxx" \ -e PLUGIN_SECRET_KEY="xxx" \ -e PLUGIN_ACTION="ModifyComponentImages" \ -e PLUGIN_PROJECT_ID="prj-xxx" \ -e PLUGIN_ENVIRONMENT_NAME="development" \ -e PLUGIN_APPLICATION_ID="app-xxx" \ -e PLUGIN_INSTANCE_ID="tad-xxx" \ -e PLUGIN_CONTAINER_NAMES="xxx-container-1,xxx-container-2" \ -e PLUGIN_CONTAINER_IMAGES="xxx-demo:v2,xxx-demo:t2" \ tencentcom/tencentyun-camp-deploy
Configure a secret file your_secrets.yaml in the secrets (private repository) with the following content:
# your_secrets.yml
SECRET_ID: xxxx
SECRET_KEY: xxx
Configure .cnb.yml to import environment variables from the above file, with the following content:
# Update example image, without using Instance URL
main:
push:
- imports: https://xxx/your_secrets.yml
stages:
- name: camp deploy
image: tencentcom/tencentyun-camp-deploy
settings:
secret_id: $SECRET_ID
secret_key: $SECRET_KEY
action: ModifyComponentImages
project_id: prj-xxx
environment_name: development
application_id: app-xxx
instance_id: tad-xxx
container_names:
- xxx-container-1
- xxx-container-2
container_images:
- xxx-demo:v1
- xxx-demo:t1
# Update example image, using Instance URL
main:
push:
- imports: https://xxx/your_secrets.yml
stages:
- name: camp deploy
image: tencentcom/tencentyun-camp-deploy
settings:
secret_id: $SECRET_ID
secret_key: $SECRET_KEY
action: ModifyComponentImages
instance_url: https://console.cloud.tencent.com/camp/app/instance/info?appId=app-xxx&projectId=prj-xxx&instanceId=tad-xxx&envName=development
container_names:
- xxx-container-1
- xxx-container-2
container_images:
- xxx-demo:v1
- xxx-demo:t1
# Destroy example instance, using Instance URL
main:
push:
- imports: https://xxx/your_secrets.yml
stages:
- name: camp deploy
image: tencentcom/tencentyun-camp-deploy
settings:
secret_id: $SECRET_ID
secret_key: $SECRET_KEY
action: DeleteInstance
instance_url: https://console.cloud.tencent.com/camp/app/instance/info?appId=app-xxx&projectId=prj-xxx&instanceId=tad-xxx&envName=development