pulumi/pkg/resource/deploy
Justin Van Patten f5b117505c Maintain alias compat for older Node.js SDKs on new CLIs
This change updates the engine to detect if a `RegisterResource` request
is coming from an older Node.js SDK that is using incorrect alias specs
and, if so, transforms the aliases to be correct. This allows us to
maintain compatibility for users who have upgraded their CLI but are
still using an older version of the Node.js SDK with incorrect alias
specs.

We detect if the request is from a Node.js SDK by looking at the gRPC
request's metadata headers, specifically looking at the "pulumi-runtime"
and "user-agent" headers.

First, if the request has a "pulumi-runtime" header with a value of
"nodejs", we know it's coming from the Node.js plugin. The Node.js
language plugin proxies gRPC calls from the Node.js SDK to the resource
monitor and the proxy now sets the "pulumi-runtime" header to "nodejs"
for `RegisterResource` calls.

Second, if the request has a "user-agent" header that starts with
"grpc-node-js/", we know it's coming from the Node.js SDK. This is the
case for inline programs in the automation API, which connects directly
to the resource monitor, rather than going through the language plugin's
proxy.

We can't just look at "user-agent", because in the proxy case it will
have a Go-specific "user-agent".

Updated Node.js SDKs set a new `aliasSpecs` field on the
`RegisterResource` request, which indicates that the alias specs are
correct, and no transforms are needed.
2023-06-14 08:34:32 -07:00
..
deploytest Maintain alias compat for older Node.js SDKs on new CLIs 2023-06-14 08:34:32 -07:00
providers Allow mapping requests to install plugins 2023-05-29 14:53:04 +01:00
builtins.go all: Reformat with gofumpt 2023-03-03 09:00:24 -08:00
deployment.go Consolidated Target parameters 2023-06-08 08:42:03 -07:00
deployment_executor.go Consolidated Target parameters 2023-06-08 08:42:03 -07:00
deployment_executor_test.go all: Reformat with gofumpt 2023-03-03 09:00:24 -08:00
deployment_test.go Remove source_fixed 2022-11-08 15:55:45 +00:00
doc.go Document Go packages (#6009) 2021-01-11 11:07:59 -07:00
import.go Don't load providers at startup 2023-05-12 10:04:21 +01:00
manifest.go Split Manifest type to it's own file (#8712) 2022-01-10 12:25:24 +00:00
plan.go all: Fix revive issues 2023-03-21 08:55:11 -07:00
snapshot.go all: Reformat with gofumpt 2023-03-03 09:00:24 -08:00
snapshot_test.go all: Fix revive issues 2023-03-21 08:55:11 -07:00
source.go Monitor.Invoke and Provider.Invoke take different arguments (#9323) 2022-04-14 10:59:46 +01:00
source_error.go all: Reformat with gofumpt 2023-03-03 09:00:24 -08:00
source_eval.go Maintain alias compat for older Node.js SDKs on new CLIs 2023-06-14 08:34:32 -07:00
source_eval_test.go Maintain alias compat for older Node.js SDKs on new CLIs 2023-06-14 08:34:32 -07:00
source_null.go all: Reformat with gofumpt 2023-03-03 09:00:24 -08:00
source_query.go Don't load providers at startup 2023-05-12 10:04:21 +01:00
source_query_test.go all: Reformat with gofumpt 2023-03-03 09:00:24 -08:00
state_builder.go all: Fix revive issues 2023-03-21 08:55:11 -07:00
state_builder_test.go Non-mutating snapshot normalization (#10128) 2022-07-18 14:04:19 -04:00
step.go Don't load providers at startup 2023-05-12 10:04:21 +01:00
step_executor.go Fix targeted-replace and update plans. 2023-05-09 07:48:53 -07:00
step_generator.go [engine] Fix aliasing children 2023-06-14 05:19:17 -07:00
step_generator_test.go Tests for generateAliases 2023-06-14 05:19:17 -07:00
target.go Add getOrganization to nodejs and python (#10504) 2022-08-31 10:33:29 +01:00