chore: revive patch-overlay sync for OTel + Telegraf submodules - #371
Merged
Merged
Conversation
PR #363 retired the patch-overlay restore scripts on the assumption that the patch trees alone were sufficient. They aren't: the patched sketch processors and selfmonitor live under the upstream submodule import paths (e.g. `go.opentelemetry.io/collector/processor/selfmonitor`), and the patched processors' `replace` directives point at `opentelemetry-collector/processor/...` not at the patch tree. A fresh clone or a worktree without overlay-staged submodules fails to build asap-otel because `processor/selfmonitor/` is missing from the v0.141.0 submodule. This revives the overlay step. The patch trees (committed in ASAPCollector main) stay the source of truth; submodules stay clean (we don't push changes upstream). The restore scripts copy `*-patch/` → submodule working tree at build time. Restored: - restore_otel_collector_patches.sh (85 files) - restore_otel_collector_contrib_patches.sh (201 files) - restore_otel_proto_patches.sh (15 files) - restore_opentelemetry_go_patches.sh (80 files) - restore_otel_client_patches.sh (legacy alias → -go) - restore_telegraf_patches.sh (7 files; skips go.mod/go.sum) - restore_otel_patches.sh (wrapper: collector+contrib+proto+go) - restore_all.sh (wrapper: otel + telegraf) Wired into: - build_asap_otel.sh: Step 1 calls restore_otel_patches.sh; --skip-patches is real again. - build_asap_telegraf.sh: Step 1 calls restore_telegraf_patches.sh; --skip-patches is real again. OTAP (build_asap_otap.sh) inlines its own overlay (stages a new crate + edits Cargo.toml/main.rs in place); not factored out, no behavior change there. Verification: - `bash -n` parses all 8 new scripts + the 2 modified build scripts. - Each restore script runs idempotently and reports the expected file counts on the current working tree. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Companion to the restore_*.sh revival. Use these when you've edited files directly in a submodule (e.g. while debugging at the build site) and want to fold the changes back into the canonical patch tree before they're blown away by the next restore. Restored: - backup_otel_collector_patches.sh (submodule → -patch) - backup_otel_collector_contrib_patches.sh (submodule → -patch) - backup_otel_proto_patches.sh (submodule → -patch) - backup_opentelemetry_go_patches.sh (submodule → -patch) - backup_otel_client_patches.sh (legacy alias → -go) - backup_telegraf_patches.sh (submodule → -patch) - backup_otel_patches.sh (wrapper) - backup_all.sh (wrapper) Each script uses `git status --porcelain` inside the submodule to discover modified/added/renamed paths and copies only those (plus their parent dirs) back into the patch tree. Deletions are skipped on purpose — patch trees should never delete files relative to the upstream tag. `backup_telegraf_patches.sh` does NOT exclude go.mod/go.sum (unlike its restore counterpart) — if you've genuinely modified those in the submodule, you probably want them captured. The script header notes the footgun: the patch tree's standalone `processors/allsketches/` go.mod is separate from telegraf's mono-module go.mod, so don't run this if you've only added an import inside the submodule's main go.mod. Verification: - `bash -n` parses all 8 scripts. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
restore_*.shpatch-overlay scripts retired in cleanup: drop dead processors, cmd dirs, backup scripts, v0 aliases #363 — fresh-clone builds ofasap-otelwere silently broken because patched sketch processors importgo.opentelemetry.io/collector/processor/selfmonitor(not in upstream v0.141.0) and the existingreplacedirectives point at the submodule, not at the patch tree.backup_*.shreverse-sync scripts so submodule-side debug edits can be folded back into the canonical patch tree.restore_*copies*-patch/→ submodule working tree at build time;backup_*does the reverse.Apply patches to submodules) back intobuild_asap_otel.shandbuild_asap_telegraf.sh;--skip-patchesis real again instead of a no-op.Restore scripts
restore_otel_collector_patches.shopentelemetry-collector-patch/→opentelemetry-collector/restore_otel_collector_contrib_patches.shopentelemetry-collector-contrib-patch/→opentelemetry-collector-contrib/restore_otel_proto_patches.shopentelemetry-proto-patch/→opentelemetry-proto/restore_opentelemetry_go_patches.shopentelemetry-go-patch/→opentelemetry-go/restore_otel_client_patches.shrestore_opentelemetry_go_patches.shrestore_telegraf_patches.shtelegraf-patch/→telegraf/(skips go.mod/go.sum)restore_otel_patches.shrestore_all.shBackup scripts (reverse direction)
Each uses
git status --porcelaininside the submodule to discover modified/added/renamed paths and copies them into the patch tree. Deletions skipped (patch trees should never delete files relative to upstream).backup_otel_collector_patches.shopentelemetry-collector/→…-patch/backup_otel_collector_contrib_patches.shopentelemetry-collector-contrib/→…-patch/backup_otel_proto_patches.shopentelemetry-proto/→…-patch/backup_opentelemetry_go_patches.shopentelemetry-go/→…-patch/backup_otel_client_patches.shbackup_opentelemetry_go_patches.shbackup_telegraf_patches.shtelegraf/→telegraf-patch/(does NOT skip go.mod/go.sum)backup_otel_patches.shbackup_all.shOut of scope
build_asap_otap.sh) inlines its own overlay (stages a new crate + editsCargo.toml/main.rsin place). No behavior change there.Test plan
bash -nparses all 16 new scripts + the 2 modified build scripts./build_asap_otel.shfrom a fresh clone (i.e. submodule working trees clean) builds asap-otel successfully./build_asap_telegraf.shfrom a fresh clone builds asap-telegraf./build_asap_otel.sh --skip-patches(after a previous successful build) skips the overlay step🤖 Generated with Claude Code