pulumi/pkg/codegen/schema
Joe Duffy 24e72c9b51
Implement plugin download cancellation (#17621)
We use context.Background() when invoking plugin installation logic, and
generally do not propagate the context to all the various leaf I/O
operations performed in the course of installing plugins. As a result,
it is impossible to cancel them. Given that plugins can be 100MBs these
days, combined with the fact that we hook SIGINT and SIGTERM to block
them in attempt to provide a good user experience, this leads to
frustratingly long periods of time where you can't cancel an operation.
And, ironically, the time during which we're waiting for these plugins
to finish downloading is one of the few strictly safe points where
cancelling is fine, since generally no state-modifying operations are in
flight.

This change plumbs the true enclosing context to all of the places it
needs to go in order to make plugin installation cancellation work. Note
that I added `*WithContext` variants anytime dealing with a public
function for compatibility's sake. I will admit, I wish we could just
delete the other ones so that this is always an explicit decision.

This change also fixes a bug introduced in [a rather old pull request](
https://github.com/pulumi/pulumi/pull/5317/files), whereby we create
diagnostic events to tell the user a ^C has been registered -- but then
ignore the return values, never sending them to the engine!

I have included a test for cancellation. It is deliberately simple so it
can be deterministic (e.g., it doesn't test partial operations). I also
have not tested the myriad download sources, because it would make the
tests dependent on GitHub, GitLab, and other network sources that would
likely cause flakiness. Any/all feedback on how to improve coverage here
welcome, but it's better than nothing.

This fixes pulumi/pulumi#17594.

---------

Co-authored-by: Julien <julien@caffeine.lu>
2024-11-12 18:04:25 +00:00
..
README.md Document code generation concepts (#17162) 2024-09-05 13:12:59 +00:00
bind.go Enable some more linting rules (#17456) 2024-10-03 17:37:13 +00:00
docs_parser.go Enable goheader rule and add missing license headers (#15473) 2024-09-09 12:05:45 +00:00
docs_renderer.go Enable goheader rule and add missing license headers (#15473) 2024-09-09 12:05:45 +00:00
docs_test.go Enable goheader rule and add missing license headers (#15473) 2024-09-09 12:05:45 +00:00
loader.go Implement plugin download cancellation (#17621) 2024-11-12 18:04:25 +00:00
loader_cached.go Split caching logic into it's own type to use with LoaderClient (#17118) 2024-08-31 13:25:20 +00:00
loader_cached_test.go Split caching logic into it's own type to use with LoaderClient (#17118) 2024-08-31 13:25:20 +00:00
loader_client.go Bump gRPC dependencies and migrate `grpc.Dial` (#17701) 2024-11-06 18:36:10 +00:00
loader_js.go [display] Enable WASM compilation (#16246) 2024-05-24 20:27:56 +00:00
loader_mmap.go [display] Enable WASM compilation (#16246) 2024-05-24 20:27:56 +00:00
loader_schema_test.go Enable goheader rule and add missing license headers (#15473) 2024-09-09 12:05:45 +00:00
loader_server.go Add schema loader service 2023-07-27 15:03:52 +01:00
loader_test.go Have `Host.Provider` accept a `PackageDescriptor` (#17244) 2024-09-12 13:17:30 +00:00
mock_pulumi_schema.go Enable goheader rule and add missing license headers (#15473) 2024-09-09 12:05:45 +00:00
package_reference.go [PCL] Implement package descriptor blocks to support parameterized packages (#17589) 2024-11-05 00:58:48 +00:00
pulumi.json Change parameterization in schemas to base64 strings (#16614) 2024-07-10 15:36:05 +00:00
schema.go [PCL] Implement package descriptor blocks to support parameterized packages (#17589) 2024-11-05 00:58:48 +00:00
schema_test.go [schema] Validate version is provided when package supports packing (#17420) 2024-09-28 23:56:17 +00:00

README.md

(schema)=

Pulumi Schema

This package defines Pulumi Schema, a language-neutral specification for cloud resource models. Pulumi Schema is the interface definition language for all Pulumi Packages, and is used as the input to SDK code generation for each supported Pulumi language.