pulumi-upgrade-provider
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChinesePulumi Upgrade Provider
Pulumi Upgrade Provider
Overview
概述
Run , fix known failures, and rerun until success. Keep git operations read-only in the repo; the tool owns branch/commit/PR state.
upgrade-provider运行工具,修复已知故障,并重试直至成功。在仓库中仅执行只读git操作;分支、提交、PR状态由该工具管理。
upgrade-providerRun Loop
运行流程
- Create output directory:
bash
mkdir -p .pulumi- Run from repo root:
bash
upgrade-provider $ORG/$REPO --repo-path . > .pulumi/upgrade-provider-stdout.txt 2> /dev/null- Wait for completion (can take up to 10 minutes).
- Check for errors by scanning lines starting with
.pulumi/upgrade-provider-stdout.txt.error: - If failed, fix using this skill's (from the skill folder, not the repo), then rerun. For upstream
references/upgrade-provider-errors.mdfailures involving ignoredgo getdirectives orreplace, rerun withunknown revision v0.0.0after applying the documented--target-versionreplacements; preserve the original major/non-major intent and addprovider/go.modonly for actual major version upgrades.--major - If a fix requires creating/amending/removing/rebasing patches, use the skill for the patch workflow.
upstream-patches - If you fixed a conflict, report exact edits (file paths + concrete changes or preserved intent).
- If the upgrade changed patches, run and review applied
./scripts/upstream.sh checkoutcommits:upstream- List commit SHAs/titles from .
upstream - Summarize the intent of each commit in plain language.
- Call out any behavioral changes or risks.
- List commit SHAs/titles from
- On success, proceed to Post-run Tasks.
- 创建输出目录:
bash
mkdir -p .pulumi- 从仓库根目录运行:
bash
upgrade-provider $ORG/$REPO --repo-path . > .pulumi/upgrade-provider-stdout.txt 2> /dev/null- 等待完成(最长可能需要10分钟)。
- 扫描中以
.pulumi/upgrade-provider-stdout.txt开头的行,检查是否存在错误。error: - 如果失败,使用本技能的(来自技能文件夹,而非仓库)进行修复,然后重新运行。对于涉及忽略
references/upgrade-provider-errors.md指令或replace的上游unknown revision v0.0.0失败,在应用文档中记录的go get替换后,添加provider/go.mod参数重新运行;保留原始的主版本/非主版本升级意图,仅在实际主版本升级时添加--target-version参数。--major - 如果修复需要创建/修改/删除/变基补丁,请使用技能处理补丁工作流。
upstream-patches - 如果修复了冲突,请报告确切的修改内容(文件路径+具体变更或保留的意图)。
- 如果升级导致补丁变更,运行并查看已应用的
./scripts/upstream.sh checkout提交:upstream- 列出的提交SHA和标题。
upstream - 用通俗易懂的语言总结每个提交的意图。
- 指出任何行为变更或风险。
- 列出
- 成功后,执行后续任务。
When to Stop and Report Failure
何时停止并报告失败
Stop iterating and report failure if any of these conditions are met:
- Command not found (exit code 127): The tool is not in PATH.
upgrade-provider - Same error 3 times: You've attempted to fix the same error 3 times without success.
- Unknown error pattern: The error is not covered in and you cannot determine a safe fix.
references/upgrade-provider-errors.md - Requires human judgment: The fix needs user input, such as:
- Choosing between multiple valid approaches
- Breaking changes that affect public API
- Deprecation strategies
- Architectural decisions about module organization
When stopping, report:
- The error(s) encountered.
- What fixes were attempted (with file paths and changes).
- Why human intervention is needed.
- Any partial progress.
如果满足以下任一条件,请停止重试并报告失败:
- 命令未找到(退出码127):工具未在PATH中。
upgrade-provider - 同一错误出现3次:尝试修复同一错误3次仍未成功。
- 未知错误模式:错误未在中覆盖,且无法确定安全的修复方案。
references/upgrade-provider-errors.md - 需要人工判断:修复需要用户输入,例如:
- 在多种有效方案中选择
- 影响公共API的破坏性变更
- 弃用策略
- 模块组织的架构决策
停止时,请报告:
- 遇到的错误。
- 尝试过的修复措施(包含文件路径和变更内容)。
- 需要人工干预的原因。
- 任何部分进展。
Post-run Tasks
后续任务
The tool creates a PR on successful upgrade.
- MUST fetch the PR URL for the current branch using read-only commands:
console
gh pr view --json url --jq .url || gh pr list --head "$(git branch --show-current)" --json url --jq '.[0].url'- MUST append a "Fixes applied to unblock upgrade" section to the existing PR body if any fixes were applied (do not overwrite):
console
repo=$(gh repo view --json nameWithOwner --jq .nameWithOwner)
pr_number=$(gh pr view --json number --jq .number)
gh pr view --json body --jq .body > /tmp/pr_body.txt
cat <<'EOF' >> /tmp/pr_body.txt
---工具在升级成功后会创建一个PR。
- 必须使用只读命令获取当前分支的PR URL:
console
gh pr view --json url --jq .url || gh pr list --head "$(git branch --show-current)" --json url --jq '.[0].url'- 如果应用了任何修复措施,必须在现有PR正文后追加“Fixes applied to unblock upgrade”部分(请勿覆盖原有内容):
console
repo=$(gh repo view --json nameWithOwner --jq .nameWithOwner)
pr_number=$(gh pr view --json number --jq .number)
gh pr view --json body --jq .body > /tmp/pr_body.txt
cat <<'EOF' >> /tmp/pr_body.txt
---Fixes applied to unblock upgrade
Fixes applied to unblock upgrade
- <list concrete unblocker edits here, with file paths and intent> EOF
gh api -X PATCH "repos/$repo/pulls/$pr_number" --raw-field body="$(cat /tmp/pr_body.txt)"
Use REST (`gh api`) instead of `gh pr edit` to avoid GraphQL project-card errors. Keep existing body content; only append.- <在此列出具体的解锁修复内容,包含文件路径和意图> EOF
gh api -X PATCH "repos/$repo/pulls/$pr_number" --raw-field body="$(cat /tmp/pr_body.txt)"
使用REST(`gh api`)而非`gh pr edit`以避免GraphQL项目卡片错误。保留现有正文内容;仅追加。Notes
注意事项
- is not supported in older git versions. Use
git rebase --continue --no-editand accept the existing commit message.git rebase --continue - To avoid the editor prompt during , run it with
git rebase --continue(orGIT_EDITOR=true).GIT_EDITOR=:
- 旧版本git不支持。请使用
git rebase --continue --no-edit并接受现有提交信息。git rebase --continue - 为避免时出现编辑器提示,请在运行时添加
git rebase --continue(或GIT_EDITOR=true)。GIT_EDITOR=:
Guardrails
约束规则
- Never commit, push, or create branches manually; only run read-only git commands.
- are allowed because the tool manages git state.
./scripts/upstream.sh checkout|rebase|check_in - Do not stash changes; the tool manages git state.
- 请勿手动提交、推送或创建分支;仅执行只读git命令。
- 允许使用,因为工具会管理git状态。
./scripts/upstream.sh checkout|rebase|check_in - 请勿暂存变更;工具会管理git状态。
References
参考资料
- Use this skill's (from the skill folder, not the repo) for patch conflict, ignored upstream replacement, vendored upstream dependency, .NET duplicate file, and new module mapping fixes.
references/upgrade-provider-errors.md
- 使用本技能的(来自技能文件夹,而非仓库)修复补丁冲突、忽略上游替换、上游依赖 vendored、.NET重复文件以及新模块映射问题。
references/upgrade-provider-errors.md