This change adds a GetRequiredPlugins RPC method to the language host, enabling us to query it for its list of plugin requirements. This is language-specific because it requires looking at the set of dependencies (e.g., package.json files). It also adds a call up front during any update/preview operation to compute the set of plugins and require that they are present. These plugins are populated in the cache and will be used for all subsequent plugin-related operations during the engine's activity. We now cache the language plugins, so that we may load them eagerly too, which we never did previously due to the fact that we needed to pass the monitor address at load time. This was a bit bizarre anyhow, since it's really the Run RPC function that needs this information. So, to enable caching and eager loading -- which we need in order to invoke GetRequiredPlugins -- the "phone home" monitor RPC address is passed at Run time. In a subsequent change, we will switch to faulting in the plugins that are missing -- rather than erroring -- in addition to supporting the `pulumi plugin install` CLI command.
47 lines
2.1 KiB
Protocol Buffer
47 lines
2.1 KiB
Protocol Buffer
// Copyright 2016-2017, Pulumi Corporation. All rights reserved.
|
|
|
|
syntax = "proto3";
|
|
|
|
import "plugin.proto";
|
|
import "google/protobuf/empty.proto";
|
|
|
|
package pulumirpc;
|
|
|
|
// LanguageRuntime is the interface that the planning monitor uses to drive execution of an interpreter responsible
|
|
// for confguring and creating resource objects.
|
|
service LanguageRuntime {
|
|
// GetRequiredPlugins computes the complete set of anticipated plugins required by a program.
|
|
rpc GetRequiredPlugins(GetRequiredPluginsRequest) returns (GetRequiredPluginsResponse) {}
|
|
// Run executes a program and returns its result.
|
|
rpc Run(RunRequest) returns (RunResponse) {}
|
|
// GetPluginInfo returns generic information about this plugin, like its version.
|
|
rpc GetPluginInfo(google.protobuf.Empty) returns (PluginInfo) {}
|
|
}
|
|
|
|
message GetRequiredPluginsRequest {
|
|
string project = 1; // the project name.
|
|
string pwd = 2; // the program's working directory.
|
|
string program = 3; // the path to the program.
|
|
}
|
|
|
|
message GetRequiredPluginsResponse {
|
|
repeated PluginDependency plugins = 1; // a list of plugins required by this program.
|
|
}
|
|
|
|
// RunRequest asks the interpreter to execute a program.
|
|
message RunRequest {
|
|
string project = 1; // the project name.
|
|
string stack = 2; // the name of the stack being deployed into.
|
|
string pwd = 3; // the program's working directory.
|
|
string program = 4; // the path to the program to execute.
|
|
repeated string args = 5; // any arguments to pass to the program.
|
|
map<string, string> config = 6; // the configuration variables to apply before running.
|
|
bool dryRun = 7; // true if we're only doing a dryrun (preview).
|
|
int32 parallel = 8; // the degree of parallelism for resource operations (<=1 for serial).
|
|
string monitor_address = 9; // the address for communicating back to the resource monitor.
|
|
}
|
|
|
|
// RunResponse is the response back from the interpreter/source back to the monitor.
|
|
message RunResponse {
|
|
string error = 1; // an unhandled error if any occurred.
|
|
}
|