manage-cde
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseManage CDE
管理CDE
Configure on-demand Cloud Development Environments with workspace templates, auto-hibernation, and cost controls in Harness.
在Harness中配置带有工作区模板、自动休眠和成本控制功能的按需云开发环境。
Instructions
操作说明
Step 1: Establish Scope
步骤1:确定范围
Confirm the user's org, project, team, and technology stack.
Call MCP tool: harness_list
Parameters:
resource_type: "project"
org_id: "<organization>"确认用户的组织、项目、团队和技术栈。
调用MCP工具: harness_list
参数:
resource_type: "project"
org_id: "<organization>"Step 2: Identify the CDE Task
步骤2:明确CDE任务
Determine which workflow the user needs:
- On-Demand Environment Setup -- Environment templates with resource allocation and lifecycle
- Workspace Standardization -- Pre-configured templates per team/stack with consistent tooling
确定用户需要的工作流:
- 按需环境搭建 -- 包含资源分配和生命周期管理的环境模板
- 工作区标准化 -- 为各团队/技术栈配置的预装一致工具的模板
Step 3: Configure On-Demand Environments
步骤3:配置按需环境
Gather from the user:
- Technology stack and runtime version
- Cloud provider (AWS, GCP, Azure)
- IDE preference (VS Code browser, VS Code SSH, JetBrains Gateway)
- Git provider for auto-clone on start
Design the environment template:
Resource allocation:
- Default size (e.g., 4 vCPU, 8GB RAM) with upgrade options
- Persistent storage for workspace files
- Ephemeral storage that clears on stop
Lifecycle configuration:
- Provisioning trigger: developer request, PR creation, or branch push
- Start time target (under 30 seconds recommended)
- Auto-stop after idle timeout (default 30 minutes)
- Persistent mode option for long-running work
Integrations:
- Secret injection from Harness Secrets, Vault, or cloud secret managers
- Supporting services (databases, caches, message queues) via Docker Compose or Kubernetes
- Custom access URL pattern (e.g., {user}-{env}.dev.company.com)
Cost controls:
- Daily cost cap per environment
- Team-level monthly budget
- Auto-hibernation for idle environments
向用户收集以下信息:
- 技术栈及运行时版本
- 云服务商(AWS、GCP、Azure)
- IDE偏好(VS Code浏览器版、VS Code SSH、JetBrains Gateway)
- 启动时自动克隆代码的Git服务商
设计环境模板:
资源分配:
- 默认规格(如4核CPU、8GB内存)及升级选项
- 用于存储工作区文件的持久化存储
- 停止时自动清空的临时存储
生命周期配置:
- 触发配置:开发者请求、PR创建或分支推送
- 启动时间目标(建议30秒以内)
- 闲置超时后自动停止(默认30分钟)
- 适用于长期工作的持久化模式选项
集成配置:
- 从Harness Secrets、Vault或云密钥管理器注入密钥
- 通过Docker Compose或Kubernetes部署支持服务(数据库、缓存、消息队列)
- 自定义访问URL规则(如{user}-{env}.dev.company.com)
成本控制:
- 单环境每日成本上限
- 团队级月度预算
- 闲置环境自动休眠
Step 4: Create Workspace Templates
步骤4:创建工作区模板
When standardizing across teams, create templates per role/stack:
Backend Service Developer:
- Runtime, build tools, testing frameworks
- Database clients, API testing tools
- Pre-configured debugger and linter
Frontend Developer:
- Node.js runtime, package manager
- Browser dev tools, component library
- Hot-reload and preview server
Full-Stack Developer:
- Combined backend + frontend tooling
- Docker Compose for local service mesh
- API mocking tools
Platform / DevOps Engineer:
- kubectl, Helm, Terraform, cloud CLIs
- Monitoring and observability tools
- Infrastructure testing frameworks
Each template should include:
- Base image and pre-installed tools
- IDE extensions/plugins list
- Git hooks and code formatting config
- Environment variables and secrets
为团队标准化配置时,按角色/技术栈创建模板:
后端服务开发者:
- 运行时、构建工具、测试框架
- 数据库客户端、API测试工具
- 预配置的调试器和代码检查工具
前端开发者:
- Node.js运行时、包管理器
- 浏览器开发工具、组件库
- 热重载和预览服务器
全栈开发者:
- 整合后端+前端工具
- 用于本地服务网格的Docker Compose
- API模拟工具
平台/DevOps工程师:
- kubectl、Helm、Terraform、云服务商CLI
- 监控与可观测性工具
- 基础设施测试框架
每个模板应包含:
- 基础镜像和预装工具
- IDE扩展/插件列表
- Git钩子和代码格式化配置
- 环境变量和密钥
Examples
示例
- "Set up cloud dev environments for our backend team" -- Configure on-demand CDEs with Java/Go tooling and auto-hibernation
- "Create workspace templates for frontend and backend developers" -- Standardized templates with stack-specific tooling
- "Configure auto-hibernation to reduce CDE costs" -- Set idle timeout and daily cost caps
- "Provision a dev environment when a PR is created" -- Configure PR-triggered ephemeral environments
- "为我们的后端团队搭建云开发环境" -- 配置带有Java/Go工具和自动休眠功能的按需CDE
- "为前端和后端开发者创建工作区模板" -- 带有技术栈专属工具的标准化模板
- "配置自动休眠以降低CDE成本" -- 设置闲置超时和每日成本上限
- "创建PR时自动提供开发环境" -- 配置PR触发的临时环境
Performance Notes
性能注意事项
- Start time under 30 seconds requires pre-built images -- avoid installing tools at startup.
- Auto-hibernation timeout should balance developer productivity (too short = friction) with cost (too long = waste).
- Persistent storage should be sized for the repo plus build artifacts -- undersizing causes build failures.
- Pre-pull common base images to reduce cold start times.
- 要实现30秒内启动,需使用预构建镜像——避免在启动时安装工具。
- 自动休眠超时需平衡开发者效率(过短会造成阻碍)与成本(过长会产生浪费)。
- 持久化存储的大小应适配代码仓库加上构建产物——容量不足会导致构建失败。
- 预拉取常用基础镜像以缩短冷启动时间。
Troubleshooting
故障排查
Environment Slow to Start
环境启动缓慢
- Check if the base image is being pulled from a remote registry -- use a local cache or pre-pull
- Reduce the number of tools installed at startup -- bake them into the base image
- Verify network connectivity to the Git provider for auto-clone
- 检查基础镜像是否从远程仓库拉取——使用本地缓存或预拉取
- 减少启动时安装的工具数量——将其打包进基础镜像
- 验证与Git服务商的网络连接是否正常,确保自动克隆功能可用
Environment Auto-Stopping Too Aggressively
环境自动停止过于频繁
- Increase the idle timeout for developers doing research or design work
- Enable persistent mode for long-running tasks
- Check that IDE keepalive signals are reaching the CDE controller
- 为从事研究或设计工作的开发者延长闲置超时时间
- 为长期运行的任务启用持久化模式
- 检查IDE的保活信号是否能传达到CDE控制器
Cost Overruns
成本超支
- Review environments that have been running for more than 24 hours
- Check for orphaned environments from deleted branches
- Verify auto-hibernation is enabled for all non-production environments
- 检查运行时长超过24小时的环境
- 排查已删除分支遗留的孤立环境
- 确认所有非生产环境已启用自动休眠