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.

pulumi의 다른 스킬

package-usage
pulumi
Pulumi 조직 내 여러 스택에서 특정 패키지를 어떤 버전으로 사용하는지 추적합니다. 스택 간 감사, 오래되었거나 유지 관리되지 않는 패키지 식별에 사용됩니다.
official
pulumi-automation-api
pulumi
Pulumi 인프라 운영을 여러 스택과 애플리케이션에 걸쳐 프로그래밍 방식으로 조정합니다. 로컬 소스(기존 Pulumi 프로젝트)와 인라인 소스(내장 프로그램) 아키텍처를 모두 지원하여 단순한 시나리오부터 복잡한 다중 스택 시나리오까지 유연한 배포 패턴을 가능하게 합니다. 종속성 순서 지정, 병렬 독립 배포, 조정된 인프라 프로비저닝을 위한 스택 간 출력 전달을 통해 다중 스택 조정을 처리합니다. 프로그래밍 방식의...
official
pulumi-best-practices
pulumi
신뢰할 수 있고 유지보수 가능한 Pulumi 인프라 코드를 작성하기 위한 종합적인 모범 사례. apply() 콜백 내에서 리소스를 생성하지 말고, Output 객체를 입력으로 직접 전달하여 종속성 추적 및 미리보기 가시성을 유지하세요. ComponentResource 클래스를 사용하여 관련 리소스를 재사용 가능한 논리적 단위로 그룹화하고, parent: this를 통해 적절한 부모-자식 계층 구조를 설정하세요. --secret 플래그 또는 config.requireSecret()를 사용하여 처음부터 비밀을 암호화하고, 상태 파일에서 자격 증명 유출을 방지하세요...
official
pulumi-component
pulumi
재사용 가능한 인프라 구성 요소로, 다중 언어 지원, 합리적인 기본값, 구성 패턴을 제공합니다. 네 가지 핵심 요소가 필요합니다: ComponentResource 확장, 표준 매개변수 수락, 모든 자식에 parent: this 설정, 생성자 끝에서 registerOutputs() 호출. Args 인터페이스는 Input<T> 래퍼를 사용해야 하며, 유니온 타입과 함수를 피하고, 다중 언어 SDK 생성을 지원하기 위해 구조를 평탄하게 유지해야 합니다. 필수 출력만 공용 속성으로 노출하고, 나머지는 숨깁니다.
official
pulumi-debug-failed-operation
pulumi
실패한 Pulumi 업데이트 또는 프리뷰를 디버그합니다: Pulumi가 이미 기록한 실패를 읽고, 원인을 찾아 수정합니다. 사용자가 요청하면 이 스킬을 로드합니다…
official
pulumi-esc
pulumi
중앙 집중식 비밀, 구성 및 동적 자격 증명 관리를 제공하여 Pulumi 인프라와 애플리케이션을 지원합니다. 가져오기 및 계층화를 통한 환경 구성을 지원하며, environmentVariables, pulumiConfig 및 files에 대한 예약 키가 있습니다. AWS, Azure, GCP용 OIDC를 통해 단기 자격 증명을 생성하며, 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
이 스킬은 일회성 CLI 작업부터 전체…에 이르기까지 클라우드 인프라 또는 SaaS 구성을 생성, 수정, 검사, 삭제하는 모든 작업에 사용하십시오.
official