You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何通过CLI为Urban Code Deploy快照中的组件版本添加状态

Adding Status to Component Versions in an Urban Code Deploy Snapshot via CLI

Got it! Since you already know how to add statuses to snapshots via the UCD CLI, adding statuses to component versions within a snapshot is pretty straightforward—here's how to do it step by step:

Prerequisites

First, make sure your UCD CLI (udclient) is configured correctly (you've set up authentication, target UCD server URL, etc.)—since you've already worked with snapshot statuses, you probably have this covered!

Step 1: Identify the Component Version(s) in Your Snapshot

You'll need either the component version ID or the combination of component name + version number to target the specific component version in your snapshot.

To get details about your snapshot and its component versions, run:

udclient getSnapshot --snapshot "YOUR_SNAPSHOT_NAME" --application "YOUR_APPLICATION_NAME"

This returns a JSON object. Look for the componentVersions array—each entry includes the component's name, version number, and unique id (the component version ID).

Step 2: Add Status to a Single Component Version

Use the addComponentVersionStatus command to apply your desired status. You have two ways to target the component version:

Option 1: Using Component Name + Version Number (more intuitive)

If you know the component name and its version in the snapshot, run:

udclient addComponentVersionStatus \
  --component "YOUR_COMPONENT_NAME" \
  --version "YOUR_COMPONENT_VERSION" \
  --status "Snap ready for Release"

Option 2: Using Component Version ID

If you have the component version ID from Step 1, use this instead:

udclient addComponentVersionStatus \
  --componentVersion "COMPONENT_VERSION_ID" \
  --status "Snap ready for Release"

Step 3: Batch Add Status to All Component Versions in the Snapshot

If you want to apply the same status to every component version in the snapshot, you can automate this with a shell script + jq (a JSON parsing tool):

# Fetch snapshot details, extract component version IDs, then apply status to each
udclient getSnapshot --snapshot "YOUR_SNAPSHOT_NAME" --application "YOUR_APPLICATION_NAME" \
  | jq -r '.componentVersions[].id' \
  | while read version_id; do
      udclient addComponentVersionStatus --componentVersion "$version_id" --status "Snap ready for Release"
    done

Important Notes

  • The status "Snap ready for Release" must already exist as a component version status in your UCD instance (either globally or scoped to the specific component). If it doesn't, you'll need to create it first via the UCD UI or CLI.
  • Double-check that you're targeting the correct application, snapshot, component, and version to avoid applying statuses to the wrong assets.

内容的提问来源于stack exchange,提问作者user9473385

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.27 10:06:40