Skip to content

Drop the pulumi/pulumi submodule - #1065

Draft
iwahbe wants to merge 12 commits into
mainfrom
iwahbe/drop-submodule
Draft

Drop the pulumi/pulumi submodule#1065
iwahbe wants to merge 12 commits into
mainfrom
iwahbe/drop-submodule

Conversation

@iwahbe

@iwahbe iwahbe commented Jul 3, 2026

Copy link
Copy Markdown
Member

Note

Stacked on #1076: this branch is rebased onto iwahbe/error-hook-conformance and targets it as the PR base. It inherits that PR's pin to an unreleased pulumi/pulumi master commit (cd588358a1); the sync scripts below handle pseudo-version pins for that reason.

Summary

Removes the pulumi git submodule. Everything it provided is replaced by an alternative pinned to the same source of truth: the github.com/pulumi/pulumi/{pkg,sdk}/v3 version in pulumi-language-dotnet/go.mod.

The .proto files cannot be sourced from the Go module graph — the pkg and sdk Go modules ship only the generated Go code (sdk/v3/proto/go), not the .proto sources, which live at the repo root of pulumi/pulumi outside both module boundaries. They are vendored instead.

Changes

  • Protobuf definitions (sdk/Pulumi/Pulumi.csproj): vendored under proto/ at the repo root, along with the Automation API CLI-spec overrides file (tools/automation/automation-overrides.jsonsdk/Pulumi.Automation.Codegen/). make sync_protos re-syncs both from a sparse clone of pulumi/pulumi at the pinned version. The format CI job re-runs the sync and fails on drift, so a go.mod bump without a proto sync cannot merge.
  • make generate_cli_spec: builds the pulumi CLI through a Go tool directive in pulumi-language-dotnet/go.mod (go tool pulumi generate-cli-spec). go run of the dependency's main package fails under module graph pruning (the CLI's dep closure isn't in go.sum), and go run pkg@version is rejected because pkg/v3's go.mod contains replace directives. The tool directive records the full closure and moves in lockstep with the pkg/v3 requirement.
  • Codegen test corpus: the codegen tests read the shared corpus (schemas, PCL programs, types.json) from tests/testdata/codegen. At 11MB across ~2,250 files it is too large to vendor, so make test_codegen fetches it into the gitignored pulumi-language-dotnet/codegen/testdata/upstream/ via a sparse clone of the pinned version, with a version stamp to skip re-downloads.
  • Pseudo-version pins (scripts/checkout_pulumi.sh): the sparse checkout used by sync_protos.sh and get_codegen_testdata.sh is factored into a shared helper. A pseudo-version pin (like the one inherited from Generate resource hooks in dotnet programs; adopt the error hook conformance test #1076) has no tag to clone, so the helper resolves it to its commit through the Go module proxy and fetches by hash.
  • Drop the submodule (.gitmodules + gitlink) and all submodules: recursive checkouts from CI.
  • Update README/AGENTS.md references.

An earlier revision vendored pulumi/tests/testprovider as integration_tests/testprovider_go for TestDotnetErrorHooks; that test was replaced by the l2-resource-hook-on-error conformance test in #1076, so the vendored provider is gone again.

Testing

  • make build_sdk compiles against the vendored protos (no Pulumi.xml drift).
  • make test_codegen: 235 tests pass, 18 skipped, with the corpus fetched at the pseudo-version.
  • make test_automation_codegen: 57 tests pass (spec generated via go tool pulumi).
  • make test_conformance TEST_FILTER=TestLanguage/l2-resource-hook-on-error passes.
  • make lint_language_host, make lint_integration_tests clean.
  • scripts/sync_protos.sh round-trips with no diff at the pinned commit.

@iwahbe
iwahbe requested a review from a team as a code owner July 3, 2026 11:48
iwahbe added a commit that referenced this pull request Jul 3, 2026
@iwahbe
iwahbe marked this pull request as draft July 3, 2026 14:20
iwahbe added 12 commits July 17, 2026 12:03
Generate ResourceHook declarations for named hook blocks (running the
hook's command via System.Diagnostics.Process and honoring the onDryRun
and ignoreErrors attributes), ErrorHook declarations for hook blocks of
kind error (which request a retry if and only if the command exits
successfully), and the Hooks resource option binding hooks to their
lifecycle events.

This makes the l2-resource-option-hooks, l2-resource-hook-after-failure,
and l2-resource-hook-ignore-errors conformance tests pass; remove them
from the expected failures and commit their snapshots.
The test was added in pulumi/pulumi#23839, which is not in any release
yet. The snapshot was generated and verified by pinning
github.com/pulumi/pulumi/{pkg,sdk}/v3 to that commit
(8a79286b30228227ab34b6471298d29005f0fcfa) and running

    PULUMI_ACCEPT=1 go test -run 'TestLanguage/l2-resource-hook-on-error$' .

followed by a clean run without PULUMI_ACCEPT. At the currently pinned
v3.253.0 the test does not exist, so the snapshot is inert until the
next pulumi/pulumi upgrade picks it up.
The l2-resource-hook-on-error conformance test covers the same round
trip: an error hook attached to a resource whose first create fails
retryably runs in-process, requests a retry, and the resource is
created on the second attempt.

pulumi/pulumi#23840 also removed the FlakyCreate resource from the
upstream testprovider that this test loaded from the submodule, so the
test would break on the next pulumi/pulumi upgrade regardless.
changie kinds are matched by label (Improvements), not by a lowercased
key; only Bug Fixes defines a key (bug-fixes).
…test

Pin github.com/pulumi/pulumi/{pkg,sdk}/v3 and the pulumi submodule to
master commit cd588358a1979fe390708412b970a2f6ab96fa88, which contains
the l2-resource-hook-on-error conformance test (pulumi/pulumi#23839).
No release includes it yet; the next regular dependency upgrade moves
the pin back to a release tag.

Fallout from moving past v3.253.0:

- Regenerate sdk/Pulumi/Pulumi.xml for new proto messages.
- Regenerate the l2-enum and l2-external-enum snapshots: upstream added
  a NumberEnum to the shared enum test provider.
- Remove the simple-enum-schema codegen goldens; the upstream test case
  was deleted in pulumi/pulumi#23952.
- Replace the now-deprecated maputil.SortedKeys with
  slices.Sorted(maps.Keys(...)) to satisfy staticcheck.
The l2-enum regeneration also produced Deluxe.cs, Inputs/HolderArgs.cs,
and Outputs/Holder.cs for the resources upstream added to the enum test
provider; they were left untracked in the previous commit, which made
snapshot validation fail in CI while passing locally.
The submodule provided three things; each is replaced by an alternative
pinned to the pulumi/pulumi version in pulumi-language-dotnet/go.mod:

- Protobuf definitions: the .proto files the C# SDK compiles via
  Grpc.Tools are now vendored under proto/ at the repo root, together
  with the Automation API CLI-spec overrides file. They cannot be
  sourced from the Go module graph because the pkg and sdk modules do
  not ship the .proto sources, so `make sync_protos` copies them from a
  sparse clone of pulumi/pulumi at the pinned version, and the format CI
  job fails if the vendored files drift from that version.

- generate_cli_spec: the pulumi CLI is now built through a Go `tool`
  directive in pulumi-language-dotnet/go.mod instead of the submodule's
  pkg directory. `go run` of the dependency's main package does not work
  because module graph pruning leaves the CLI's dependency closure out
  of go.sum, and `go run pkg@version` is rejected because pkg/v3's
  go.mod contains replace directives; the tool directive records the
  full closure and stays in lockstep with the pkg/v3 requirement.

- tests/testprovider: the Go test provider used by TestDotnetErrorHooks
  is copied to integration_tests/testprovider_go. It runs shimless via
  its PulumiPlugin.yaml, so it needs no separate build step. The C#
  testprovider cannot replace it because only the Go provider returns
  the ErrorResourceInitFailed detail that marks a create failure as
  retryable.

CI no longer checks out submodules.
The codegen tests read the shared test corpus (schemas, PCL programs,
types.json) from tests/testdata/codegen in pulumi/pulumi, previously
reached through the submodule. At 11MB across ~2,250 files the corpus is
too large to vendor, so `make test_codegen` now fetches it into the
gitignored pulumi-language-dotnet/codegen/testdata/upstream directory
via a sparse clone of the version pinned in go.mod. A version stamp
skips the download when the corpus is already current. The script uses
cp instead of rsync so it also runs under Git Bash on Windows.
The branch now stacks on a pin to an unreleased pulumi/pulumi master
commit, which sync_protos.sh and get_codegen_testdata.sh could not
handle: a pseudo-version has no tag to clone. Factor the sparse
checkout into scripts/checkout_pulumi.sh, which resolves a
pseudo-version to its commit through the Go module proxy and fetches it
by hash. Re-sync the vendored protos and automation-overrides.json at
the pinned commit (cd588358a1).
Its only consumer was TestDotnetErrorHooks, which was removed in favor
of the l2-resource-hook-on-error conformance test.
@iwahbe
iwahbe changed the base branch from main to iwahbe/error-hook-conformance July 17, 2026 12:13
@pulumi-self-hosted-staging

Copy link
Copy Markdown

⚠️ Pulumi could not deploy preview(s) for this pull request because GitHub reports it is not mergeable (mergeable state: dirty). This usually means the branch has merge conflicts with its base branch. Resolve the conflicts and push a new commit to retry.

@iwahbe
iwahbe force-pushed the iwahbe/drop-submodule branch from 8be0567 to 2c7f3c8 Compare July 17, 2026 12:14

@Frassle Frassle left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm really not convinced this is better than just the submodule.
The testdata changes are fine, if we want to pull that via go instead of the submodule that makes sense. But for the proto files the submodule seems way simpler.

@iwahbe

iwahbe commented Jul 17, 2026

Copy link
Copy Markdown
Member Author

I'm not happy with a bunch of stuff in this PR, and I haven't read through carefully. Package gen tests are a real drag here.

@iwahbe
iwahbe force-pushed the iwahbe/error-hook-conformance branch from 2d01193 to fb28bf6 Compare July 29, 2026 09:17
Base automatically changed from iwahbe/error-hook-conformance to main July 29, 2026 11:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants