pulumi-upgrade-provider

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Pulumi Upgrade Provider

Pulumi Upgrade Provider

Overview

概述

Run
upgrade-provider
, 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状态由该工具管理。

Run Loop

运行流程

  1. Create output directory:
bash
mkdir -p .pulumi
  1. Run from repo root:
bash
upgrade-provider $ORG/$REPO --repo-path . > .pulumi/upgrade-provider-stdout.txt 2> /dev/null
  1. Wait for completion (can take up to 10 minutes).
  2. Check for errors by scanning
    .pulumi/upgrade-provider-stdout.txt
    lines starting with
    error: 
    .
  3. If failed, fix using this skill's
    references/upgrade-provider-errors.md
    (from the skill folder, not the repo), then rerun. For upstream
    go get
    failures involving ignored
    replace
    directives or
    unknown revision v0.0.0
    , rerun with
    --target-version
    after applying the documented
    provider/go.mod
    replacements; preserve the original major/non-major intent and add
    --major
    only for actual major version upgrades.
  4. If a fix requires creating/amending/removing/rebasing patches, use the
    upstream-patches
    skill for the patch workflow.
  5. If you fixed a conflict, report exact edits (file paths + concrete changes or preserved intent).
  6. If the upgrade changed patches, run
    ./scripts/upstream.sh checkout
    and review applied
    upstream
    commits:
    • List commit SHAs/titles from
      upstream
      .
    • Summarize the intent of each commit in plain language.
    • Call out any behavioral changes or risks.
  7. On success, proceed to Post-run Tasks.
  1. 创建输出目录:
bash
mkdir -p .pulumi
  1. 从仓库根目录运行:
bash
upgrade-provider $ORG/$REPO --repo-path . > .pulumi/upgrade-provider-stdout.txt 2> /dev/null
  1. 等待完成(最长可能需要10分钟)。
  2. 扫描
    .pulumi/upgrade-provider-stdout.txt
    中以
    error: 
    开头的行,检查是否存在错误。
  3. 如果失败,使用本技能的
    references/upgrade-provider-errors.md
    (来自技能文件夹,而非仓库)进行修复,然后重新运行。对于涉及忽略
    replace
    指令或
    unknown revision v0.0.0
    的上游
    go get
    失败,在应用文档中记录的
    provider/go.mod
    替换后,添加
    --target-version
    参数重新运行;保留原始的主版本/非主版本升级意图,仅在实际主版本升级时添加
    --major
    参数。
  4. 如果修复需要创建/修改/删除/变基补丁,请使用
    upstream-patches
    技能处理补丁工作流。
  5. 如果修复了冲突,请报告确切的修改内容(文件路径+具体变更或保留的意图)。
  6. 如果升级导致补丁变更,运行
    ./scripts/upstream.sh checkout
    并查看已应用的
    upstream
    提交:
    • 列出
      upstream
      的提交SHA和标题。
    • 用通俗易懂的语言总结每个提交的意图。
    • 指出任何行为变更或风险。
  7. 成功后,执行后续任务。

When to Stop and Report Failure

何时停止并报告失败

Stop iterating and report failure if any of these conditions are met:
  1. Command not found (exit code 127): The
    upgrade-provider
    tool is not in PATH.
  2. Same error 3 times: You've attempted to fix the same error 3 times without success.
  3. Unknown error pattern: The error is not covered in
    references/upgrade-provider-errors.md
    and you cannot determine a safe fix.
  4. 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:
  1. The error(s) encountered.
  2. What fixes were attempted (with file paths and changes).
  3. Why human intervention is needed.
  4. Any partial progress.
如果满足以下任一条件,请停止重试并报告失败:
  1. 命令未找到(退出码127)
    upgrade-provider
    工具未在PATH中。
  2. 同一错误出现3次:尝试修复同一错误3次仍未成功。
  3. 未知错误模式:错误未在
    references/upgrade-provider-errors.md
    中覆盖,且无法确定安全的修复方案。
  4. 需要人工判断:修复需要用户输入,例如:
    • 在多种有效方案中选择
    • 影响公共API的破坏性变更
    • 弃用策略
    • 模块组织的架构决策
停止时,请报告:
  1. 遇到的错误。
  2. 尝试过的修复措施(包含文件路径和变更内容)。
  3. 需要人工干预的原因。
  4. 任何部分进展。

Post-run Tasks

后续任务

The tool creates a PR on successful upgrade.
  1. 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'
  1. 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。
  1. 必须使用只读命令获取当前分支的PR URL:
console
gh pr view --json url --jq .url || gh pr list --head "$(git branch --show-current)" --json url --jq '.[0].url'
  1. 如果应用了任何修复措施,必须在现有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

注意事项

  • git rebase --continue --no-edit
    is not supported in older git versions. Use
    git rebase --continue
    and accept the existing commit message.
  • To avoid the editor prompt during
    git rebase --continue
    , run it with
    GIT_EDITOR=true
    (or
    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.
  • ./scripts/upstream.sh checkout|rebase|check_in
    are allowed because the tool manages git state.
  • Do not stash changes; the tool manages git state.
  • 请勿手动提交、推送或创建分支;仅执行只读git命令。
  • 允许使用
    ./scripts/upstream.sh checkout|rebase|check_in
    ,因为工具会管理git状态。
  • 请勿暂存变更;工具会管理git状态。

References

参考资料

  • Use this skill's
    references/upgrade-provider-errors.md
    (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重复文件以及新模块映射问题。