upstream-patches

โดย pulumi

Create, amend, remove, and rebase patches for Terraform provider submodules using `./scripts/upstream.sh`. Use when `upgrade-provider` or manual patch work…

npx skills add https://github.com/pulumi/agent-skills --skill upstream-patches

Upstream Patches

upstream/ is a git submodule pointing to the upstream Terraform provider. patches/ contains patch files applied on top of it. Use ./scripts/upstream.sh to manage patch state.

Default Behavior

  • If fixing a regression introduced by an existing patch, amend the owning patch commit.
  • Do not create a new patch unless the user explicitly asks.

Commands Reference

CommandDescription
./scripts/upstream.sh initInitialize upstream and apply patches to working directory
./scripts/upstream.sh init -fDestructively discard checkout/rebase state and re-initialize upstream
./scripts/upstream.sh checkoutCreate branch with patches as commits for editing
./scripts/upstream.sh rebase -iInteractively edit patch commits
./scripts/upstream.sh rebase -o <commit>Rebase patches onto a new upstream commit
./scripts/upstream.sh check_inWrite commits back to patches and exit checkout mode

Guardrails

  • Never commit directly to upstream/ without checkout/check_in.
  • Direct edits under upstream/ outside checkout are ephemeral during upgrade-provider; the tool resets submodule state.
  • Do not hand-edit patches/*.patch unless intentionally doing raw patch surgery.
  • Prefer non-interactive rewrite flow over interactive rebase for agents.

Find Owning Patch First

Before editing patch content, identify the owning patch/commit.

./scripts/upstream.sh checkout

# Find candidate patch files by touched file path or unique hunk text
rg -n "path/to/file|unique_symbol" patches/*.patch

# Optional: inspect candidate patch header/hunks
sed -n '1,120p' patches/00NN-Example.patch

# Map patch file to commit in upstream checkout branch
patch=patches/00NN-Example.patch
subject=$(sed -n 's/^Subject: \[PATCH\] //p' "$patch" | head -n1)
cd upstream
git log --oneline pulumi/patch-checkout --grep "$subject"

# If needed, disambiguate by touched path
git log --oneline pulumi/patch-checkout -- path/to/file
cd ..

If rg is unavailable, use grep -En for the patch search. Set target_sha to the owning commit and edit that commit, not HEAD.

Amend Existing Patch (Preferred, Non-Interactive)

./scripts/upstream.sh checkout
cd upstream

target_sha=<owning-commit-sha>
base_sha=$(git rev-parse "${target_sha}^")
tmp_branch="rewrite-${target_sha:0:8}"

# Rebuild history from parent of target commit
git checkout -b "$tmp_branch" "$base_sha"
git cherry-pick "$target_sha"

# Apply fix and amend target commit
# ...edit files...
git add <files>
git commit --amend --no-edit

# Replay remaining commits
git cherry-pick "${target_sha}..pulumi/patch-checkout"

# If cherry-pick conflicts occur:
#   resolve files
#   git add <resolved files>
#   git cherry-pick --continue

# Move checkout branch to rewritten history
git branch -f pulumi/patch-checkout HEAD
git checkout pulumi/patch-checkout
git branch -D "$tmp_branch"
cd ..

Interactive fallback:

./scripts/upstream.sh checkout
./scripts/upstream.sh rebase -i
# mark target commit as edit, amend, then continue

Remove Entire Patch

Use when a patch should be deleted completely.

rm patches/00NN-Description.patch
./scripts/upstream.sh checkout
./scripts/upstream.sh check_in

Remove Part of a Patch

Use when only selected hunks/files should be removed from an existing patch.

  1. Find owning patch/commit (target_sha) and use the amend workflow above.
  2. Revert only unwanted changes from the target commit, then amend.

Example during amend step:

cd upstream
# Restore specific docs-only files from parent of amended commit
git checkout HEAD^ -- path/to/docs-only-file path/to/another-doc-file
git add path/to/docs-only-file path/to/another-doc-file
git commit --amend --no-edit
cd ..

Create New Patch (Only If Requested)

./scripts/upstream.sh checkout
cd upstream
# ...make changes...
git add <files>
git commit -m "Describe new patch"
cd ..
./scripts/upstream.sh check_in

Rebasing Patches to a New Upstream Version

./scripts/upstream.sh checkout

# Rebase onto the new upstream commit
./scripts/upstream.sh rebase -o <new_commit_sha>
# Resolve any conflicts that arise

# Write updated patch files
./scripts/upstream.sh check_in

Verification Checklist

Before check_in:

  • Confirm expected patch count change (0 by default; -1 for full patch removal).
  • Confirm whether target patch should remain present (default yes) or be removed (explicit deletion case).
  • Confirm you are editing the owning commit, not adding a new commit by accident.

After check_in:

  • Verify patch count matches expectation.
  • Verify target patch number/purpose is still present when expected.
  • Verify no unexpected new 00NN-*.patch was introduced.

Interrupted Checkout or Rebase

Preserve work by default. Inspect git -C upstream status, complete the active git am/rebase, verify that every patch was applied, and run ./scripts/upstream.sh check_in before rerunning automation. An interrupted checkout invokes git am separately for each patch, so later patch files may not have been reached.

Use ./scripts/upstream.sh init -f only when intentionally discarding all interrupted work. It can remove conflict resolution, patch commits, operation metadata, and untracked files; it is not routine recovery for a stuck checkout.

Skills เพิ่มเติมจาก pulumi

package-usage
pulumi
ติดตามว่าสแต็กใดในองค์กร Pulumi ที่ใช้แพ็กเกจเฉพาะและในเวอร์ชันใด ใช้สำหรับการตรวจสอบข้ามสแต็ก ระบุเวอร์ชันที่ล้าสมัยหรือไม่ได้รับการดูแล...
official
pulumi-automation-api
pulumi
การจัดเรียงการทำงานของโครงสร้างพื้นฐาน Pulumi แบบโปรแกรมเมติกข้ามหลายสแต็กและแอปพลิเคชัน รองรับทั้งสถาปัตยกรรมแหล่งที่มาในเครื่อง (โปรเจกต์ Pulumi ที่มีอยู่) และแหล่งที่มาแบบอินไลน์ (โปรแกรมที่ฝังตัว) ทำให้สามารถปรับใช้รูปแบบการปรับใช้ได้อย่างยืดหยุ่นตั้งแต่สถานการณ์ง่ายไปจนถึงซับซ้อนหลายสแต็ก จัดการการจัดเรียงหลายสแต็กด้วยลำดับการพึ่งพา การปรับใช้แบบอิสระแบบขนาน และการส่งผ่านเอาต์พุตข้ามสแต็กสำหรับการจัดเตรียมโครงสร้างพื้นฐานที่ประสานงานกัน ให้การทำงานแบบโปรแกรมเมติก...
official
pulumi-best-practices
pulumi
แนวทางปฏิบัติที่ดีที่สุดสำหรับการเขียนโค้ดโครงสร้างพื้นฐาน Pulumi ที่เชื่อถือได้และบำรุงรักษาได้ หลีกเลี่ยงการสร้างทรัพยากรภายใน callback ของ apply() ส่งผ่านอ็อบเจกต์ Output โดยตรงเป็นอินพุตเพื่อรักษาการติดตามการพึ่งพาและการมองเห็นในตัวอย่าง ใช้คลาส ComponentResource เพื่อจัดกลุ่มทรัพยากรที่เกี่ยวข้องเป็นหน่วยตรรกะที่นำกลับมาใช้ใหม่ได้พร้อมลำดับชั้น parent-child ที่เหมาะสมผ่าน parent: this เข้ารหัสความลับตั้งแต่เริ่มต้นด้วยแฟล็ก --secret หรือ config.requireSecret() เพื่อป้องกันการรั่วไหลของข้อมูลประจำตัวในไฟล์สถานะ...
official
pulumi-component
pulumi
ส่วนประกอบโครงสร้างพื้นฐานที่นำกลับมาใช้ใหม่ได้พร้อมรองรับหลายภาษา ค่าเริ่มต้นที่เหมาะสม และรูปแบบการประกอบ ต้องมีองค์ประกอบหลักสี่ประการ: ขยาย ComponentResource, ยอมรับพารามิเตอร์มาตรฐาน, ตั้งค่า parent: this บน child ทั้งหมด, และเรียก registerOutputs() ที่ส่วนท้ายของ constructor อินเทอร์เฟซ Args ต้องใช้ wrapper Input<T>, หลีกเลี่ยง union types และฟังก์ชัน, และรักษาโครงสร้างให้เรียบเพื่อรองรับการสร้าง SDK หลายภาษา เปิดเผยเฉพาะ output ที่จำเป็นเป็น public properties; ซ่อน...
official
pulumi-debug-failed-operation
pulumi
ดีบักการอัปเดตหรือพรีวิว Pulumi ที่ล้มเหลว: อ่านความล้มเหลวที่ Pulumi บันทึกไว้แล้ว ค้นหาสาเหตุที่ทำให้เกิด และแก้ไข โหลดสกิลนี้เมื่อผู้ใช้ขอให้…
official
pulumi-esc
pulumi
การจัดการความลับ การกำหนดค่า และข้อมูลประจำตัวแบบไดนามิกแบบรวมศูนย์สำหรับโครงสร้างพื้นฐานและแอปพลิเคชันของ Pulumi รองรับการประกอบสภาพแวดล้อมผ่านการนำเข้าและการวางซ้อน โดยมีคีย์สำรองสำหรับ environmentVariables, pulumiConfig และ files สร้างข้อมูลประจำตัวระยะสั้นผ่าน OIDC สำหรับ AWS, Azure และ GCP; ผสานรวมกับ AWS Secrets Manager, Azure Key Vault, HashiCorp Vault และ 1Password คำสั่ง CLI หลักประกอบด้วย pulumi env init, pulumi env edit, pulumi env open (เปิดเผย...
official
pulumi-neo-handoff
pulumi
ส่งต่อเธรดปัจจุบันไปยังงาน Pulumi Neo ใหม่แบบถ่ายโอนทางเดียว ใช้เมื่อผู้ใช้ขอให้ส่งต่อ ส่ง โอน หรือดำเนินการต่อจากปัจจุบันอย่างชัดเจน…
official
pulumi-overview
pulumi
ใช้ทักษะนี้สำหรับงานใดๆ ที่สร้าง แก้ไข ตรวจสอบ หรือทำลายโครงสร้างพื้นฐานคลาวด์หรือการกำหนดค่า SaaS ตั้งแต่การดำเนินการ CLI แบบครั้งเดียวไปจนถึงเต็มรูปแบบ…
official