Loading...
Loading...
Compare original and translation side by side
TiltfileTiltfile| Task | Command |
|---|---|
| Start dev environment | |
| Start with terminal log streaming | |
| Start specific resources only | |
| Run in CI/batch mode (exits on success/failure) | |
| Stop and delete deployed resources | |
| Change runtime Tiltfile args | |
| Change runtime args (clear all) | |
tilt upserve_cmdtilt down| 任务 | 命令 |
|---|---|
| 启动开发环境 | |
| 启动并在终端流式输出日志 | |
| 仅启动特定资源 | |
| 以CI/批量模式运行(成功/失败后退出) | |
| 停止并删除已部署的资源 | |
| 修改运行时Tiltfile参数 | |
| 修改运行时参数(清空所有) | |
tilt upserve_cmdtilt down| Task | Command |
|---|---|
| Stream all logs | |
| Stream logs for one resource | |
| Show only errors | |
| Show build logs only | |
| Show runtime logs only | |
| Logs since 5 minutes ago | |
| Last 100 lines | |
| JSON output (for parsing) | |
| 任务 | 命令 |
|---|---|
| 流式输出所有日志 | |
| 流式输出单个资源的日志 | |
| 仅显示错误日志 | |
| 仅显示构建日志 | |
| 仅显示运行时日志 | |
| 显示最近5分钟的日志 | |
| 显示最后100行日志 | |
| JSON格式输出(用于解析) | |
| Task | Command |
|---|---|
| List all resources | |
| Resource status as JSON | |
| Describe a resource in detail | |
| Force rebuild a resource | |
| Enable a disabled resource | |
| Disable a resource | |
| Wait for resource readiness | |
| 任务 | 命令 |
|---|---|
| 列出所有资源 | |
| 以JSON格式查看资源状态 | |
| 查看资源的详细描述 | |
| 强制重建资源 | |
| 启用已禁用的资源 | |
| 禁用资源 | |
| 等待资源就绪 | |
| Task | Command |
|---|---|
| Diagnostics (versions, cluster) | |
| Inspect file watches | |
| Describe a specific file watch | |
| Full engine state dump (JSON) | |
| Full UI state dump | |
| Test Docker build as Tilt would | |
| List API resource types | |
localhost:10350tilt get/describe/trigger| 任务 | 命令 |
|---|---|
| 诊断(版本、集群信息) | |
| 查看文件监听列表 | |
| 查看特定文件监听的详情 | |
| 导出完整引擎状态(JSON格式) | |
| 导出完整UI状态 | |
| 测试Tilt方式的Docker构建 | |
| 列出API资源类型 | |
localhost:10350tilt get/describe/trigger| Situation | Function | Key detail |
|---|---|---|
| Standard Dockerfile | | Watches context dir, auto-injects into k8s |
| Custom toolchain (Bazel, ko, Buildpacks) | | Must tag with |
| Non-Docker builder (Buildah, kaniko) | | Builder handles push independently |
| Docker Compose services | | Manages compose lifecycle |
| Helm charts | | Renders locally, deploys to cluster |
| Kustomize overlays | | Renders locally, deploys to cluster |
| 场景 | 函数 | 关键细节 |
|---|---|---|
| 标准Dockerfile | | 监听上下文目录,自动注入到Kubernetes中 |
| 自定义工具链(Bazel、ko、Buildpacks) | | 必须使用 |
| 非Docker构建工具(Buildah、kaniko) | | 构建工具独立处理镜像推送 |
| Docker Compose服务 | | 管理Compose的生命周期 |
| Helm图表 | | 本地渲染,部署到集群 |
| Kustomize覆盖层 | | 本地渲染,部署到集群 |
| Step | Purpose | Ordering |
|---|---|---|
| Force full rebuild when these files change | Must come first |
| Copy changed files into running container | After fall_back_on |
| Execute command in container (e.g., install deps) | After sync |
| Restart the container process | Must come last |
docker_build('myapp', '.', live_update=[
fall_back_on(['requirements.txt']),
sync('./src', '/app/src'),
run('pip install -r requirements.txt', trigger=['requirements.txt']),
])docker_buildsync()tilt up| 步骤 | 目的 | 顺序 |
|---|---|---|
| 当这些文件变更时强制完整重建 | 必须放在最前面 |
| 将变更的文件复制到运行中的容器内 | 在fall_back_on之后 |
| 在容器内执行命令(例如安装依赖) | 在sync之后 |
| 重启容器进程 | 必须放在最后 |
docker_build('myapp', '.', live_update=[
fall_back_on(['requirements.txt']),
sync('./src', '/app/src'),
run('pip install -r requirements.txt', trigger=['requirements.txt']),
])docker_buildsync()tilt upundefinedundefined
**Parallelism:** Local resources run serially by default. Set `allow_parallel=True` for independent resources. Image builds default to 3 concurrent — adjust with `update_settings(max_parallel_updates=N)`.
**Dependencies:** `resource_deps` gates on first-ever readiness only — once a dependency is ready once, dependents unlock permanently for that session.
**并行性:** 本地资源默认串行运行。对于独立资源,设置`allow_parallel=True`。镜像构建默认支持3个并发任务——可通过`update_settings(max_parallel_updates=N)`调整。
**依赖关系:** `resource_deps`仅在首次就绪时生效——一旦依赖项首次就绪,在本次会话中依赖它的资源将永久解锁。Service crashing? → tilt logs -f <resource> --source runtime
Build failing? → tilt logs -f <resource> --source build
tilt docker -- build <args> (reproduces Tilt's exact build)
Wrong files rebuild? → tilt get filewatches
tilt describe filewatch <name>
Check .tiltignore, watch_settings(ignore=), ignore= param
Force a rebuild? → tilt trigger <resource>
Resource stuck? → tilt describe uiresource <name>
Check resource_deps chain
For CRDs: pod_readiness='ignore'
General diagnostics? → tilt doctor
Full state dump? → tilt dump engine | jq .服务崩溃? → tilt logs -f <resource> --source runtime
构建失败? → tilt logs -f <resource> --source build
tilt docker -- build <args> (复现Tilt的构建流程)
文件重建异常? → tilt get filewatches
tilt describe filewatch <name>
检查.tiltignore、watch_settings(ignore=)、ignore=参数
强制重建? → tilt trigger <resource>
资源卡住? → tilt describe uiresource <name>
检查resource_deps依赖链
对于CRD:设置pod_readiness='ignore'
常规诊断? → tilt doctor
导出完整状态? → tilt dump engine | jq .| Pitfall | Fix |
|---|---|
| Wrap with |
| Live update paths outside docker_build context | Ensure sync local paths fall within context dir |
| Local resources block each other | Set |
| It only checks first-ever readiness, not current version |
| Starlark has no while/try-except/class/recursion | Use for loops, |
| Use |
| Build script MUST tag the image with this env var |
| Trigger paths must also be covered by a sync step |
First | Live update cannot work until a container is running |
| CRD pods stuck in pending | Set |
| 陷阱 | 解决方法 |
|---|---|
| 用 |
| 实时更新路径在docker_build上下文之外 | 确保同步的本地路径在上下文目录内 |
| 本地资源相互阻塞 | 对独立资源设置 |
| 它仅检查首次就绪状态,不检查当前版本 |
| Starlark不支持while/try-except/class/递归 | 使用for循环、 |
| 使用 |
custom_build中未使用 | 构建脚本必须使用此环境变量为镜像打标签 |
| 触发路径必须被某个sync步骤覆盖 |
首次 | 实时更新需要容器运行后才能生效 |
| CRD Pod卡在Pending状态 | 在CRD资源上设置 |
references/api-reference.mdreferences/patterns.mdreferences/api-reference.mdreferences/patterns.md