XMC Upgrade Environment
Upgrades an existing XManager on Cloud (XMC) environment on GKE to the latest current branch state using the deployment configuration YAML.
- License 许可
- Apache-2.0
- 所属仓库
- google/xmc
- 最近更新
- 2026-11-14
- Stars
- ★ 8
- Forks
- 0
01 前言 Front Matter
- name
- XMC Upgrade Environment
- description
- Upgrades an existing XManager on Cloud (XMC) environment on GKE to the latest current branch state using the deployment configuration YAML.
03 SKILL.md 正文
Upgrade XMC Environment Workflow
This skill guides the agent through upgrading an existing deployed XManager on Cloud (XMC) environment on Google Kubernetes Engine (GKE) so that it runs the latest code from the current local repository branch (HEAD), leveraging the deployment configuration YAML file.
[!IMPORTANT] All execution steps in this skill MUST strictly adhere to the policy rules defined in Skills & Automation Guidelines and Core Engineering Standards.
[!CAUTION] Exclusive Execution Tool Policy: Environment upgrades MUST be performed EXCLUSIVELY using the unified development environment CLI
python3 tools/dev_env/dev_env.py gke-upgrade(or legacypython3 ./tools/dev_env/upgrade_dev_env.py). Agents MUST NOT run manualhelm upgrade,kubectl apply,kubectl set image, orgcluster deploycommands for upgrades. If the user does not specify a specific upgrade step, run the entire upgrade script (or run step-by-step using--only <step>or--start-from <step>depending on the prompt). If a step fails or is interrupted, troubleshoot script inputs or resume usingpython3 tools/dev_env/dev_env.py gke-upgrade --start-from <step>or--only <step>.
[!CAUTION] Authentication Integrity Policy: Under no circumstances should
gke-upgradebe invoked withauth.mockAuth="true"orauth.disableAuthentication="true"unless the user explicitly requests and confirms mock authentication. Published images are built without themockauthGo build tag, so every XMC service refuses to start when either flag is true. Always maintain the production OAuth/IAP authentication pipeline configured indeploy/ctk_v2/xmanager-cloud-deployment.yaml.
graph TD
Start[Start Upgrade] --> CheckEnv["Check configuration YAML"]
CheckEnv --> CheckRun["Run python3 tools/dev_env/dev_env.py gke-upgrade --only check"]
CheckRun --> MigrateCheck["Run python3 tools/dev_env/dev_env.py gke-upgrade --only migrate"]
MigrateCheck -->|No pending migrations| AutoRun["Run python3 tools/dev_env/dev_env.py gke-upgrade --start-from images"]
MigrateCheck -->|"Pending migrations (Exit 10)"| PromptUser["Prompt User to run migrations"]
PromptUser -->|User declines| Abort["Abort Upgrade"]
PromptUser -->|User approves| AutoRunMigrate["Run python3 tools/dev_env/dev_env.py gke-upgrade --start-from migrate --run-migrations"]
AutoRunMigrate --> Verify["Verification & Validation"]
AutoRun --> Verify
Verify -->|All checks pass| L["Report completed upgrade & healthy rollout"]
1. Pre-flight CLI & Config Checks
CLI Tool Checks
Before running any upgrade step, verify that the required CLI tools are installed and operational:
| CLI Tool | Verification Command | Expected Successful Outcome |
|---|---|---|
gcloud |
gcloud --version |
Prints Google Cloud SDK version info |
kubectl |
kubectl version --client |
Prints Kubernetes client version |
helm |
helm version |
Prints Helm client version (minimum 3.14.0) |
bazel |
bazel --version |
Prints Bazel version |
[!CAUTION] Check Action: If any CLI check fails (command not found or returns error):
- Rule out PATH first: Apply PATH-First Diagnosis for Missing CLIs; if the binary is found, add its directory to
PATHand re-run the check.- If still failing, stop execution immediately.
- Alert the user about the missing/broken CLI dependency.
- Provide installation instructions and do not proceed.
Configuration File Verification (YAML)
Verify that the deployment configuration YAML file exists. By default, the script looks for deploy/ctk_v2/xmanager-cloud-deployment.yaml.
If you need to use a custom configuration file, you must pass it using the --config (or -c) flag.
You can optionally define environment variable overrides (e.g., PROJECT_ID, K8S_NAMESPACE, XMANAGER_ENV) in your active shell before running the script to bypass values defined in the YAML configuration. You can copy .env.example to .env and export them: set -o allexport; source .env; set +o allexport.
If no configuration file is found at the default path:
- Search for alternatives: Check if there are any other
*-deployment.yamlfiles indeploy/ctk_v2/. - Handle missing config:
- If other configuration files are found, ask the user which one they want to use and run the script with
--config <path>. - If no configuration files are found, stop execution and instruct the user to create a deployment configuration (referring to
INSTALL.mdor thexmc_deployskill) before upgrading.
- If other configuration files are found, ask the user which one they want to use and run the script with
2. Automated Dev Upgrade (tools/dev_env/dev_env.py gke-upgrade)
Use the unified environment tool (python3 tools/dev_env/dev_env.py gke-upgrade or legacy upgrade_dev_env.py / upgrade command) to execute the environment upgrade.
Step 1: Run Configuration & Authentication Checks
Validate configuration in YAML, authenticate with Google Cloud and GKE, and verify that the target Kubernetes namespace exists:
python3 tools/dev_env/dev_env.py gke-upgrade --only check
Step 2: Check for Pending Database Migrations
Verify if there are any pending Spanner database migrations:
python3 tools/dev_env/dev_env.py gke-upgrade --only migrate
[!IMPORTANT] Migration Decision:
- If the command succeeds (Exit 0): No pending migrations are found. Proceed to Step 3.
- If the command exits with code 10: Pending migrations were detected.
- Stop execution and communicate the pending migrations status to the user.
- Ask the user if they want to run the pending migrations.
- If user says YES: Proceed to Step 3 and append
--run-migrationsflag to the command.- If user says NO: Abort the upgrade workflow and report to the user that upgrade was cancelled due to declined migrations.
Step 3: Execute Upgrade
If no migrations were pending, or if the user approved running migrations:
- Case A: No pending migrations:
Run the upgrade starting from the
imagesstep (skipping migration step):python3 tools/dev_env/dev_env.py gke-upgrade --start-from images - Case B: User approved migrations:
Run the upgrade starting from
migratestep and authorize migration execution:python3 tools/dev_env/dev_env.py gke-upgrade --start-from migrate --run-migrations
[!NOTE] During the
appstep,gke-upgradeautomatically re-compiles the Cluster Toolkit blueprint (gcluster create deploy/ctk_v2/xmanager-cloud.yaml -d ... --force) and exports outputs across prerequisite groups (primary,compute) so that all updated feature flags, environment variables, and Helm values are propagated toctk-out/before applying Kubernetes workload updates.
Resuming or Running Specific Steps (Advanced / Troubleshooting)
If the upgrade fails at a specific phase, or if you need to rerun a specific part of the workflow:
- Resume from a specific step: To resume from a failed phase (
check,migrate,images,app,restart,verify):python3 tools/dev_env/dev_env.py gke-upgrade --start-from <failed_step> - Execute a single step: To execute only one specific step:
Valid steps:python3 tools/dev_env/dev_env.py gke-upgrade --only <step>check,migrate,images,app,restart,verify
4. Verification and Validation
Ensure the Python virtual environment is activated, then run the verification script from the repository root to verify that all upgraded pods are running and endpoints respond correctly:
ENVIRONMENT="${XMANAGER_ENV:-dev}" REGION="${GCP_REGION:-us-central1}" PROJECT_ID="$PROJECT_ID" python3 ./deploy/ctk_v2/verify_xmc.py
[!TIP] Once the verification script reports that all pods are healthy and services are ready, confirm to the user that the XMC environment upgrade is complete and running the current branch state.
04 同仓库更多 Skills
XMC Trajectory Comparison
Validates proposed skill or rule changes by executing concurrent A/B benchmark subagents on clean baseline vs candidate worktrees, comparing trajectories, and tearing down test resources.
XMC Review PR
Interactive multi-agent PR review workflow enforcing code rules, open direction discussions, explicit confirmation gates, inline comment deduplication, and follow-up re-review verification.
XMC Release
Orchestrates an end-to-end XMC release workflow — deploying the latest main to nightly, running and verifying e2e tests, capturing visual snapshot galleries, generating and iterating on structured release notes with the user, and publishing the release. Use when preparing, orchestrating, or publishing a formal XMC release from main.
XMC PR Split Verification
Analyzes pull request diffs exceeding size thresholds (400 prod / 1000 total / 1000 docs) to enforce Single Responsibility Principle (SRP), evaluate vertical slice splitting feasibility, eliminate dead code, and plan gh-stack PR stacks.
XMC Iterative Reflection
Audits active session trajectory, thought history, and PR review comments to identify friction points, rule gaps, missing helper tools, and token inefficiencies. Use when requested by the user, after major implementations, or following PR review comment resolutions.
XMC Generate Release Notes
Generates structured, intelligent release notes segmented into out-of-the-box user-facing changes, behind-the-flag preview features, and operational/dev progress.