2022-10-17 14:21:11 +00:00
// Copyright 2016-2023, Pulumi Corporation.
2022-06-11 07:52:24 +00:00
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
2018-06-26 18:14:03 +00:00
// Code generated by protoc-gen-go. DO NOT EDIT.
2022-06-11 07:52:24 +00:00
// versions:
2022-12-14 19:17:27 +00:00
// protoc-gen-go v1.28.1
2022-06-11 07:52:24 +00:00
// protoc v3.20.1
2022-07-12 13:45:03 +00:00
// source: pulumi/language.proto
2017-11-17 02:21:41 +00:00
2018-07-12 01:07:50 +00:00
package pulumirpc
2017-11-17 02:21:41 +00:00
import (
2022-10-17 14:21:11 +00:00
codegen "github.com/pulumi/pulumi/sdk/v3/proto/go/codegen"
2022-06-11 07:52:24 +00:00
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
2024-01-24 17:15:30 +00:00
emptypb "google.golang.org/protobuf/types/known/emptypb"
structpb "google.golang.org/protobuf/types/known/structpb"
2023-03-04 22:11:52 +00:00
reflect "reflect"
sync "sync"
2017-11-17 02:21:41 +00:00
)
2022-06-11 07:52:24 +00:00
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl . EnforceVersion ( 20 - protoimpl . MinVersion )
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl . EnforceVersion ( protoimpl . MaxVersion - 20 )
)
2018-07-12 01:07:50 +00:00
2024-06-17 17:10:55 +00:00
type RuntimeOptionPrompt_RuntimeOptionType int32
const (
RuntimeOptionPrompt_STRING RuntimeOptionPrompt_RuntimeOptionType = 0
RuntimeOptionPrompt_INT32 RuntimeOptionPrompt_RuntimeOptionType = 1
)
// Enum value maps for RuntimeOptionPrompt_RuntimeOptionType.
var (
RuntimeOptionPrompt_RuntimeOptionType_name = map [ int32 ] string {
0 : "STRING" ,
1 : "INT32" ,
}
RuntimeOptionPrompt_RuntimeOptionType_value = map [ string ] int32 {
"STRING" : 0 ,
"INT32" : 1 ,
}
)
func ( x RuntimeOptionPrompt_RuntimeOptionType ) Enum ( ) * RuntimeOptionPrompt_RuntimeOptionType {
p := new ( RuntimeOptionPrompt_RuntimeOptionType )
* p = x
return p
}
func ( x RuntimeOptionPrompt_RuntimeOptionType ) String ( ) string {
return protoimpl . X . EnumStringOf ( x . Descriptor ( ) , protoreflect . EnumNumber ( x ) )
}
func ( RuntimeOptionPrompt_RuntimeOptionType ) Descriptor ( ) protoreflect . EnumDescriptor {
return file_pulumi_language_proto_enumTypes [ 0 ] . Descriptor ( )
}
func ( RuntimeOptionPrompt_RuntimeOptionType ) Type ( ) protoreflect . EnumType {
return & file_pulumi_language_proto_enumTypes [ 0 ]
}
func ( x RuntimeOptionPrompt_RuntimeOptionType ) Number ( ) protoreflect . EnumNumber {
return protoreflect . EnumNumber ( x )
}
// Deprecated: Use RuntimeOptionPrompt_RuntimeOptionType.Descriptor instead.
func ( RuntimeOptionPrompt_RuntimeOptionType ) EnumDescriptor ( ) ( [ ] byte , [ ] int ) {
return file_pulumi_language_proto_rawDescGZIP ( ) , [ ] int { 13 , 0 }
}
Pass root and main info to language host methods (#14654)
<!---
Thanks so much for your contribution! If this is your first time
contributing, please ensure that you have read the
[CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md)
documentation.
-->
# Description
<!--- Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context. -->
This is two changes rolled together in a way.
Firstly passing some of the data that we pass on language runtime
startup to also pass it to Run/GetRequiredPlugins/etc. This is needed
for matrix testing, as we only get to start the language runtime up once
for that but want to execute multiple programs with it.
I feel it's also a little more consistent as we use the language
runtimes in other contexts (codegen) where there isn't really a root
directory, and aren't any options (and if we did do options the options
for codegen are not going to be the same as for execution). It also
means we can reuse a language host for shimless and substack programs,
as before they heavily relied on their current working directory to
calculate paths, and obviosly could only take one set of options at
startup. Imagine a shimless python package + a python root program, that
would have needed two startups of the python language host to deal with,
this unblocks it so we can make the engine smarter and only use one.
Secondly renaming some of the fields we pass to
Run/GetRequiredPlugins/etc today. `Pwd` and `Program` were not very
descriptive and had pretty non-obvious documentation:
```
string pwd = 3; // the program's working directory.
string program = 4; // the path to the program to execute.
```
`pwd` will remain, although probably rename it to `working_directory` at
some point, because while today we always start programs up with the
working directory equal to the program directory that definitely is
going to change in the future (at least for MLCs and substack programs).
But the name `pwd` doesn't make it clear that this was intended to be
the working directory _and_ the directory which contains the program.
`program` was in fact nearly always ".", and if it wasn't that it was
just a filename. The engine never sent a path for `program` (although we
did have some unit tests to check how that worked for the nodejs and
python hosts).
These are now replaced by a new structure with (I think) more clearly
named and documented fields (see ProgramInfo in langauge.proto).
The engine still sends the old data for now, we need to update
dotnet/yaml/java before we break the old interface and give Virtus Labs
a chance to update [besom](https://github.com/VirtusLab/besom).
## Checklist
- [x] I have run `make tidy` to update any new dependencies
- [x] I have run `make lint` to verify my code passes the lint check
- [ ] I have formatted my code using `gofumpt`
<!--- Please provide details if the checkbox below is to be left
unchecked. -->
- [x] I have added tests that prove my fix is effective or that my
feature works
<!---
User-facing changes require a CHANGELOG entry.
-->
- [ ] I have run `make changelog` and committed the
`changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the
Pulumi Cloud,
then the service should honor older versions of the CLI where this
change would not exist.
You must then bump the API version in
/pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi
Cloud API version
<!-- @Pulumi employees: If yes, you must submit corresponding changes in
the service repo. -->
2023-12-10 17:30:51 +00:00
// ProgramInfo are the common set of options that a language runtime needs to execute or query a program. This
// is filled in by the engine based on where the `Pulumi.yaml` file was, the `runtime.options` property, and
// the `main` property.
type ProgramInfo struct {
state protoimpl . MessageState
sizeCache protoimpl . SizeCache
unknownFields protoimpl . UnknownFields
// the root of the project, where the `Pulumi.yaml` file is located.
RootDirectory string ` protobuf:"bytes,1,opt,name=root_directory,json=rootDirectory,proto3" json:"root_directory,omitempty" `
// the absolute path to the directory of the program to execute. Generally, but not required to be,
// underneath the root directory.
ProgramDirectory string ` protobuf:"bytes,2,opt,name=program_directory,json=programDirectory,proto3" json:"program_directory,omitempty" `
// the entry point of the program, normally '.' meaning to just use the program directory, but can also be
// a filename inside the program directory. How that filename is interpreted, if at all, is language
// specific.
EntryPoint string ` protobuf:"bytes,3,opt,name=entry_point,json=entryPoint,proto3" json:"entry_point,omitempty" `
// JSON style options from the `Pulumi.yaml` runtime options section.
Options * structpb . Struct ` protobuf:"bytes,4,opt,name=options,proto3" json:"options,omitempty" `
}
func ( x * ProgramInfo ) Reset ( ) {
* x = ProgramInfo { }
if protoimpl . UnsafeEnabled {
mi := & file_pulumi_language_proto_msgTypes [ 0 ]
ms := protoimpl . X . MessageStateOf ( protoimpl . Pointer ( x ) )
ms . StoreMessageInfo ( mi )
}
}
func ( x * ProgramInfo ) String ( ) string {
return protoimpl . X . MessageStringOf ( x )
}
func ( * ProgramInfo ) ProtoMessage ( ) { }
func ( x * ProgramInfo ) ProtoReflect ( ) protoreflect . Message {
mi := & file_pulumi_language_proto_msgTypes [ 0 ]
if protoimpl . UnsafeEnabled && x != nil {
ms := protoimpl . X . MessageStateOf ( protoimpl . Pointer ( x ) )
if ms . LoadMessageInfo ( ) == nil {
ms . StoreMessageInfo ( mi )
}
return ms
}
return mi . MessageOf ( x )
}
// Deprecated: Use ProgramInfo.ProtoReflect.Descriptor instead.
func ( * ProgramInfo ) Descriptor ( ) ( [ ] byte , [ ] int ) {
return file_pulumi_language_proto_rawDescGZIP ( ) , [ ] int { 0 }
}
func ( x * ProgramInfo ) GetRootDirectory ( ) string {
if x != nil {
return x . RootDirectory
}
return ""
}
func ( x * ProgramInfo ) GetProgramDirectory ( ) string {
if x != nil {
return x . ProgramDirectory
}
return ""
}
func ( x * ProgramInfo ) GetEntryPoint ( ) string {
if x != nil {
return x . EntryPoint
}
return ""
}
func ( x * ProgramInfo ) GetOptions ( ) * structpb . Struct {
if x != nil {
return x . Options
}
return nil
}
2024-06-06 08:21:46 +00:00
type AboutRequest struct {
state protoimpl . MessageState
sizeCache protoimpl . SizeCache
unknownFields protoimpl . UnknownFields
Info * ProgramInfo ` protobuf:"bytes,1,opt,name=info,proto3" json:"info,omitempty" ` // the program info to use.
}
func ( x * AboutRequest ) Reset ( ) {
* x = AboutRequest { }
if protoimpl . UnsafeEnabled {
mi := & file_pulumi_language_proto_msgTypes [ 1 ]
ms := protoimpl . X . MessageStateOf ( protoimpl . Pointer ( x ) )
ms . StoreMessageInfo ( mi )
}
}
func ( x * AboutRequest ) String ( ) string {
return protoimpl . X . MessageStringOf ( x )
}
func ( * AboutRequest ) ProtoMessage ( ) { }
func ( x * AboutRequest ) ProtoReflect ( ) protoreflect . Message {
mi := & file_pulumi_language_proto_msgTypes [ 1 ]
if protoimpl . UnsafeEnabled && x != nil {
ms := protoimpl . X . MessageStateOf ( protoimpl . Pointer ( x ) )
if ms . LoadMessageInfo ( ) == nil {
ms . StoreMessageInfo ( mi )
}
return ms
}
return mi . MessageOf ( x )
}
// Deprecated: Use AboutRequest.ProtoReflect.Descriptor instead.
func ( * AboutRequest ) Descriptor ( ) ( [ ] byte , [ ] int ) {
return file_pulumi_language_proto_rawDescGZIP ( ) , [ ] int { 1 }
}
func ( x * AboutRequest ) GetInfo ( ) * ProgramInfo {
if x != nil {
return x . Info
}
return nil
}
2022-07-25 11:35:16 +00:00
// AboutResponse returns runtime information about the language.
type AboutResponse struct {
state protoimpl . MessageState
sizeCache protoimpl . SizeCache
unknownFields protoimpl . UnknownFields
Executable string ` protobuf:"bytes,1,opt,name=executable,proto3" json:"executable,omitempty" ` // the primary executable for the runtime of this language.
Version string ` protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty" ` // the version of the runtime for this language.
Metadata map [ string ] string ` protobuf:"bytes,3,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3" ` // other information about this language.
}
func ( x * AboutResponse ) Reset ( ) {
* x = AboutResponse { }
if protoimpl . UnsafeEnabled {
2024-06-06 08:21:46 +00:00
mi := & file_pulumi_language_proto_msgTypes [ 2 ]
2022-07-25 11:35:16 +00:00
ms := protoimpl . X . MessageStateOf ( protoimpl . Pointer ( x ) )
ms . StoreMessageInfo ( mi )
}
}
func ( x * AboutResponse ) String ( ) string {
return protoimpl . X . MessageStringOf ( x )
}
func ( * AboutResponse ) ProtoMessage ( ) { }
func ( x * AboutResponse ) ProtoReflect ( ) protoreflect . Message {
2024-06-06 08:21:46 +00:00
mi := & file_pulumi_language_proto_msgTypes [ 2 ]
2022-07-25 11:35:16 +00:00
if protoimpl . UnsafeEnabled && x != nil {
ms := protoimpl . X . MessageStateOf ( protoimpl . Pointer ( x ) )
if ms . LoadMessageInfo ( ) == nil {
ms . StoreMessageInfo ( mi )
}
return ms
}
return mi . MessageOf ( x )
}
// Deprecated: Use AboutResponse.ProtoReflect.Descriptor instead.
func ( * AboutResponse ) Descriptor ( ) ( [ ] byte , [ ] int ) {
2024-06-06 08:21:46 +00:00
return file_pulumi_language_proto_rawDescGZIP ( ) , [ ] int { 2 }
2022-07-25 11:35:16 +00:00
}
func ( x * AboutResponse ) GetExecutable ( ) string {
if x != nil {
return x . Executable
}
return ""
}
func ( x * AboutResponse ) GetVersion ( ) string {
if x != nil {
return x . Version
}
return ""
}
func ( x * AboutResponse ) GetMetadata ( ) map [ string ] string {
if x != nil {
return x . Metadata
}
return nil
}
type GetProgramDependenciesRequest struct {
state protoimpl . MessageState
sizeCache protoimpl . SizeCache
unknownFields protoimpl . UnknownFields
Pass root and main info to language host methods (#14654)
<!---
Thanks so much for your contribution! If this is your first time
contributing, please ensure that you have read the
[CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md)
documentation.
-->
# Description
<!--- Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context. -->
This is two changes rolled together in a way.
Firstly passing some of the data that we pass on language runtime
startup to also pass it to Run/GetRequiredPlugins/etc. This is needed
for matrix testing, as we only get to start the language runtime up once
for that but want to execute multiple programs with it.
I feel it's also a little more consistent as we use the language
runtimes in other contexts (codegen) where there isn't really a root
directory, and aren't any options (and if we did do options the options
for codegen are not going to be the same as for execution). It also
means we can reuse a language host for shimless and substack programs,
as before they heavily relied on their current working directory to
calculate paths, and obviosly could only take one set of options at
startup. Imagine a shimless python package + a python root program, that
would have needed two startups of the python language host to deal with,
this unblocks it so we can make the engine smarter and only use one.
Secondly renaming some of the fields we pass to
Run/GetRequiredPlugins/etc today. `Pwd` and `Program` were not very
descriptive and had pretty non-obvious documentation:
```
string pwd = 3; // the program's working directory.
string program = 4; // the path to the program to execute.
```
`pwd` will remain, although probably rename it to `working_directory` at
some point, because while today we always start programs up with the
working directory equal to the program directory that definitely is
going to change in the future (at least for MLCs and substack programs).
But the name `pwd` doesn't make it clear that this was intended to be
the working directory _and_ the directory which contains the program.
`program` was in fact nearly always ".", and if it wasn't that it was
just a filename. The engine never sent a path for `program` (although we
did have some unit tests to check how that worked for the nodejs and
python hosts).
These are now replaced by a new structure with (I think) more clearly
named and documented fields (see ProgramInfo in langauge.proto).
The engine still sends the old data for now, we need to update
dotnet/yaml/java before we break the old interface and give Virtus Labs
a chance to update [besom](https://github.com/VirtusLab/besom).
## Checklist
- [x] I have run `make tidy` to update any new dependencies
- [x] I have run `make lint` to verify my code passes the lint check
- [ ] I have formatted my code using `gofumpt`
<!--- Please provide details if the checkbox below is to be left
unchecked. -->
- [x] I have added tests that prove my fix is effective or that my
feature works
<!---
User-facing changes require a CHANGELOG entry.
-->
- [ ] I have run `make changelog` and committed the
`changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the
Pulumi Cloud,
then the service should honor older versions of the CLI where this
change would not exist.
You must then bump the API version in
/pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi
Cloud API version
<!-- @Pulumi employees: If yes, you must submit corresponding changes in
the service repo. -->
2023-12-10 17:30:51 +00:00
// Deprecated: Do not use.
2024-01-16 17:06:14 +00:00
Project string ` protobuf:"bytes,1,opt,name=project,proto3" json:"project,omitempty" ` // the project name, the engine always sets this to "deprecated" now.
Pass root and main info to language host methods (#14654)
<!---
Thanks so much for your contribution! If this is your first time
contributing, please ensure that you have read the
[CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md)
documentation.
-->
# Description
<!--- Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context. -->
This is two changes rolled together in a way.
Firstly passing some of the data that we pass on language runtime
startup to also pass it to Run/GetRequiredPlugins/etc. This is needed
for matrix testing, as we only get to start the language runtime up once
for that but want to execute multiple programs with it.
I feel it's also a little more consistent as we use the language
runtimes in other contexts (codegen) where there isn't really a root
directory, and aren't any options (and if we did do options the options
for codegen are not going to be the same as for execution). It also
means we can reuse a language host for shimless and substack programs,
as before they heavily relied on their current working directory to
calculate paths, and obviosly could only take one set of options at
startup. Imagine a shimless python package + a python root program, that
would have needed two startups of the python language host to deal with,
this unblocks it so we can make the engine smarter and only use one.
Secondly renaming some of the fields we pass to
Run/GetRequiredPlugins/etc today. `Pwd` and `Program` were not very
descriptive and had pretty non-obvious documentation:
```
string pwd = 3; // the program's working directory.
string program = 4; // the path to the program to execute.
```
`pwd` will remain, although probably rename it to `working_directory` at
some point, because while today we always start programs up with the
working directory equal to the program directory that definitely is
going to change in the future (at least for MLCs and substack programs).
But the name `pwd` doesn't make it clear that this was intended to be
the working directory _and_ the directory which contains the program.
`program` was in fact nearly always ".", and if it wasn't that it was
just a filename. The engine never sent a path for `program` (although we
did have some unit tests to check how that worked for the nodejs and
python hosts).
These are now replaced by a new structure with (I think) more clearly
named and documented fields (see ProgramInfo in langauge.proto).
The engine still sends the old data for now, we need to update
dotnet/yaml/java before we break the old interface and give Virtus Labs
a chance to update [besom](https://github.com/VirtusLab/besom).
## Checklist
- [x] I have run `make tidy` to update any new dependencies
- [x] I have run `make lint` to verify my code passes the lint check
- [ ] I have formatted my code using `gofumpt`
<!--- Please provide details if the checkbox below is to be left
unchecked. -->
- [x] I have added tests that prove my fix is effective or that my
feature works
<!---
User-facing changes require a CHANGELOG entry.
-->
- [ ] I have run `make changelog` and committed the
`changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the
Pulumi Cloud,
then the service should honor older versions of the CLI where this
change would not exist.
You must then bump the API version in
/pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi
Cloud API version
<!-- @Pulumi employees: If yes, you must submit corresponding changes in
the service repo. -->
2023-12-10 17:30:51 +00:00
// Deprecated: Do not use.
Pwd string ` protobuf:"bytes,2,opt,name=pwd,proto3" json:"pwd,omitempty" ` // the program's working directory.
// Deprecated: Do not use.
Program string ` protobuf:"bytes,3,opt,name=program,proto3" json:"program,omitempty" ` // the path to the program.
TransitiveDependencies bool ` protobuf:"varint,4,opt,name=transitiveDependencies,proto3" json:"transitiveDependencies,omitempty" ` // if transitive dependencies should be included in the result.
Info * ProgramInfo ` protobuf:"bytes,5,opt,name=info,proto3" json:"info,omitempty" ` // the program info to use to calculate dependencies.
2022-07-25 11:35:16 +00:00
}
func ( x * GetProgramDependenciesRequest ) Reset ( ) {
* x = GetProgramDependenciesRequest { }
if protoimpl . UnsafeEnabled {
2024-06-06 08:21:46 +00:00
mi := & file_pulumi_language_proto_msgTypes [ 3 ]
2022-07-25 11:35:16 +00:00
ms := protoimpl . X . MessageStateOf ( protoimpl . Pointer ( x ) )
ms . StoreMessageInfo ( mi )
}
}
func ( x * GetProgramDependenciesRequest ) String ( ) string {
return protoimpl . X . MessageStringOf ( x )
}
func ( * GetProgramDependenciesRequest ) ProtoMessage ( ) { }
func ( x * GetProgramDependenciesRequest ) ProtoReflect ( ) protoreflect . Message {
2024-06-06 08:21:46 +00:00
mi := & file_pulumi_language_proto_msgTypes [ 3 ]
2022-07-25 11:35:16 +00:00
if protoimpl . UnsafeEnabled && x != nil {
ms := protoimpl . X . MessageStateOf ( protoimpl . Pointer ( x ) )
if ms . LoadMessageInfo ( ) == nil {
ms . StoreMessageInfo ( mi )
}
return ms
}
return mi . MessageOf ( x )
}
// Deprecated: Use GetProgramDependenciesRequest.ProtoReflect.Descriptor instead.
func ( * GetProgramDependenciesRequest ) Descriptor ( ) ( [ ] byte , [ ] int ) {
2024-06-06 08:21:46 +00:00
return file_pulumi_language_proto_rawDescGZIP ( ) , [ ] int { 3 }
2022-07-25 11:35:16 +00:00
}
Pass root and main info to language host methods (#14654)
<!---
Thanks so much for your contribution! If this is your first time
contributing, please ensure that you have read the
[CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md)
documentation.
-->
# Description
<!--- Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context. -->
This is two changes rolled together in a way.
Firstly passing some of the data that we pass on language runtime
startup to also pass it to Run/GetRequiredPlugins/etc. This is needed
for matrix testing, as we only get to start the language runtime up once
for that but want to execute multiple programs with it.
I feel it's also a little more consistent as we use the language
runtimes in other contexts (codegen) where there isn't really a root
directory, and aren't any options (and if we did do options the options
for codegen are not going to be the same as for execution). It also
means we can reuse a language host for shimless and substack programs,
as before they heavily relied on their current working directory to
calculate paths, and obviosly could only take one set of options at
startup. Imagine a shimless python package + a python root program, that
would have needed two startups of the python language host to deal with,
this unblocks it so we can make the engine smarter and only use one.
Secondly renaming some of the fields we pass to
Run/GetRequiredPlugins/etc today. `Pwd` and `Program` were not very
descriptive and had pretty non-obvious documentation:
```
string pwd = 3; // the program's working directory.
string program = 4; // the path to the program to execute.
```
`pwd` will remain, although probably rename it to `working_directory` at
some point, because while today we always start programs up with the
working directory equal to the program directory that definitely is
going to change in the future (at least for MLCs and substack programs).
But the name `pwd` doesn't make it clear that this was intended to be
the working directory _and_ the directory which contains the program.
`program` was in fact nearly always ".", and if it wasn't that it was
just a filename. The engine never sent a path for `program` (although we
did have some unit tests to check how that worked for the nodejs and
python hosts).
These are now replaced by a new structure with (I think) more clearly
named and documented fields (see ProgramInfo in langauge.proto).
The engine still sends the old data for now, we need to update
dotnet/yaml/java before we break the old interface and give Virtus Labs
a chance to update [besom](https://github.com/VirtusLab/besom).
## Checklist
- [x] I have run `make tidy` to update any new dependencies
- [x] I have run `make lint` to verify my code passes the lint check
- [ ] I have formatted my code using `gofumpt`
<!--- Please provide details if the checkbox below is to be left
unchecked. -->
- [x] I have added tests that prove my fix is effective or that my
feature works
<!---
User-facing changes require a CHANGELOG entry.
-->
- [ ] I have run `make changelog` and committed the
`changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the
Pulumi Cloud,
then the service should honor older versions of the CLI where this
change would not exist.
You must then bump the API version in
/pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi
Cloud API version
<!-- @Pulumi employees: If yes, you must submit corresponding changes in
the service repo. -->
2023-12-10 17:30:51 +00:00
// Deprecated: Do not use.
2022-07-25 11:35:16 +00:00
func ( x * GetProgramDependenciesRequest ) GetProject ( ) string {
if x != nil {
return x . Project
}
return ""
}
Pass root and main info to language host methods (#14654)
<!---
Thanks so much for your contribution! If this is your first time
contributing, please ensure that you have read the
[CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md)
documentation.
-->
# Description
<!--- Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context. -->
This is two changes rolled together in a way.
Firstly passing some of the data that we pass on language runtime
startup to also pass it to Run/GetRequiredPlugins/etc. This is needed
for matrix testing, as we only get to start the language runtime up once
for that but want to execute multiple programs with it.
I feel it's also a little more consistent as we use the language
runtimes in other contexts (codegen) where there isn't really a root
directory, and aren't any options (and if we did do options the options
for codegen are not going to be the same as for execution). It also
means we can reuse a language host for shimless and substack programs,
as before they heavily relied on their current working directory to
calculate paths, and obviosly could only take one set of options at
startup. Imagine a shimless python package + a python root program, that
would have needed two startups of the python language host to deal with,
this unblocks it so we can make the engine smarter and only use one.
Secondly renaming some of the fields we pass to
Run/GetRequiredPlugins/etc today. `Pwd` and `Program` were not very
descriptive and had pretty non-obvious documentation:
```
string pwd = 3; // the program's working directory.
string program = 4; // the path to the program to execute.
```
`pwd` will remain, although probably rename it to `working_directory` at
some point, because while today we always start programs up with the
working directory equal to the program directory that definitely is
going to change in the future (at least for MLCs and substack programs).
But the name `pwd` doesn't make it clear that this was intended to be
the working directory _and_ the directory which contains the program.
`program` was in fact nearly always ".", and if it wasn't that it was
just a filename. The engine never sent a path for `program` (although we
did have some unit tests to check how that worked for the nodejs and
python hosts).
These are now replaced by a new structure with (I think) more clearly
named and documented fields (see ProgramInfo in langauge.proto).
The engine still sends the old data for now, we need to update
dotnet/yaml/java before we break the old interface and give Virtus Labs
a chance to update [besom](https://github.com/VirtusLab/besom).
## Checklist
- [x] I have run `make tidy` to update any new dependencies
- [x] I have run `make lint` to verify my code passes the lint check
- [ ] I have formatted my code using `gofumpt`
<!--- Please provide details if the checkbox below is to be left
unchecked. -->
- [x] I have added tests that prove my fix is effective or that my
feature works
<!---
User-facing changes require a CHANGELOG entry.
-->
- [ ] I have run `make changelog` and committed the
`changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the
Pulumi Cloud,
then the service should honor older versions of the CLI where this
change would not exist.
You must then bump the API version in
/pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi
Cloud API version
<!-- @Pulumi employees: If yes, you must submit corresponding changes in
the service repo. -->
2023-12-10 17:30:51 +00:00
// Deprecated: Do not use.
2022-07-25 11:35:16 +00:00
func ( x * GetProgramDependenciesRequest ) GetPwd ( ) string {
if x != nil {
return x . Pwd
}
return ""
}
Pass root and main info to language host methods (#14654)
<!---
Thanks so much for your contribution! If this is your first time
contributing, please ensure that you have read the
[CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md)
documentation.
-->
# Description
<!--- Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context. -->
This is two changes rolled together in a way.
Firstly passing some of the data that we pass on language runtime
startup to also pass it to Run/GetRequiredPlugins/etc. This is needed
for matrix testing, as we only get to start the language runtime up once
for that but want to execute multiple programs with it.
I feel it's also a little more consistent as we use the language
runtimes in other contexts (codegen) where there isn't really a root
directory, and aren't any options (and if we did do options the options
for codegen are not going to be the same as for execution). It also
means we can reuse a language host for shimless and substack programs,
as before they heavily relied on their current working directory to
calculate paths, and obviosly could only take one set of options at
startup. Imagine a shimless python package + a python root program, that
would have needed two startups of the python language host to deal with,
this unblocks it so we can make the engine smarter and only use one.
Secondly renaming some of the fields we pass to
Run/GetRequiredPlugins/etc today. `Pwd` and `Program` were not very
descriptive and had pretty non-obvious documentation:
```
string pwd = 3; // the program's working directory.
string program = 4; // the path to the program to execute.
```
`pwd` will remain, although probably rename it to `working_directory` at
some point, because while today we always start programs up with the
working directory equal to the program directory that definitely is
going to change in the future (at least for MLCs and substack programs).
But the name `pwd` doesn't make it clear that this was intended to be
the working directory _and_ the directory which contains the program.
`program` was in fact nearly always ".", and if it wasn't that it was
just a filename. The engine never sent a path for `program` (although we
did have some unit tests to check how that worked for the nodejs and
python hosts).
These are now replaced by a new structure with (I think) more clearly
named and documented fields (see ProgramInfo in langauge.proto).
The engine still sends the old data for now, we need to update
dotnet/yaml/java before we break the old interface and give Virtus Labs
a chance to update [besom](https://github.com/VirtusLab/besom).
## Checklist
- [x] I have run `make tidy` to update any new dependencies
- [x] I have run `make lint` to verify my code passes the lint check
- [ ] I have formatted my code using `gofumpt`
<!--- Please provide details if the checkbox below is to be left
unchecked. -->
- [x] I have added tests that prove my fix is effective or that my
feature works
<!---
User-facing changes require a CHANGELOG entry.
-->
- [ ] I have run `make changelog` and committed the
`changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the
Pulumi Cloud,
then the service should honor older versions of the CLI where this
change would not exist.
You must then bump the API version in
/pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi
Cloud API version
<!-- @Pulumi employees: If yes, you must submit corresponding changes in
the service repo. -->
2023-12-10 17:30:51 +00:00
// Deprecated: Do not use.
2022-07-25 11:35:16 +00:00
func ( x * GetProgramDependenciesRequest ) GetProgram ( ) string {
if x != nil {
return x . Program
}
return ""
}
func ( x * GetProgramDependenciesRequest ) GetTransitiveDependencies ( ) bool {
if x != nil {
return x . TransitiveDependencies
}
return false
}
Pass root and main info to language host methods (#14654)
<!---
Thanks so much for your contribution! If this is your first time
contributing, please ensure that you have read the
[CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md)
documentation.
-->
# Description
<!--- Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context. -->
This is two changes rolled together in a way.
Firstly passing some of the data that we pass on language runtime
startup to also pass it to Run/GetRequiredPlugins/etc. This is needed
for matrix testing, as we only get to start the language runtime up once
for that but want to execute multiple programs with it.
I feel it's also a little more consistent as we use the language
runtimes in other contexts (codegen) where there isn't really a root
directory, and aren't any options (and if we did do options the options
for codegen are not going to be the same as for execution). It also
means we can reuse a language host for shimless and substack programs,
as before they heavily relied on their current working directory to
calculate paths, and obviosly could only take one set of options at
startup. Imagine a shimless python package + a python root program, that
would have needed two startups of the python language host to deal with,
this unblocks it so we can make the engine smarter and only use one.
Secondly renaming some of the fields we pass to
Run/GetRequiredPlugins/etc today. `Pwd` and `Program` were not very
descriptive and had pretty non-obvious documentation:
```
string pwd = 3; // the program's working directory.
string program = 4; // the path to the program to execute.
```
`pwd` will remain, although probably rename it to `working_directory` at
some point, because while today we always start programs up with the
working directory equal to the program directory that definitely is
going to change in the future (at least for MLCs and substack programs).
But the name `pwd` doesn't make it clear that this was intended to be
the working directory _and_ the directory which contains the program.
`program` was in fact nearly always ".", and if it wasn't that it was
just a filename. The engine never sent a path for `program` (although we
did have some unit tests to check how that worked for the nodejs and
python hosts).
These are now replaced by a new structure with (I think) more clearly
named and documented fields (see ProgramInfo in langauge.proto).
The engine still sends the old data for now, we need to update
dotnet/yaml/java before we break the old interface and give Virtus Labs
a chance to update [besom](https://github.com/VirtusLab/besom).
## Checklist
- [x] I have run `make tidy` to update any new dependencies
- [x] I have run `make lint` to verify my code passes the lint check
- [ ] I have formatted my code using `gofumpt`
<!--- Please provide details if the checkbox below is to be left
unchecked. -->
- [x] I have added tests that prove my fix is effective or that my
feature works
<!---
User-facing changes require a CHANGELOG entry.
-->
- [ ] I have run `make changelog` and committed the
`changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the
Pulumi Cloud,
then the service should honor older versions of the CLI where this
change would not exist.
You must then bump the API version in
/pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi
Cloud API version
<!-- @Pulumi employees: If yes, you must submit corresponding changes in
the service repo. -->
2023-12-10 17:30:51 +00:00
func ( x * GetProgramDependenciesRequest ) GetInfo ( ) * ProgramInfo {
if x != nil {
return x . Info
}
return nil
}
2022-07-25 11:35:16 +00:00
type DependencyInfo struct {
state protoimpl . MessageState
sizeCache protoimpl . SizeCache
unknownFields protoimpl . UnknownFields
Name string ` protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty" ` // The name of the dependency.
Version string ` protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty" ` // The version of the dependency.
}
func ( x * DependencyInfo ) Reset ( ) {
* x = DependencyInfo { }
if protoimpl . UnsafeEnabled {
2024-06-06 08:21:46 +00:00
mi := & file_pulumi_language_proto_msgTypes [ 4 ]
2022-07-25 11:35:16 +00:00
ms := protoimpl . X . MessageStateOf ( protoimpl . Pointer ( x ) )
ms . StoreMessageInfo ( mi )
}
}
func ( x * DependencyInfo ) String ( ) string {
return protoimpl . X . MessageStringOf ( x )
}
func ( * DependencyInfo ) ProtoMessage ( ) { }
func ( x * DependencyInfo ) ProtoReflect ( ) protoreflect . Message {
2024-06-06 08:21:46 +00:00
mi := & file_pulumi_language_proto_msgTypes [ 4 ]
2022-07-25 11:35:16 +00:00
if protoimpl . UnsafeEnabled && x != nil {
ms := protoimpl . X . MessageStateOf ( protoimpl . Pointer ( x ) )
if ms . LoadMessageInfo ( ) == nil {
ms . StoreMessageInfo ( mi )
}
return ms
}
return mi . MessageOf ( x )
}
// Deprecated: Use DependencyInfo.ProtoReflect.Descriptor instead.
func ( * DependencyInfo ) Descriptor ( ) ( [ ] byte , [ ] int ) {
2024-06-06 08:21:46 +00:00
return file_pulumi_language_proto_rawDescGZIP ( ) , [ ] int { 4 }
2022-07-25 11:35:16 +00:00
}
func ( x * DependencyInfo ) GetName ( ) string {
if x != nil {
return x . Name
}
return ""
}
func ( x * DependencyInfo ) GetVersion ( ) string {
if x != nil {
return x . Version
}
return ""
}
type GetProgramDependenciesResponse struct {
state protoimpl . MessageState
sizeCache protoimpl . SizeCache
unknownFields protoimpl . UnknownFields
Dependencies [ ] * DependencyInfo ` protobuf:"bytes,1,rep,name=dependencies,proto3" json:"dependencies,omitempty" ` // the dependencies of this program
}
func ( x * GetProgramDependenciesResponse ) Reset ( ) {
* x = GetProgramDependenciesResponse { }
if protoimpl . UnsafeEnabled {
2024-06-06 08:21:46 +00:00
mi := & file_pulumi_language_proto_msgTypes [ 5 ]
2022-07-25 11:35:16 +00:00
ms := protoimpl . X . MessageStateOf ( protoimpl . Pointer ( x ) )
ms . StoreMessageInfo ( mi )
}
}
func ( x * GetProgramDependenciesResponse ) String ( ) string {
return protoimpl . X . MessageStringOf ( x )
}
func ( * GetProgramDependenciesResponse ) ProtoMessage ( ) { }
func ( x * GetProgramDependenciesResponse ) ProtoReflect ( ) protoreflect . Message {
2024-06-06 08:21:46 +00:00
mi := & file_pulumi_language_proto_msgTypes [ 5 ]
2022-07-25 11:35:16 +00:00
if protoimpl . UnsafeEnabled && x != nil {
ms := protoimpl . X . MessageStateOf ( protoimpl . Pointer ( x ) )
if ms . LoadMessageInfo ( ) == nil {
ms . StoreMessageInfo ( mi )
}
return ms
}
return mi . MessageOf ( x )
}
// Deprecated: Use GetProgramDependenciesResponse.ProtoReflect.Descriptor instead.
func ( * GetProgramDependenciesResponse ) Descriptor ( ) ( [ ] byte , [ ] int ) {
2024-06-06 08:21:46 +00:00
return file_pulumi_language_proto_rawDescGZIP ( ) , [ ] int { 5 }
2022-07-25 11:35:16 +00:00
}
func ( x * GetProgramDependenciesResponse ) GetDependencies ( ) [ ] * DependencyInfo {
if x != nil {
return x . Dependencies
}
return nil
}
2018-02-06 17:57:32 +00:00
type GetRequiredPluginsRequest struct {
2022-06-11 07:52:24 +00:00
state protoimpl . MessageState
sizeCache protoimpl . SizeCache
unknownFields protoimpl . UnknownFields
2018-07-12 01:07:50 +00:00
Pass root and main info to language host methods (#14654)
<!---
Thanks so much for your contribution! If this is your first time
contributing, please ensure that you have read the
[CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md)
documentation.
-->
# Description
<!--- Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context. -->
This is two changes rolled together in a way.
Firstly passing some of the data that we pass on language runtime
startup to also pass it to Run/GetRequiredPlugins/etc. This is needed
for matrix testing, as we only get to start the language runtime up once
for that but want to execute multiple programs with it.
I feel it's also a little more consistent as we use the language
runtimes in other contexts (codegen) where there isn't really a root
directory, and aren't any options (and if we did do options the options
for codegen are not going to be the same as for execution). It also
means we can reuse a language host for shimless and substack programs,
as before they heavily relied on their current working directory to
calculate paths, and obviosly could only take one set of options at
startup. Imagine a shimless python package + a python root program, that
would have needed two startups of the python language host to deal with,
this unblocks it so we can make the engine smarter and only use one.
Secondly renaming some of the fields we pass to
Run/GetRequiredPlugins/etc today. `Pwd` and `Program` were not very
descriptive and had pretty non-obvious documentation:
```
string pwd = 3; // the program's working directory.
string program = 4; // the path to the program to execute.
```
`pwd` will remain, although probably rename it to `working_directory` at
some point, because while today we always start programs up with the
working directory equal to the program directory that definitely is
going to change in the future (at least for MLCs and substack programs).
But the name `pwd` doesn't make it clear that this was intended to be
the working directory _and_ the directory which contains the program.
`program` was in fact nearly always ".", and if it wasn't that it was
just a filename. The engine never sent a path for `program` (although we
did have some unit tests to check how that worked for the nodejs and
python hosts).
These are now replaced by a new structure with (I think) more clearly
named and documented fields (see ProgramInfo in langauge.proto).
The engine still sends the old data for now, we need to update
dotnet/yaml/java before we break the old interface and give Virtus Labs
a chance to update [besom](https://github.com/VirtusLab/besom).
## Checklist
- [x] I have run `make tidy` to update any new dependencies
- [x] I have run `make lint` to verify my code passes the lint check
- [ ] I have formatted my code using `gofumpt`
<!--- Please provide details if the checkbox below is to be left
unchecked. -->
- [x] I have added tests that prove my fix is effective or that my
feature works
<!---
User-facing changes require a CHANGELOG entry.
-->
- [ ] I have run `make changelog` and committed the
`changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the
Pulumi Cloud,
then the service should honor older versions of the CLI where this
change would not exist.
You must then bump the API version in
/pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi
Cloud API version
<!-- @Pulumi employees: If yes, you must submit corresponding changes in
the service repo. -->
2023-12-10 17:30:51 +00:00
// Deprecated: Do not use.
2024-01-16 17:06:14 +00:00
Project string ` protobuf:"bytes,1,opt,name=project,proto3" json:"project,omitempty" ` // the project name, the engine always sets this to "deprecated" now.
Pass root and main info to language host methods (#14654)
<!---
Thanks so much for your contribution! If this is your first time
contributing, please ensure that you have read the
[CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md)
documentation.
-->
# Description
<!--- Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context. -->
This is two changes rolled together in a way.
Firstly passing some of the data that we pass on language runtime
startup to also pass it to Run/GetRequiredPlugins/etc. This is needed
for matrix testing, as we only get to start the language runtime up once
for that but want to execute multiple programs with it.
I feel it's also a little more consistent as we use the language
runtimes in other contexts (codegen) where there isn't really a root
directory, and aren't any options (and if we did do options the options
for codegen are not going to be the same as for execution). It also
means we can reuse a language host for shimless and substack programs,
as before they heavily relied on their current working directory to
calculate paths, and obviosly could only take one set of options at
startup. Imagine a shimless python package + a python root program, that
would have needed two startups of the python language host to deal with,
this unblocks it so we can make the engine smarter and only use one.
Secondly renaming some of the fields we pass to
Run/GetRequiredPlugins/etc today. `Pwd` and `Program` were not very
descriptive and had pretty non-obvious documentation:
```
string pwd = 3; // the program's working directory.
string program = 4; // the path to the program to execute.
```
`pwd` will remain, although probably rename it to `working_directory` at
some point, because while today we always start programs up with the
working directory equal to the program directory that definitely is
going to change in the future (at least for MLCs and substack programs).
But the name `pwd` doesn't make it clear that this was intended to be
the working directory _and_ the directory which contains the program.
`program` was in fact nearly always ".", and if it wasn't that it was
just a filename. The engine never sent a path for `program` (although we
did have some unit tests to check how that worked for the nodejs and
python hosts).
These are now replaced by a new structure with (I think) more clearly
named and documented fields (see ProgramInfo in langauge.proto).
The engine still sends the old data for now, we need to update
dotnet/yaml/java before we break the old interface and give Virtus Labs
a chance to update [besom](https://github.com/VirtusLab/besom).
## Checklist
- [x] I have run `make tidy` to update any new dependencies
- [x] I have run `make lint` to verify my code passes the lint check
- [ ] I have formatted my code using `gofumpt`
<!--- Please provide details if the checkbox below is to be left
unchecked. -->
- [x] I have added tests that prove my fix is effective or that my
feature works
<!---
User-facing changes require a CHANGELOG entry.
-->
- [ ] I have run `make changelog` and committed the
`changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the
Pulumi Cloud,
then the service should honor older versions of the CLI where this
change would not exist.
You must then bump the API version in
/pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi
Cloud API version
<!-- @Pulumi employees: If yes, you must submit corresponding changes in
the service repo. -->
2023-12-10 17:30:51 +00:00
// Deprecated: Do not use.
Pwd string ` protobuf:"bytes,2,opt,name=pwd,proto3" json:"pwd,omitempty" ` // the program's working directory.
// Deprecated: Do not use.
Program string ` protobuf:"bytes,3,opt,name=program,proto3" json:"program,omitempty" ` // the path to the program.
Info * ProgramInfo ` protobuf:"bytes,4,opt,name=info,proto3" json:"info,omitempty" ` // the program info to use to calculate plugins.
2018-07-12 01:07:50 +00:00
}
2020-02-28 11:53:47 +00:00
2022-06-11 07:52:24 +00:00
func ( x * GetRequiredPluginsRequest ) Reset ( ) {
* x = GetRequiredPluginsRequest { }
if protoimpl . UnsafeEnabled {
2024-06-06 08:21:46 +00:00
mi := & file_pulumi_language_proto_msgTypes [ 6 ]
2022-06-11 07:52:24 +00:00
ms := protoimpl . X . MessageStateOf ( protoimpl . Pointer ( x ) )
ms . StoreMessageInfo ( mi )
}
2018-07-12 01:07:50 +00:00
}
2022-06-11 07:52:24 +00:00
func ( x * GetRequiredPluginsRequest ) String ( ) string {
return protoimpl . X . MessageStringOf ( x )
2018-07-12 01:07:50 +00:00
}
2022-06-11 07:52:24 +00:00
func ( * GetRequiredPluginsRequest ) ProtoMessage ( ) { }
func ( x * GetRequiredPluginsRequest ) ProtoReflect ( ) protoreflect . Message {
2024-06-06 08:21:46 +00:00
mi := & file_pulumi_language_proto_msgTypes [ 6 ]
2022-06-11 07:52:24 +00:00
if protoimpl . UnsafeEnabled && x != nil {
ms := protoimpl . X . MessageStateOf ( protoimpl . Pointer ( x ) )
if ms . LoadMessageInfo ( ) == nil {
ms . StoreMessageInfo ( mi )
}
return ms
}
return mi . MessageOf ( x )
2018-02-06 17:57:32 +00:00
}
2022-06-11 07:52:24 +00:00
// Deprecated: Use GetRequiredPluginsRequest.ProtoReflect.Descriptor instead.
func ( * GetRequiredPluginsRequest ) Descriptor ( ) ( [ ] byte , [ ] int ) {
2024-06-06 08:21:46 +00:00
return file_pulumi_language_proto_rawDescGZIP ( ) , [ ] int { 6 }
2022-06-11 07:52:24 +00:00
}
2018-02-06 17:57:32 +00:00
Pass root and main info to language host methods (#14654)
<!---
Thanks so much for your contribution! If this is your first time
contributing, please ensure that you have read the
[CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md)
documentation.
-->
# Description
<!--- Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context. -->
This is two changes rolled together in a way.
Firstly passing some of the data that we pass on language runtime
startup to also pass it to Run/GetRequiredPlugins/etc. This is needed
for matrix testing, as we only get to start the language runtime up once
for that but want to execute multiple programs with it.
I feel it's also a little more consistent as we use the language
runtimes in other contexts (codegen) where there isn't really a root
directory, and aren't any options (and if we did do options the options
for codegen are not going to be the same as for execution). It also
means we can reuse a language host for shimless and substack programs,
as before they heavily relied on their current working directory to
calculate paths, and obviosly could only take one set of options at
startup. Imagine a shimless python package + a python root program, that
would have needed two startups of the python language host to deal with,
this unblocks it so we can make the engine smarter and only use one.
Secondly renaming some of the fields we pass to
Run/GetRequiredPlugins/etc today. `Pwd` and `Program` were not very
descriptive and had pretty non-obvious documentation:
```
string pwd = 3; // the program's working directory.
string program = 4; // the path to the program to execute.
```
`pwd` will remain, although probably rename it to `working_directory` at
some point, because while today we always start programs up with the
working directory equal to the program directory that definitely is
going to change in the future (at least for MLCs and substack programs).
But the name `pwd` doesn't make it clear that this was intended to be
the working directory _and_ the directory which contains the program.
`program` was in fact nearly always ".", and if it wasn't that it was
just a filename. The engine never sent a path for `program` (although we
did have some unit tests to check how that worked for the nodejs and
python hosts).
These are now replaced by a new structure with (I think) more clearly
named and documented fields (see ProgramInfo in langauge.proto).
The engine still sends the old data for now, we need to update
dotnet/yaml/java before we break the old interface and give Virtus Labs
a chance to update [besom](https://github.com/VirtusLab/besom).
## Checklist
- [x] I have run `make tidy` to update any new dependencies
- [x] I have run `make lint` to verify my code passes the lint check
- [ ] I have formatted my code using `gofumpt`
<!--- Please provide details if the checkbox below is to be left
unchecked. -->
- [x] I have added tests that prove my fix is effective or that my
feature works
<!---
User-facing changes require a CHANGELOG entry.
-->
- [ ] I have run `make changelog` and committed the
`changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the
Pulumi Cloud,
then the service should honor older versions of the CLI where this
change would not exist.
You must then bump the API version in
/pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi
Cloud API version
<!-- @Pulumi employees: If yes, you must submit corresponding changes in
the service repo. -->
2023-12-10 17:30:51 +00:00
// Deprecated: Do not use.
2022-06-11 07:52:24 +00:00
func ( x * GetRequiredPluginsRequest ) GetProject ( ) string {
if x != nil {
return x . Project
2018-02-06 17:57:32 +00:00
}
return ""
}
Pass root and main info to language host methods (#14654)
<!---
Thanks so much for your contribution! If this is your first time
contributing, please ensure that you have read the
[CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md)
documentation.
-->
# Description
<!--- Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context. -->
This is two changes rolled together in a way.
Firstly passing some of the data that we pass on language runtime
startup to also pass it to Run/GetRequiredPlugins/etc. This is needed
for matrix testing, as we only get to start the language runtime up once
for that but want to execute multiple programs with it.
I feel it's also a little more consistent as we use the language
runtimes in other contexts (codegen) where there isn't really a root
directory, and aren't any options (and if we did do options the options
for codegen are not going to be the same as for execution). It also
means we can reuse a language host for shimless and substack programs,
as before they heavily relied on their current working directory to
calculate paths, and obviosly could only take one set of options at
startup. Imagine a shimless python package + a python root program, that
would have needed two startups of the python language host to deal with,
this unblocks it so we can make the engine smarter and only use one.
Secondly renaming some of the fields we pass to
Run/GetRequiredPlugins/etc today. `Pwd` and `Program` were not very
descriptive and had pretty non-obvious documentation:
```
string pwd = 3; // the program's working directory.
string program = 4; // the path to the program to execute.
```
`pwd` will remain, although probably rename it to `working_directory` at
some point, because while today we always start programs up with the
working directory equal to the program directory that definitely is
going to change in the future (at least for MLCs and substack programs).
But the name `pwd` doesn't make it clear that this was intended to be
the working directory _and_ the directory which contains the program.
`program` was in fact nearly always ".", and if it wasn't that it was
just a filename. The engine never sent a path for `program` (although we
did have some unit tests to check how that worked for the nodejs and
python hosts).
These are now replaced by a new structure with (I think) more clearly
named and documented fields (see ProgramInfo in langauge.proto).
The engine still sends the old data for now, we need to update
dotnet/yaml/java before we break the old interface and give Virtus Labs
a chance to update [besom](https://github.com/VirtusLab/besom).
## Checklist
- [x] I have run `make tidy` to update any new dependencies
- [x] I have run `make lint` to verify my code passes the lint check
- [ ] I have formatted my code using `gofumpt`
<!--- Please provide details if the checkbox below is to be left
unchecked. -->
- [x] I have added tests that prove my fix is effective or that my
feature works
<!---
User-facing changes require a CHANGELOG entry.
-->
- [ ] I have run `make changelog` and committed the
`changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the
Pulumi Cloud,
then the service should honor older versions of the CLI where this
change would not exist.
You must then bump the API version in
/pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi
Cloud API version
<!-- @Pulumi employees: If yes, you must submit corresponding changes in
the service repo. -->
2023-12-10 17:30:51 +00:00
// Deprecated: Do not use.
2022-06-11 07:52:24 +00:00
func ( x * GetRequiredPluginsRequest ) GetPwd ( ) string {
if x != nil {
return x . Pwd
2018-02-06 17:57:32 +00:00
}
return ""
}
Pass root and main info to language host methods (#14654)
<!---
Thanks so much for your contribution! If this is your first time
contributing, please ensure that you have read the
[CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md)
documentation.
-->
# Description
<!--- Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context. -->
This is two changes rolled together in a way.
Firstly passing some of the data that we pass on language runtime
startup to also pass it to Run/GetRequiredPlugins/etc. This is needed
for matrix testing, as we only get to start the language runtime up once
for that but want to execute multiple programs with it.
I feel it's also a little more consistent as we use the language
runtimes in other contexts (codegen) where there isn't really a root
directory, and aren't any options (and if we did do options the options
for codegen are not going to be the same as for execution). It also
means we can reuse a language host for shimless and substack programs,
as before they heavily relied on their current working directory to
calculate paths, and obviosly could only take one set of options at
startup. Imagine a shimless python package + a python root program, that
would have needed two startups of the python language host to deal with,
this unblocks it so we can make the engine smarter and only use one.
Secondly renaming some of the fields we pass to
Run/GetRequiredPlugins/etc today. `Pwd` and `Program` were not very
descriptive and had pretty non-obvious documentation:
```
string pwd = 3; // the program's working directory.
string program = 4; // the path to the program to execute.
```
`pwd` will remain, although probably rename it to `working_directory` at
some point, because while today we always start programs up with the
working directory equal to the program directory that definitely is
going to change in the future (at least for MLCs and substack programs).
But the name `pwd` doesn't make it clear that this was intended to be
the working directory _and_ the directory which contains the program.
`program` was in fact nearly always ".", and if it wasn't that it was
just a filename. The engine never sent a path for `program` (although we
did have some unit tests to check how that worked for the nodejs and
python hosts).
These are now replaced by a new structure with (I think) more clearly
named and documented fields (see ProgramInfo in langauge.proto).
The engine still sends the old data for now, we need to update
dotnet/yaml/java before we break the old interface and give Virtus Labs
a chance to update [besom](https://github.com/VirtusLab/besom).
## Checklist
- [x] I have run `make tidy` to update any new dependencies
- [x] I have run `make lint` to verify my code passes the lint check
- [ ] I have formatted my code using `gofumpt`
<!--- Please provide details if the checkbox below is to be left
unchecked. -->
- [x] I have added tests that prove my fix is effective or that my
feature works
<!---
User-facing changes require a CHANGELOG entry.
-->
- [ ] I have run `make changelog` and committed the
`changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the
Pulumi Cloud,
then the service should honor older versions of the CLI where this
change would not exist.
You must then bump the API version in
/pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi
Cloud API version
<!-- @Pulumi employees: If yes, you must submit corresponding changes in
the service repo. -->
2023-12-10 17:30:51 +00:00
// Deprecated: Do not use.
2022-06-11 07:52:24 +00:00
func ( x * GetRequiredPluginsRequest ) GetProgram ( ) string {
if x != nil {
return x . Program
2018-02-06 17:57:32 +00:00
}
return ""
}
Pass root and main info to language host methods (#14654)
<!---
Thanks so much for your contribution! If this is your first time
contributing, please ensure that you have read the
[CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md)
documentation.
-->
# Description
<!--- Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context. -->
This is two changes rolled together in a way.
Firstly passing some of the data that we pass on language runtime
startup to also pass it to Run/GetRequiredPlugins/etc. This is needed
for matrix testing, as we only get to start the language runtime up once
for that but want to execute multiple programs with it.
I feel it's also a little more consistent as we use the language
runtimes in other contexts (codegen) where there isn't really a root
directory, and aren't any options (and if we did do options the options
for codegen are not going to be the same as for execution). It also
means we can reuse a language host for shimless and substack programs,
as before they heavily relied on their current working directory to
calculate paths, and obviosly could only take one set of options at
startup. Imagine a shimless python package + a python root program, that
would have needed two startups of the python language host to deal with,
this unblocks it so we can make the engine smarter and only use one.
Secondly renaming some of the fields we pass to
Run/GetRequiredPlugins/etc today. `Pwd` and `Program` were not very
descriptive and had pretty non-obvious documentation:
```
string pwd = 3; // the program's working directory.
string program = 4; // the path to the program to execute.
```
`pwd` will remain, although probably rename it to `working_directory` at
some point, because while today we always start programs up with the
working directory equal to the program directory that definitely is
going to change in the future (at least for MLCs and substack programs).
But the name `pwd` doesn't make it clear that this was intended to be
the working directory _and_ the directory which contains the program.
`program` was in fact nearly always ".", and if it wasn't that it was
just a filename. The engine never sent a path for `program` (although we
did have some unit tests to check how that worked for the nodejs and
python hosts).
These are now replaced by a new structure with (I think) more clearly
named and documented fields (see ProgramInfo in langauge.proto).
The engine still sends the old data for now, we need to update
dotnet/yaml/java before we break the old interface and give Virtus Labs
a chance to update [besom](https://github.com/VirtusLab/besom).
## Checklist
- [x] I have run `make tidy` to update any new dependencies
- [x] I have run `make lint` to verify my code passes the lint check
- [ ] I have formatted my code using `gofumpt`
<!--- Please provide details if the checkbox below is to be left
unchecked. -->
- [x] I have added tests that prove my fix is effective or that my
feature works
<!---
User-facing changes require a CHANGELOG entry.
-->
- [ ] I have run `make changelog` and committed the
`changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the
Pulumi Cloud,
then the service should honor older versions of the CLI where this
change would not exist.
You must then bump the API version in
/pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi
Cloud API version
<!-- @Pulumi employees: If yes, you must submit corresponding changes in
the service repo. -->
2023-12-10 17:30:51 +00:00
func ( x * GetRequiredPluginsRequest ) GetInfo ( ) * ProgramInfo {
if x != nil {
return x . Info
}
return nil
}
2018-02-06 17:57:32 +00:00
type GetRequiredPluginsResponse struct {
2022-06-11 07:52:24 +00:00
state protoimpl . MessageState
sizeCache protoimpl . SizeCache
unknownFields protoimpl . UnknownFields
2018-07-12 01:07:50 +00:00
2022-06-11 07:52:24 +00:00
Plugins [ ] * PluginDependency ` protobuf:"bytes,1,rep,name=plugins,proto3" json:"plugins,omitempty" ` // a list of plugins required by this program.
2018-07-12 01:07:50 +00:00
}
2020-02-28 11:53:47 +00:00
2022-06-11 07:52:24 +00:00
func ( x * GetRequiredPluginsResponse ) Reset ( ) {
* x = GetRequiredPluginsResponse { }
if protoimpl . UnsafeEnabled {
2024-06-06 08:21:46 +00:00
mi := & file_pulumi_language_proto_msgTypes [ 7 ]
2022-06-11 07:52:24 +00:00
ms := protoimpl . X . MessageStateOf ( protoimpl . Pointer ( x ) )
ms . StoreMessageInfo ( mi )
}
2018-07-12 01:07:50 +00:00
}
2022-06-11 07:52:24 +00:00
func ( x * GetRequiredPluginsResponse ) String ( ) string {
return protoimpl . X . MessageStringOf ( x )
2018-07-12 01:07:50 +00:00
}
2022-06-11 07:52:24 +00:00
func ( * GetRequiredPluginsResponse ) ProtoMessage ( ) { }
func ( x * GetRequiredPluginsResponse ) ProtoReflect ( ) protoreflect . Message {
2024-06-06 08:21:46 +00:00
mi := & file_pulumi_language_proto_msgTypes [ 7 ]
2022-06-11 07:52:24 +00:00
if protoimpl . UnsafeEnabled && x != nil {
ms := protoimpl . X . MessageStateOf ( protoimpl . Pointer ( x ) )
if ms . LoadMessageInfo ( ) == nil {
ms . StoreMessageInfo ( mi )
}
return ms
}
return mi . MessageOf ( x )
2018-02-06 17:57:32 +00:00
}
2022-06-11 07:52:24 +00:00
// Deprecated: Use GetRequiredPluginsResponse.ProtoReflect.Descriptor instead.
func ( * GetRequiredPluginsResponse ) Descriptor ( ) ( [ ] byte , [ ] int ) {
2024-06-06 08:21:46 +00:00
return file_pulumi_language_proto_rawDescGZIP ( ) , [ ] int { 7 }
2022-06-11 07:52:24 +00:00
}
2018-02-06 17:57:32 +00:00
2022-06-11 07:52:24 +00:00
func ( x * GetRequiredPluginsResponse ) GetPlugins ( ) [ ] * PluginDependency {
if x != nil {
return x . Plugins
2018-02-06 17:57:32 +00:00
}
return nil
}
2017-11-17 02:21:41 +00:00
// RunRequest asks the interpreter to execute a program.
type RunRequest struct {
2022-06-11 07:52:24 +00:00
state protoimpl . MessageState
sizeCache protoimpl . SizeCache
unknownFields protoimpl . UnknownFields
Pass root and main info to language host methods (#14654)
<!---
Thanks so much for your contribution! If this is your first time
contributing, please ensure that you have read the
[CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md)
documentation.
-->
# Description
<!--- Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context. -->
This is two changes rolled together in a way.
Firstly passing some of the data that we pass on language runtime
startup to also pass it to Run/GetRequiredPlugins/etc. This is needed
for matrix testing, as we only get to start the language runtime up once
for that but want to execute multiple programs with it.
I feel it's also a little more consistent as we use the language
runtimes in other contexts (codegen) where there isn't really a root
directory, and aren't any options (and if we did do options the options
for codegen are not going to be the same as for execution). It also
means we can reuse a language host for shimless and substack programs,
as before they heavily relied on their current working directory to
calculate paths, and obviosly could only take one set of options at
startup. Imagine a shimless python package + a python root program, that
would have needed two startups of the python language host to deal with,
this unblocks it so we can make the engine smarter and only use one.
Secondly renaming some of the fields we pass to
Run/GetRequiredPlugins/etc today. `Pwd` and `Program` were not very
descriptive and had pretty non-obvious documentation:
```
string pwd = 3; // the program's working directory.
string program = 4; // the path to the program to execute.
```
`pwd` will remain, although probably rename it to `working_directory` at
some point, because while today we always start programs up with the
working directory equal to the program directory that definitely is
going to change in the future (at least for MLCs and substack programs).
But the name `pwd` doesn't make it clear that this was intended to be
the working directory _and_ the directory which contains the program.
`program` was in fact nearly always ".", and if it wasn't that it was
just a filename. The engine never sent a path for `program` (although we
did have some unit tests to check how that worked for the nodejs and
python hosts).
These are now replaced by a new structure with (I think) more clearly
named and documented fields (see ProgramInfo in langauge.proto).
The engine still sends the old data for now, we need to update
dotnet/yaml/java before we break the old interface and give Virtus Labs
a chance to update [besom](https://github.com/VirtusLab/besom).
## Checklist
- [x] I have run `make tidy` to update any new dependencies
- [x] I have run `make lint` to verify my code passes the lint check
- [ ] I have formatted my code using `gofumpt`
<!--- Please provide details if the checkbox below is to be left
unchecked. -->
- [x] I have added tests that prove my fix is effective or that my
feature works
<!---
User-facing changes require a CHANGELOG entry.
-->
- [ ] I have run `make changelog` and committed the
`changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the
Pulumi Cloud,
then the service should honor older versions of the CLI where this
change would not exist.
You must then bump the API version in
/pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi
Cloud API version
<!-- @Pulumi employees: If yes, you must submit corresponding changes in
the service repo. -->
2023-12-10 17:30:51 +00:00
Project string ` protobuf:"bytes,1,opt,name=project,proto3" json:"project,omitempty" ` // the project name.
Stack string ` protobuf:"bytes,2,opt,name=stack,proto3" json:"stack,omitempty" ` // the name of the stack being deployed into.
Pwd string ` protobuf:"bytes,3,opt,name=pwd,proto3" json:"pwd,omitempty" ` // the program's working directory.
// Deprecated: Do not use.
2023-10-20 10:44:16 +00:00
Program string ` protobuf:"bytes,4,opt,name=program,proto3" json:"program,omitempty" ` // the path to the program to execute.
Args [ ] string ` protobuf:"bytes,5,rep,name=args,proto3" json:"args,omitempty" ` // any arguments to pass to the program.
Config map [ string ] string ` protobuf:"bytes,6,rep,name=config,proto3" json:"config,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3" ` // the configuration variables to apply before running.
DryRun bool ` protobuf:"varint,7,opt,name=dryRun,proto3" json:"dryRun,omitempty" ` // true if we're only doing a dryrun (preview).
Parallel int32 ` protobuf:"varint,8,opt,name=parallel,proto3" json:"parallel,omitempty" ` // the degree of parallelism for resource operations (<=1 for serial).
MonitorAddress string ` protobuf:"bytes,9,opt,name=monitor_address,json=monitorAddress,proto3" json:"monitor_address,omitempty" ` // the address for communicating back to the resource monitor.
QueryMode bool ` protobuf:"varint,10,opt,name=queryMode,proto3" json:"queryMode,omitempty" ` // true if we're only doing a query.
ConfigSecretKeys [ ] string ` protobuf:"bytes,11,rep,name=configSecretKeys,proto3" json:"configSecretKeys,omitempty" ` // the configuration keys that have secret values.
Organization string ` protobuf:"bytes,12,opt,name=organization,proto3" json:"organization,omitempty" ` // the organization of the stack being deployed into.
ConfigPropertyMap * structpb . Struct ` protobuf:"bytes,13,opt,name=configPropertyMap,proto3" json:"configPropertyMap,omitempty" ` // the configuration variables to apply before running.
Pass root and main info to language host methods (#14654)
<!---
Thanks so much for your contribution! If this is your first time
contributing, please ensure that you have read the
[CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md)
documentation.
-->
# Description
<!--- Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context. -->
This is two changes rolled together in a way.
Firstly passing some of the data that we pass on language runtime
startup to also pass it to Run/GetRequiredPlugins/etc. This is needed
for matrix testing, as we only get to start the language runtime up once
for that but want to execute multiple programs with it.
I feel it's also a little more consistent as we use the language
runtimes in other contexts (codegen) where there isn't really a root
directory, and aren't any options (and if we did do options the options
for codegen are not going to be the same as for execution). It also
means we can reuse a language host for shimless and substack programs,
as before they heavily relied on their current working directory to
calculate paths, and obviosly could only take one set of options at
startup. Imagine a shimless python package + a python root program, that
would have needed two startups of the python language host to deal with,
this unblocks it so we can make the engine smarter and only use one.
Secondly renaming some of the fields we pass to
Run/GetRequiredPlugins/etc today. `Pwd` and `Program` were not very
descriptive and had pretty non-obvious documentation:
```
string pwd = 3; // the program's working directory.
string program = 4; // the path to the program to execute.
```
`pwd` will remain, although probably rename it to `working_directory` at
some point, because while today we always start programs up with the
working directory equal to the program directory that definitely is
going to change in the future (at least for MLCs and substack programs).
But the name `pwd` doesn't make it clear that this was intended to be
the working directory _and_ the directory which contains the program.
`program` was in fact nearly always ".", and if it wasn't that it was
just a filename. The engine never sent a path for `program` (although we
did have some unit tests to check how that worked for the nodejs and
python hosts).
These are now replaced by a new structure with (I think) more clearly
named and documented fields (see ProgramInfo in langauge.proto).
The engine still sends the old data for now, we need to update
dotnet/yaml/java before we break the old interface and give Virtus Labs
a chance to update [besom](https://github.com/VirtusLab/besom).
## Checklist
- [x] I have run `make tidy` to update any new dependencies
- [x] I have run `make lint` to verify my code passes the lint check
- [ ] I have formatted my code using `gofumpt`
<!--- Please provide details if the checkbox below is to be left
unchecked. -->
- [x] I have added tests that prove my fix is effective or that my
feature works
<!---
User-facing changes require a CHANGELOG entry.
-->
- [ ] I have run `make changelog` and committed the
`changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the
Pulumi Cloud,
then the service should honor older versions of the CLI where this
change would not exist.
You must then bump the API version in
/pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi
Cloud API version
<!-- @Pulumi employees: If yes, you must submit corresponding changes in
the service repo. -->
2023-12-10 17:30:51 +00:00
Info * ProgramInfo ` protobuf:"bytes,14,opt,name=info,proto3" json:"info,omitempty" ` // the program info to use to execute the program.
2022-06-11 07:52:24 +00:00
}
func ( x * RunRequest ) Reset ( ) {
* x = RunRequest { }
if protoimpl . UnsafeEnabled {
2024-06-06 08:21:46 +00:00
mi := & file_pulumi_language_proto_msgTypes [ 8 ]
2022-06-11 07:52:24 +00:00
ms := protoimpl . X . MessageStateOf ( protoimpl . Pointer ( x ) )
ms . StoreMessageInfo ( mi )
}
2018-07-12 01:07:50 +00:00
}
2020-02-28 11:53:47 +00:00
2022-06-11 07:52:24 +00:00
func ( x * RunRequest ) String ( ) string {
return protoimpl . X . MessageStringOf ( x )
2018-07-12 01:07:50 +00:00
}
2022-06-11 07:52:24 +00:00
func ( * RunRequest ) ProtoMessage ( ) { }
func ( x * RunRequest ) ProtoReflect ( ) protoreflect . Message {
2024-06-06 08:21:46 +00:00
mi := & file_pulumi_language_proto_msgTypes [ 8 ]
2022-06-11 07:52:24 +00:00
if protoimpl . UnsafeEnabled && x != nil {
ms := protoimpl . X . MessageStateOf ( protoimpl . Pointer ( x ) )
if ms . LoadMessageInfo ( ) == nil {
ms . StoreMessageInfo ( mi )
}
return ms
}
return mi . MessageOf ( x )
2018-07-12 01:07:50 +00:00
}
2022-06-11 07:52:24 +00:00
// Deprecated: Use RunRequest.ProtoReflect.Descriptor instead.
func ( * RunRequest ) Descriptor ( ) ( [ ] byte , [ ] int ) {
2024-06-06 08:21:46 +00:00
return file_pulumi_language_proto_rawDescGZIP ( ) , [ ] int { 8 }
2022-06-11 07:52:24 +00:00
}
2017-11-17 02:21:41 +00:00
2022-06-11 07:52:24 +00:00
func ( x * RunRequest ) GetProject ( ) string {
if x != nil {
return x . Project
2017-11-17 02:21:41 +00:00
}
return ""
}
2022-06-11 07:52:24 +00:00
func ( x * RunRequest ) GetStack ( ) string {
if x != nil {
return x . Stack
2017-11-17 02:21:41 +00:00
}
return ""
}
2022-06-11 07:52:24 +00:00
func ( x * RunRequest ) GetPwd ( ) string {
if x != nil {
return x . Pwd
2017-11-17 02:21:41 +00:00
}
return ""
}
Pass root and main info to language host methods (#14654)
<!---
Thanks so much for your contribution! If this is your first time
contributing, please ensure that you have read the
[CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md)
documentation.
-->
# Description
<!--- Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context. -->
This is two changes rolled together in a way.
Firstly passing some of the data that we pass on language runtime
startup to also pass it to Run/GetRequiredPlugins/etc. This is needed
for matrix testing, as we only get to start the language runtime up once
for that but want to execute multiple programs with it.
I feel it's also a little more consistent as we use the language
runtimes in other contexts (codegen) where there isn't really a root
directory, and aren't any options (and if we did do options the options
for codegen are not going to be the same as for execution). It also
means we can reuse a language host for shimless and substack programs,
as before they heavily relied on their current working directory to
calculate paths, and obviosly could only take one set of options at
startup. Imagine a shimless python package + a python root program, that
would have needed two startups of the python language host to deal with,
this unblocks it so we can make the engine smarter and only use one.
Secondly renaming some of the fields we pass to
Run/GetRequiredPlugins/etc today. `Pwd` and `Program` were not very
descriptive and had pretty non-obvious documentation:
```
string pwd = 3; // the program's working directory.
string program = 4; // the path to the program to execute.
```
`pwd` will remain, although probably rename it to `working_directory` at
some point, because while today we always start programs up with the
working directory equal to the program directory that definitely is
going to change in the future (at least for MLCs and substack programs).
But the name `pwd` doesn't make it clear that this was intended to be
the working directory _and_ the directory which contains the program.
`program` was in fact nearly always ".", and if it wasn't that it was
just a filename. The engine never sent a path for `program` (although we
did have some unit tests to check how that worked for the nodejs and
python hosts).
These are now replaced by a new structure with (I think) more clearly
named and documented fields (see ProgramInfo in langauge.proto).
The engine still sends the old data for now, we need to update
dotnet/yaml/java before we break the old interface and give Virtus Labs
a chance to update [besom](https://github.com/VirtusLab/besom).
## Checklist
- [x] I have run `make tidy` to update any new dependencies
- [x] I have run `make lint` to verify my code passes the lint check
- [ ] I have formatted my code using `gofumpt`
<!--- Please provide details if the checkbox below is to be left
unchecked. -->
- [x] I have added tests that prove my fix is effective or that my
feature works
<!---
User-facing changes require a CHANGELOG entry.
-->
- [ ] I have run `make changelog` and committed the
`changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the
Pulumi Cloud,
then the service should honor older versions of the CLI where this
change would not exist.
You must then bump the API version in
/pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi
Cloud API version
<!-- @Pulumi employees: If yes, you must submit corresponding changes in
the service repo. -->
2023-12-10 17:30:51 +00:00
// Deprecated: Do not use.
2022-06-11 07:52:24 +00:00
func ( x * RunRequest ) GetProgram ( ) string {
if x != nil {
return x . Program
2017-11-17 02:21:41 +00:00
}
return ""
}
2022-06-11 07:52:24 +00:00
func ( x * RunRequest ) GetArgs ( ) [ ] string {
if x != nil {
return x . Args
2017-11-17 02:21:41 +00:00
}
return nil
}
2022-06-11 07:52:24 +00:00
func ( x * RunRequest ) GetConfig ( ) map [ string ] string {
if x != nil {
return x . Config
2017-11-17 02:21:41 +00:00
}
return nil
}
2022-06-11 07:52:24 +00:00
func ( x * RunRequest ) GetDryRun ( ) bool {
if x != nil {
return x . DryRun
2017-11-17 02:21:41 +00:00
}
return false
}
2022-06-11 07:52:24 +00:00
func ( x * RunRequest ) GetParallel ( ) int32 {
if x != nil {
return x . Parallel
2017-11-17 02:21:41 +00:00
}
return 0
}
2022-06-11 07:52:24 +00:00
func ( x * RunRequest ) GetMonitorAddress ( ) string {
if x != nil {
return x . MonitorAddress
2018-02-06 17:57:32 +00:00
}
return ""
}
2022-06-11 07:52:24 +00:00
func ( x * RunRequest ) GetQueryMode ( ) bool {
if x != nil {
return x . QueryMode
2019-05-01 01:09:02 +00:00
}
return false
}
2022-06-11 07:52:24 +00:00
func ( x * RunRequest ) GetConfigSecretKeys ( ) [ ] string {
if x != nil {
return x . ConfigSecretKeys
2021-05-18 16:48:08 +00:00
}
return nil
}
2022-08-31 09:33:29 +00:00
func ( x * RunRequest ) GetOrganization ( ) string {
if x != nil {
return x . Organization
}
return ""
}
2023-10-20 10:44:16 +00:00
func ( x * RunRequest ) GetConfigPropertyMap ( ) * structpb . Struct {
if x != nil {
return x . ConfigPropertyMap
}
return nil
}
Pass root and main info to language host methods (#14654)
<!---
Thanks so much for your contribution! If this is your first time
contributing, please ensure that you have read the
[CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md)
documentation.
-->
# Description
<!--- Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context. -->
This is two changes rolled together in a way.
Firstly passing some of the data that we pass on language runtime
startup to also pass it to Run/GetRequiredPlugins/etc. This is needed
for matrix testing, as we only get to start the language runtime up once
for that but want to execute multiple programs with it.
I feel it's also a little more consistent as we use the language
runtimes in other contexts (codegen) where there isn't really a root
directory, and aren't any options (and if we did do options the options
for codegen are not going to be the same as for execution). It also
means we can reuse a language host for shimless and substack programs,
as before they heavily relied on their current working directory to
calculate paths, and obviosly could only take one set of options at
startup. Imagine a shimless python package + a python root program, that
would have needed two startups of the python language host to deal with,
this unblocks it so we can make the engine smarter and only use one.
Secondly renaming some of the fields we pass to
Run/GetRequiredPlugins/etc today. `Pwd` and `Program` were not very
descriptive and had pretty non-obvious documentation:
```
string pwd = 3; // the program's working directory.
string program = 4; // the path to the program to execute.
```
`pwd` will remain, although probably rename it to `working_directory` at
some point, because while today we always start programs up with the
working directory equal to the program directory that definitely is
going to change in the future (at least for MLCs and substack programs).
But the name `pwd` doesn't make it clear that this was intended to be
the working directory _and_ the directory which contains the program.
`program` was in fact nearly always ".", and if it wasn't that it was
just a filename. The engine never sent a path for `program` (although we
did have some unit tests to check how that worked for the nodejs and
python hosts).
These are now replaced by a new structure with (I think) more clearly
named and documented fields (see ProgramInfo in langauge.proto).
The engine still sends the old data for now, we need to update
dotnet/yaml/java before we break the old interface and give Virtus Labs
a chance to update [besom](https://github.com/VirtusLab/besom).
## Checklist
- [x] I have run `make tidy` to update any new dependencies
- [x] I have run `make lint` to verify my code passes the lint check
- [ ] I have formatted my code using `gofumpt`
<!--- Please provide details if the checkbox below is to be left
unchecked. -->
- [x] I have added tests that prove my fix is effective or that my
feature works
<!---
User-facing changes require a CHANGELOG entry.
-->
- [ ] I have run `make changelog` and committed the
`changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the
Pulumi Cloud,
then the service should honor older versions of the CLI where this
change would not exist.
You must then bump the API version in
/pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi
Cloud API version
<!-- @Pulumi employees: If yes, you must submit corresponding changes in
the service repo. -->
2023-12-10 17:30:51 +00:00
func ( x * RunRequest ) GetInfo ( ) * ProgramInfo {
if x != nil {
return x . Info
}
return nil
}
2017-11-17 02:21:41 +00:00
// RunResponse is the response back from the interpreter/source back to the monitor.
type RunResponse struct {
2022-06-11 07:52:24 +00:00
state protoimpl . MessageState
sizeCache protoimpl . SizeCache
unknownFields protoimpl . UnknownFields
2019-03-20 18:54:32 +00:00
// An unhandled error if any occurred.
2020-02-28 11:53:47 +00:00
Error string ` protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty" `
2019-03-20 18:54:32 +00:00
// An error happened. And it was reported to the user. Work should stop immediately
// with nothing further to print to the user. This corresponds to a "result.Bail()"
// value in the 'go' layer.
2022-06-11 07:52:24 +00:00
Bail bool ` protobuf:"varint,2,opt,name=bail,proto3" json:"bail,omitempty" `
2018-07-12 01:07:50 +00:00
}
2022-06-11 07:52:24 +00:00
func ( x * RunResponse ) Reset ( ) {
* x = RunResponse { }
if protoimpl . UnsafeEnabled {
2024-06-06 08:21:46 +00:00
mi := & file_pulumi_language_proto_msgTypes [ 9 ]
2022-06-11 07:52:24 +00:00
ms := protoimpl . X . MessageStateOf ( protoimpl . Pointer ( x ) )
ms . StoreMessageInfo ( mi )
}
2018-07-12 01:07:50 +00:00
}
2020-02-28 11:53:47 +00:00
2022-06-11 07:52:24 +00:00
func ( x * RunResponse ) String ( ) string {
return protoimpl . X . MessageStringOf ( x )
2018-07-12 01:07:50 +00:00
}
2022-06-11 07:52:24 +00:00
func ( * RunResponse ) ProtoMessage ( ) { }
func ( x * RunResponse ) ProtoReflect ( ) protoreflect . Message {
2024-06-06 08:21:46 +00:00
mi := & file_pulumi_language_proto_msgTypes [ 9 ]
2022-06-11 07:52:24 +00:00
if protoimpl . UnsafeEnabled && x != nil {
ms := protoimpl . X . MessageStateOf ( protoimpl . Pointer ( x ) )
if ms . LoadMessageInfo ( ) == nil {
ms . StoreMessageInfo ( mi )
}
return ms
}
return mi . MessageOf ( x )
2017-11-17 02:21:41 +00:00
}
2022-06-11 07:52:24 +00:00
// Deprecated: Use RunResponse.ProtoReflect.Descriptor instead.
func ( * RunResponse ) Descriptor ( ) ( [ ] byte , [ ] int ) {
2024-06-06 08:21:46 +00:00
return file_pulumi_language_proto_rawDescGZIP ( ) , [ ] int { 9 }
2022-06-11 07:52:24 +00:00
}
2017-11-17 02:21:41 +00:00
2022-06-11 07:52:24 +00:00
func ( x * RunResponse ) GetError ( ) string {
if x != nil {
return x . Error
2017-11-17 02:21:41 +00:00
}
return ""
}
2022-06-11 07:52:24 +00:00
func ( x * RunResponse ) GetBail ( ) bool {
if x != nil {
return x . Bail
2019-03-20 18:54:32 +00:00
}
return false
}
2022-04-03 14:54:59 +00:00
type InstallDependenciesRequest struct {
2022-06-11 07:52:24 +00:00
state protoimpl . MessageState
sizeCache protoimpl . SizeCache
unknownFields protoimpl . UnknownFields
2022-04-03 14:54:59 +00:00
Pass root and main info to language host methods (#14654)
<!---
Thanks so much for your contribution! If this is your first time
contributing, please ensure that you have read the
[CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md)
documentation.
-->
# Description
<!--- Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context. -->
This is two changes rolled together in a way.
Firstly passing some of the data that we pass on language runtime
startup to also pass it to Run/GetRequiredPlugins/etc. This is needed
for matrix testing, as we only get to start the language runtime up once
for that but want to execute multiple programs with it.
I feel it's also a little more consistent as we use the language
runtimes in other contexts (codegen) where there isn't really a root
directory, and aren't any options (and if we did do options the options
for codegen are not going to be the same as for execution). It also
means we can reuse a language host for shimless and substack programs,
as before they heavily relied on their current working directory to
calculate paths, and obviosly could only take one set of options at
startup. Imagine a shimless python package + a python root program, that
would have needed two startups of the python language host to deal with,
this unblocks it so we can make the engine smarter and only use one.
Secondly renaming some of the fields we pass to
Run/GetRequiredPlugins/etc today. `Pwd` and `Program` were not very
descriptive and had pretty non-obvious documentation:
```
string pwd = 3; // the program's working directory.
string program = 4; // the path to the program to execute.
```
`pwd` will remain, although probably rename it to `working_directory` at
some point, because while today we always start programs up with the
working directory equal to the program directory that definitely is
going to change in the future (at least for MLCs and substack programs).
But the name `pwd` doesn't make it clear that this was intended to be
the working directory _and_ the directory which contains the program.
`program` was in fact nearly always ".", and if it wasn't that it was
just a filename. The engine never sent a path for `program` (although we
did have some unit tests to check how that worked for the nodejs and
python hosts).
These are now replaced by a new structure with (I think) more clearly
named and documented fields (see ProgramInfo in langauge.proto).
The engine still sends the old data for now, we need to update
dotnet/yaml/java before we break the old interface and give Virtus Labs
a chance to update [besom](https://github.com/VirtusLab/besom).
## Checklist
- [x] I have run `make tidy` to update any new dependencies
- [x] I have run `make lint` to verify my code passes the lint check
- [ ] I have formatted my code using `gofumpt`
<!--- Please provide details if the checkbox below is to be left
unchecked. -->
- [x] I have added tests that prove my fix is effective or that my
feature works
<!---
User-facing changes require a CHANGELOG entry.
-->
- [ ] I have run `make changelog` and committed the
`changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the
Pulumi Cloud,
then the service should honor older versions of the CLI where this
change would not exist.
You must then bump the API version in
/pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi
Cloud API version
<!-- @Pulumi employees: If yes, you must submit corresponding changes in
the service repo. -->
2023-12-10 17:30:51 +00:00
// Deprecated: Do not use.
Directory string ` protobuf:"bytes,1,opt,name=directory,proto3" json:"directory,omitempty" ` // the program's working directory.
IsTerminal bool ` protobuf:"varint,2,opt,name=is_terminal,json=isTerminal,proto3" json:"is_terminal,omitempty" ` // if we are running in a terminal and should use ANSI codes
Info * ProgramInfo ` protobuf:"bytes,3,opt,name=info,proto3" json:"info,omitempty" ` // the program info to use to execute the plugin.
2022-04-03 14:54:59 +00:00
}
2022-06-11 07:52:24 +00:00
func ( x * InstallDependenciesRequest ) Reset ( ) {
* x = InstallDependenciesRequest { }
if protoimpl . UnsafeEnabled {
2024-06-06 08:21:46 +00:00
mi := & file_pulumi_language_proto_msgTypes [ 10 ]
2022-06-11 07:52:24 +00:00
ms := protoimpl . X . MessageStateOf ( protoimpl . Pointer ( x ) )
ms . StoreMessageInfo ( mi )
}
2022-04-03 14:54:59 +00:00
}
2022-06-11 07:52:24 +00:00
func ( x * InstallDependenciesRequest ) String ( ) string {
return protoimpl . X . MessageStringOf ( x )
2022-04-03 14:54:59 +00:00
}
2022-06-11 07:52:24 +00:00
func ( * InstallDependenciesRequest ) ProtoMessage ( ) { }
func ( x * InstallDependenciesRequest ) ProtoReflect ( ) protoreflect . Message {
2024-06-06 08:21:46 +00:00
mi := & file_pulumi_language_proto_msgTypes [ 10 ]
2022-06-11 07:52:24 +00:00
if protoimpl . UnsafeEnabled && x != nil {
ms := protoimpl . X . MessageStateOf ( protoimpl . Pointer ( x ) )
if ms . LoadMessageInfo ( ) == nil {
ms . StoreMessageInfo ( mi )
}
return ms
}
return mi . MessageOf ( x )
2022-04-03 14:54:59 +00:00
}
2022-06-11 07:52:24 +00:00
// Deprecated: Use InstallDependenciesRequest.ProtoReflect.Descriptor instead.
func ( * InstallDependenciesRequest ) Descriptor ( ) ( [ ] byte , [ ] int ) {
2024-06-06 08:21:46 +00:00
return file_pulumi_language_proto_rawDescGZIP ( ) , [ ] int { 10 }
2022-06-11 07:52:24 +00:00
}
2022-04-03 14:54:59 +00:00
Pass root and main info to language host methods (#14654)
<!---
Thanks so much for your contribution! If this is your first time
contributing, please ensure that you have read the
[CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md)
documentation.
-->
# Description
<!--- Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context. -->
This is two changes rolled together in a way.
Firstly passing some of the data that we pass on language runtime
startup to also pass it to Run/GetRequiredPlugins/etc. This is needed
for matrix testing, as we only get to start the language runtime up once
for that but want to execute multiple programs with it.
I feel it's also a little more consistent as we use the language
runtimes in other contexts (codegen) where there isn't really a root
directory, and aren't any options (and if we did do options the options
for codegen are not going to be the same as for execution). It also
means we can reuse a language host for shimless and substack programs,
as before they heavily relied on their current working directory to
calculate paths, and obviosly could only take one set of options at
startup. Imagine a shimless python package + a python root program, that
would have needed two startups of the python language host to deal with,
this unblocks it so we can make the engine smarter and only use one.
Secondly renaming some of the fields we pass to
Run/GetRequiredPlugins/etc today. `Pwd` and `Program` were not very
descriptive and had pretty non-obvious documentation:
```
string pwd = 3; // the program's working directory.
string program = 4; // the path to the program to execute.
```
`pwd` will remain, although probably rename it to `working_directory` at
some point, because while today we always start programs up with the
working directory equal to the program directory that definitely is
going to change in the future (at least for MLCs and substack programs).
But the name `pwd` doesn't make it clear that this was intended to be
the working directory _and_ the directory which contains the program.
`program` was in fact nearly always ".", and if it wasn't that it was
just a filename. The engine never sent a path for `program` (although we
did have some unit tests to check how that worked for the nodejs and
python hosts).
These are now replaced by a new structure with (I think) more clearly
named and documented fields (see ProgramInfo in langauge.proto).
The engine still sends the old data for now, we need to update
dotnet/yaml/java before we break the old interface and give Virtus Labs
a chance to update [besom](https://github.com/VirtusLab/besom).
## Checklist
- [x] I have run `make tidy` to update any new dependencies
- [x] I have run `make lint` to verify my code passes the lint check
- [ ] I have formatted my code using `gofumpt`
<!--- Please provide details if the checkbox below is to be left
unchecked. -->
- [x] I have added tests that prove my fix is effective or that my
feature works
<!---
User-facing changes require a CHANGELOG entry.
-->
- [ ] I have run `make changelog` and committed the
`changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the
Pulumi Cloud,
then the service should honor older versions of the CLI where this
change would not exist.
You must then bump the API version in
/pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi
Cloud API version
<!-- @Pulumi employees: If yes, you must submit corresponding changes in
the service repo. -->
2023-12-10 17:30:51 +00:00
// Deprecated: Do not use.
2022-06-11 07:52:24 +00:00
func ( x * InstallDependenciesRequest ) GetDirectory ( ) string {
if x != nil {
return x . Directory
2022-04-03 14:54:59 +00:00
}
return ""
}
2022-06-11 07:52:24 +00:00
func ( x * InstallDependenciesRequest ) GetIsTerminal ( ) bool {
if x != nil {
return x . IsTerminal
2022-04-03 14:54:59 +00:00
}
return false
}
Pass root and main info to language host methods (#14654)
<!---
Thanks so much for your contribution! If this is your first time
contributing, please ensure that you have read the
[CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md)
documentation.
-->
# Description
<!--- Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context. -->
This is two changes rolled together in a way.
Firstly passing some of the data that we pass on language runtime
startup to also pass it to Run/GetRequiredPlugins/etc. This is needed
for matrix testing, as we only get to start the language runtime up once
for that but want to execute multiple programs with it.
I feel it's also a little more consistent as we use the language
runtimes in other contexts (codegen) where there isn't really a root
directory, and aren't any options (and if we did do options the options
for codegen are not going to be the same as for execution). It also
means we can reuse a language host for shimless and substack programs,
as before they heavily relied on their current working directory to
calculate paths, and obviosly could only take one set of options at
startup. Imagine a shimless python package + a python root program, that
would have needed two startups of the python language host to deal with,
this unblocks it so we can make the engine smarter and only use one.
Secondly renaming some of the fields we pass to
Run/GetRequiredPlugins/etc today. `Pwd` and `Program` were not very
descriptive and had pretty non-obvious documentation:
```
string pwd = 3; // the program's working directory.
string program = 4; // the path to the program to execute.
```
`pwd` will remain, although probably rename it to `working_directory` at
some point, because while today we always start programs up with the
working directory equal to the program directory that definitely is
going to change in the future (at least for MLCs and substack programs).
But the name `pwd` doesn't make it clear that this was intended to be
the working directory _and_ the directory which contains the program.
`program` was in fact nearly always ".", and if it wasn't that it was
just a filename. The engine never sent a path for `program` (although we
did have some unit tests to check how that worked for the nodejs and
python hosts).
These are now replaced by a new structure with (I think) more clearly
named and documented fields (see ProgramInfo in langauge.proto).
The engine still sends the old data for now, we need to update
dotnet/yaml/java before we break the old interface and give Virtus Labs
a chance to update [besom](https://github.com/VirtusLab/besom).
## Checklist
- [x] I have run `make tidy` to update any new dependencies
- [x] I have run `make lint` to verify my code passes the lint check
- [ ] I have formatted my code using `gofumpt`
<!--- Please provide details if the checkbox below is to be left
unchecked. -->
- [x] I have added tests that prove my fix is effective or that my
feature works
<!---
User-facing changes require a CHANGELOG entry.
-->
- [ ] I have run `make changelog` and committed the
`changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the
Pulumi Cloud,
then the service should honor older versions of the CLI where this
change would not exist.
You must then bump the API version in
/pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi
Cloud API version
<!-- @Pulumi employees: If yes, you must submit corresponding changes in
the service repo. -->
2023-12-10 17:30:51 +00:00
func ( x * InstallDependenciesRequest ) GetInfo ( ) * ProgramInfo {
if x != nil {
return x . Info
}
return nil
}
2022-04-03 14:54:59 +00:00
type InstallDependenciesResponse struct {
2022-06-11 07:52:24 +00:00
state protoimpl . MessageState
sizeCache protoimpl . SizeCache
unknownFields protoimpl . UnknownFields
2022-04-03 14:54:59 +00:00
2022-06-11 07:52:24 +00:00
Stdout [ ] byte ` protobuf:"bytes,1,opt,name=stdout,proto3" json:"stdout,omitempty" ` // a line of stdout text.
Stderr [ ] byte ` protobuf:"bytes,2,opt,name=stderr,proto3" json:"stderr,omitempty" ` // a line of stderr text.
2022-04-03 14:54:59 +00:00
}
2022-06-11 07:52:24 +00:00
func ( x * InstallDependenciesResponse ) Reset ( ) {
* x = InstallDependenciesResponse { }
if protoimpl . UnsafeEnabled {
2024-06-06 08:21:46 +00:00
mi := & file_pulumi_language_proto_msgTypes [ 11 ]
2022-06-11 07:52:24 +00:00
ms := protoimpl . X . MessageStateOf ( protoimpl . Pointer ( x ) )
ms . StoreMessageInfo ( mi )
}
2022-04-03 14:54:59 +00:00
}
2022-06-11 07:52:24 +00:00
func ( x * InstallDependenciesResponse ) String ( ) string {
return protoimpl . X . MessageStringOf ( x )
2022-04-03 14:54:59 +00:00
}
2022-06-11 07:52:24 +00:00
func ( * InstallDependenciesResponse ) ProtoMessage ( ) { }
func ( x * InstallDependenciesResponse ) ProtoReflect ( ) protoreflect . Message {
2024-06-06 08:21:46 +00:00
mi := & file_pulumi_language_proto_msgTypes [ 11 ]
2022-06-11 07:52:24 +00:00
if protoimpl . UnsafeEnabled && x != nil {
ms := protoimpl . X . MessageStateOf ( protoimpl . Pointer ( x ) )
if ms . LoadMessageInfo ( ) == nil {
ms . StoreMessageInfo ( mi )
}
return ms
}
return mi . MessageOf ( x )
2022-04-03 14:54:59 +00:00
}
2022-06-11 07:52:24 +00:00
// Deprecated: Use InstallDependenciesResponse.ProtoReflect.Descriptor instead.
func ( * InstallDependenciesResponse ) Descriptor ( ) ( [ ] byte , [ ] int ) {
2024-06-06 08:21:46 +00:00
return file_pulumi_language_proto_rawDescGZIP ( ) , [ ] int { 11 }
2022-06-11 07:52:24 +00:00
}
2022-04-03 14:54:59 +00:00
2022-06-11 07:52:24 +00:00
func ( x * InstallDependenciesResponse ) GetStdout ( ) [ ] byte {
if x != nil {
return x . Stdout
2022-04-03 14:54:59 +00:00
}
return nil
}
2022-06-11 07:52:24 +00:00
func ( x * InstallDependenciesResponse ) GetStderr ( ) [ ] byte {
if x != nil {
return x . Stderr
2022-04-03 14:54:59 +00:00
}
return nil
}
2024-06-17 17:10:55 +00:00
type RuntimeOptionsRequest struct {
state protoimpl . MessageState
sizeCache protoimpl . SizeCache
unknownFields protoimpl . UnknownFields
Info * ProgramInfo ` protobuf:"bytes,1,opt,name=info,proto3" json:"info,omitempty" ` // The current program info used to evaluate which prompts should be asked.
}
func ( x * RuntimeOptionsRequest ) Reset ( ) {
* x = RuntimeOptionsRequest { }
if protoimpl . UnsafeEnabled {
mi := & file_pulumi_language_proto_msgTypes [ 12 ]
ms := protoimpl . X . MessageStateOf ( protoimpl . Pointer ( x ) )
ms . StoreMessageInfo ( mi )
}
}
func ( x * RuntimeOptionsRequest ) String ( ) string {
return protoimpl . X . MessageStringOf ( x )
}
func ( * RuntimeOptionsRequest ) ProtoMessage ( ) { }
func ( x * RuntimeOptionsRequest ) ProtoReflect ( ) protoreflect . Message {
mi := & file_pulumi_language_proto_msgTypes [ 12 ]
if protoimpl . UnsafeEnabled && x != nil {
ms := protoimpl . X . MessageStateOf ( protoimpl . Pointer ( x ) )
if ms . LoadMessageInfo ( ) == nil {
ms . StoreMessageInfo ( mi )
}
return ms
}
return mi . MessageOf ( x )
}
// Deprecated: Use RuntimeOptionsRequest.ProtoReflect.Descriptor instead.
func ( * RuntimeOptionsRequest ) Descriptor ( ) ( [ ] byte , [ ] int ) {
return file_pulumi_language_proto_rawDescGZIP ( ) , [ ] int { 12 }
}
func ( x * RuntimeOptionsRequest ) GetInfo ( ) * ProgramInfo {
if x != nil {
return x . Info
}
return nil
}
type RuntimeOptionPrompt struct {
state protoimpl . MessageState
sizeCache protoimpl . SizeCache
unknownFields protoimpl . UnknownFields
Key string ` protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty" `
Description string ` protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty" `
PromptType RuntimeOptionPrompt_RuntimeOptionType ` protobuf:"varint,3,opt,name=promptType,proto3,enum=pulumirpc.RuntimeOptionPrompt_RuntimeOptionType" json:"promptType,omitempty" `
Choices [ ] * RuntimeOptionPrompt_RuntimeOptionValue ` protobuf:"bytes,4,rep,name=choices,proto3" json:"choices,omitempty" `
Default * RuntimeOptionPrompt_RuntimeOptionValue ` protobuf:"bytes,5,opt,name=default,proto3" json:"default,omitempty" `
}
func ( x * RuntimeOptionPrompt ) Reset ( ) {
* x = RuntimeOptionPrompt { }
if protoimpl . UnsafeEnabled {
mi := & file_pulumi_language_proto_msgTypes [ 13 ]
ms := protoimpl . X . MessageStateOf ( protoimpl . Pointer ( x ) )
ms . StoreMessageInfo ( mi )
}
}
func ( x * RuntimeOptionPrompt ) String ( ) string {
return protoimpl . X . MessageStringOf ( x )
}
func ( * RuntimeOptionPrompt ) ProtoMessage ( ) { }
func ( x * RuntimeOptionPrompt ) ProtoReflect ( ) protoreflect . Message {
mi := & file_pulumi_language_proto_msgTypes [ 13 ]
if protoimpl . UnsafeEnabled && x != nil {
ms := protoimpl . X . MessageStateOf ( protoimpl . Pointer ( x ) )
if ms . LoadMessageInfo ( ) == nil {
ms . StoreMessageInfo ( mi )
}
return ms
}
return mi . MessageOf ( x )
}
// Deprecated: Use RuntimeOptionPrompt.ProtoReflect.Descriptor instead.
func ( * RuntimeOptionPrompt ) Descriptor ( ) ( [ ] byte , [ ] int ) {
return file_pulumi_language_proto_rawDescGZIP ( ) , [ ] int { 13 }
}
func ( x * RuntimeOptionPrompt ) GetKey ( ) string {
if x != nil {
return x . Key
}
return ""
}
func ( x * RuntimeOptionPrompt ) GetDescription ( ) string {
if x != nil {
return x . Description
}
return ""
}
func ( x * RuntimeOptionPrompt ) GetPromptType ( ) RuntimeOptionPrompt_RuntimeOptionType {
if x != nil {
return x . PromptType
}
return RuntimeOptionPrompt_STRING
}
func ( x * RuntimeOptionPrompt ) GetChoices ( ) [ ] * RuntimeOptionPrompt_RuntimeOptionValue {
if x != nil {
return x . Choices
}
return nil
}
func ( x * RuntimeOptionPrompt ) GetDefault ( ) * RuntimeOptionPrompt_RuntimeOptionValue {
if x != nil {
return x . Default
}
return nil
}
type RuntimeOptionsResponse struct {
state protoimpl . MessageState
sizeCache protoimpl . SizeCache
unknownFields protoimpl . UnknownFields
Prompts [ ] * RuntimeOptionPrompt ` protobuf:"bytes,1,rep,name=prompts,proto3" json:"prompts,omitempty" ` // additional prompts to ask the user
}
func ( x * RuntimeOptionsResponse ) Reset ( ) {
* x = RuntimeOptionsResponse { }
if protoimpl . UnsafeEnabled {
mi := & file_pulumi_language_proto_msgTypes [ 14 ]
ms := protoimpl . X . MessageStateOf ( protoimpl . Pointer ( x ) )
ms . StoreMessageInfo ( mi )
}
}
func ( x * RuntimeOptionsResponse ) String ( ) string {
return protoimpl . X . MessageStringOf ( x )
}
func ( * RuntimeOptionsResponse ) ProtoMessage ( ) { }
func ( x * RuntimeOptionsResponse ) ProtoReflect ( ) protoreflect . Message {
mi := & file_pulumi_language_proto_msgTypes [ 14 ]
if protoimpl . UnsafeEnabled && x != nil {
ms := protoimpl . X . MessageStateOf ( protoimpl . Pointer ( x ) )
if ms . LoadMessageInfo ( ) == nil {
ms . StoreMessageInfo ( mi )
}
return ms
}
return mi . MessageOf ( x )
}
// Deprecated: Use RuntimeOptionsResponse.ProtoReflect.Descriptor instead.
func ( * RuntimeOptionsResponse ) Descriptor ( ) ( [ ] byte , [ ] int ) {
return file_pulumi_language_proto_rawDescGZIP ( ) , [ ] int { 14 }
}
func ( x * RuntimeOptionsResponse ) GetPrompts ( ) [ ] * RuntimeOptionPrompt {
if x != nil {
return x . Prompts
}
return nil
}
2022-10-04 08:58:01 +00:00
type RunPluginRequest struct {
state protoimpl . MessageState
sizeCache protoimpl . SizeCache
unknownFields protoimpl . UnknownFields
Pass root and main info to language host methods (#14654)
<!---
Thanks so much for your contribution! If this is your first time
contributing, please ensure that you have read the
[CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md)
documentation.
-->
# Description
<!--- Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context. -->
This is two changes rolled together in a way.
Firstly passing some of the data that we pass on language runtime
startup to also pass it to Run/GetRequiredPlugins/etc. This is needed
for matrix testing, as we only get to start the language runtime up once
for that but want to execute multiple programs with it.
I feel it's also a little more consistent as we use the language
runtimes in other contexts (codegen) where there isn't really a root
directory, and aren't any options (and if we did do options the options
for codegen are not going to be the same as for execution). It also
means we can reuse a language host for shimless and substack programs,
as before they heavily relied on their current working directory to
calculate paths, and obviosly could only take one set of options at
startup. Imagine a shimless python package + a python root program, that
would have needed two startups of the python language host to deal with,
this unblocks it so we can make the engine smarter and only use one.
Secondly renaming some of the fields we pass to
Run/GetRequiredPlugins/etc today. `Pwd` and `Program` were not very
descriptive and had pretty non-obvious documentation:
```
string pwd = 3; // the program's working directory.
string program = 4; // the path to the program to execute.
```
`pwd` will remain, although probably rename it to `working_directory` at
some point, because while today we always start programs up with the
working directory equal to the program directory that definitely is
going to change in the future (at least for MLCs and substack programs).
But the name `pwd` doesn't make it clear that this was intended to be
the working directory _and_ the directory which contains the program.
`program` was in fact nearly always ".", and if it wasn't that it was
just a filename. The engine never sent a path for `program` (although we
did have some unit tests to check how that worked for the nodejs and
python hosts).
These are now replaced by a new structure with (I think) more clearly
named and documented fields (see ProgramInfo in langauge.proto).
The engine still sends the old data for now, we need to update
dotnet/yaml/java before we break the old interface and give Virtus Labs
a chance to update [besom](https://github.com/VirtusLab/besom).
## Checklist
- [x] I have run `make tidy` to update any new dependencies
- [x] I have run `make lint` to verify my code passes the lint check
- [ ] I have formatted my code using `gofumpt`
<!--- Please provide details if the checkbox below is to be left
unchecked. -->
- [x] I have added tests that prove my fix is effective or that my
feature works
<!---
User-facing changes require a CHANGELOG entry.
-->
- [ ] I have run `make changelog` and committed the
`changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the
Pulumi Cloud,
then the service should honor older versions of the CLI where this
change would not exist.
You must then bump the API version in
/pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi
Cloud API version
<!-- @Pulumi employees: If yes, you must submit corresponding changes in
the service repo. -->
2023-12-10 17:30:51 +00:00
Pwd string ` protobuf:"bytes,1,opt,name=pwd,proto3" json:"pwd,omitempty" ` // the program's working directory.
// Deprecated: Do not use.
Program string ` protobuf:"bytes,2,opt,name=program,proto3" json:"program,omitempty" ` // the path to the program to execute.
Args [ ] string ` protobuf:"bytes,3,rep,name=args,proto3" json:"args,omitempty" ` // any arguments to pass to the program.
Env [ ] string ` protobuf:"bytes,4,rep,name=env,proto3" json:"env,omitempty" ` // any environment variables to set as part of the program.
Info * ProgramInfo ` protobuf:"bytes,5,opt,name=info,proto3" json:"info,omitempty" ` // the program info to use to execute the plugin.
2022-10-04 08:58:01 +00:00
}
func ( x * RunPluginRequest ) Reset ( ) {
* x = RunPluginRequest { }
if protoimpl . UnsafeEnabled {
2024-06-17 17:10:55 +00:00
mi := & file_pulumi_language_proto_msgTypes [ 15 ]
2022-10-04 08:58:01 +00:00
ms := protoimpl . X . MessageStateOf ( protoimpl . Pointer ( x ) )
ms . StoreMessageInfo ( mi )
}
}
func ( x * RunPluginRequest ) String ( ) string {
return protoimpl . X . MessageStringOf ( x )
}
func ( * RunPluginRequest ) ProtoMessage ( ) { }
func ( x * RunPluginRequest ) ProtoReflect ( ) protoreflect . Message {
2024-06-17 17:10:55 +00:00
mi := & file_pulumi_language_proto_msgTypes [ 15 ]
2022-10-04 08:58:01 +00:00
if protoimpl . UnsafeEnabled && x != nil {
ms := protoimpl . X . MessageStateOf ( protoimpl . Pointer ( x ) )
if ms . LoadMessageInfo ( ) == nil {
ms . StoreMessageInfo ( mi )
}
return ms
}
return mi . MessageOf ( x )
}
// Deprecated: Use RunPluginRequest.ProtoReflect.Descriptor instead.
func ( * RunPluginRequest ) Descriptor ( ) ( [ ] byte , [ ] int ) {
2024-06-17 17:10:55 +00:00
return file_pulumi_language_proto_rawDescGZIP ( ) , [ ] int { 15 }
2022-10-04 08:58:01 +00:00
}
func ( x * RunPluginRequest ) GetPwd ( ) string {
if x != nil {
return x . Pwd
}
return ""
}
Pass root and main info to language host methods (#14654)
<!---
Thanks so much for your contribution! If this is your first time
contributing, please ensure that you have read the
[CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md)
documentation.
-->
# Description
<!--- Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context. -->
This is two changes rolled together in a way.
Firstly passing some of the data that we pass on language runtime
startup to also pass it to Run/GetRequiredPlugins/etc. This is needed
for matrix testing, as we only get to start the language runtime up once
for that but want to execute multiple programs with it.
I feel it's also a little more consistent as we use the language
runtimes in other contexts (codegen) where there isn't really a root
directory, and aren't any options (and if we did do options the options
for codegen are not going to be the same as for execution). It also
means we can reuse a language host for shimless and substack programs,
as before they heavily relied on their current working directory to
calculate paths, and obviosly could only take one set of options at
startup. Imagine a shimless python package + a python root program, that
would have needed two startups of the python language host to deal with,
this unblocks it so we can make the engine smarter and only use one.
Secondly renaming some of the fields we pass to
Run/GetRequiredPlugins/etc today. `Pwd` and `Program` were not very
descriptive and had pretty non-obvious documentation:
```
string pwd = 3; // the program's working directory.
string program = 4; // the path to the program to execute.
```
`pwd` will remain, although probably rename it to `working_directory` at
some point, because while today we always start programs up with the
working directory equal to the program directory that definitely is
going to change in the future (at least for MLCs and substack programs).
But the name `pwd` doesn't make it clear that this was intended to be
the working directory _and_ the directory which contains the program.
`program` was in fact nearly always ".", and if it wasn't that it was
just a filename. The engine never sent a path for `program` (although we
did have some unit tests to check how that worked for the nodejs and
python hosts).
These are now replaced by a new structure with (I think) more clearly
named and documented fields (see ProgramInfo in langauge.proto).
The engine still sends the old data for now, we need to update
dotnet/yaml/java before we break the old interface and give Virtus Labs
a chance to update [besom](https://github.com/VirtusLab/besom).
## Checklist
- [x] I have run `make tidy` to update any new dependencies
- [x] I have run `make lint` to verify my code passes the lint check
- [ ] I have formatted my code using `gofumpt`
<!--- Please provide details if the checkbox below is to be left
unchecked. -->
- [x] I have added tests that prove my fix is effective or that my
feature works
<!---
User-facing changes require a CHANGELOG entry.
-->
- [ ] I have run `make changelog` and committed the
`changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the
Pulumi Cloud,
then the service should honor older versions of the CLI where this
change would not exist.
You must then bump the API version in
/pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi
Cloud API version
<!-- @Pulumi employees: If yes, you must submit corresponding changes in
the service repo. -->
2023-12-10 17:30:51 +00:00
// Deprecated: Do not use.
2022-10-04 08:58:01 +00:00
func ( x * RunPluginRequest ) GetProgram ( ) string {
if x != nil {
return x . Program
}
return ""
}
func ( x * RunPluginRequest ) GetArgs ( ) [ ] string {
if x != nil {
return x . Args
}
return nil
}
func ( x * RunPluginRequest ) GetEnv ( ) [ ] string {
if x != nil {
return x . Env
}
return nil
}
Pass root and main info to language host methods (#14654)
<!---
Thanks so much for your contribution! If this is your first time
contributing, please ensure that you have read the
[CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md)
documentation.
-->
# Description
<!--- Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context. -->
This is two changes rolled together in a way.
Firstly passing some of the data that we pass on language runtime
startup to also pass it to Run/GetRequiredPlugins/etc. This is needed
for matrix testing, as we only get to start the language runtime up once
for that but want to execute multiple programs with it.
I feel it's also a little more consistent as we use the language
runtimes in other contexts (codegen) where there isn't really a root
directory, and aren't any options (and if we did do options the options
for codegen are not going to be the same as for execution). It also
means we can reuse a language host for shimless and substack programs,
as before they heavily relied on their current working directory to
calculate paths, and obviosly could only take one set of options at
startup. Imagine a shimless python package + a python root program, that
would have needed two startups of the python language host to deal with,
this unblocks it so we can make the engine smarter and only use one.
Secondly renaming some of the fields we pass to
Run/GetRequiredPlugins/etc today. `Pwd` and `Program` were not very
descriptive and had pretty non-obvious documentation:
```
string pwd = 3; // the program's working directory.
string program = 4; // the path to the program to execute.
```
`pwd` will remain, although probably rename it to `working_directory` at
some point, because while today we always start programs up with the
working directory equal to the program directory that definitely is
going to change in the future (at least for MLCs and substack programs).
But the name `pwd` doesn't make it clear that this was intended to be
the working directory _and_ the directory which contains the program.
`program` was in fact nearly always ".", and if it wasn't that it was
just a filename. The engine never sent a path for `program` (although we
did have some unit tests to check how that worked for the nodejs and
python hosts).
These are now replaced by a new structure with (I think) more clearly
named and documented fields (see ProgramInfo in langauge.proto).
The engine still sends the old data for now, we need to update
dotnet/yaml/java before we break the old interface and give Virtus Labs
a chance to update [besom](https://github.com/VirtusLab/besom).
## Checklist
- [x] I have run `make tidy` to update any new dependencies
- [x] I have run `make lint` to verify my code passes the lint check
- [ ] I have formatted my code using `gofumpt`
<!--- Please provide details if the checkbox below is to be left
unchecked. -->
- [x] I have added tests that prove my fix is effective or that my
feature works
<!---
User-facing changes require a CHANGELOG entry.
-->
- [ ] I have run `make changelog` and committed the
`changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the
Pulumi Cloud,
then the service should honor older versions of the CLI where this
change would not exist.
You must then bump the API version in
/pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi
Cloud API version
<!-- @Pulumi employees: If yes, you must submit corresponding changes in
the service repo. -->
2023-12-10 17:30:51 +00:00
func ( x * RunPluginRequest ) GetInfo ( ) * ProgramInfo {
if x != nil {
return x . Info
}
return nil
}
2022-10-04 08:58:01 +00:00
type RunPluginResponse struct {
state protoimpl . MessageState
sizeCache protoimpl . SizeCache
unknownFields protoimpl . UnknownFields
// Types that are assignable to Output:
// *RunPluginResponse_Stdout
// *RunPluginResponse_Stderr
// *RunPluginResponse_Exitcode
Output isRunPluginResponse_Output ` protobuf_oneof:"output" `
}
func ( x * RunPluginResponse ) Reset ( ) {
* x = RunPluginResponse { }
if protoimpl . UnsafeEnabled {
2024-06-17 17:10:55 +00:00
mi := & file_pulumi_language_proto_msgTypes [ 16 ]
2022-10-04 08:58:01 +00:00
ms := protoimpl . X . MessageStateOf ( protoimpl . Pointer ( x ) )
ms . StoreMessageInfo ( mi )
}
}
func ( x * RunPluginResponse ) String ( ) string {
return protoimpl . X . MessageStringOf ( x )
}
func ( * RunPluginResponse ) ProtoMessage ( ) { }
func ( x * RunPluginResponse ) ProtoReflect ( ) protoreflect . Message {
2024-06-17 17:10:55 +00:00
mi := & file_pulumi_language_proto_msgTypes [ 16 ]
2022-10-04 08:58:01 +00:00
if protoimpl . UnsafeEnabled && x != nil {
ms := protoimpl . X . MessageStateOf ( protoimpl . Pointer ( x ) )
if ms . LoadMessageInfo ( ) == nil {
ms . StoreMessageInfo ( mi )
}
return ms
}
return mi . MessageOf ( x )
}
// Deprecated: Use RunPluginResponse.ProtoReflect.Descriptor instead.
func ( * RunPluginResponse ) Descriptor ( ) ( [ ] byte , [ ] int ) {
2024-06-17 17:10:55 +00:00
return file_pulumi_language_proto_rawDescGZIP ( ) , [ ] int { 16 }
2022-10-04 08:58:01 +00:00
}
func ( m * RunPluginResponse ) GetOutput ( ) isRunPluginResponse_Output {
if m != nil {
return m . Output
}
return nil
}
func ( x * RunPluginResponse ) GetStdout ( ) [ ] byte {
if x , ok := x . GetOutput ( ) . ( * RunPluginResponse_Stdout ) ; ok {
return x . Stdout
}
return nil
}
func ( x * RunPluginResponse ) GetStderr ( ) [ ] byte {
if x , ok := x . GetOutput ( ) . ( * RunPluginResponse_Stderr ) ; ok {
return x . Stderr
}
return nil
}
func ( x * RunPluginResponse ) GetExitcode ( ) int32 {
if x , ok := x . GetOutput ( ) . ( * RunPluginResponse_Exitcode ) ; ok {
return x . Exitcode
}
return 0
}
type isRunPluginResponse_Output interface {
isRunPluginResponse_Output ( )
}
type RunPluginResponse_Stdout struct {
Stdout [ ] byte ` protobuf:"bytes,1,opt,name=stdout,proto3,oneof" ` // a line of stdout text.
}
type RunPluginResponse_Stderr struct {
Stderr [ ] byte ` protobuf:"bytes,2,opt,name=stderr,proto3,oneof" ` // a line of stderr text.
}
type RunPluginResponse_Exitcode struct {
Exitcode int32 ` protobuf:"varint,3,opt,name=exitcode,proto3,oneof" ` // the exit code of the provider.
}
func ( * RunPluginResponse_Stdout ) isRunPluginResponse_Output ( ) { }
func ( * RunPluginResponse_Stderr ) isRunPluginResponse_Output ( ) { }
func ( * RunPluginResponse_Exitcode ) isRunPluginResponse_Output ( ) { }
2022-10-17 14:21:11 +00:00
type GenerateProgramRequest struct {
state protoimpl . MessageState
sizeCache protoimpl . SizeCache
unknownFields protoimpl . UnknownFields
// the PCL source of the project.
Source map [ string ] string ` protobuf:"bytes,1,rep,name=source,proto3" json:"source,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3" `
2023-07-27 09:27:07 +00:00
// The target of a codegen.LoaderServer to use for loading schemas.
LoaderTarget string ` protobuf:"bytes,2,opt,name=loader_target,json=loaderTarget,proto3" json:"loader_target,omitempty" `
[cli/import] Fix undefined variable errors in code generation when imported resources use a parent or provider (#16786)
Fixes #15410 Fixes #13339
## Problem Context
When using `pulumi import` we generate code snippets for the resources
that were imported. Sometimes the user specifies `--parent
parentName=URN` or `--provider providerName=URN` which tweak the parent
or provider that the imported resources uses. When using `--parent` or
`--provider` the generated code emits a resource option `parent =
parentName` (in case of using `--parent`) where `parentName` is an
unbound variable.
Usually unbound variables would result in a _bind_ error such as `error:
undefined variable parentName` when type-checking the program however in
the import code generation we specify the bind option
`pcl.AllowMissingVariables` which turns that unbound variable errors
into warnings and code generation can continue to emit code.
This is all good and works as expected. However in the issues linked
above, we do get an _error_ for unbound variables in generated code even
though we specified `AllowMissingVariables`.
The problem as it turns out is when we are trying to generate code via
dynamically loaded `LangaugeRuntime` plugins. Specifically for NodeJS
and Python, we load `pulumi-language-nodejs` or `pulumi-language-python`
and call `GenerateProgram` to get the generated program. That function
`GenerateProgram` takes the text _SOURCE_ of the a bound program (one
that was bound using option `AllowMissingVariables`) and re-binds again
inside the implementation of the language plugin. The second time we
bind the program, we don't pass it the option `AllowMissingVariables`
and so it fails with `unboud variable` error.
I've verified that the issue above don't repro when doing an import for
dotnet (probably same for java/yaml) because we use the statically
linked function `codegen/{lang}/gen_program.go -> GenerateProgram`
## Solution
The problem can be solved by propagating the bind options from the CLI
to the language hosts during import so that they know how to bind the
program. I've extended the gRPC interface in `GenerateProgramRequest`
with a property `Strict` which follows the same logic from `pulumi
convert --strict` and made it such that the import command sends
`strict=false` to the language plugins when doing `GenerateProgram`.
This is consistent with `GenerateProject` that uses the same flag. When
`strict=false` we use `pcl.NonStrictBindOptions()` which includes
`AllowMissingVariables` .
## Repro
Once can test the before and after behaviour by running `pulumi up
--yes` on the following TypeScript program:
```ts
import * as pulumi from "@pulumi/pulumi";
import * as random from "@pulumi/random";
export class MyComponent extends pulumi.ComponentResource {
public readonly randomPetId: pulumi.Output<string>;
constructor(name: string, opts?: pulumi.ComponentResourceOptions) {
super("example:index:MyComponent", name, {}, opts);
const randomPet = new random.RandomPet("randomPet", {}, {
parent: this
});
this.randomPetId = randomPet.id;
this.registerOutputs({
randomPetId: randomPet.id,
});
}
}
const example = new MyComponent("example");
export const randomPetId = example.randomPetId;
```
Then running `pulumi import -f import.json` where `import.json` contains
a resource to be imported under the created component (stack=`dev`,
project=`importerrors`)
```ts
{
"nameTable": {
"parentComponent": "urn:pulumi:dev::importerrors::example:index:MyComponent::example"
},
"resources": [
{
"type": "random:index/randomPassword:RandomPassword",
"name": "randomPassword",
"id": "supersecret",
"parent": "parentComponent"
}
]
}
```
Running this locally I get the following generated code (which
previously failed to generate)
```ts
import * as pulumi from "@pulumi/pulumi";
import * as random from "@pulumi/random";
const randomPassword = new random.RandomPassword("randomPassword", {
length: 11,
lower: true,
number: true,
numeric: true,
special: true,
upper: true,
}, {
parent: parentComponent,
});
```
2024-07-25 13:53:44 +00:00
// if PCL binding should be strict or not.
Strict bool ` protobuf:"varint,3,opt,name=strict,proto3" json:"strict,omitempty" `
2022-10-17 14:21:11 +00:00
}
func ( x * GenerateProgramRequest ) Reset ( ) {
* x = GenerateProgramRequest { }
if protoimpl . UnsafeEnabled {
2024-06-17 17:10:55 +00:00
mi := & file_pulumi_language_proto_msgTypes [ 17 ]
2022-10-17 14:21:11 +00:00
ms := protoimpl . X . MessageStateOf ( protoimpl . Pointer ( x ) )
ms . StoreMessageInfo ( mi )
}
}
func ( x * GenerateProgramRequest ) String ( ) string {
return protoimpl . X . MessageStringOf ( x )
}
func ( * GenerateProgramRequest ) ProtoMessage ( ) { }
func ( x * GenerateProgramRequest ) ProtoReflect ( ) protoreflect . Message {
2024-06-17 17:10:55 +00:00
mi := & file_pulumi_language_proto_msgTypes [ 17 ]
2022-10-17 14:21:11 +00:00
if protoimpl . UnsafeEnabled && x != nil {
ms := protoimpl . X . MessageStateOf ( protoimpl . Pointer ( x ) )
if ms . LoadMessageInfo ( ) == nil {
ms . StoreMessageInfo ( mi )
}
return ms
}
return mi . MessageOf ( x )
}
// Deprecated: Use GenerateProgramRequest.ProtoReflect.Descriptor instead.
func ( * GenerateProgramRequest ) Descriptor ( ) ( [ ] byte , [ ] int ) {
2024-06-17 17:10:55 +00:00
return file_pulumi_language_proto_rawDescGZIP ( ) , [ ] int { 17 }
2022-10-17 14:21:11 +00:00
}
func ( x * GenerateProgramRequest ) GetSource ( ) map [ string ] string {
if x != nil {
return x . Source
}
return nil
}
2023-07-27 09:27:07 +00:00
func ( x * GenerateProgramRequest ) GetLoaderTarget ( ) string {
if x != nil {
return x . LoaderTarget
}
return ""
}
[cli/import] Fix undefined variable errors in code generation when imported resources use a parent or provider (#16786)
Fixes #15410 Fixes #13339
## Problem Context
When using `pulumi import` we generate code snippets for the resources
that were imported. Sometimes the user specifies `--parent
parentName=URN` or `--provider providerName=URN` which tweak the parent
or provider that the imported resources uses. When using `--parent` or
`--provider` the generated code emits a resource option `parent =
parentName` (in case of using `--parent`) where `parentName` is an
unbound variable.
Usually unbound variables would result in a _bind_ error such as `error:
undefined variable parentName` when type-checking the program however in
the import code generation we specify the bind option
`pcl.AllowMissingVariables` which turns that unbound variable errors
into warnings and code generation can continue to emit code.
This is all good and works as expected. However in the issues linked
above, we do get an _error_ for unbound variables in generated code even
though we specified `AllowMissingVariables`.
The problem as it turns out is when we are trying to generate code via
dynamically loaded `LangaugeRuntime` plugins. Specifically for NodeJS
and Python, we load `pulumi-language-nodejs` or `pulumi-language-python`
and call `GenerateProgram` to get the generated program. That function
`GenerateProgram` takes the text _SOURCE_ of the a bound program (one
that was bound using option `AllowMissingVariables`) and re-binds again
inside the implementation of the language plugin. The second time we
bind the program, we don't pass it the option `AllowMissingVariables`
and so it fails with `unboud variable` error.
I've verified that the issue above don't repro when doing an import for
dotnet (probably same for java/yaml) because we use the statically
linked function `codegen/{lang}/gen_program.go -> GenerateProgram`
## Solution
The problem can be solved by propagating the bind options from the CLI
to the language hosts during import so that they know how to bind the
program. I've extended the gRPC interface in `GenerateProgramRequest`
with a property `Strict` which follows the same logic from `pulumi
convert --strict` and made it such that the import command sends
`strict=false` to the language plugins when doing `GenerateProgram`.
This is consistent with `GenerateProject` that uses the same flag. When
`strict=false` we use `pcl.NonStrictBindOptions()` which includes
`AllowMissingVariables` .
## Repro
Once can test the before and after behaviour by running `pulumi up
--yes` on the following TypeScript program:
```ts
import * as pulumi from "@pulumi/pulumi";
import * as random from "@pulumi/random";
export class MyComponent extends pulumi.ComponentResource {
public readonly randomPetId: pulumi.Output<string>;
constructor(name: string, opts?: pulumi.ComponentResourceOptions) {
super("example:index:MyComponent", name, {}, opts);
const randomPet = new random.RandomPet("randomPet", {}, {
parent: this
});
this.randomPetId = randomPet.id;
this.registerOutputs({
randomPetId: randomPet.id,
});
}
}
const example = new MyComponent("example");
export const randomPetId = example.randomPetId;
```
Then running `pulumi import -f import.json` where `import.json` contains
a resource to be imported under the created component (stack=`dev`,
project=`importerrors`)
```ts
{
"nameTable": {
"parentComponent": "urn:pulumi:dev::importerrors::example:index:MyComponent::example"
},
"resources": [
{
"type": "random:index/randomPassword:RandomPassword",
"name": "randomPassword",
"id": "supersecret",
"parent": "parentComponent"
}
]
}
```
Running this locally I get the following generated code (which
previously failed to generate)
```ts
import * as pulumi from "@pulumi/pulumi";
import * as random from "@pulumi/random";
const randomPassword = new random.RandomPassword("randomPassword", {
length: 11,
lower: true,
number: true,
numeric: true,
special: true,
upper: true,
}, {
parent: parentComponent,
});
```
2024-07-25 13:53:44 +00:00
func ( x * GenerateProgramRequest ) GetStrict ( ) bool {
if x != nil {
return x . Strict
}
return false
}
2022-10-17 14:21:11 +00:00
type GenerateProgramResponse struct {
state protoimpl . MessageState
sizeCache protoimpl . SizeCache
unknownFields protoimpl . UnknownFields
// any diagnostics from code generation.
Diagnostics [ ] * codegen . Diagnostic ` protobuf:"bytes,1,rep,name=diagnostics,proto3" json:"diagnostics,omitempty" `
// the generated program source code.
Source map [ string ] [ ] byte ` protobuf:"bytes,2,rep,name=source,proto3" json:"source,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3" `
}
func ( x * GenerateProgramResponse ) Reset ( ) {
* x = GenerateProgramResponse { }
if protoimpl . UnsafeEnabled {
2024-06-17 17:10:55 +00:00
mi := & file_pulumi_language_proto_msgTypes [ 18 ]
2022-10-17 14:21:11 +00:00
ms := protoimpl . X . MessageStateOf ( protoimpl . Pointer ( x ) )
ms . StoreMessageInfo ( mi )
}
}
func ( x * GenerateProgramResponse ) String ( ) string {
return protoimpl . X . MessageStringOf ( x )
}
func ( * GenerateProgramResponse ) ProtoMessage ( ) { }
func ( x * GenerateProgramResponse ) ProtoReflect ( ) protoreflect . Message {
2024-06-17 17:10:55 +00:00
mi := & file_pulumi_language_proto_msgTypes [ 18 ]
2022-10-17 14:21:11 +00:00
if protoimpl . UnsafeEnabled && x != nil {
ms := protoimpl . X . MessageStateOf ( protoimpl . Pointer ( x ) )
if ms . LoadMessageInfo ( ) == nil {
ms . StoreMessageInfo ( mi )
}
return ms
}
return mi . MessageOf ( x )
}
// Deprecated: Use GenerateProgramResponse.ProtoReflect.Descriptor instead.
func ( * GenerateProgramResponse ) Descriptor ( ) ( [ ] byte , [ ] int ) {
2024-06-17 17:10:55 +00:00
return file_pulumi_language_proto_rawDescGZIP ( ) , [ ] int { 18 }
2022-10-17 14:21:11 +00:00
}
func ( x * GenerateProgramResponse ) GetDiagnostics ( ) [ ] * codegen . Diagnostic {
if x != nil {
return x . Diagnostics
}
return nil
}
func ( x * GenerateProgramResponse ) GetSource ( ) map [ string ] [ ] byte {
if x != nil {
return x . Source
}
return nil
}
type GenerateProjectRequest struct {
state protoimpl . MessageState
sizeCache protoimpl . SizeCache
unknownFields protoimpl . UnknownFields
2023-05-26 10:32:19 +00:00
// the directory to generate the project from.
SourceDirectory string ` protobuf:"bytes,1,opt,name=source_directory,json=sourceDirectory,proto3" json:"source_directory,omitempty" `
2022-10-17 14:21:11 +00:00
// the directory to generate the project in.
2023-05-26 10:32:19 +00:00
TargetDirectory string ` protobuf:"bytes,2,opt,name=target_directory,json=targetDirectory,proto3" json:"target_directory,omitempty" `
2022-10-17 14:21:11 +00:00
// the JSON-encoded pulumi project file.
2023-05-26 10:32:19 +00:00
Project string ` protobuf:"bytes,3,opt,name=project,proto3" json:"project,omitempty" `
2023-06-07 17:17:59 +00:00
// if PCL binding should be strict or not.
Strict bool ` protobuf:"varint,4,opt,name=strict,proto3" json:"strict,omitempty" `
2023-07-27 09:27:07 +00:00
// The target of a codegen.LoaderServer to use for loading schemas.
LoaderTarget string ` protobuf:"bytes,5,opt,name=loader_target,json=loaderTarget,proto3" json:"loader_target,omitempty" `
2023-08-03 10:40:05 +00:00
// local dependencies to use instead of using the package system. This is a map of package name to a local
// path of a language specific artifact to use for the SDK for that package.
LocalDependencies map [ string ] string ` protobuf:"bytes,6,rep,name=local_dependencies,json=localDependencies,proto3" json:"local_dependencies,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3" `
2022-10-17 14:21:11 +00:00
}
func ( x * GenerateProjectRequest ) Reset ( ) {
* x = GenerateProjectRequest { }
if protoimpl . UnsafeEnabled {
2024-06-17 17:10:55 +00:00
mi := & file_pulumi_language_proto_msgTypes [ 19 ]
2022-10-17 14:21:11 +00:00
ms := protoimpl . X . MessageStateOf ( protoimpl . Pointer ( x ) )
ms . StoreMessageInfo ( mi )
}
}
func ( x * GenerateProjectRequest ) String ( ) string {
return protoimpl . X . MessageStringOf ( x )
}
func ( * GenerateProjectRequest ) ProtoMessage ( ) { }
func ( x * GenerateProjectRequest ) ProtoReflect ( ) protoreflect . Message {
2024-06-17 17:10:55 +00:00
mi := & file_pulumi_language_proto_msgTypes [ 19 ]
2022-10-17 14:21:11 +00:00
if protoimpl . UnsafeEnabled && x != nil {
ms := protoimpl . X . MessageStateOf ( protoimpl . Pointer ( x ) )
if ms . LoadMessageInfo ( ) == nil {
ms . StoreMessageInfo ( mi )
}
return ms
}
return mi . MessageOf ( x )
}
// Deprecated: Use GenerateProjectRequest.ProtoReflect.Descriptor instead.
func ( * GenerateProjectRequest ) Descriptor ( ) ( [ ] byte , [ ] int ) {
2024-06-17 17:10:55 +00:00
return file_pulumi_language_proto_rawDescGZIP ( ) , [ ] int { 19 }
2022-10-17 14:21:11 +00:00
}
2023-05-26 10:32:19 +00:00
func ( x * GenerateProjectRequest ) GetSourceDirectory ( ) string {
2022-10-17 14:21:11 +00:00
if x != nil {
2023-05-26 10:32:19 +00:00
return x . SourceDirectory
2022-10-17 14:21:11 +00:00
}
return ""
}
2023-05-26 10:32:19 +00:00
func ( x * GenerateProjectRequest ) GetTargetDirectory ( ) string {
2022-10-17 14:21:11 +00:00
if x != nil {
2023-05-26 10:32:19 +00:00
return x . TargetDirectory
2022-10-17 14:21:11 +00:00
}
return ""
}
2023-05-26 10:32:19 +00:00
func ( x * GenerateProjectRequest ) GetProject ( ) string {
2022-10-17 14:21:11 +00:00
if x != nil {
2023-05-26 10:32:19 +00:00
return x . Project
2022-10-17 14:21:11 +00:00
}
2023-05-26 10:32:19 +00:00
return ""
2022-10-17 14:21:11 +00:00
}
2023-06-07 17:17:59 +00:00
func ( x * GenerateProjectRequest ) GetStrict ( ) bool {
if x != nil {
return x . Strict
}
return false
}
2023-07-27 09:27:07 +00:00
func ( x * GenerateProjectRequest ) GetLoaderTarget ( ) string {
if x != nil {
return x . LoaderTarget
}
return ""
}
2023-08-03 10:40:05 +00:00
func ( x * GenerateProjectRequest ) GetLocalDependencies ( ) map [ string ] string {
if x != nil {
return x . LocalDependencies
}
return nil
}
2022-10-17 14:21:11 +00:00
type GenerateProjectResponse struct {
state protoimpl . MessageState
sizeCache protoimpl . SizeCache
unknownFields protoimpl . UnknownFields
2023-05-26 10:32:19 +00:00
// any diagnostics from code generation.
Diagnostics [ ] * codegen . Diagnostic ` protobuf:"bytes,1,rep,name=diagnostics,proto3" json:"diagnostics,omitempty" `
2022-10-17 14:21:11 +00:00
}
func ( x * GenerateProjectResponse ) Reset ( ) {
* x = GenerateProjectResponse { }
if protoimpl . UnsafeEnabled {
2024-06-17 17:10:55 +00:00
mi := & file_pulumi_language_proto_msgTypes [ 20 ]
2022-10-17 14:21:11 +00:00
ms := protoimpl . X . MessageStateOf ( protoimpl . Pointer ( x ) )
ms . StoreMessageInfo ( mi )
}
}
func ( x * GenerateProjectResponse ) String ( ) string {
return protoimpl . X . MessageStringOf ( x )
}
func ( * GenerateProjectResponse ) ProtoMessage ( ) { }
func ( x * GenerateProjectResponse ) ProtoReflect ( ) protoreflect . Message {
2024-06-17 17:10:55 +00:00
mi := & file_pulumi_language_proto_msgTypes [ 20 ]
2022-10-17 14:21:11 +00:00
if protoimpl . UnsafeEnabled && x != nil {
ms := protoimpl . X . MessageStateOf ( protoimpl . Pointer ( x ) )
if ms . LoadMessageInfo ( ) == nil {
ms . StoreMessageInfo ( mi )
}
return ms
}
return mi . MessageOf ( x )
}
// Deprecated: Use GenerateProjectResponse.ProtoReflect.Descriptor instead.
func ( * GenerateProjectResponse ) Descriptor ( ) ( [ ] byte , [ ] int ) {
2024-06-17 17:10:55 +00:00
return file_pulumi_language_proto_rawDescGZIP ( ) , [ ] int { 20 }
2022-10-17 14:21:11 +00:00
}
2023-05-26 10:32:19 +00:00
func ( x * GenerateProjectResponse ) GetDiagnostics ( ) [ ] * codegen . Diagnostic {
if x != nil {
return x . Diagnostics
}
return nil
}
2022-10-17 14:21:11 +00:00
type GeneratePackageRequest struct {
state protoimpl . MessageState
sizeCache protoimpl . SizeCache
unknownFields protoimpl . UnknownFields
// the directory to generate the package in.
Directory string ` protobuf:"bytes,1,opt,name=directory,proto3" json:"directory,omitempty" `
// the JSON-encoded schema.
Schema string ` protobuf:"bytes,2,opt,name=schema,proto3" json:"schema,omitempty" `
// extra files to copy to the package output.
2023-05-26 10:32:19 +00:00
ExtraFiles map [ string ] [ ] byte ` protobuf:"bytes,3,rep,name=extra_files,json=extraFiles,proto3" json:"extra_files,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3" `
2023-07-27 09:27:07 +00:00
// The target of a codegen.LoaderServer to use for loading schemas.
LoaderTarget string ` protobuf:"bytes,4,opt,name=loader_target,json=loaderTarget,proto3" json:"loader_target,omitempty" `
2024-03-26 13:10:34 +00:00
// local dependencies to use instead of using the package system. This is a map of package name to a local
// path of a language specific artifact to use for the SDK for that package.
LocalDependencies map [ string ] string ` protobuf:"bytes,5,rep,name=local_dependencies,json=localDependencies,proto3" json:"local_dependencies,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3" `
2024-08-07 08:16:37 +00:00
// if true generates an SDK appropriate for local usage, this may differ from a standard publishable SDK depending
// on the language.
Local bool ` protobuf:"varint,6,opt,name=local,proto3" json:"local,omitempty" `
2022-10-17 14:21:11 +00:00
}
func ( x * GeneratePackageRequest ) Reset ( ) {
* x = GeneratePackageRequest { }
if protoimpl . UnsafeEnabled {
2024-06-17 17:10:55 +00:00
mi := & file_pulumi_language_proto_msgTypes [ 21 ]
2022-10-17 14:21:11 +00:00
ms := protoimpl . X . MessageStateOf ( protoimpl . Pointer ( x ) )
ms . StoreMessageInfo ( mi )
}
}
func ( x * GeneratePackageRequest ) String ( ) string {
return protoimpl . X . MessageStringOf ( x )
}
func ( * GeneratePackageRequest ) ProtoMessage ( ) { }
func ( x * GeneratePackageRequest ) ProtoReflect ( ) protoreflect . Message {
2024-06-17 17:10:55 +00:00
mi := & file_pulumi_language_proto_msgTypes [ 21 ]
2022-10-17 14:21:11 +00:00
if protoimpl . UnsafeEnabled && x != nil {
ms := protoimpl . X . MessageStateOf ( protoimpl . Pointer ( x ) )
if ms . LoadMessageInfo ( ) == nil {
ms . StoreMessageInfo ( mi )
}
return ms
}
return mi . MessageOf ( x )
}
// Deprecated: Use GeneratePackageRequest.ProtoReflect.Descriptor instead.
func ( * GeneratePackageRequest ) Descriptor ( ) ( [ ] byte , [ ] int ) {
2024-06-17 17:10:55 +00:00
return file_pulumi_language_proto_rawDescGZIP ( ) , [ ] int { 21 }
2022-10-17 14:21:11 +00:00
}
func ( x * GeneratePackageRequest ) GetDirectory ( ) string {
if x != nil {
return x . Directory
}
return ""
}
func ( x * GeneratePackageRequest ) GetSchema ( ) string {
if x != nil {
return x . Schema
}
return ""
}
func ( x * GeneratePackageRequest ) GetExtraFiles ( ) map [ string ] [ ] byte {
if x != nil {
return x . ExtraFiles
}
return nil
}
2023-07-27 09:27:07 +00:00
func ( x * GeneratePackageRequest ) GetLoaderTarget ( ) string {
if x != nil {
return x . LoaderTarget
}
return ""
}
2024-03-26 13:10:34 +00:00
func ( x * GeneratePackageRequest ) GetLocalDependencies ( ) map [ string ] string {
if x != nil {
return x . LocalDependencies
}
return nil
}
2024-08-07 08:16:37 +00:00
func ( x * GeneratePackageRequest ) GetLocal ( ) bool {
if x != nil {
return x . Local
}
return false
}
2022-10-17 14:21:11 +00:00
type GeneratePackageResponse struct {
state protoimpl . MessageState
sizeCache protoimpl . SizeCache
unknownFields protoimpl . UnknownFields
2023-12-05 17:47:52 +00:00
// any diagnostics from code generation.
Diagnostics [ ] * codegen . Diagnostic ` protobuf:"bytes,1,rep,name=diagnostics,proto3" json:"diagnostics,omitempty" `
2022-10-17 14:21:11 +00:00
}
func ( x * GeneratePackageResponse ) Reset ( ) {
* x = GeneratePackageResponse { }
if protoimpl . UnsafeEnabled {
2024-06-17 17:10:55 +00:00
mi := & file_pulumi_language_proto_msgTypes [ 22 ]
2022-10-17 14:21:11 +00:00
ms := protoimpl . X . MessageStateOf ( protoimpl . Pointer ( x ) )
ms . StoreMessageInfo ( mi )
}
}
func ( x * GeneratePackageResponse ) String ( ) string {
return protoimpl . X . MessageStringOf ( x )
}
func ( * GeneratePackageResponse ) ProtoMessage ( ) { }
func ( x * GeneratePackageResponse ) ProtoReflect ( ) protoreflect . Message {
2024-06-17 17:10:55 +00:00
mi := & file_pulumi_language_proto_msgTypes [ 22 ]
2022-10-17 14:21:11 +00:00
if protoimpl . UnsafeEnabled && x != nil {
ms := protoimpl . X . MessageStateOf ( protoimpl . Pointer ( x ) )
if ms . LoadMessageInfo ( ) == nil {
ms . StoreMessageInfo ( mi )
}
return ms
}
return mi . MessageOf ( x )
}
// Deprecated: Use GeneratePackageResponse.ProtoReflect.Descriptor instead.
func ( * GeneratePackageResponse ) Descriptor ( ) ( [ ] byte , [ ] int ) {
2024-06-17 17:10:55 +00:00
return file_pulumi_language_proto_rawDescGZIP ( ) , [ ] int { 22 }
2022-10-17 14:21:11 +00:00
}
2023-12-05 17:47:52 +00:00
func ( x * GeneratePackageResponse ) GetDiagnostics ( ) [ ] * codegen . Diagnostic {
if x != nil {
return x . Diagnostics
}
return nil
}
2023-07-27 21:39:36 +00:00
type PackRequest struct {
state protoimpl . MessageState
sizeCache protoimpl . SizeCache
unknownFields protoimpl . UnknownFields
// the directory of a package to pack.
PackageDirectory string ` protobuf:"bytes,1,opt,name=package_directory,json=packageDirectory,proto3" json:"package_directory,omitempty" `
// the directory to write the packed artifact to.
Add SupportPack to schemas to write out in the new style (#15713)
<!---
Thanks so much for your contribution! If this is your first time
contributing, please ensure that you have read the
[CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md)
documentation.
-->
# Description
<!--- Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context. -->
This adds a new flag to the schema metadata to tell codegen to use the
new proposed style of SDKs where we fill in versions and write go.mods
etc.
I've reworked pack to operate on packages assuming they're in this new
style. That is pack no longer has the responsibility to fill in any
version information.
This updates python and node codegen to write out SDKs in this new
style, and fixes their core libraries to still be buildable via pack.
There are two approaches to fixing those, I've chosen option 1 below but
could pretty easily rework for option 2.
1) Write the version information directly to the SDKs at the same time
as we edit the .version file. To simplify this I've added a new
'set-version.py' script that takes a version string an writes it to all
the relevant places (.version, package.json, etc).
2) Write "pack" in the language host to search up the directory tree for
the ".version" file and then fill in the version information as we we're
doing before with envvar tricks and copying and editing package.json.
I think 1 is simpler long term, but does force some amount of cleanup in
unrelated bits of the system right now (release makefiles need a small
edit). 2 is much more localised but keeps this complexity that
sdk/nodejs sdk/python aren't actually valid source modules.
## Checklist
- [x] I have run `make tidy` to update any new dependencies
- [x] I have run `make lint` to verify my code passes the lint check
- [x] I have formatted my code using `gofumpt`
<!--- Please provide details if the checkbox below is to be left
unchecked. -->
- [x] I have added tests that prove my fix is effective or that my
feature works
<!---
User-facing changes require a CHANGELOG entry.
-->
- [ ] I have run `make changelog` and committed the
`changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the
Pulumi Cloud,
then the service should honor older versions of the CLI where this
change would not exist.
You must then bump the API version in
/pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi
Cloud API version
<!-- @Pulumi employees: If yes, you must submit corresponding changes in
the service repo. -->
2024-03-22 09:25:46 +00:00
DestinationDirectory string ` protobuf:"bytes,2,opt,name=destination_directory,json=destinationDirectory,proto3" json:"destination_directory,omitempty" `
2023-07-27 21:39:36 +00:00
}
func ( x * PackRequest ) Reset ( ) {
* x = PackRequest { }
if protoimpl . UnsafeEnabled {
2024-06-17 17:10:55 +00:00
mi := & file_pulumi_language_proto_msgTypes [ 23 ]
2023-07-27 21:39:36 +00:00
ms := protoimpl . X . MessageStateOf ( protoimpl . Pointer ( x ) )
ms . StoreMessageInfo ( mi )
}
}
func ( x * PackRequest ) String ( ) string {
return protoimpl . X . MessageStringOf ( x )
}
func ( * PackRequest ) ProtoMessage ( ) { }
func ( x * PackRequest ) ProtoReflect ( ) protoreflect . Message {
2024-06-17 17:10:55 +00:00
mi := & file_pulumi_language_proto_msgTypes [ 23 ]
2023-07-27 21:39:36 +00:00
if protoimpl . UnsafeEnabled && x != nil {
ms := protoimpl . X . MessageStateOf ( protoimpl . Pointer ( x ) )
if ms . LoadMessageInfo ( ) == nil {
ms . StoreMessageInfo ( mi )
}
return ms
}
return mi . MessageOf ( x )
}
// Deprecated: Use PackRequest.ProtoReflect.Descriptor instead.
func ( * PackRequest ) Descriptor ( ) ( [ ] byte , [ ] int ) {
2024-06-17 17:10:55 +00:00
return file_pulumi_language_proto_rawDescGZIP ( ) , [ ] int { 23 }
2023-07-27 21:39:36 +00:00
}
func ( x * PackRequest ) GetPackageDirectory ( ) string {
if x != nil {
return x . PackageDirectory
}
return ""
}
func ( x * PackRequest ) GetDestinationDirectory ( ) string {
if x != nil {
return x . DestinationDirectory
}
return ""
}
type PackResponse struct {
state protoimpl . MessageState
sizeCache protoimpl . SizeCache
unknownFields protoimpl . UnknownFields
// the full path of the packed artifact.
ArtifactPath string ` protobuf:"bytes,1,opt,name=artifact_path,json=artifactPath,proto3" json:"artifact_path,omitempty" `
}
func ( x * PackResponse ) Reset ( ) {
* x = PackResponse { }
if protoimpl . UnsafeEnabled {
2024-06-17 17:10:55 +00:00
mi := & file_pulumi_language_proto_msgTypes [ 24 ]
2023-07-27 21:39:36 +00:00
ms := protoimpl . X . MessageStateOf ( protoimpl . Pointer ( x ) )
ms . StoreMessageInfo ( mi )
}
}
func ( x * PackResponse ) String ( ) string {
return protoimpl . X . MessageStringOf ( x )
}
func ( * PackResponse ) ProtoMessage ( ) { }
func ( x * PackResponse ) ProtoReflect ( ) protoreflect . Message {
2024-06-17 17:10:55 +00:00
mi := & file_pulumi_language_proto_msgTypes [ 24 ]
2023-07-27 21:39:36 +00:00
if protoimpl . UnsafeEnabled && x != nil {
ms := protoimpl . X . MessageStateOf ( protoimpl . Pointer ( x ) )
if ms . LoadMessageInfo ( ) == nil {
ms . StoreMessageInfo ( mi )
}
return ms
}
return mi . MessageOf ( x )
}
// Deprecated: Use PackResponse.ProtoReflect.Descriptor instead.
func ( * PackResponse ) Descriptor ( ) ( [ ] byte , [ ] int ) {
2024-06-17 17:10:55 +00:00
return file_pulumi_language_proto_rawDescGZIP ( ) , [ ] int { 24 }
2023-07-27 21:39:36 +00:00
}
func ( x * PackResponse ) GetArtifactPath ( ) string {
if x != nil {
return x . ArtifactPath
}
return ""
}
2024-06-17 17:10:55 +00:00
type RuntimeOptionPrompt_RuntimeOptionValue struct {
state protoimpl . MessageState
sizeCache protoimpl . SizeCache
unknownFields protoimpl . UnknownFields
PromptType RuntimeOptionPrompt_RuntimeOptionType ` protobuf:"varint,1,opt,name=promptType,proto3,enum=pulumirpc.RuntimeOptionPrompt_RuntimeOptionType" json:"promptType,omitempty" `
StringValue string ` protobuf:"bytes,2,opt,name=stringValue,proto3" json:"stringValue,omitempty" `
Int32Value int32 ` protobuf:"varint,3,opt,name=int32Value,proto3" json:"int32Value,omitempty" `
2024-06-28 23:21:55 +00:00
DisplayName string ` protobuf:"bytes,4,opt,name=displayName,proto3" json:"displayName,omitempty" `
2024-06-17 17:10:55 +00:00
}
func ( x * RuntimeOptionPrompt_RuntimeOptionValue ) Reset ( ) {
* x = RuntimeOptionPrompt_RuntimeOptionValue { }
if protoimpl . UnsafeEnabled {
mi := & file_pulumi_language_proto_msgTypes [ 27 ]
ms := protoimpl . X . MessageStateOf ( protoimpl . Pointer ( x ) )
ms . StoreMessageInfo ( mi )
}
}
func ( x * RuntimeOptionPrompt_RuntimeOptionValue ) String ( ) string {
return protoimpl . X . MessageStringOf ( x )
}
func ( * RuntimeOptionPrompt_RuntimeOptionValue ) ProtoMessage ( ) { }
func ( x * RuntimeOptionPrompt_RuntimeOptionValue ) ProtoReflect ( ) protoreflect . Message {
mi := & file_pulumi_language_proto_msgTypes [ 27 ]
if protoimpl . UnsafeEnabled && x != nil {
ms := protoimpl . X . MessageStateOf ( protoimpl . Pointer ( x ) )
if ms . LoadMessageInfo ( ) == nil {
ms . StoreMessageInfo ( mi )
}
return ms
}
return mi . MessageOf ( x )
}
// Deprecated: Use RuntimeOptionPrompt_RuntimeOptionValue.ProtoReflect.Descriptor instead.
func ( * RuntimeOptionPrompt_RuntimeOptionValue ) Descriptor ( ) ( [ ] byte , [ ] int ) {
return file_pulumi_language_proto_rawDescGZIP ( ) , [ ] int { 13 , 0 }
}
func ( x * RuntimeOptionPrompt_RuntimeOptionValue ) GetPromptType ( ) RuntimeOptionPrompt_RuntimeOptionType {
if x != nil {
return x . PromptType
}
return RuntimeOptionPrompt_STRING
}
func ( x * RuntimeOptionPrompt_RuntimeOptionValue ) GetStringValue ( ) string {
if x != nil {
return x . StringValue
}
return ""
}
func ( x * RuntimeOptionPrompt_RuntimeOptionValue ) GetInt32Value ( ) int32 {
if x != nil {
return x . Int32Value
}
return 0
}
2024-06-28 23:21:55 +00:00
func ( x * RuntimeOptionPrompt_RuntimeOptionValue ) GetDisplayName ( ) string {
if x != nil {
return x . DisplayName
}
return ""
}
2022-07-12 13:45:03 +00:00
var File_pulumi_language_proto protoreflect . FileDescriptor
var file_pulumi_language_proto_rawDesc = [ ] byte {
0x0a , 0x15 , 0x70 , 0x75 , 0x6c , 0x75 , 0x6d , 0x69 , 0x2f , 0x6c , 0x61 , 0x6e , 0x67 , 0x75 , 0x61 , 0x67 ,
0x65 , 0x2e , 0x70 , 0x72 , 0x6f , 0x74 , 0x6f , 0x12 , 0x09 , 0x70 , 0x75 , 0x6c , 0x75 , 0x6d , 0x69 , 0x72 ,
2022-10-17 14:21:11 +00:00
0x70 , 0x63 , 0x1a , 0x18 , 0x70 , 0x75 , 0x6c , 0x75 , 0x6d , 0x69 , 0x2f , 0x63 , 0x6f , 0x64 , 0x65 , 0x67 ,
0x65 , 0x6e , 0x2f , 0x68 , 0x63 , 0x6c , 0x2e , 0x70 , 0x72 , 0x6f , 0x74 , 0x6f , 0x1a , 0x13 , 0x70 , 0x75 ,
0x6c , 0x75 , 0x6d , 0x69 , 0x2f , 0x70 , 0x6c , 0x75 , 0x67 , 0x69 , 0x6e , 0x2e , 0x70 , 0x72 , 0x6f , 0x74 ,
0x6f , 0x1a , 0x1b , 0x67 , 0x6f , 0x6f , 0x67 , 0x6c , 0x65 , 0x2f , 0x70 , 0x72 , 0x6f , 0x74 , 0x6f , 0x62 ,
2023-10-20 10:44:16 +00:00
0x75 , 0x66 , 0x2f , 0x65 , 0x6d , 0x70 , 0x74 , 0x79 , 0x2e , 0x70 , 0x72 , 0x6f , 0x74 , 0x6f , 0x1a , 0x1c ,
0x67 , 0x6f , 0x6f , 0x67 , 0x6c , 0x65 , 0x2f , 0x70 , 0x72 , 0x6f , 0x74 , 0x6f , 0x62 , 0x75 , 0x66 , 0x2f ,
Pass root and main info to language host methods (#14654)
<!---
Thanks so much for your contribution! If this is your first time
contributing, please ensure that you have read the
[CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md)
documentation.
-->
# Description
<!--- Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context. -->
This is two changes rolled together in a way.
Firstly passing some of the data that we pass on language runtime
startup to also pass it to Run/GetRequiredPlugins/etc. This is needed
for matrix testing, as we only get to start the language runtime up once
for that but want to execute multiple programs with it.
I feel it's also a little more consistent as we use the language
runtimes in other contexts (codegen) where there isn't really a root
directory, and aren't any options (and if we did do options the options
for codegen are not going to be the same as for execution). It also
means we can reuse a language host for shimless and substack programs,
as before they heavily relied on their current working directory to
calculate paths, and obviosly could only take one set of options at
startup. Imagine a shimless python package + a python root program, that
would have needed two startups of the python language host to deal with,
this unblocks it so we can make the engine smarter and only use one.
Secondly renaming some of the fields we pass to
Run/GetRequiredPlugins/etc today. `Pwd` and `Program` were not very
descriptive and had pretty non-obvious documentation:
```
string pwd = 3; // the program's working directory.
string program = 4; // the path to the program to execute.
```
`pwd` will remain, although probably rename it to `working_directory` at
some point, because while today we always start programs up with the
working directory equal to the program directory that definitely is
going to change in the future (at least for MLCs and substack programs).
But the name `pwd` doesn't make it clear that this was intended to be
the working directory _and_ the directory which contains the program.
`program` was in fact nearly always ".", and if it wasn't that it was
just a filename. The engine never sent a path for `program` (although we
did have some unit tests to check how that worked for the nodejs and
python hosts).
These are now replaced by a new structure with (I think) more clearly
named and documented fields (see ProgramInfo in langauge.proto).
The engine still sends the old data for now, we need to update
dotnet/yaml/java before we break the old interface and give Virtus Labs
a chance to update [besom](https://github.com/VirtusLab/besom).
## Checklist
- [x] I have run `make tidy` to update any new dependencies
- [x] I have run `make lint` to verify my code passes the lint check
- [ ] I have formatted my code using `gofumpt`
<!--- Please provide details if the checkbox below is to be left
unchecked. -->
- [x] I have added tests that prove my fix is effective or that my
feature works
<!---
User-facing changes require a CHANGELOG entry.
-->
- [ ] I have run `make changelog` and committed the
`changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the
Pulumi Cloud,
then the service should honor older versions of the CLI where this
change would not exist.
You must then bump the API version in
/pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi
Cloud API version
<!-- @Pulumi employees: If yes, you must submit corresponding changes in
the service repo. -->
2023-12-10 17:30:51 +00:00
0x73 , 0x74 , 0x72 , 0x75 , 0x63 , 0x74 , 0x2e , 0x70 , 0x72 , 0x6f , 0x74 , 0x6f , 0x22 , 0xb5 , 0x01 , 0x0a ,
0x0b , 0x50 , 0x72 , 0x6f , 0x67 , 0x72 , 0x61 , 0x6d , 0x49 , 0x6e , 0x66 , 0x6f , 0x12 , 0x25 , 0x0a , 0x0e ,
0x72 , 0x6f , 0x6f , 0x74 , 0x5f , 0x64 , 0x69 , 0x72 , 0x65 , 0x63 , 0x74 , 0x6f , 0x72 , 0x79 , 0x18 , 0x01 ,
0x20 , 0x01 , 0x28 , 0x09 , 0x52 , 0x0d , 0x72 , 0x6f , 0x6f , 0x74 , 0x44 , 0x69 , 0x72 , 0x65 , 0x63 , 0x74 ,
0x6f , 0x72 , 0x79 , 0x12 , 0x2b , 0x0a , 0x11 , 0x70 , 0x72 , 0x6f , 0x67 , 0x72 , 0x61 , 0x6d , 0x5f , 0x64 ,
0x69 , 0x72 , 0x65 , 0x63 , 0x74 , 0x6f , 0x72 , 0x79 , 0x18 , 0x02 , 0x20 , 0x01 , 0x28 , 0x09 , 0x52 , 0x10 ,
0x70 , 0x72 , 0x6f , 0x67 , 0x72 , 0x61 , 0x6d , 0x44 , 0x69 , 0x72 , 0x65 , 0x63 , 0x74 , 0x6f , 0x72 , 0x79 ,
0x12 , 0x1f , 0x0a , 0x0b , 0x65 , 0x6e , 0x74 , 0x72 , 0x79 , 0x5f , 0x70 , 0x6f , 0x69 , 0x6e , 0x74 , 0x18 ,
0x03 , 0x20 , 0x01 , 0x28 , 0x09 , 0x52 , 0x0a , 0x65 , 0x6e , 0x74 , 0x72 , 0x79 , 0x50 , 0x6f , 0x69 , 0x6e ,
0x74 , 0x12 , 0x31 , 0x0a , 0x07 , 0x6f , 0x70 , 0x74 , 0x69 , 0x6f , 0x6e , 0x73 , 0x18 , 0x04 , 0x20 , 0x01 ,
0x28 , 0x0b , 0x32 , 0x17 , 0x2e , 0x67 , 0x6f , 0x6f , 0x67 , 0x6c , 0x65 , 0x2e , 0x70 , 0x72 , 0x6f , 0x74 ,
0x6f , 0x62 , 0x75 , 0x66 , 0x2e , 0x53 , 0x74 , 0x72 , 0x75 , 0x63 , 0x74 , 0x52 , 0x07 , 0x6f , 0x70 , 0x74 ,
2024-06-06 08:21:46 +00:00
0x69 , 0x6f , 0x6e , 0x73 , 0x22 , 0x3a , 0x0a , 0x0c , 0x41 , 0x62 , 0x6f , 0x75 , 0x74 , 0x52 , 0x65 , 0x71 ,
0x75 , 0x65 , 0x73 , 0x74 , 0x12 , 0x2a , 0x0a , 0x04 , 0x69 , 0x6e , 0x66 , 0x6f , 0x18 , 0x01 , 0x20 , 0x01 ,
0x28 , 0x0b , 0x32 , 0x16 , 0x2e , 0x70 , 0x75 , 0x6c , 0x75 , 0x6d , 0x69 , 0x72 , 0x70 , 0x63 , 0x2e , 0x50 ,
0x72 , 0x6f , 0x67 , 0x72 , 0x61 , 0x6d , 0x49 , 0x6e , 0x66 , 0x6f , 0x52 , 0x04 , 0x69 , 0x6e , 0x66 , 0x6f ,
0x22 , 0xca , 0x01 , 0x0a , 0x0d , 0x41 , 0x62 , 0x6f , 0x75 , 0x74 , 0x52 , 0x65 , 0x73 , 0x70 , 0x6f , 0x6e ,
0x73 , 0x65 , 0x12 , 0x1e , 0x0a , 0x0a , 0x65 , 0x78 , 0x65 , 0x63 , 0x75 , 0x74 , 0x61 , 0x62 , 0x6c , 0x65 ,
0x18 , 0x01 , 0x20 , 0x01 , 0x28 , 0x09 , 0x52 , 0x0a , 0x65 , 0x78 , 0x65 , 0x63 , 0x75 , 0x74 , 0x61 , 0x62 ,
0x6c , 0x65 , 0x12 , 0x18 , 0x0a , 0x07 , 0x76 , 0x65 , 0x72 , 0x73 , 0x69 , 0x6f , 0x6e , 0x18 , 0x02 , 0x20 ,
0x01 , 0x28 , 0x09 , 0x52 , 0x07 , 0x76 , 0x65 , 0x72 , 0x73 , 0x69 , 0x6f , 0x6e , 0x12 , 0x42 , 0x0a , 0x08 ,
0x6d , 0x65 , 0x74 , 0x61 , 0x64 , 0x61 , 0x74 , 0x61 , 0x18 , 0x03 , 0x20 , 0x03 , 0x28 , 0x0b , 0x32 , 0x26 ,
0x2e , 0x70 , 0x75 , 0x6c , 0x75 , 0x6d , 0x69 , 0x72 , 0x70 , 0x63 , 0x2e , 0x41 , 0x62 , 0x6f , 0x75 , 0x74 ,
0x52 , 0x65 , 0x73 , 0x70 , 0x6f , 0x6e , 0x73 , 0x65 , 0x2e , 0x4d , 0x65 , 0x74 , 0x61 , 0x64 , 0x61 , 0x74 ,
0x61 , 0x45 , 0x6e , 0x74 , 0x72 , 0x79 , 0x52 , 0x08 , 0x6d , 0x65 , 0x74 , 0x61 , 0x64 , 0x61 , 0x74 , 0x61 ,
0x1a , 0x3b , 0x0a , 0x0d , 0x4d , 0x65 , 0x74 , 0x61 , 0x64 , 0x61 , 0x74 , 0x61 , 0x45 , 0x6e , 0x74 , 0x72 ,
0x79 , 0x12 , 0x10 , 0x0a , 0x03 , 0x6b , 0x65 , 0x79 , 0x18 , 0x01 , 0x20 , 0x01 , 0x28 , 0x09 , 0x52 , 0x03 ,
0x6b , 0x65 , 0x79 , 0x12 , 0x14 , 0x0a , 0x05 , 0x76 , 0x61 , 0x6c , 0x75 , 0x65 , 0x18 , 0x02 , 0x20 , 0x01 ,
0x28 , 0x09 , 0x52 , 0x05 , 0x76 , 0x61 , 0x6c , 0x75 , 0x65 , 0x3a , 0x02 , 0x38 , 0x01 , 0x22 , 0xd5 , 0x01 ,
0x0a , 0x1d , 0x47 , 0x65 , 0x74 , 0x50 , 0x72 , 0x6f , 0x67 , 0x72 , 0x61 , 0x6d , 0x44 , 0x65 , 0x70 , 0x65 ,
0x6e , 0x64 , 0x65 , 0x6e , 0x63 , 0x69 , 0x65 , 0x73 , 0x52 , 0x65 , 0x71 , 0x75 , 0x65 , 0x73 , 0x74 , 0x12 ,
0x1c , 0x0a , 0x07 , 0x70 , 0x72 , 0x6f , 0x6a , 0x65 , 0x63 , 0x74 , 0x18 , 0x01 , 0x20 , 0x01 , 0x28 , 0x09 ,
0x42 , 0x02 , 0x18 , 0x01 , 0x52 , 0x07 , 0x70 , 0x72 , 0x6f , 0x6a , 0x65 , 0x63 , 0x74 , 0x12 , 0x14 , 0x0a ,
0x03 , 0x70 , 0x77 , 0x64 , 0x18 , 0x02 , 0x20 , 0x01 , 0x28 , 0x09 , 0x42 , 0x02 , 0x18 , 0x01 , 0x52 , 0x03 ,
0x70 , 0x77 , 0x64 , 0x12 , 0x1c , 0x0a , 0x07 , 0x70 , 0x72 , 0x6f , 0x67 , 0x72 , 0x61 , 0x6d , 0x18 , 0x03 ,
0x20 , 0x01 , 0x28 , 0x09 , 0x42 , 0x02 , 0x18 , 0x01 , 0x52 , 0x07 , 0x70 , 0x72 , 0x6f , 0x67 , 0x72 , 0x61 ,
0x6d , 0x12 , 0x36 , 0x0a , 0x16 , 0x74 , 0x72 , 0x61 , 0x6e , 0x73 , 0x69 , 0x74 , 0x69 , 0x76 , 0x65 , 0x44 ,
0x65 , 0x70 , 0x65 , 0x6e , 0x64 , 0x65 , 0x6e , 0x63 , 0x69 , 0x65 , 0x73 , 0x18 , 0x04 , 0x20 , 0x01 , 0x28 ,
0x08 , 0x52 , 0x16 , 0x74 , 0x72 , 0x61 , 0x6e , 0x73 , 0x69 , 0x74 , 0x69 , 0x76 , 0x65 , 0x44 , 0x65 , 0x70 ,
0x65 , 0x6e , 0x64 , 0x65 , 0x6e , 0x63 , 0x69 , 0x65 , 0x73 , 0x12 , 0x2a , 0x0a , 0x04 , 0x69 , 0x6e , 0x66 ,
0x6f , 0x18 , 0x05 , 0x20 , 0x01 , 0x28 , 0x0b , 0x32 , 0x16 , 0x2e , 0x70 , 0x75 , 0x6c , 0x75 , 0x6d , 0x69 ,
0x72 , 0x70 , 0x63 , 0x2e , 0x50 , 0x72 , 0x6f , 0x67 , 0x72 , 0x61 , 0x6d , 0x49 , 0x6e , 0x66 , 0x6f , 0x52 ,
0x04 , 0x69 , 0x6e , 0x66 , 0x6f , 0x22 , 0x3e , 0x0a , 0x0e , 0x44 , 0x65 , 0x70 , 0x65 , 0x6e , 0x64 , 0x65 ,
0x6e , 0x63 , 0x79 , 0x49 , 0x6e , 0x66 , 0x6f , 0x12 , 0x12 , 0x0a , 0x04 , 0x6e , 0x61 , 0x6d , 0x65 , 0x18 ,
0x01 , 0x20 , 0x01 , 0x28 , 0x09 , 0x52 , 0x04 , 0x6e , 0x61 , 0x6d , 0x65 , 0x12 , 0x18 , 0x0a , 0x07 , 0x76 ,
0x65 , 0x72 , 0x73 , 0x69 , 0x6f , 0x6e , 0x18 , 0x02 , 0x20 , 0x01 , 0x28 , 0x09 , 0x52 , 0x07 , 0x76 , 0x65 ,
0x72 , 0x73 , 0x69 , 0x6f , 0x6e , 0x22 , 0x5f , 0x0a , 0x1e , 0x47 , 0x65 , 0x74 , 0x50 , 0x72 , 0x6f , 0x67 ,
0x72 , 0x61 , 0x6d , 0x44 , 0x65 , 0x70 , 0x65 , 0x6e , 0x64 , 0x65 , 0x6e , 0x63 , 0x69 , 0x65 , 0x73 , 0x52 ,
0x65 , 0x73 , 0x70 , 0x6f , 0x6e , 0x73 , 0x65 , 0x12 , 0x3d , 0x0a , 0x0c , 0x64 , 0x65 , 0x70 , 0x65 , 0x6e ,
0x64 , 0x65 , 0x6e , 0x63 , 0x69 , 0x65 , 0x73 , 0x18 , 0x01 , 0x20 , 0x03 , 0x28 , 0x0b , 0x32 , 0x19 , 0x2e ,
0x70 , 0x75 , 0x6c , 0x75 , 0x6d , 0x69 , 0x72 , 0x70 , 0x63 , 0x2e , 0x44 , 0x65 , 0x70 , 0x65 , 0x6e , 0x64 ,
0x65 , 0x6e , 0x63 , 0x79 , 0x49 , 0x6e , 0x66 , 0x6f , 0x52 , 0x0c , 0x64 , 0x65 , 0x70 , 0x65 , 0x6e , 0x64 ,
0x65 , 0x6e , 0x63 , 0x69 , 0x65 , 0x73 , 0x22 , 0x99 , 0x01 , 0x0a , 0x19 , 0x47 , 0x65 , 0x74 , 0x52 , 0x65 ,
0x71 , 0x75 , 0x69 , 0x72 , 0x65 , 0x64 , 0x50 , 0x6c , 0x75 , 0x67 , 0x69 , 0x6e , 0x73 , 0x52 , 0x65 , 0x71 ,
0x75 , 0x65 , 0x73 , 0x74 , 0x12 , 0x1c , 0x0a , 0x07 , 0x70 , 0x72 , 0x6f , 0x6a , 0x65 , 0x63 , 0x74 , 0x18 ,
0x01 , 0x20 , 0x01 , 0x28 , 0x09 , 0x42 , 0x02 , 0x18 , 0x01 , 0x52 , 0x07 , 0x70 , 0x72 , 0x6f , 0x6a , 0x65 ,
0x63 , 0x74 , 0x12 , 0x14 , 0x0a , 0x03 , 0x70 , 0x77 , 0x64 , 0x18 , 0x02 , 0x20 , 0x01 , 0x28 , 0x09 , 0x42 ,
0x02 , 0x18 , 0x01 , 0x52 , 0x03 , 0x70 , 0x77 , 0x64 , 0x12 , 0x1c , 0x0a , 0x07 , 0x70 , 0x72 , 0x6f , 0x67 ,
0x72 , 0x61 , 0x6d , 0x18 , 0x03 , 0x20 , 0x01 , 0x28 , 0x09 , 0x42 , 0x02 , 0x18 , 0x01 , 0x52 , 0x07 , 0x70 ,
0x72 , 0x6f , 0x67 , 0x72 , 0x61 , 0x6d , 0x12 , 0x2a , 0x0a , 0x04 , 0x69 , 0x6e , 0x66 , 0x6f , 0x18 , 0x04 ,
0x20 , 0x01 , 0x28 , 0x0b , 0x32 , 0x16 , 0x2e , 0x70 , 0x75 , 0x6c , 0x75 , 0x6d , 0x69 , 0x72 , 0x70 , 0x63 ,
0x2e , 0x50 , 0x72 , 0x6f , 0x67 , 0x72 , 0x61 , 0x6d , 0x49 , 0x6e , 0x66 , 0x6f , 0x52 , 0x04 , 0x69 , 0x6e ,
0x66 , 0x6f , 0x22 , 0x53 , 0x0a , 0x1a , 0x47 , 0x65 , 0x74 , 0x52 , 0x65 , 0x71 , 0x75 , 0x69 , 0x72 , 0x65 ,
0x64 , 0x50 , 0x6c , 0x75 , 0x67 , 0x69 , 0x6e , 0x73 , 0x52 , 0x65 , 0x73 , 0x70 , 0x6f , 0x6e , 0x73 , 0x65 ,
0x12 , 0x35 , 0x0a , 0x07 , 0x70 , 0x6c , 0x75 , 0x67 , 0x69 , 0x6e , 0x73 , 0x18 , 0x01 , 0x20 , 0x03 , 0x28 ,
0x0b , 0x32 , 0x1b , 0x2e , 0x70 , 0x75 , 0x6c , 0x75 , 0x6d , 0x69 , 0x72 , 0x70 , 0x63 , 0x2e , 0x50 , 0x6c ,
0x75 , 0x67 , 0x69 , 0x6e , 0x44 , 0x65 , 0x70 , 0x65 , 0x6e , 0x64 , 0x65 , 0x6e , 0x63 , 0x79 , 0x52 , 0x07 ,
0x70 , 0x6c , 0x75 , 0x67 , 0x69 , 0x6e , 0x73 , 0x22 , 0xb4 , 0x04 , 0x0a , 0x0a , 0x52 , 0x75 , 0x6e , 0x52 ,
0x65 , 0x71 , 0x75 , 0x65 , 0x73 , 0x74 , 0x12 , 0x18 , 0x0a , 0x07 , 0x70 , 0x72 , 0x6f , 0x6a , 0x65 , 0x63 ,
0x74 , 0x18 , 0x01 , 0x20 , 0x01 , 0x28 , 0x09 , 0x52 , 0x07 , 0x70 , 0x72 , 0x6f , 0x6a , 0x65 , 0x63 , 0x74 ,
0x12 , 0x14 , 0x0a , 0x05 , 0x73 , 0x74 , 0x61 , 0x63 , 0x6b , 0x18 , 0x02 , 0x20 , 0x01 , 0x28 , 0x09 , 0x52 ,
0x05 , 0x73 , 0x74 , 0x61 , 0x63 , 0x6b , 0x12 , 0x10 , 0x0a , 0x03 , 0x70 , 0x77 , 0x64 , 0x18 , 0x03 , 0x20 ,
0x01 , 0x28 , 0x09 , 0x52 , 0x03 , 0x70 , 0x77 , 0x64 , 0x12 , 0x1c , 0x0a , 0x07 , 0x70 , 0x72 , 0x6f , 0x67 ,
0x72 , 0x61 , 0x6d , 0x18 , 0x04 , 0x20 , 0x01 , 0x28 , 0x09 , 0x42 , 0x02 , 0x18 , 0x01 , 0x52 , 0x07 , 0x70 ,
0x72 , 0x6f , 0x67 , 0x72 , 0x61 , 0x6d , 0x12 , 0x12 , 0x0a , 0x04 , 0x61 , 0x72 , 0x67 , 0x73 , 0x18 , 0x05 ,
0x20 , 0x03 , 0x28 , 0x09 , 0x52 , 0x04 , 0x61 , 0x72 , 0x67 , 0x73 , 0x12 , 0x39 , 0x0a , 0x06 , 0x63 , 0x6f ,
0x6e , 0x66 , 0x69 , 0x67 , 0x18 , 0x06 , 0x20 , 0x03 , 0x28 , 0x0b , 0x32 , 0x21 , 0x2e , 0x70 , 0x75 , 0x6c ,
0x75 , 0x6d , 0x69 , 0x72 , 0x70 , 0x63 , 0x2e , 0x52 , 0x75 , 0x6e , 0x52 , 0x65 , 0x71 , 0x75 , 0x65 , 0x73 ,
0x74 , 0x2e , 0x43 , 0x6f , 0x6e , 0x66 , 0x69 , 0x67 , 0x45 , 0x6e , 0x74 , 0x72 , 0x79 , 0x52 , 0x06 , 0x63 ,
0x6f , 0x6e , 0x66 , 0x69 , 0x67 , 0x12 , 0x16 , 0x0a , 0x06 , 0x64 , 0x72 , 0x79 , 0x52 , 0x75 , 0x6e , 0x18 ,
0x07 , 0x20 , 0x01 , 0x28 , 0x08 , 0x52 , 0x06 , 0x64 , 0x72 , 0x79 , 0x52 , 0x75 , 0x6e , 0x12 , 0x1a , 0x0a ,
0x08 , 0x70 , 0x61 , 0x72 , 0x61 , 0x6c , 0x6c , 0x65 , 0x6c , 0x18 , 0x08 , 0x20 , 0x01 , 0x28 , 0x05 , 0x52 ,
0x08 , 0x70 , 0x61 , 0x72 , 0x61 , 0x6c , 0x6c , 0x65 , 0x6c , 0x12 , 0x27 , 0x0a , 0x0f , 0x6d , 0x6f , 0x6e ,
0x69 , 0x74 , 0x6f , 0x72 , 0x5f , 0x61 , 0x64 , 0x64 , 0x72 , 0x65 , 0x73 , 0x73 , 0x18 , 0x09 , 0x20 , 0x01 ,
0x28 , 0x09 , 0x52 , 0x0e , 0x6d , 0x6f , 0x6e , 0x69 , 0x74 , 0x6f , 0x72 , 0x41 , 0x64 , 0x64 , 0x72 , 0x65 ,
0x73 , 0x73 , 0x12 , 0x1c , 0x0a , 0x09 , 0x71 , 0x75 , 0x65 , 0x72 , 0x79 , 0x4d , 0x6f , 0x64 , 0x65 , 0x18 ,
0x0a , 0x20 , 0x01 , 0x28 , 0x08 , 0x52 , 0x09 , 0x71 , 0x75 , 0x65 , 0x72 , 0x79 , 0x4d , 0x6f , 0x64 , 0x65 ,
0x12 , 0x2a , 0x0a , 0x10 , 0x63 , 0x6f , 0x6e , 0x66 , 0x69 , 0x67 , 0x53 , 0x65 , 0x63 , 0x72 , 0x65 , 0x74 ,
0x4b , 0x65 , 0x79 , 0x73 , 0x18 , 0x0b , 0x20 , 0x03 , 0x28 , 0x09 , 0x52 , 0x10 , 0x63 , 0x6f , 0x6e , 0x66 ,
0x69 , 0x67 , 0x53 , 0x65 , 0x63 , 0x72 , 0x65 , 0x74 , 0x4b , 0x65 , 0x79 , 0x73 , 0x12 , 0x22 , 0x0a , 0x0c ,
0x6f , 0x72 , 0x67 , 0x61 , 0x6e , 0x69 , 0x7a , 0x61 , 0x74 , 0x69 , 0x6f , 0x6e , 0x18 , 0x0c , 0x20 , 0x01 ,
0x28 , 0x09 , 0x52 , 0x0c , 0x6f , 0x72 , 0x67 , 0x61 , 0x6e , 0x69 , 0x7a , 0x61 , 0x74 , 0x69 , 0x6f , 0x6e ,
0x12 , 0x45 , 0x0a , 0x11 , 0x63 , 0x6f , 0x6e , 0x66 , 0x69 , 0x67 , 0x50 , 0x72 , 0x6f , 0x70 , 0x65 , 0x72 ,
0x74 , 0x79 , 0x4d , 0x61 , 0x70 , 0x18 , 0x0d , 0x20 , 0x01 , 0x28 , 0x0b , 0x32 , 0x17 , 0x2e , 0x67 , 0x6f ,
0x6f , 0x67 , 0x6c , 0x65 , 0x2e , 0x70 , 0x72 , 0x6f , 0x74 , 0x6f , 0x62 , 0x75 , 0x66 , 0x2e , 0x53 , 0x74 ,
0x72 , 0x75 , 0x63 , 0x74 , 0x52 , 0x11 , 0x63 , 0x6f , 0x6e , 0x66 , 0x69 , 0x67 , 0x50 , 0x72 , 0x6f , 0x70 ,
0x65 , 0x72 , 0x74 , 0x79 , 0x4d , 0x61 , 0x70 , 0x12 , 0x2a , 0x0a , 0x04 , 0x69 , 0x6e , 0x66 , 0x6f , 0x18 ,
0x0e , 0x20 , 0x01 , 0x28 , 0x0b , 0x32 , 0x16 , 0x2e , 0x70 , 0x75 , 0x6c , 0x75 , 0x6d , 0x69 , 0x72 , 0x70 ,
0x63 , 0x2e , 0x50 , 0x72 , 0x6f , 0x67 , 0x72 , 0x61 , 0x6d , 0x49 , 0x6e , 0x66 , 0x6f , 0x52 , 0x04 , 0x69 ,
0x6e , 0x66 , 0x6f , 0x1a , 0x39 , 0x0a , 0x0b , 0x43 , 0x6f , 0x6e , 0x66 , 0x69 , 0x67 , 0x45 , 0x6e , 0x74 ,
0x72 , 0x79 , 0x12 , 0x10 , 0x0a , 0x03 , 0x6b , 0x65 , 0x79 , 0x18 , 0x01 , 0x20 , 0x01 , 0x28 , 0x09 , 0x52 ,
0x03 , 0x6b , 0x65 , 0x79 , 0x12 , 0x14 , 0x0a , 0x05 , 0x76 , 0x61 , 0x6c , 0x75 , 0x65 , 0x18 , 0x02 , 0x20 ,
0x01 , 0x28 , 0x09 , 0x52 , 0x05 , 0x76 , 0x61 , 0x6c , 0x75 , 0x65 , 0x3a , 0x02 , 0x38 , 0x01 , 0x22 , 0x37 ,
0x0a , 0x0b , 0x52 , 0x75 , 0x6e , 0x52 , 0x65 , 0x73 , 0x70 , 0x6f , 0x6e , 0x73 , 0x65 , 0x12 , 0x14 , 0x0a ,
0x05 , 0x65 , 0x72 , 0x72 , 0x6f , 0x72 , 0x18 , 0x01 , 0x20 , 0x01 , 0x28 , 0x09 , 0x52 , 0x05 , 0x65 , 0x72 ,
0x72 , 0x6f , 0x72 , 0x12 , 0x12 , 0x0a , 0x04 , 0x62 , 0x61 , 0x69 , 0x6c , 0x18 , 0x02 , 0x20 , 0x01 , 0x28 ,
0x08 , 0x52 , 0x04 , 0x62 , 0x61 , 0x69 , 0x6c , 0x22 , 0x8b , 0x01 , 0x0a , 0x1a , 0x49 , 0x6e , 0x73 , 0x74 ,
0x61 , 0x6c , 0x6c , 0x44 , 0x65 , 0x70 , 0x65 , 0x6e , 0x64 , 0x65 , 0x6e , 0x63 , 0x69 , 0x65 , 0x73 , 0x52 ,
0x65 , 0x71 , 0x75 , 0x65 , 0x73 , 0x74 , 0x12 , 0x20 , 0x0a , 0x09 , 0x64 , 0x69 , 0x72 , 0x65 , 0x63 , 0x74 ,
0x6f , 0x72 , 0x79 , 0x18 , 0x01 , 0x20 , 0x01 , 0x28 , 0x09 , 0x42 , 0x02 , 0x18 , 0x01 , 0x52 , 0x09 , 0x64 ,
0x69 , 0x72 , 0x65 , 0x63 , 0x74 , 0x6f , 0x72 , 0x79 , 0x12 , 0x1f , 0x0a , 0x0b , 0x69 , 0x73 , 0x5f , 0x74 ,
0x65 , 0x72 , 0x6d , 0x69 , 0x6e , 0x61 , 0x6c , 0x18 , 0x02 , 0x20 , 0x01 , 0x28 , 0x08 , 0x52 , 0x0a , 0x69 ,
0x73 , 0x54 , 0x65 , 0x72 , 0x6d , 0x69 , 0x6e , 0x61 , 0x6c , 0x12 , 0x2a , 0x0a , 0x04 , 0x69 , 0x6e , 0x66 ,
0x6f , 0x18 , 0x03 , 0x20 , 0x01 , 0x28 , 0x0b , 0x32 , 0x16 , 0x2e , 0x70 , 0x75 , 0x6c , 0x75 , 0x6d , 0x69 ,
0x72 , 0x70 , 0x63 , 0x2e , 0x50 , 0x72 , 0x6f , 0x67 , 0x72 , 0x61 , 0x6d , 0x49 , 0x6e , 0x66 , 0x6f , 0x52 ,
0x04 , 0x69 , 0x6e , 0x66 , 0x6f , 0x22 , 0x4d , 0x0a , 0x1b , 0x49 , 0x6e , 0x73 , 0x74 , 0x61 , 0x6c , 0x6c ,
0x44 , 0x65 , 0x70 , 0x65 , 0x6e , 0x64 , 0x65 , 0x6e , 0x63 , 0x69 , 0x65 , 0x73 , 0x52 , 0x65 , 0x73 , 0x70 ,
0x6f , 0x6e , 0x73 , 0x65 , 0x12 , 0x16 , 0x0a , 0x06 , 0x73 , 0x74 , 0x64 , 0x6f , 0x75 , 0x74 , 0x18 , 0x01 ,
0x20 , 0x01 , 0x28 , 0x0c , 0x52 , 0x06 , 0x73 , 0x74 , 0x64 , 0x6f , 0x75 , 0x74 , 0x12 , 0x16 , 0x0a , 0x06 ,
0x73 , 0x74 , 0x64 , 0x65 , 0x72 , 0x72 , 0x18 , 0x02 , 0x20 , 0x01 , 0x28 , 0x0c , 0x52 , 0x06 , 0x73 , 0x74 ,
2024-06-17 17:10:55 +00:00
0x64 , 0x65 , 0x72 , 0x72 , 0x22 , 0x43 , 0x0a , 0x15 , 0x52 , 0x75 , 0x6e , 0x74 , 0x69 , 0x6d , 0x65 , 0x4f ,
0x70 , 0x74 , 0x69 , 0x6f , 0x6e , 0x73 , 0x52 , 0x65 , 0x71 , 0x75 , 0x65 , 0x73 , 0x74 , 0x12 , 0x2a , 0x0a ,
0x04 , 0x69 , 0x6e , 0x66 , 0x6f , 0x18 , 0x01 , 0x20 , 0x01 , 0x28 , 0x0b , 0x32 , 0x16 , 0x2e , 0x70 , 0x75 ,
0x6c , 0x75 , 0x6d , 0x69 , 0x72 , 0x70 , 0x63 , 0x2e , 0x50 , 0x72 , 0x6f , 0x67 , 0x72 , 0x61 , 0x6d , 0x49 ,
2024-06-28 23:21:55 +00:00
0x6e , 0x66 , 0x6f , 0x52 , 0x04 , 0x69 , 0x6e , 0x66 , 0x6f , 0x22 , 0xae , 0x04 , 0x0a , 0x13 , 0x52 , 0x75 ,
2024-06-17 17:10:55 +00:00
0x6e , 0x74 , 0x69 , 0x6d , 0x65 , 0x4f , 0x70 , 0x74 , 0x69 , 0x6f , 0x6e , 0x50 , 0x72 , 0x6f , 0x6d , 0x70 ,
0x74 , 0x12 , 0x10 , 0x0a , 0x03 , 0x6b , 0x65 , 0x79 , 0x18 , 0x01 , 0x20 , 0x01 , 0x28 , 0x09 , 0x52 , 0x03 ,
0x6b , 0x65 , 0x79 , 0x12 , 0x20 , 0x0a , 0x0b , 0x64 , 0x65 , 0x73 , 0x63 , 0x72 , 0x69 , 0x70 , 0x74 , 0x69 ,
0x6f , 0x6e , 0x18 , 0x02 , 0x20 , 0x01 , 0x28 , 0x09 , 0x52 , 0x0b , 0x64 , 0x65 , 0x73 , 0x63 , 0x72 , 0x69 ,
0x70 , 0x74 , 0x69 , 0x6f , 0x6e , 0x12 , 0x50 , 0x0a , 0x0a , 0x70 , 0x72 , 0x6f , 0x6d , 0x70 , 0x74 , 0x54 ,
0x79 , 0x70 , 0x65 , 0x18 , 0x03 , 0x20 , 0x01 , 0x28 , 0x0e , 0x32 , 0x30 , 0x2e , 0x70 , 0x75 , 0x6c , 0x75 ,
0x6d , 0x69 , 0x72 , 0x70 , 0x63 , 0x2e , 0x52 , 0x75 , 0x6e , 0x74 , 0x69 , 0x6d , 0x65 , 0x4f , 0x70 , 0x74 ,
0x69 , 0x6f , 0x6e , 0x50 , 0x72 , 0x6f , 0x6d , 0x70 , 0x74 , 0x2e , 0x52 , 0x75 , 0x6e , 0x74 , 0x69 , 0x6d ,
0x65 , 0x4f , 0x70 , 0x74 , 0x69 , 0x6f , 0x6e , 0x54 , 0x79 , 0x70 , 0x65 , 0x52 , 0x0a , 0x70 , 0x72 , 0x6f ,
0x6d , 0x70 , 0x74 , 0x54 , 0x79 , 0x70 , 0x65 , 0x12 , 0x4b , 0x0a , 0x07 , 0x63 , 0x68 , 0x6f , 0x69 , 0x63 ,
0x65 , 0x73 , 0x18 , 0x04 , 0x20 , 0x03 , 0x28 , 0x0b , 0x32 , 0x31 , 0x2e , 0x70 , 0x75 , 0x6c , 0x75 , 0x6d ,
0x69 , 0x72 , 0x70 , 0x63 , 0x2e , 0x52 , 0x75 , 0x6e , 0x74 , 0x69 , 0x6d , 0x65 , 0x4f , 0x70 , 0x74 , 0x69 ,
0x6f , 0x6e , 0x50 , 0x72 , 0x6f , 0x6d , 0x70 , 0x74 , 0x2e , 0x52 , 0x75 , 0x6e , 0x74 , 0x69 , 0x6d , 0x65 ,
0x4f , 0x70 , 0x74 , 0x69 , 0x6f , 0x6e , 0x56 , 0x61 , 0x6c , 0x75 , 0x65 , 0x52 , 0x07 , 0x63 , 0x68 , 0x6f ,
0x69 , 0x63 , 0x65 , 0x73 , 0x12 , 0x4b , 0x0a , 0x07 , 0x64 , 0x65 , 0x66 , 0x61 , 0x75 , 0x6c , 0x74 , 0x18 ,
0x05 , 0x20 , 0x01 , 0x28 , 0x0b , 0x32 , 0x31 , 0x2e , 0x70 , 0x75 , 0x6c , 0x75 , 0x6d , 0x69 , 0x72 , 0x70 ,
0x63 , 0x2e , 0x52 , 0x75 , 0x6e , 0x74 , 0x69 , 0x6d , 0x65 , 0x4f , 0x70 , 0x74 , 0x69 , 0x6f , 0x6e , 0x50 ,
0x72 , 0x6f , 0x6d , 0x70 , 0x74 , 0x2e , 0x52 , 0x75 , 0x6e , 0x74 , 0x69 , 0x6d , 0x65 , 0x4f , 0x70 , 0x74 ,
0x69 , 0x6f , 0x6e , 0x56 , 0x61 , 0x6c , 0x75 , 0x65 , 0x52 , 0x07 , 0x64 , 0x65 , 0x66 , 0x61 , 0x75 , 0x6c ,
2024-06-28 23:21:55 +00:00
0x74 , 0x1a , 0xca , 0x01 , 0x0a , 0x12 , 0x52 , 0x75 , 0x6e , 0x74 , 0x69 , 0x6d , 0x65 , 0x4f , 0x70 , 0x74 ,
2024-06-17 17:10:55 +00:00
0x69 , 0x6f , 0x6e , 0x56 , 0x61 , 0x6c , 0x75 , 0x65 , 0x12 , 0x50 , 0x0a , 0x0a , 0x70 , 0x72 , 0x6f , 0x6d ,
0x70 , 0x74 , 0x54 , 0x79 , 0x70 , 0x65 , 0x18 , 0x01 , 0x20 , 0x01 , 0x28 , 0x0e , 0x32 , 0x30 , 0x2e , 0x70 ,
0x75 , 0x6c , 0x75 , 0x6d , 0x69 , 0x72 , 0x70 , 0x63 , 0x2e , 0x52 , 0x75 , 0x6e , 0x74 , 0x69 , 0x6d , 0x65 ,
0x4f , 0x70 , 0x74 , 0x69 , 0x6f , 0x6e , 0x50 , 0x72 , 0x6f , 0x6d , 0x70 , 0x74 , 0x2e , 0x52 , 0x75 , 0x6e ,
0x74 , 0x69 , 0x6d , 0x65 , 0x4f , 0x70 , 0x74 , 0x69 , 0x6f , 0x6e , 0x54 , 0x79 , 0x70 , 0x65 , 0x52 , 0x0a ,
0x70 , 0x72 , 0x6f , 0x6d , 0x70 , 0x74 , 0x54 , 0x79 , 0x70 , 0x65 , 0x12 , 0x20 , 0x0a , 0x0b , 0x73 , 0x74 ,
0x72 , 0x69 , 0x6e , 0x67 , 0x56 , 0x61 , 0x6c , 0x75 , 0x65 , 0x18 , 0x02 , 0x20 , 0x01 , 0x28 , 0x09 , 0x52 ,
0x0b , 0x73 , 0x74 , 0x72 , 0x69 , 0x6e , 0x67 , 0x56 , 0x61 , 0x6c , 0x75 , 0x65 , 0x12 , 0x1e , 0x0a , 0x0a ,
0x69 , 0x6e , 0x74 , 0x33 , 0x32 , 0x56 , 0x61 , 0x6c , 0x75 , 0x65 , 0x18 , 0x03 , 0x20 , 0x01 , 0x28 , 0x05 ,
2024-06-28 23:21:55 +00:00
0x52 , 0x0a , 0x69 , 0x6e , 0x74 , 0x33 , 0x32 , 0x56 , 0x61 , 0x6c , 0x75 , 0x65 , 0x12 , 0x20 , 0x0a , 0x0b ,
0x64 , 0x69 , 0x73 , 0x70 , 0x6c , 0x61 , 0x79 , 0x4e , 0x61 , 0x6d , 0x65 , 0x18 , 0x04 , 0x20 , 0x01 , 0x28 ,
0x09 , 0x52 , 0x0b , 0x64 , 0x69 , 0x73 , 0x70 , 0x6c , 0x61 , 0x79 , 0x4e , 0x61 , 0x6d , 0x65 , 0x22 , 0x2a ,
0x0a , 0x11 , 0x52 , 0x75 , 0x6e , 0x74 , 0x69 , 0x6d , 0x65 , 0x4f , 0x70 , 0x74 , 0x69 , 0x6f , 0x6e , 0x54 ,
0x79 , 0x70 , 0x65 , 0x12 , 0x0a , 0x0a , 0x06 , 0x53 , 0x54 , 0x52 , 0x49 , 0x4e , 0x47 , 0x10 , 0x00 , 0x12 ,
0x09 , 0x0a , 0x05 , 0x49 , 0x4e , 0x54 , 0x33 , 0x32 , 0x10 , 0x01 , 0x22 , 0x52 , 0x0a , 0x16 , 0x52 , 0x75 ,
0x6e , 0x74 , 0x69 , 0x6d , 0x65 , 0x4f , 0x70 , 0x74 , 0x69 , 0x6f , 0x6e , 0x73 , 0x52 , 0x65 , 0x73 , 0x70 ,
0x6f , 0x6e , 0x73 , 0x65 , 0x12 , 0x38 , 0x0a , 0x07 , 0x70 , 0x72 , 0x6f , 0x6d , 0x70 , 0x74 , 0x73 , 0x18 ,
0x01 , 0x20 , 0x03 , 0x28 , 0x0b , 0x32 , 0x1e , 0x2e , 0x70 , 0x75 , 0x6c , 0x75 , 0x6d , 0x69 , 0x72 , 0x70 ,
0x63 , 0x2e , 0x52 , 0x75 , 0x6e , 0x74 , 0x69 , 0x6d , 0x65 , 0x4f , 0x70 , 0x74 , 0x69 , 0x6f , 0x6e , 0x50 ,
0x72 , 0x6f , 0x6d , 0x70 , 0x74 , 0x52 , 0x07 , 0x70 , 0x72 , 0x6f , 0x6d , 0x70 , 0x74 , 0x73 , 0x22 , 0x94 ,
0x01 , 0x0a , 0x10 , 0x52 , 0x75 , 0x6e , 0x50 , 0x6c , 0x75 , 0x67 , 0x69 , 0x6e , 0x52 , 0x65 , 0x71 , 0x75 ,
0x65 , 0x73 , 0x74 , 0x12 , 0x10 , 0x0a , 0x03 , 0x70 , 0x77 , 0x64 , 0x18 , 0x01 , 0x20 , 0x01 , 0x28 , 0x09 ,
0x52 , 0x03 , 0x70 , 0x77 , 0x64 , 0x12 , 0x1c , 0x0a , 0x07 , 0x70 , 0x72 , 0x6f , 0x67 , 0x72 , 0x61 , 0x6d ,
0x18 , 0x02 , 0x20 , 0x01 , 0x28 , 0x09 , 0x42 , 0x02 , 0x18 , 0x01 , 0x52 , 0x07 , 0x70 , 0x72 , 0x6f , 0x67 ,
0x72 , 0x61 , 0x6d , 0x12 , 0x12 , 0x0a , 0x04 , 0x61 , 0x72 , 0x67 , 0x73 , 0x18 , 0x03 , 0x20 , 0x03 , 0x28 ,
0x09 , 0x52 , 0x04 , 0x61 , 0x72 , 0x67 , 0x73 , 0x12 , 0x10 , 0x0a , 0x03 , 0x65 , 0x6e , 0x76 , 0x18 , 0x04 ,
0x20 , 0x03 , 0x28 , 0x09 , 0x52 , 0x03 , 0x65 , 0x6e , 0x76 , 0x12 , 0x2a , 0x0a , 0x04 , 0x69 , 0x6e , 0x66 ,
0x6f , 0x18 , 0x05 , 0x20 , 0x01 , 0x28 , 0x0b , 0x32 , 0x16 , 0x2e , 0x70 , 0x75 , 0x6c , 0x75 , 0x6d , 0x69 ,
0x72 , 0x70 , 0x63 , 0x2e , 0x50 , 0x72 , 0x6f , 0x67 , 0x72 , 0x61 , 0x6d , 0x49 , 0x6e , 0x66 , 0x6f , 0x52 ,
0x04 , 0x69 , 0x6e , 0x66 , 0x6f , 0x22 , 0x6f , 0x0a , 0x11 , 0x52 , 0x75 , 0x6e , 0x50 , 0x6c , 0x75 , 0x67 ,
0x69 , 0x6e , 0x52 , 0x65 , 0x73 , 0x70 , 0x6f , 0x6e , 0x73 , 0x65 , 0x12 , 0x18 , 0x0a , 0x06 , 0x73 , 0x74 ,
0x64 , 0x6f , 0x75 , 0x74 , 0x18 , 0x01 , 0x20 , 0x01 , 0x28 , 0x0c , 0x48 , 0x00 , 0x52 , 0x06 , 0x73 , 0x74 ,
0x64 , 0x6f , 0x75 , 0x74 , 0x12 , 0x18 , 0x0a , 0x06 , 0x73 , 0x74 , 0x64 , 0x65 , 0x72 , 0x72 , 0x18 , 0x02 ,
0x20 , 0x01 , 0x28 , 0x0c , 0x48 , 0x00 , 0x52 , 0x06 , 0x73 , 0x74 , 0x64 , 0x65 , 0x72 , 0x72 , 0x12 , 0x1c ,
0x0a , 0x08 , 0x65 , 0x78 , 0x69 , 0x74 , 0x63 , 0x6f , 0x64 , 0x65 , 0x18 , 0x03 , 0x20 , 0x01 , 0x28 , 0x05 ,
0x48 , 0x00 , 0x52 , 0x08 , 0x65 , 0x78 , 0x69 , 0x74 , 0x63 , 0x6f , 0x64 , 0x65 , 0x42 , 0x08 , 0x0a , 0x06 ,
[cli/import] Fix undefined variable errors in code generation when imported resources use a parent or provider (#16786)
Fixes #15410 Fixes #13339
## Problem Context
When using `pulumi import` we generate code snippets for the resources
that were imported. Sometimes the user specifies `--parent
parentName=URN` or `--provider providerName=URN` which tweak the parent
or provider that the imported resources uses. When using `--parent` or
`--provider` the generated code emits a resource option `parent =
parentName` (in case of using `--parent`) where `parentName` is an
unbound variable.
Usually unbound variables would result in a _bind_ error such as `error:
undefined variable parentName` when type-checking the program however in
the import code generation we specify the bind option
`pcl.AllowMissingVariables` which turns that unbound variable errors
into warnings and code generation can continue to emit code.
This is all good and works as expected. However in the issues linked
above, we do get an _error_ for unbound variables in generated code even
though we specified `AllowMissingVariables`.
The problem as it turns out is when we are trying to generate code via
dynamically loaded `LangaugeRuntime` plugins. Specifically for NodeJS
and Python, we load `pulumi-language-nodejs` or `pulumi-language-python`
and call `GenerateProgram` to get the generated program. That function
`GenerateProgram` takes the text _SOURCE_ of the a bound program (one
that was bound using option `AllowMissingVariables`) and re-binds again
inside the implementation of the language plugin. The second time we
bind the program, we don't pass it the option `AllowMissingVariables`
and so it fails with `unboud variable` error.
I've verified that the issue above don't repro when doing an import for
dotnet (probably same for java/yaml) because we use the statically
linked function `codegen/{lang}/gen_program.go -> GenerateProgram`
## Solution
The problem can be solved by propagating the bind options from the CLI
to the language hosts during import so that they know how to bind the
program. I've extended the gRPC interface in `GenerateProgramRequest`
with a property `Strict` which follows the same logic from `pulumi
convert --strict` and made it such that the import command sends
`strict=false` to the language plugins when doing `GenerateProgram`.
This is consistent with `GenerateProject` that uses the same flag. When
`strict=false` we use `pcl.NonStrictBindOptions()` which includes
`AllowMissingVariables` .
## Repro
Once can test the before and after behaviour by running `pulumi up
--yes` on the following TypeScript program:
```ts
import * as pulumi from "@pulumi/pulumi";
import * as random from "@pulumi/random";
export class MyComponent extends pulumi.ComponentResource {
public readonly randomPetId: pulumi.Output<string>;
constructor(name: string, opts?: pulumi.ComponentResourceOptions) {
super("example:index:MyComponent", name, {}, opts);
const randomPet = new random.RandomPet("randomPet", {}, {
parent: this
});
this.randomPetId = randomPet.id;
this.registerOutputs({
randomPetId: randomPet.id,
});
}
}
const example = new MyComponent("example");
export const randomPetId = example.randomPetId;
```
Then running `pulumi import -f import.json` where `import.json` contains
a resource to be imported under the created component (stack=`dev`,
project=`importerrors`)
```ts
{
"nameTable": {
"parentComponent": "urn:pulumi:dev::importerrors::example:index:MyComponent::example"
},
"resources": [
{
"type": "random:index/randomPassword:RandomPassword",
"name": "randomPassword",
"id": "supersecret",
"parent": "parentComponent"
}
]
}
```
Running this locally I get the following generated code (which
previously failed to generate)
```ts
import * as pulumi from "@pulumi/pulumi";
import * as random from "@pulumi/random";
const randomPassword = new random.RandomPassword("randomPassword", {
length: 11,
lower: true,
number: true,
numeric: true,
special: true,
upper: true,
}, {
parent: parentComponent,
});
```
2024-07-25 13:53:44 +00:00
0x6f , 0x75 , 0x74 , 0x70 , 0x75 , 0x74 , 0x22 , 0xd7 , 0x01 , 0x0a , 0x16 , 0x47 , 0x65 , 0x6e , 0x65 , 0x72 ,
2024-06-28 23:21:55 +00:00
0x61 , 0x74 , 0x65 , 0x50 , 0x72 , 0x6f , 0x67 , 0x72 , 0x61 , 0x6d , 0x52 , 0x65 , 0x71 , 0x75 , 0x65 , 0x73 ,
0x74 , 0x12 , 0x45 , 0x0a , 0x06 , 0x73 , 0x6f , 0x75 , 0x72 , 0x63 , 0x65 , 0x18 , 0x01 , 0x20 , 0x03 , 0x28 ,
0x0b , 0x32 , 0x2d , 0x2e , 0x70 , 0x75 , 0x6c , 0x75 , 0x6d , 0x69 , 0x72 , 0x70 , 0x63 , 0x2e , 0x47 , 0x65 ,
0x6e , 0x65 , 0x72 , 0x61 , 0x74 , 0x65 , 0x50 , 0x72 , 0x6f , 0x67 , 0x72 , 0x61 , 0x6d , 0x52 , 0x65 , 0x71 ,
0x75 , 0x65 , 0x73 , 0x74 , 0x2e , 0x53 , 0x6f , 0x75 , 0x72 , 0x63 , 0x65 , 0x45 , 0x6e , 0x74 , 0x72 , 0x79 ,
0x52 , 0x06 , 0x73 , 0x6f , 0x75 , 0x72 , 0x63 , 0x65 , 0x12 , 0x23 , 0x0a , 0x0d , 0x6c , 0x6f , 0x61 , 0x64 ,
0x65 , 0x72 , 0x5f , 0x74 , 0x61 , 0x72 , 0x67 , 0x65 , 0x74 , 0x18 , 0x02 , 0x20 , 0x01 , 0x28 , 0x09 , 0x52 ,
[cli/import] Fix undefined variable errors in code generation when imported resources use a parent or provider (#16786)
Fixes #15410 Fixes #13339
## Problem Context
When using `pulumi import` we generate code snippets for the resources
that were imported. Sometimes the user specifies `--parent
parentName=URN` or `--provider providerName=URN` which tweak the parent
or provider that the imported resources uses. When using `--parent` or
`--provider` the generated code emits a resource option `parent =
parentName` (in case of using `--parent`) where `parentName` is an
unbound variable.
Usually unbound variables would result in a _bind_ error such as `error:
undefined variable parentName` when type-checking the program however in
the import code generation we specify the bind option
`pcl.AllowMissingVariables` which turns that unbound variable errors
into warnings and code generation can continue to emit code.
This is all good and works as expected. However in the issues linked
above, we do get an _error_ for unbound variables in generated code even
though we specified `AllowMissingVariables`.
The problem as it turns out is when we are trying to generate code via
dynamically loaded `LangaugeRuntime` plugins. Specifically for NodeJS
and Python, we load `pulumi-language-nodejs` or `pulumi-language-python`
and call `GenerateProgram` to get the generated program. That function
`GenerateProgram` takes the text _SOURCE_ of the a bound program (one
that was bound using option `AllowMissingVariables`) and re-binds again
inside the implementation of the language plugin. The second time we
bind the program, we don't pass it the option `AllowMissingVariables`
and so it fails with `unboud variable` error.
I've verified that the issue above don't repro when doing an import for
dotnet (probably same for java/yaml) because we use the statically
linked function `codegen/{lang}/gen_program.go -> GenerateProgram`
## Solution
The problem can be solved by propagating the bind options from the CLI
to the language hosts during import so that they know how to bind the
program. I've extended the gRPC interface in `GenerateProgramRequest`
with a property `Strict` which follows the same logic from `pulumi
convert --strict` and made it such that the import command sends
`strict=false` to the language plugins when doing `GenerateProgram`.
This is consistent with `GenerateProject` that uses the same flag. When
`strict=false` we use `pcl.NonStrictBindOptions()` which includes
`AllowMissingVariables` .
## Repro
Once can test the before and after behaviour by running `pulumi up
--yes` on the following TypeScript program:
```ts
import * as pulumi from "@pulumi/pulumi";
import * as random from "@pulumi/random";
export class MyComponent extends pulumi.ComponentResource {
public readonly randomPetId: pulumi.Output<string>;
constructor(name: string, opts?: pulumi.ComponentResourceOptions) {
super("example:index:MyComponent", name, {}, opts);
const randomPet = new random.RandomPet("randomPet", {}, {
parent: this
});
this.randomPetId = randomPet.id;
this.registerOutputs({
randomPetId: randomPet.id,
});
}
}
const example = new MyComponent("example");
export const randomPetId = example.randomPetId;
```
Then running `pulumi import -f import.json` where `import.json` contains
a resource to be imported under the created component (stack=`dev`,
project=`importerrors`)
```ts
{
"nameTable": {
"parentComponent": "urn:pulumi:dev::importerrors::example:index:MyComponent::example"
},
"resources": [
{
"type": "random:index/randomPassword:RandomPassword",
"name": "randomPassword",
"id": "supersecret",
"parent": "parentComponent"
}
]
}
```
Running this locally I get the following generated code (which
previously failed to generate)
```ts
import * as pulumi from "@pulumi/pulumi";
import * as random from "@pulumi/random";
const randomPassword = new random.RandomPassword("randomPassword", {
length: 11,
lower: true,
number: true,
numeric: true,
special: true,
upper: true,
}, {
parent: parentComponent,
});
```
2024-07-25 13:53:44 +00:00
0x0c , 0x6c , 0x6f , 0x61 , 0x64 , 0x65 , 0x72 , 0x54 , 0x61 , 0x72 , 0x67 , 0x65 , 0x74 , 0x12 , 0x16 , 0x0a ,
0x06 , 0x73 , 0x74 , 0x72 , 0x69 , 0x63 , 0x74 , 0x18 , 0x03 , 0x20 , 0x01 , 0x28 , 0x08 , 0x52 , 0x06 , 0x73 ,
0x74 , 0x72 , 0x69 , 0x63 , 0x74 , 0x1a , 0x39 , 0x0a , 0x0b , 0x53 , 0x6f , 0x75 , 0x72 , 0x63 , 0x65 , 0x45 ,
0x6e , 0x74 , 0x72 , 0x79 , 0x12 , 0x10 , 0x0a , 0x03 , 0x6b , 0x65 , 0x79 , 0x18 , 0x01 , 0x20 , 0x01 , 0x28 ,
0x09 , 0x52 , 0x03 , 0x6b , 0x65 , 0x79 , 0x12 , 0x14 , 0x0a , 0x05 , 0x76 , 0x61 , 0x6c , 0x75 , 0x65 , 0x18 ,
0x02 , 0x20 , 0x01 , 0x28 , 0x09 , 0x52 , 0x05 , 0x76 , 0x61 , 0x6c , 0x75 , 0x65 , 0x3a , 0x02 , 0x38 , 0x01 ,
0x22 , 0xdd , 0x01 , 0x0a , 0x17 , 0x47 , 0x65 , 0x6e , 0x65 , 0x72 , 0x61 , 0x74 , 0x65 , 0x50 , 0x72 , 0x6f ,
0x67 , 0x72 , 0x61 , 0x6d , 0x52 , 0x65 , 0x73 , 0x70 , 0x6f , 0x6e , 0x73 , 0x65 , 0x12 , 0x3f , 0x0a , 0x0b ,
0x64 , 0x69 , 0x61 , 0x67 , 0x6e , 0x6f , 0x73 , 0x74 , 0x69 , 0x63 , 0x73 , 0x18 , 0x01 , 0x20 , 0x03 , 0x28 ,
0x0b , 0x32 , 0x1d , 0x2e , 0x70 , 0x75 , 0x6c , 0x75 , 0x6d , 0x69 , 0x72 , 0x70 , 0x63 , 0x2e , 0x63 , 0x6f ,
0x64 , 0x65 , 0x67 , 0x65 , 0x6e , 0x2e , 0x44 , 0x69 , 0x61 , 0x67 , 0x6e , 0x6f , 0x73 , 0x74 , 0x69 , 0x63 ,
0x52 , 0x0b , 0x64 , 0x69 , 0x61 , 0x67 , 0x6e , 0x6f , 0x73 , 0x74 , 0x69 , 0x63 , 0x73 , 0x12 , 0x46 , 0x0a ,
0x06 , 0x73 , 0x6f , 0x75 , 0x72 , 0x63 , 0x65 , 0x18 , 0x02 , 0x20 , 0x03 , 0x28 , 0x0b , 0x32 , 0x2e , 0x2e ,
0x70 , 0x75 , 0x6c , 0x75 , 0x6d , 0x69 , 0x72 , 0x70 , 0x63 , 0x2e , 0x47 , 0x65 , 0x6e , 0x65 , 0x72 , 0x61 ,
0x74 , 0x65 , 0x50 , 0x72 , 0x6f , 0x67 , 0x72 , 0x61 , 0x6d , 0x52 , 0x65 , 0x73 , 0x70 , 0x6f , 0x6e , 0x73 ,
0x65 , 0x2e , 0x53 , 0x6f , 0x75 , 0x72 , 0x63 , 0x65 , 0x45 , 0x6e , 0x74 , 0x72 , 0x79 , 0x52 , 0x06 , 0x73 ,
0x6f , 0x75 , 0x72 , 0x63 , 0x65 , 0x1a , 0x39 , 0x0a , 0x0b , 0x53 , 0x6f , 0x75 , 0x72 , 0x63 , 0x65 , 0x45 ,
0x6e , 0x74 , 0x72 , 0x79 , 0x12 , 0x10 , 0x0a , 0x03 , 0x6b , 0x65 , 0x79 , 0x18 , 0x01 , 0x20 , 0x01 , 0x28 ,
0x09 , 0x52 , 0x03 , 0x6b , 0x65 , 0x79 , 0x12 , 0x14 , 0x0a , 0x05 , 0x76 , 0x61 , 0x6c , 0x75 , 0x65 , 0x18 ,
0x02 , 0x20 , 0x01 , 0x28 , 0x0c , 0x52 , 0x05 , 0x76 , 0x61 , 0x6c , 0x75 , 0x65 , 0x3a , 0x02 , 0x38 , 0x01 ,
0x22 , 0xf4 , 0x02 , 0x0a , 0x16 , 0x47 , 0x65 , 0x6e , 0x65 , 0x72 , 0x61 , 0x74 , 0x65 , 0x50 , 0x72 , 0x6f ,
0x6a , 0x65 , 0x63 , 0x74 , 0x52 , 0x65 , 0x71 , 0x75 , 0x65 , 0x73 , 0x74 , 0x12 , 0x29 , 0x0a , 0x10 , 0x73 ,
0x6f , 0x75 , 0x72 , 0x63 , 0x65 , 0x5f , 0x64 , 0x69 , 0x72 , 0x65 , 0x63 , 0x74 , 0x6f , 0x72 , 0x79 , 0x18 ,
0x01 , 0x20 , 0x01 , 0x28 , 0x09 , 0x52 , 0x0f , 0x73 , 0x6f , 0x75 , 0x72 , 0x63 , 0x65 , 0x44 , 0x69 , 0x72 ,
0x65 , 0x63 , 0x74 , 0x6f , 0x72 , 0x79 , 0x12 , 0x29 , 0x0a , 0x10 , 0x74 , 0x61 , 0x72 , 0x67 , 0x65 , 0x74 ,
0x5f , 0x64 , 0x69 , 0x72 , 0x65 , 0x63 , 0x74 , 0x6f , 0x72 , 0x79 , 0x18 , 0x02 , 0x20 , 0x01 , 0x28 , 0x09 ,
0x52 , 0x0f , 0x74 , 0x61 , 0x72 , 0x67 , 0x65 , 0x74 , 0x44 , 0x69 , 0x72 , 0x65 , 0x63 , 0x74 , 0x6f , 0x72 ,
0x79 , 0x12 , 0x18 , 0x0a , 0x07 , 0x70 , 0x72 , 0x6f , 0x6a , 0x65 , 0x63 , 0x74 , 0x18 , 0x03 , 0x20 , 0x01 ,
0x28 , 0x09 , 0x52 , 0x07 , 0x70 , 0x72 , 0x6f , 0x6a , 0x65 , 0x63 , 0x74 , 0x12 , 0x16 , 0x0a , 0x06 , 0x73 ,
0x74 , 0x72 , 0x69 , 0x63 , 0x74 , 0x18 , 0x04 , 0x20 , 0x01 , 0x28 , 0x08 , 0x52 , 0x06 , 0x73 , 0x74 , 0x72 ,
0x69 , 0x63 , 0x74 , 0x12 , 0x23 , 0x0a , 0x0d , 0x6c , 0x6f , 0x61 , 0x64 , 0x65 , 0x72 , 0x5f , 0x74 , 0x61 ,
0x72 , 0x67 , 0x65 , 0x74 , 0x18 , 0x05 , 0x20 , 0x01 , 0x28 , 0x09 , 0x52 , 0x0c , 0x6c , 0x6f , 0x61 , 0x64 ,
0x65 , 0x72 , 0x54 , 0x61 , 0x72 , 0x67 , 0x65 , 0x74 , 0x12 , 0x67 , 0x0a , 0x12 , 0x6c , 0x6f , 0x63 , 0x61 ,
0x6c , 0x5f , 0x64 , 0x65 , 0x70 , 0x65 , 0x6e , 0x64 , 0x65 , 0x6e , 0x63 , 0x69 , 0x65 , 0x73 , 0x18 , 0x06 ,
0x20 , 0x03 , 0x28 , 0x0b , 0x32 , 0x38 , 0x2e , 0x70 , 0x75 , 0x6c , 0x75 , 0x6d , 0x69 , 0x72 , 0x70 , 0x63 ,
0x2e , 0x47 , 0x65 , 0x6e , 0x65 , 0x72 , 0x61 , 0x74 , 0x65 , 0x50 , 0x72 , 0x6f , 0x6a , 0x65 , 0x63 , 0x74 ,
0x52 , 0x65 , 0x71 , 0x75 , 0x65 , 0x73 , 0x74 , 0x2e , 0x4c , 0x6f , 0x63 , 0x61 , 0x6c , 0x44 , 0x65 , 0x70 ,
0x65 , 0x6e , 0x64 , 0x65 , 0x6e , 0x63 , 0x69 , 0x65 , 0x73 , 0x45 , 0x6e , 0x74 , 0x72 , 0x79 , 0x52 , 0x11 ,
0x6c , 0x6f , 0x63 , 0x61 , 0x6c , 0x44 , 0x65 , 0x70 , 0x65 , 0x6e , 0x64 , 0x65 , 0x6e , 0x63 , 0x69 , 0x65 ,
0x73 , 0x1a , 0x44 , 0x0a , 0x16 , 0x4c , 0x6f , 0x63 , 0x61 , 0x6c , 0x44 , 0x65 , 0x70 , 0x65 , 0x6e , 0x64 ,
0x65 , 0x6e , 0x63 , 0x69 , 0x65 , 0x73 , 0x45 , 0x6e , 0x74 , 0x72 , 0x79 , 0x12 , 0x10 , 0x0a , 0x03 , 0x6b ,
0x65 , 0x79 , 0x18 , 0x01 , 0x20 , 0x01 , 0x28 , 0x09 , 0x52 , 0x03 , 0x6b , 0x65 , 0x79 , 0x12 , 0x14 , 0x0a ,
0x05 , 0x76 , 0x61 , 0x6c , 0x75 , 0x65 , 0x18 , 0x02 , 0x20 , 0x01 , 0x28 , 0x09 , 0x52 , 0x05 , 0x76 , 0x61 ,
0x6c , 0x75 , 0x65 , 0x3a , 0x02 , 0x38 , 0x01 , 0x22 , 0x5a , 0x0a , 0x17 , 0x47 , 0x65 , 0x6e , 0x65 , 0x72 ,
0x61 , 0x74 , 0x65 , 0x50 , 0x72 , 0x6f , 0x6a , 0x65 , 0x63 , 0x74 , 0x52 , 0x65 , 0x73 , 0x70 , 0x6f , 0x6e ,
0x73 , 0x65 , 0x12 , 0x3f , 0x0a , 0x0b , 0x64 , 0x69 , 0x61 , 0x67 , 0x6e , 0x6f , 0x73 , 0x74 , 0x69 , 0x63 ,
0x73 , 0x18 , 0x01 , 0x20 , 0x03 , 0x28 , 0x0b , 0x32 , 0x1d , 0x2e , 0x70 , 0x75 , 0x6c , 0x75 , 0x6d , 0x69 ,
0x72 , 0x70 , 0x63 , 0x2e , 0x63 , 0x6f , 0x64 , 0x65 , 0x67 , 0x65 , 0x6e , 0x2e , 0x44 , 0x69 , 0x61 , 0x67 ,
0x6e , 0x6f , 0x73 , 0x74 , 0x69 , 0x63 , 0x52 , 0x0b , 0x64 , 0x69 , 0x61 , 0x67 , 0x6e , 0x6f , 0x73 , 0x74 ,
2024-08-07 08:16:37 +00:00
0x69 , 0x63 , 0x73 , 0x22 , 0xcb , 0x03 , 0x0a , 0x16 , 0x47 , 0x65 , 0x6e , 0x65 , 0x72 , 0x61 , 0x74 , 0x65 ,
[cli/import] Fix undefined variable errors in code generation when imported resources use a parent or provider (#16786)
Fixes #15410 Fixes #13339
## Problem Context
When using `pulumi import` we generate code snippets for the resources
that were imported. Sometimes the user specifies `--parent
parentName=URN` or `--provider providerName=URN` which tweak the parent
or provider that the imported resources uses. When using `--parent` or
`--provider` the generated code emits a resource option `parent =
parentName` (in case of using `--parent`) where `parentName` is an
unbound variable.
Usually unbound variables would result in a _bind_ error such as `error:
undefined variable parentName` when type-checking the program however in
the import code generation we specify the bind option
`pcl.AllowMissingVariables` which turns that unbound variable errors
into warnings and code generation can continue to emit code.
This is all good and works as expected. However in the issues linked
above, we do get an _error_ for unbound variables in generated code even
though we specified `AllowMissingVariables`.
The problem as it turns out is when we are trying to generate code via
dynamically loaded `LangaugeRuntime` plugins. Specifically for NodeJS
and Python, we load `pulumi-language-nodejs` or `pulumi-language-python`
and call `GenerateProgram` to get the generated program. That function
`GenerateProgram` takes the text _SOURCE_ of the a bound program (one
that was bound using option `AllowMissingVariables`) and re-binds again
inside the implementation of the language plugin. The second time we
bind the program, we don't pass it the option `AllowMissingVariables`
and so it fails with `unboud variable` error.
I've verified that the issue above don't repro when doing an import for
dotnet (probably same for java/yaml) because we use the statically
linked function `codegen/{lang}/gen_program.go -> GenerateProgram`
## Solution
The problem can be solved by propagating the bind options from the CLI
to the language hosts during import so that they know how to bind the
program. I've extended the gRPC interface in `GenerateProgramRequest`
with a property `Strict` which follows the same logic from `pulumi
convert --strict` and made it such that the import command sends
`strict=false` to the language plugins when doing `GenerateProgram`.
This is consistent with `GenerateProject` that uses the same flag. When
`strict=false` we use `pcl.NonStrictBindOptions()` which includes
`AllowMissingVariables` .
## Repro
Once can test the before and after behaviour by running `pulumi up
--yes` on the following TypeScript program:
```ts
import * as pulumi from "@pulumi/pulumi";
import * as random from "@pulumi/random";
export class MyComponent extends pulumi.ComponentResource {
public readonly randomPetId: pulumi.Output<string>;
constructor(name: string, opts?: pulumi.ComponentResourceOptions) {
super("example:index:MyComponent", name, {}, opts);
const randomPet = new random.RandomPet("randomPet", {}, {
parent: this
});
this.randomPetId = randomPet.id;
this.registerOutputs({
randomPetId: randomPet.id,
});
}
}
const example = new MyComponent("example");
export const randomPetId = example.randomPetId;
```
Then running `pulumi import -f import.json` where `import.json` contains
a resource to be imported under the created component (stack=`dev`,
project=`importerrors`)
```ts
{
"nameTable": {
"parentComponent": "urn:pulumi:dev::importerrors::example:index:MyComponent::example"
},
"resources": [
{
"type": "random:index/randomPassword:RandomPassword",
"name": "randomPassword",
"id": "supersecret",
"parent": "parentComponent"
}
]
}
```
Running this locally I get the following generated code (which
previously failed to generate)
```ts
import * as pulumi from "@pulumi/pulumi";
import * as random from "@pulumi/random";
const randomPassword = new random.RandomPassword("randomPassword", {
length: 11,
lower: true,
number: true,
numeric: true,
special: true,
upper: true,
}, {
parent: parentComponent,
});
```
2024-07-25 13:53:44 +00:00
0x50 , 0x61 , 0x63 , 0x6b , 0x61 , 0x67 , 0x65 , 0x52 , 0x65 , 0x71 , 0x75 , 0x65 , 0x73 , 0x74 , 0x12 , 0x1c ,
0x0a , 0x09 , 0x64 , 0x69 , 0x72 , 0x65 , 0x63 , 0x74 , 0x6f , 0x72 , 0x79 , 0x18 , 0x01 , 0x20 , 0x01 , 0x28 ,
0x09 , 0x52 , 0x09 , 0x64 , 0x69 , 0x72 , 0x65 , 0x63 , 0x74 , 0x6f , 0x72 , 0x79 , 0x12 , 0x16 , 0x0a , 0x06 ,
0x73 , 0x63 , 0x68 , 0x65 , 0x6d , 0x61 , 0x18 , 0x02 , 0x20 , 0x01 , 0x28 , 0x09 , 0x52 , 0x06 , 0x73 , 0x63 ,
0x68 , 0x65 , 0x6d , 0x61 , 0x12 , 0x52 , 0x0a , 0x0b , 0x65 , 0x78 , 0x74 , 0x72 , 0x61 , 0x5f , 0x66 , 0x69 ,
0x6c , 0x65 , 0x73 , 0x18 , 0x03 , 0x20 , 0x03 , 0x28 , 0x0b , 0x32 , 0x31 , 0x2e , 0x70 , 0x75 , 0x6c , 0x75 ,
0x6d , 0x69 , 0x72 , 0x70 , 0x63 , 0x2e , 0x47 , 0x65 , 0x6e , 0x65 , 0x72 , 0x61 , 0x74 , 0x65 , 0x50 , 0x61 ,
0x63 , 0x6b , 0x61 , 0x67 , 0x65 , 0x52 , 0x65 , 0x71 , 0x75 , 0x65 , 0x73 , 0x74 , 0x2e , 0x45 , 0x78 , 0x74 ,
0x72 , 0x61 , 0x46 , 0x69 , 0x6c , 0x65 , 0x73 , 0x45 , 0x6e , 0x74 , 0x72 , 0x79 , 0x52 , 0x0a , 0x65 , 0x78 ,
0x74 , 0x72 , 0x61 , 0x46 , 0x69 , 0x6c , 0x65 , 0x73 , 0x12 , 0x23 , 0x0a , 0x0d , 0x6c , 0x6f , 0x61 , 0x64 ,
0x65 , 0x72 , 0x5f , 0x74 , 0x61 , 0x72 , 0x67 , 0x65 , 0x74 , 0x18 , 0x04 , 0x20 , 0x01 , 0x28 , 0x09 , 0x52 ,
0x0c , 0x6c , 0x6f , 0x61 , 0x64 , 0x65 , 0x72 , 0x54 , 0x61 , 0x72 , 0x67 , 0x65 , 0x74 , 0x12 , 0x67 , 0x0a ,
0x12 , 0x6c , 0x6f , 0x63 , 0x61 , 0x6c , 0x5f , 0x64 , 0x65 , 0x70 , 0x65 , 0x6e , 0x64 , 0x65 , 0x6e , 0x63 ,
0x69 , 0x65 , 0x73 , 0x18 , 0x05 , 0x20 , 0x03 , 0x28 , 0x0b , 0x32 , 0x38 , 0x2e , 0x70 , 0x75 , 0x6c , 0x75 ,
0x6d , 0x69 , 0x72 , 0x70 , 0x63 , 0x2e , 0x47 , 0x65 , 0x6e , 0x65 , 0x72 , 0x61 , 0x74 , 0x65 , 0x50 , 0x61 ,
0x63 , 0x6b , 0x61 , 0x67 , 0x65 , 0x52 , 0x65 , 0x71 , 0x75 , 0x65 , 0x73 , 0x74 , 0x2e , 0x4c , 0x6f , 0x63 ,
2024-06-28 23:21:55 +00:00
0x61 , 0x6c , 0x44 , 0x65 , 0x70 , 0x65 , 0x6e , 0x64 , 0x65 , 0x6e , 0x63 , 0x69 , 0x65 , 0x73 , 0x45 , 0x6e ,
[cli/import] Fix undefined variable errors in code generation when imported resources use a parent or provider (#16786)
Fixes #15410 Fixes #13339
## Problem Context
When using `pulumi import` we generate code snippets for the resources
that were imported. Sometimes the user specifies `--parent
parentName=URN` or `--provider providerName=URN` which tweak the parent
or provider that the imported resources uses. When using `--parent` or
`--provider` the generated code emits a resource option `parent =
parentName` (in case of using `--parent`) where `parentName` is an
unbound variable.
Usually unbound variables would result in a _bind_ error such as `error:
undefined variable parentName` when type-checking the program however in
the import code generation we specify the bind option
`pcl.AllowMissingVariables` which turns that unbound variable errors
into warnings and code generation can continue to emit code.
This is all good and works as expected. However in the issues linked
above, we do get an _error_ for unbound variables in generated code even
though we specified `AllowMissingVariables`.
The problem as it turns out is when we are trying to generate code via
dynamically loaded `LangaugeRuntime` plugins. Specifically for NodeJS
and Python, we load `pulumi-language-nodejs` or `pulumi-language-python`
and call `GenerateProgram` to get the generated program. That function
`GenerateProgram` takes the text _SOURCE_ of the a bound program (one
that was bound using option `AllowMissingVariables`) and re-binds again
inside the implementation of the language plugin. The second time we
bind the program, we don't pass it the option `AllowMissingVariables`
and so it fails with `unboud variable` error.
I've verified that the issue above don't repro when doing an import for
dotnet (probably same for java/yaml) because we use the statically
linked function `codegen/{lang}/gen_program.go -> GenerateProgram`
## Solution
The problem can be solved by propagating the bind options from the CLI
to the language hosts during import so that they know how to bind the
program. I've extended the gRPC interface in `GenerateProgramRequest`
with a property `Strict` which follows the same logic from `pulumi
convert --strict` and made it such that the import command sends
`strict=false` to the language plugins when doing `GenerateProgram`.
This is consistent with `GenerateProject` that uses the same flag. When
`strict=false` we use `pcl.NonStrictBindOptions()` which includes
`AllowMissingVariables` .
## Repro
Once can test the before and after behaviour by running `pulumi up
--yes` on the following TypeScript program:
```ts
import * as pulumi from "@pulumi/pulumi";
import * as random from "@pulumi/random";
export class MyComponent extends pulumi.ComponentResource {
public readonly randomPetId: pulumi.Output<string>;
constructor(name: string, opts?: pulumi.ComponentResourceOptions) {
super("example:index:MyComponent", name, {}, opts);
const randomPet = new random.RandomPet("randomPet", {}, {
parent: this
});
this.randomPetId = randomPet.id;
this.registerOutputs({
randomPetId: randomPet.id,
});
}
}
const example = new MyComponent("example");
export const randomPetId = example.randomPetId;
```
Then running `pulumi import -f import.json` where `import.json` contains
a resource to be imported under the created component (stack=`dev`,
project=`importerrors`)
```ts
{
"nameTable": {
"parentComponent": "urn:pulumi:dev::importerrors::example:index:MyComponent::example"
},
"resources": [
{
"type": "random:index/randomPassword:RandomPassword",
"name": "randomPassword",
"id": "supersecret",
"parent": "parentComponent"
}
]
}
```
Running this locally I get the following generated code (which
previously failed to generate)
```ts
import * as pulumi from "@pulumi/pulumi";
import * as random from "@pulumi/random";
const randomPassword = new random.RandomPassword("randomPassword", {
length: 11,
lower: true,
number: true,
numeric: true,
special: true,
upper: true,
}, {
parent: parentComponent,
});
```
2024-07-25 13:53:44 +00:00
0x74 , 0x72 , 0x79 , 0x52 , 0x11 , 0x6c , 0x6f , 0x63 , 0x61 , 0x6c , 0x44 , 0x65 , 0x70 , 0x65 , 0x6e , 0x64 ,
2024-08-07 08:16:37 +00:00
0x65 , 0x6e , 0x63 , 0x69 , 0x65 , 0x73 , 0x12 , 0x14 , 0x0a , 0x05 , 0x6c , 0x6f , 0x63 , 0x61 , 0x6c , 0x18 ,
0x06 , 0x20 , 0x01 , 0x28 , 0x08 , 0x52 , 0x05 , 0x6c , 0x6f , 0x63 , 0x61 , 0x6c , 0x1a , 0x3d , 0x0a , 0x0f ,
0x45 , 0x78 , 0x74 , 0x72 , 0x61 , 0x46 , 0x69 , 0x6c , 0x65 , 0x73 , 0x45 , 0x6e , 0x74 , 0x72 , 0x79 , 0x12 ,
[cli/import] Fix undefined variable errors in code generation when imported resources use a parent or provider (#16786)
Fixes #15410 Fixes #13339
## Problem Context
When using `pulumi import` we generate code snippets for the resources
that were imported. Sometimes the user specifies `--parent
parentName=URN` or `--provider providerName=URN` which tweak the parent
or provider that the imported resources uses. When using `--parent` or
`--provider` the generated code emits a resource option `parent =
parentName` (in case of using `--parent`) where `parentName` is an
unbound variable.
Usually unbound variables would result in a _bind_ error such as `error:
undefined variable parentName` when type-checking the program however in
the import code generation we specify the bind option
`pcl.AllowMissingVariables` which turns that unbound variable errors
into warnings and code generation can continue to emit code.
This is all good and works as expected. However in the issues linked
above, we do get an _error_ for unbound variables in generated code even
though we specified `AllowMissingVariables`.
The problem as it turns out is when we are trying to generate code via
dynamically loaded `LangaugeRuntime` plugins. Specifically for NodeJS
and Python, we load `pulumi-language-nodejs` or `pulumi-language-python`
and call `GenerateProgram` to get the generated program. That function
`GenerateProgram` takes the text _SOURCE_ of the a bound program (one
that was bound using option `AllowMissingVariables`) and re-binds again
inside the implementation of the language plugin. The second time we
bind the program, we don't pass it the option `AllowMissingVariables`
and so it fails with `unboud variable` error.
I've verified that the issue above don't repro when doing an import for
dotnet (probably same for java/yaml) because we use the statically
linked function `codegen/{lang}/gen_program.go -> GenerateProgram`
## Solution
The problem can be solved by propagating the bind options from the CLI
to the language hosts during import so that they know how to bind the
program. I've extended the gRPC interface in `GenerateProgramRequest`
with a property `Strict` which follows the same logic from `pulumi
convert --strict` and made it such that the import command sends
`strict=false` to the language plugins when doing `GenerateProgram`.
This is consistent with `GenerateProject` that uses the same flag. When
`strict=false` we use `pcl.NonStrictBindOptions()` which includes
`AllowMissingVariables` .
## Repro
Once can test the before and after behaviour by running `pulumi up
--yes` on the following TypeScript program:
```ts
import * as pulumi from "@pulumi/pulumi";
import * as random from "@pulumi/random";
export class MyComponent extends pulumi.ComponentResource {
public readonly randomPetId: pulumi.Output<string>;
constructor(name: string, opts?: pulumi.ComponentResourceOptions) {
super("example:index:MyComponent", name, {}, opts);
const randomPet = new random.RandomPet("randomPet", {}, {
parent: this
});
this.randomPetId = randomPet.id;
this.registerOutputs({
randomPetId: randomPet.id,
});
}
}
const example = new MyComponent("example");
export const randomPetId = example.randomPetId;
```
Then running `pulumi import -f import.json` where `import.json` contains
a resource to be imported under the created component (stack=`dev`,
project=`importerrors`)
```ts
{
"nameTable": {
"parentComponent": "urn:pulumi:dev::importerrors::example:index:MyComponent::example"
},
"resources": [
{
"type": "random:index/randomPassword:RandomPassword",
"name": "randomPassword",
"id": "supersecret",
"parent": "parentComponent"
}
]
}
```
Running this locally I get the following generated code (which
previously failed to generate)
```ts
import * as pulumi from "@pulumi/pulumi";
import * as random from "@pulumi/random";
const randomPassword = new random.RandomPassword("randomPassword", {
length: 11,
lower: true,
number: true,
numeric: true,
special: true,
upper: true,
}, {
parent: parentComponent,
});
```
2024-07-25 13:53:44 +00:00
0x10 , 0x0a , 0x03 , 0x6b , 0x65 , 0x79 , 0x18 , 0x01 , 0x20 , 0x01 , 0x28 , 0x09 , 0x52 , 0x03 , 0x6b , 0x65 ,
2024-08-07 08:16:37 +00:00
0x79 , 0x12 , 0x14 , 0x0a , 0x05 , 0x76 , 0x61 , 0x6c , 0x75 , 0x65 , 0x18 , 0x02 , 0x20 , 0x01 , 0x28 , 0x0c ,
0x52 , 0x05 , 0x76 , 0x61 , 0x6c , 0x75 , 0x65 , 0x3a , 0x02 , 0x38 , 0x01 , 0x1a , 0x44 , 0x0a , 0x16 , 0x4c ,
0x6f , 0x63 , 0x61 , 0x6c , 0x44 , 0x65 , 0x70 , 0x65 , 0x6e , 0x64 , 0x65 , 0x6e , 0x63 , 0x69 , 0x65 , 0x73 ,
0x45 , 0x6e , 0x74 , 0x72 , 0x79 , 0x12 , 0x10 , 0x0a , 0x03 , 0x6b , 0x65 , 0x79 , 0x18 , 0x01 , 0x20 , 0x01 ,
0x28 , 0x09 , 0x52 , 0x03 , 0x6b , 0x65 , 0x79 , 0x12 , 0x14 , 0x0a , 0x05 , 0x76 , 0x61 , 0x6c , 0x75 , 0x65 ,
0x18 , 0x02 , 0x20 , 0x01 , 0x28 , 0x09 , 0x52 , 0x05 , 0x76 , 0x61 , 0x6c , 0x75 , 0x65 , 0x3a , 0x02 , 0x38 ,
0x01 , 0x22 , 0x5a , 0x0a , 0x17 , 0x47 , 0x65 , 0x6e , 0x65 , 0x72 , 0x61 , 0x74 , 0x65 , 0x50 , 0x61 , 0x63 ,
0x6b , 0x61 , 0x67 , 0x65 , 0x52 , 0x65 , 0x73 , 0x70 , 0x6f , 0x6e , 0x73 , 0x65 , 0x12 , 0x3f , 0x0a , 0x0b ,
0x64 , 0x69 , 0x61 , 0x67 , 0x6e , 0x6f , 0x73 , 0x74 , 0x69 , 0x63 , 0x73 , 0x18 , 0x01 , 0x20 , 0x03 , 0x28 ,
0x0b , 0x32 , 0x1d , 0x2e , 0x70 , 0x75 , 0x6c , 0x75 , 0x6d , 0x69 , 0x72 , 0x70 , 0x63 , 0x2e , 0x63 , 0x6f ,
0x64 , 0x65 , 0x67 , 0x65 , 0x6e , 0x2e , 0x44 , 0x69 , 0x61 , 0x67 , 0x6e , 0x6f , 0x73 , 0x74 , 0x69 , 0x63 ,
0x52 , 0x0b , 0x64 , 0x69 , 0x61 , 0x67 , 0x6e , 0x6f , 0x73 , 0x74 , 0x69 , 0x63 , 0x73 , 0x22 , 0x6f , 0x0a ,
0x0b , 0x50 , 0x61 , 0x63 , 0x6b , 0x52 , 0x65 , 0x71 , 0x75 , 0x65 , 0x73 , 0x74 , 0x12 , 0x2b , 0x0a , 0x11 ,
0x70 , 0x61 , 0x63 , 0x6b , 0x61 , 0x67 , 0x65 , 0x5f , 0x64 , 0x69 , 0x72 , 0x65 , 0x63 , 0x74 , 0x6f , 0x72 ,
0x79 , 0x18 , 0x01 , 0x20 , 0x01 , 0x28 , 0x09 , 0x52 , 0x10 , 0x70 , 0x61 , 0x63 , 0x6b , 0x61 , 0x67 , 0x65 ,
0x44 , 0x69 , 0x72 , 0x65 , 0x63 , 0x74 , 0x6f , 0x72 , 0x79 , 0x12 , 0x33 , 0x0a , 0x15 , 0x64 , 0x65 , 0x73 ,
0x74 , 0x69 , 0x6e , 0x61 , 0x74 , 0x69 , 0x6f , 0x6e , 0x5f , 0x64 , 0x69 , 0x72 , 0x65 , 0x63 , 0x74 , 0x6f ,
0x72 , 0x79 , 0x18 , 0x02 , 0x20 , 0x01 , 0x28 , 0x09 , 0x52 , 0x14 , 0x64 , 0x65 , 0x73 , 0x74 , 0x69 , 0x6e ,
0x61 , 0x74 , 0x69 , 0x6f , 0x6e , 0x44 , 0x69 , 0x72 , 0x65 , 0x63 , 0x74 , 0x6f , 0x72 , 0x79 , 0x22 , 0x33 ,
0x0a , 0x0c , 0x50 , 0x61 , 0x63 , 0x6b , 0x52 , 0x65 , 0x73 , 0x70 , 0x6f , 0x6e , 0x73 , 0x65 , 0x12 , 0x23 ,
0x0a , 0x0d , 0x61 , 0x72 , 0x74 , 0x69 , 0x66 , 0x61 , 0x63 , 0x74 , 0x5f , 0x70 , 0x61 , 0x74 , 0x68 , 0x18 ,
0x01 , 0x20 , 0x01 , 0x28 , 0x09 , 0x52 , 0x0c , 0x61 , 0x72 , 0x74 , 0x69 , 0x66 , 0x61 , 0x63 , 0x74 , 0x50 ,
0x61 , 0x74 , 0x68 , 0x32 , 0x84 , 0x08 , 0x0a , 0x0f , 0x4c , 0x61 , 0x6e , 0x67 , 0x75 , 0x61 , 0x67 , 0x65 ,
0x52 , 0x75 , 0x6e , 0x74 , 0x69 , 0x6d , 0x65 , 0x12 , 0x63 , 0x0a , 0x12 , 0x47 , 0x65 , 0x74 , 0x52 , 0x65 ,
0x71 , 0x75 , 0x69 , 0x72 , 0x65 , 0x64 , 0x50 , 0x6c , 0x75 , 0x67 , 0x69 , 0x6e , 0x73 , 0x12 , 0x24 , 0x2e ,
[cli/import] Fix undefined variable errors in code generation when imported resources use a parent or provider (#16786)
Fixes #15410 Fixes #13339
## Problem Context
When using `pulumi import` we generate code snippets for the resources
that were imported. Sometimes the user specifies `--parent
parentName=URN` or `--provider providerName=URN` which tweak the parent
or provider that the imported resources uses. When using `--parent` or
`--provider` the generated code emits a resource option `parent =
parentName` (in case of using `--parent`) where `parentName` is an
unbound variable.
Usually unbound variables would result in a _bind_ error such as `error:
undefined variable parentName` when type-checking the program however in
the import code generation we specify the bind option
`pcl.AllowMissingVariables` which turns that unbound variable errors
into warnings and code generation can continue to emit code.
This is all good and works as expected. However in the issues linked
above, we do get an _error_ for unbound variables in generated code even
though we specified `AllowMissingVariables`.
The problem as it turns out is when we are trying to generate code via
dynamically loaded `LangaugeRuntime` plugins. Specifically for NodeJS
and Python, we load `pulumi-language-nodejs` or `pulumi-language-python`
and call `GenerateProgram` to get the generated program. That function
`GenerateProgram` takes the text _SOURCE_ of the a bound program (one
that was bound using option `AllowMissingVariables`) and re-binds again
inside the implementation of the language plugin. The second time we
bind the program, we don't pass it the option `AllowMissingVariables`
and so it fails with `unboud variable` error.
I've verified that the issue above don't repro when doing an import for
dotnet (probably same for java/yaml) because we use the statically
linked function `codegen/{lang}/gen_program.go -> GenerateProgram`
## Solution
The problem can be solved by propagating the bind options from the CLI
to the language hosts during import so that they know how to bind the
program. I've extended the gRPC interface in `GenerateProgramRequest`
with a property `Strict` which follows the same logic from `pulumi
convert --strict` and made it such that the import command sends
`strict=false` to the language plugins when doing `GenerateProgram`.
This is consistent with `GenerateProject` that uses the same flag. When
`strict=false` we use `pcl.NonStrictBindOptions()` which includes
`AllowMissingVariables` .
## Repro
Once can test the before and after behaviour by running `pulumi up
--yes` on the following TypeScript program:
```ts
import * as pulumi from "@pulumi/pulumi";
import * as random from "@pulumi/random";
export class MyComponent extends pulumi.ComponentResource {
public readonly randomPetId: pulumi.Output<string>;
constructor(name: string, opts?: pulumi.ComponentResourceOptions) {
super("example:index:MyComponent", name, {}, opts);
const randomPet = new random.RandomPet("randomPet", {}, {
parent: this
});
this.randomPetId = randomPet.id;
this.registerOutputs({
randomPetId: randomPet.id,
});
}
}
const example = new MyComponent("example");
export const randomPetId = example.randomPetId;
```
Then running `pulumi import -f import.json` where `import.json` contains
a resource to be imported under the created component (stack=`dev`,
project=`importerrors`)
```ts
{
"nameTable": {
"parentComponent": "urn:pulumi:dev::importerrors::example:index:MyComponent::example"
},
"resources": [
{
"type": "random:index/randomPassword:RandomPassword",
"name": "randomPassword",
"id": "supersecret",
"parent": "parentComponent"
}
]
}
```
Running this locally I get the following generated code (which
previously failed to generate)
```ts
import * as pulumi from "@pulumi/pulumi";
import * as random from "@pulumi/random";
const randomPassword = new random.RandomPassword("randomPassword", {
length: 11,
lower: true,
number: true,
numeric: true,
special: true,
upper: true,
}, {
parent: parentComponent,
});
```
2024-07-25 13:53:44 +00:00
0x70 , 0x75 , 0x6c , 0x75 , 0x6d , 0x69 , 0x72 , 0x70 , 0x63 , 0x2e , 0x47 , 0x65 , 0x74 , 0x52 , 0x65 , 0x71 ,
2024-08-07 08:16:37 +00:00
0x75 , 0x69 , 0x72 , 0x65 , 0x64 , 0x50 , 0x6c , 0x75 , 0x67 , 0x69 , 0x6e , 0x73 , 0x52 , 0x65 , 0x71 , 0x75 ,
0x65 , 0x73 , 0x74 , 0x1a , 0x25 , 0x2e , 0x70 , 0x75 , 0x6c , 0x75 , 0x6d , 0x69 , 0x72 , 0x70 , 0x63 , 0x2e ,
0x47 , 0x65 , 0x74 , 0x52 , 0x65 , 0x71 , 0x75 , 0x69 , 0x72 , 0x65 , 0x64 , 0x50 , 0x6c , 0x75 , 0x67 , 0x69 ,
0x6e , 0x73 , 0x52 , 0x65 , 0x73 , 0x70 , 0x6f , 0x6e , 0x73 , 0x65 , 0x22 , 0x00 , 0x12 , 0x36 , 0x0a , 0x03 ,
0x52 , 0x75 , 0x6e , 0x12 , 0x15 , 0x2e , 0x70 , 0x75 , 0x6c , 0x75 , 0x6d , 0x69 , 0x72 , 0x70 , 0x63 , 0x2e ,
0x52 , 0x75 , 0x6e , 0x52 , 0x65 , 0x71 , 0x75 , 0x65 , 0x73 , 0x74 , 0x1a , 0x16 , 0x2e , 0x70 , 0x75 , 0x6c ,
0x75 , 0x6d , 0x69 , 0x72 , 0x70 , 0x63 , 0x2e , 0x52 , 0x75 , 0x6e , 0x52 , 0x65 , 0x73 , 0x70 , 0x6f , 0x6e ,
0x73 , 0x65 , 0x22 , 0x00 , 0x12 , 0x40 , 0x0a , 0x0d , 0x47 , 0x65 , 0x74 , 0x50 , 0x6c , 0x75 , 0x67 , 0x69 ,
0x6e , 0x49 , 0x6e , 0x66 , 0x6f , 0x12 , 0x16 , 0x2e , 0x67 , 0x6f , 0x6f , 0x67 , 0x6c , 0x65 , 0x2e , 0x70 ,
0x72 , 0x6f , 0x74 , 0x6f , 0x62 , 0x75 , 0x66 , 0x2e , 0x45 , 0x6d , 0x70 , 0x74 , 0x79 , 0x1a , 0x15 , 0x2e ,
0x70 , 0x75 , 0x6c , 0x75 , 0x6d , 0x69 , 0x72 , 0x70 , 0x63 , 0x2e , 0x50 , 0x6c , 0x75 , 0x67 , 0x69 , 0x6e ,
0x49 , 0x6e , 0x66 , 0x6f , 0x22 , 0x00 , 0x12 , 0x68 , 0x0a , 0x13 , 0x49 , 0x6e , 0x73 , 0x74 , 0x61 , 0x6c ,
0x6c , 0x44 , 0x65 , 0x70 , 0x65 , 0x6e , 0x64 , 0x65 , 0x6e , 0x63 , 0x69 , 0x65 , 0x73 , 0x12 , 0x25 , 0x2e ,
0x70 , 0x75 , 0x6c , 0x75 , 0x6d , 0x69 , 0x72 , 0x70 , 0x63 , 0x2e , 0x49 , 0x6e , 0x73 , 0x74 , 0x61 , 0x6c ,
0x6c , 0x44 , 0x65 , 0x70 , 0x65 , 0x6e , 0x64 , 0x65 , 0x6e , 0x63 , 0x69 , 0x65 , 0x73 , 0x52 , 0x65 , 0x71 ,
0x75 , 0x65 , 0x73 , 0x74 , 0x1a , 0x26 , 0x2e , 0x70 , 0x75 , 0x6c , 0x75 , 0x6d , 0x69 , 0x72 , 0x70 , 0x63 ,
0x2e , 0x49 , 0x6e , 0x73 , 0x74 , 0x61 , 0x6c , 0x6c , 0x44 , 0x65 , 0x70 , 0x65 , 0x6e , 0x64 , 0x65 , 0x6e ,
0x63 , 0x69 , 0x65 , 0x73 , 0x52 , 0x65 , 0x73 , 0x70 , 0x6f , 0x6e , 0x73 , 0x65 , 0x22 , 0x00 , 0x30 , 0x01 ,
0x12 , 0x5e , 0x0a , 0x15 , 0x52 , 0x75 , 0x6e , 0x74 , 0x69 , 0x6d , 0x65 , 0x4f , 0x70 , 0x74 , 0x69 , 0x6f ,
0x6e , 0x73 , 0x50 , 0x72 , 0x6f , 0x6d , 0x70 , 0x74 , 0x73 , 0x12 , 0x20 , 0x2e , 0x70 , 0x75 , 0x6c , 0x75 ,
0x6d , 0x69 , 0x72 , 0x70 , 0x63 , 0x2e , 0x52 , 0x75 , 0x6e , 0x74 , 0x69 , 0x6d , 0x65 , 0x4f , 0x70 , 0x74 ,
0x69 , 0x6f , 0x6e , 0x73 , 0x52 , 0x65 , 0x71 , 0x75 , 0x65 , 0x73 , 0x74 , 0x1a , 0x21 , 0x2e , 0x70 , 0x75 ,
0x6c , 0x75 , 0x6d , 0x69 , 0x72 , 0x70 , 0x63 , 0x2e , 0x52 , 0x75 , 0x6e , 0x74 , 0x69 , 0x6d , 0x65 , 0x4f ,
0x70 , 0x74 , 0x69 , 0x6f , 0x6e , 0x73 , 0x52 , 0x65 , 0x73 , 0x70 , 0x6f , 0x6e , 0x73 , 0x65 , 0x22 , 0x00 ,
0x12 , 0x3c , 0x0a , 0x05 , 0x41 , 0x62 , 0x6f , 0x75 , 0x74 , 0x12 , 0x17 , 0x2e , 0x70 , 0x75 , 0x6c , 0x75 ,
0x6d , 0x69 , 0x72 , 0x70 , 0x63 , 0x2e , 0x41 , 0x62 , 0x6f , 0x75 , 0x74 , 0x52 , 0x65 , 0x71 , 0x75 , 0x65 ,
0x73 , 0x74 , 0x1a , 0x18 , 0x2e , 0x70 , 0x75 , 0x6c , 0x75 , 0x6d , 0x69 , 0x72 , 0x70 , 0x63 , 0x2e , 0x41 ,
0x62 , 0x6f , 0x75 , 0x74 , 0x52 , 0x65 , 0x73 , 0x70 , 0x6f , 0x6e , 0x73 , 0x65 , 0x22 , 0x00 , 0x12 , 0x6f ,
0x0a , 0x16 , 0x47 , 0x65 , 0x74 , 0x50 , 0x72 , 0x6f , 0x67 , 0x72 , 0x61 , 0x6d , 0x44 , 0x65 , 0x70 , 0x65 ,
0x6e , 0x64 , 0x65 , 0x6e , 0x63 , 0x69 , 0x65 , 0x73 , 0x12 , 0x28 , 0x2e , 0x70 , 0x75 , 0x6c , 0x75 , 0x6d ,
0x69 , 0x72 , 0x70 , 0x63 , 0x2e , 0x47 , 0x65 , 0x74 , 0x50 , 0x72 , 0x6f , 0x67 , 0x72 , 0x61 , 0x6d , 0x44 ,
0x65 , 0x70 , 0x65 , 0x6e , 0x64 , 0x65 , 0x6e , 0x63 , 0x69 , 0x65 , 0x73 , 0x52 , 0x65 , 0x71 , 0x75 , 0x65 ,
0x73 , 0x74 , 0x1a , 0x29 , 0x2e , 0x70 , 0x75 , 0x6c , 0x75 , 0x6d , 0x69 , 0x72 , 0x70 , 0x63 , 0x2e , 0x47 ,
[cli/import] Fix undefined variable errors in code generation when imported resources use a parent or provider (#16786)
Fixes #15410 Fixes #13339
## Problem Context
When using `pulumi import` we generate code snippets for the resources
that were imported. Sometimes the user specifies `--parent
parentName=URN` or `--provider providerName=URN` which tweak the parent
or provider that the imported resources uses. When using `--parent` or
`--provider` the generated code emits a resource option `parent =
parentName` (in case of using `--parent`) where `parentName` is an
unbound variable.
Usually unbound variables would result in a _bind_ error such as `error:
undefined variable parentName` when type-checking the program however in
the import code generation we specify the bind option
`pcl.AllowMissingVariables` which turns that unbound variable errors
into warnings and code generation can continue to emit code.
This is all good and works as expected. However in the issues linked
above, we do get an _error_ for unbound variables in generated code even
though we specified `AllowMissingVariables`.
The problem as it turns out is when we are trying to generate code via
dynamically loaded `LangaugeRuntime` plugins. Specifically for NodeJS
and Python, we load `pulumi-language-nodejs` or `pulumi-language-python`
and call `GenerateProgram` to get the generated program. That function
`GenerateProgram` takes the text _SOURCE_ of the a bound program (one
that was bound using option `AllowMissingVariables`) and re-binds again
inside the implementation of the language plugin. The second time we
bind the program, we don't pass it the option `AllowMissingVariables`
and so it fails with `unboud variable` error.
I've verified that the issue above don't repro when doing an import for
dotnet (probably same for java/yaml) because we use the statically
linked function `codegen/{lang}/gen_program.go -> GenerateProgram`
## Solution
The problem can be solved by propagating the bind options from the CLI
to the language hosts during import so that they know how to bind the
program. I've extended the gRPC interface in `GenerateProgramRequest`
with a property `Strict` which follows the same logic from `pulumi
convert --strict` and made it such that the import command sends
`strict=false` to the language plugins when doing `GenerateProgram`.
This is consistent with `GenerateProject` that uses the same flag. When
`strict=false` we use `pcl.NonStrictBindOptions()` which includes
`AllowMissingVariables` .
## Repro
Once can test the before and after behaviour by running `pulumi up
--yes` on the following TypeScript program:
```ts
import * as pulumi from "@pulumi/pulumi";
import * as random from "@pulumi/random";
export class MyComponent extends pulumi.ComponentResource {
public readonly randomPetId: pulumi.Output<string>;
constructor(name: string, opts?: pulumi.ComponentResourceOptions) {
super("example:index:MyComponent", name, {}, opts);
const randomPet = new random.RandomPet("randomPet", {}, {
parent: this
});
this.randomPetId = randomPet.id;
this.registerOutputs({
randomPetId: randomPet.id,
});
}
}
const example = new MyComponent("example");
export const randomPetId = example.randomPetId;
```
Then running `pulumi import -f import.json` where `import.json` contains
a resource to be imported under the created component (stack=`dev`,
project=`importerrors`)
```ts
{
"nameTable": {
"parentComponent": "urn:pulumi:dev::importerrors::example:index:MyComponent::example"
},
"resources": [
{
"type": "random:index/randomPassword:RandomPassword",
"name": "randomPassword",
"id": "supersecret",
"parent": "parentComponent"
}
]
}
```
Running this locally I get the following generated code (which
previously failed to generate)
```ts
import * as pulumi from "@pulumi/pulumi";
import * as random from "@pulumi/random";
const randomPassword = new random.RandomPassword("randomPassword", {
length: 11,
lower: true,
number: true,
numeric: true,
special: true,
upper: true,
}, {
parent: parentComponent,
});
```
2024-07-25 13:53:44 +00:00
0x65 , 0x74 , 0x50 , 0x72 , 0x6f , 0x67 , 0x72 , 0x61 , 0x6d , 0x44 , 0x65 , 0x70 , 0x65 , 0x6e , 0x64 , 0x65 ,
2024-08-07 08:16:37 +00:00
0x6e , 0x63 , 0x69 , 0x65 , 0x73 , 0x52 , 0x65 , 0x73 , 0x70 , 0x6f , 0x6e , 0x73 , 0x65 , 0x22 , 0x00 , 0x12 ,
0x4a , 0x0a , 0x09 , 0x52 , 0x75 , 0x6e , 0x50 , 0x6c , 0x75 , 0x67 , 0x69 , 0x6e , 0x12 , 0x1b , 0x2e , 0x70 ,
0x75 , 0x6c , 0x75 , 0x6d , 0x69 , 0x72 , 0x70 , 0x63 , 0x2e , 0x52 , 0x75 , 0x6e , 0x50 , 0x6c , 0x75 , 0x67 ,
0x69 , 0x6e , 0x52 , 0x65 , 0x71 , 0x75 , 0x65 , 0x73 , 0x74 , 0x1a , 0x1c , 0x2e , 0x70 , 0x75 , 0x6c , 0x75 ,
0x6d , 0x69 , 0x72 , 0x70 , 0x63 , 0x2e , 0x52 , 0x75 , 0x6e , 0x50 , 0x6c , 0x75 , 0x67 , 0x69 , 0x6e , 0x52 ,
0x65 , 0x73 , 0x70 , 0x6f , 0x6e , 0x73 , 0x65 , 0x22 , 0x00 , 0x30 , 0x01 , 0x12 , 0x5a , 0x0a , 0x0f , 0x47 ,
0x65 , 0x6e , 0x65 , 0x72 , 0x61 , 0x74 , 0x65 , 0x50 , 0x72 , 0x6f , 0x67 , 0x72 , 0x61 , 0x6d , 0x12 , 0x21 ,
0x2e , 0x70 , 0x75 , 0x6c , 0x75 , 0x6d , 0x69 , 0x72 , 0x70 , 0x63 , 0x2e , 0x47 , 0x65 , 0x6e , 0x65 , 0x72 ,
0x61 , 0x74 , 0x65 , 0x50 , 0x72 , 0x6f , 0x67 , 0x72 , 0x61 , 0x6d , 0x52 , 0x65 , 0x71 , 0x75 , 0x65 , 0x73 ,
0x74 , 0x1a , 0x22 , 0x2e , 0x70 , 0x75 , 0x6c , 0x75 , 0x6d , 0x69 , 0x72 , 0x70 , 0x63 , 0x2e , 0x47 , 0x65 ,
0x6e , 0x65 , 0x72 , 0x61 , 0x74 , 0x65 , 0x50 , 0x72 , 0x6f , 0x67 , 0x72 , 0x61 , 0x6d , 0x52 , 0x65 , 0x73 ,
0x70 , 0x6f , 0x6e , 0x73 , 0x65 , 0x22 , 0x00 , 0x12 , 0x5a , 0x0a , 0x0f , 0x47 , 0x65 , 0x6e , 0x65 , 0x72 ,
0x61 , 0x74 , 0x65 , 0x50 , 0x72 , 0x6f , 0x6a , 0x65 , 0x63 , 0x74 , 0x12 , 0x21 , 0x2e , 0x70 , 0x75 , 0x6c ,
0x75 , 0x6d , 0x69 , 0x72 , 0x70 , 0x63 , 0x2e , 0x47 , 0x65 , 0x6e , 0x65 , 0x72 , 0x61 , 0x74 , 0x65 , 0x50 ,
0x72 , 0x6f , 0x6a , 0x65 , 0x63 , 0x74 , 0x52 , 0x65 , 0x71 , 0x75 , 0x65 , 0x73 , 0x74 , 0x1a , 0x22 , 0x2e ,
0x70 , 0x75 , 0x6c , 0x75 , 0x6d , 0x69 , 0x72 , 0x70 , 0x63 , 0x2e , 0x47 , 0x65 , 0x6e , 0x65 , 0x72 , 0x61 ,
0x74 , 0x65 , 0x50 , 0x72 , 0x6f , 0x6a , 0x65 , 0x63 , 0x74 , 0x52 , 0x65 , 0x73 , 0x70 , 0x6f , 0x6e , 0x73 ,
0x65 , 0x22 , 0x00 , 0x12 , 0x5a , 0x0a , 0x0f , 0x47 , 0x65 , 0x6e , 0x65 , 0x72 , 0x61 , 0x74 , 0x65 , 0x50 ,
0x61 , 0x63 , 0x6b , 0x61 , 0x67 , 0x65 , 0x12 , 0x21 , 0x2e , 0x70 , 0x75 , 0x6c , 0x75 , 0x6d , 0x69 , 0x72 ,
0x70 , 0x63 , 0x2e , 0x47 , 0x65 , 0x6e , 0x65 , 0x72 , 0x61 , 0x74 , 0x65 , 0x50 , 0x61 , 0x63 , 0x6b , 0x61 ,
0x67 , 0x65 , 0x52 , 0x65 , 0x71 , 0x75 , 0x65 , 0x73 , 0x74 , 0x1a , 0x22 , 0x2e , 0x70 , 0x75 , 0x6c , 0x75 ,
0x6d , 0x69 , 0x72 , 0x70 , 0x63 , 0x2e , 0x47 , 0x65 , 0x6e , 0x65 , 0x72 , 0x61 , 0x74 , 0x65 , 0x50 , 0x61 ,
0x63 , 0x6b , 0x61 , 0x67 , 0x65 , 0x52 , 0x65 , 0x73 , 0x70 , 0x6f , 0x6e , 0x73 , 0x65 , 0x22 , 0x00 , 0x12 ,
0x39 , 0x0a , 0x04 , 0x50 , 0x61 , 0x63 , 0x6b , 0x12 , 0x16 , 0x2e , 0x70 , 0x75 , 0x6c , 0x75 , 0x6d , 0x69 ,
0x72 , 0x70 , 0x63 , 0x2e , 0x50 , 0x61 , 0x63 , 0x6b , 0x52 , 0x65 , 0x71 , 0x75 , 0x65 , 0x73 , 0x74 , 0x1a ,
0x17 , 0x2e , 0x70 , 0x75 , 0x6c , 0x75 , 0x6d , 0x69 , 0x72 , 0x70 , 0x63 , 0x2e , 0x50 , 0x61 , 0x63 , 0x6b ,
0x52 , 0x65 , 0x73 , 0x70 , 0x6f , 0x6e , 0x73 , 0x65 , 0x22 , 0x00 , 0x42 , 0x34 , 0x5a , 0x32 , 0x67 , 0x69 ,
0x74 , 0x68 , 0x75 , 0x62 , 0x2e , 0x63 , 0x6f , 0x6d , 0x2f , 0x70 , 0x75 , 0x6c , 0x75 , 0x6d , 0x69 , 0x2f ,
0x70 , 0x75 , 0x6c , 0x75 , 0x6d , 0x69 , 0x2f , 0x73 , 0x64 , 0x6b , 0x2f , 0x76 , 0x33 , 0x2f , 0x70 , 0x72 ,
0x6f , 0x74 , 0x6f , 0x2f , 0x67 , 0x6f , 0x3b , 0x70 , 0x75 , 0x6c , 0x75 , 0x6d , 0x69 , 0x72 , 0x70 , 0x63 ,
0x62 , 0x06 , 0x70 , 0x72 , 0x6f , 0x74 , 0x6f , 0x33 ,
2022-06-11 07:52:24 +00:00
}
var (
2022-07-12 13:45:03 +00:00
file_pulumi_language_proto_rawDescOnce sync . Once
file_pulumi_language_proto_rawDescData = file_pulumi_language_proto_rawDesc
2022-06-11 07:52:24 +00:00
)
2022-07-12 13:45:03 +00:00
func file_pulumi_language_proto_rawDescGZIP ( ) [ ] byte {
file_pulumi_language_proto_rawDescOnce . Do ( func ( ) {
file_pulumi_language_proto_rawDescData = protoimpl . X . CompressGZIP ( file_pulumi_language_proto_rawDescData )
2022-06-11 07:52:24 +00:00
} )
2022-07-12 13:45:03 +00:00
return file_pulumi_language_proto_rawDescData
2022-06-11 07:52:24 +00:00
}
2024-06-17 17:10:55 +00:00
var file_pulumi_language_proto_enumTypes = make ( [ ] protoimpl . EnumInfo , 1 )
var file_pulumi_language_proto_msgTypes = make ( [ ] protoimpl . MessageInfo , 33 )
2023-03-04 22:11:52 +00:00
var file_pulumi_language_proto_goTypes = [ ] interface { } {
2024-06-17 17:10:55 +00:00
( RuntimeOptionPrompt_RuntimeOptionType ) ( 0 ) , // 0: pulumirpc.RuntimeOptionPrompt.RuntimeOptionType
( * ProgramInfo ) ( nil ) , // 1: pulumirpc.ProgramInfo
( * AboutRequest ) ( nil ) , // 2: pulumirpc.AboutRequest
( * AboutResponse ) ( nil ) , // 3: pulumirpc.AboutResponse
( * GetProgramDependenciesRequest ) ( nil ) , // 4: pulumirpc.GetProgramDependenciesRequest
( * DependencyInfo ) ( nil ) , // 5: pulumirpc.DependencyInfo
( * GetProgramDependenciesResponse ) ( nil ) , // 6: pulumirpc.GetProgramDependenciesResponse
( * GetRequiredPluginsRequest ) ( nil ) , // 7: pulumirpc.GetRequiredPluginsRequest
( * GetRequiredPluginsResponse ) ( nil ) , // 8: pulumirpc.GetRequiredPluginsResponse
( * RunRequest ) ( nil ) , // 9: pulumirpc.RunRequest
( * RunResponse ) ( nil ) , // 10: pulumirpc.RunResponse
( * InstallDependenciesRequest ) ( nil ) , // 11: pulumirpc.InstallDependenciesRequest
( * InstallDependenciesResponse ) ( nil ) , // 12: pulumirpc.InstallDependenciesResponse
( * RuntimeOptionsRequest ) ( nil ) , // 13: pulumirpc.RuntimeOptionsRequest
( * RuntimeOptionPrompt ) ( nil ) , // 14: pulumirpc.RuntimeOptionPrompt
( * RuntimeOptionsResponse ) ( nil ) , // 15: pulumirpc.RuntimeOptionsResponse
( * RunPluginRequest ) ( nil ) , // 16: pulumirpc.RunPluginRequest
( * RunPluginResponse ) ( nil ) , // 17: pulumirpc.RunPluginResponse
( * GenerateProgramRequest ) ( nil ) , // 18: pulumirpc.GenerateProgramRequest
( * GenerateProgramResponse ) ( nil ) , // 19: pulumirpc.GenerateProgramResponse
( * GenerateProjectRequest ) ( nil ) , // 20: pulumirpc.GenerateProjectRequest
( * GenerateProjectResponse ) ( nil ) , // 21: pulumirpc.GenerateProjectResponse
( * GeneratePackageRequest ) ( nil ) , // 22: pulumirpc.GeneratePackageRequest
( * GeneratePackageResponse ) ( nil ) , // 23: pulumirpc.GeneratePackageResponse
( * PackRequest ) ( nil ) , // 24: pulumirpc.PackRequest
( * PackResponse ) ( nil ) , // 25: pulumirpc.PackResponse
nil , // 26: pulumirpc.AboutResponse.MetadataEntry
nil , // 27: pulumirpc.RunRequest.ConfigEntry
( * RuntimeOptionPrompt_RuntimeOptionValue ) ( nil ) , // 28: pulumirpc.RuntimeOptionPrompt.RuntimeOptionValue
nil , // 29: pulumirpc.GenerateProgramRequest.SourceEntry
nil , // 30: pulumirpc.GenerateProgramResponse.SourceEntry
nil , // 31: pulumirpc.GenerateProjectRequest.LocalDependenciesEntry
nil , // 32: pulumirpc.GeneratePackageRequest.ExtraFilesEntry
nil , // 33: pulumirpc.GeneratePackageRequest.LocalDependenciesEntry
( * structpb . Struct ) ( nil ) , // 34: google.protobuf.Struct
( * PluginDependency ) ( nil ) , // 35: pulumirpc.PluginDependency
( * codegen . Diagnostic ) ( nil ) , // 36: pulumirpc.codegen.Diagnostic
( * emptypb . Empty ) ( nil ) , // 37: google.protobuf.Empty
( * PluginInfo ) ( nil ) , // 38: pulumirpc.PluginInfo
2023-03-04 22:11:52 +00:00
}
2022-07-12 13:45:03 +00:00
var file_pulumi_language_proto_depIdxs = [ ] int32 {
2024-06-17 17:10:55 +00:00
34 , // 0: pulumirpc.ProgramInfo.options:type_name -> google.protobuf.Struct
1 , // 1: pulumirpc.AboutRequest.info:type_name -> pulumirpc.ProgramInfo
26 , // 2: pulumirpc.AboutResponse.metadata:type_name -> pulumirpc.AboutResponse.MetadataEntry
1 , // 3: pulumirpc.GetProgramDependenciesRequest.info:type_name -> pulumirpc.ProgramInfo
5 , // 4: pulumirpc.GetProgramDependenciesResponse.dependencies:type_name -> pulumirpc.DependencyInfo
1 , // 5: pulumirpc.GetRequiredPluginsRequest.info:type_name -> pulumirpc.ProgramInfo
35 , // 6: pulumirpc.GetRequiredPluginsResponse.plugins:type_name -> pulumirpc.PluginDependency
27 , // 7: pulumirpc.RunRequest.config:type_name -> pulumirpc.RunRequest.ConfigEntry
34 , // 8: pulumirpc.RunRequest.configPropertyMap:type_name -> google.protobuf.Struct
1 , // 9: pulumirpc.RunRequest.info:type_name -> pulumirpc.ProgramInfo
1 , // 10: pulumirpc.InstallDependenciesRequest.info:type_name -> pulumirpc.ProgramInfo
1 , // 11: pulumirpc.RuntimeOptionsRequest.info:type_name -> pulumirpc.ProgramInfo
0 , // 12: pulumirpc.RuntimeOptionPrompt.promptType:type_name -> pulumirpc.RuntimeOptionPrompt.RuntimeOptionType
28 , // 13: pulumirpc.RuntimeOptionPrompt.choices:type_name -> pulumirpc.RuntimeOptionPrompt.RuntimeOptionValue
28 , // 14: pulumirpc.RuntimeOptionPrompt.default:type_name -> pulumirpc.RuntimeOptionPrompt.RuntimeOptionValue
14 , // 15: pulumirpc.RuntimeOptionsResponse.prompts:type_name -> pulumirpc.RuntimeOptionPrompt
1 , // 16: pulumirpc.RunPluginRequest.info:type_name -> pulumirpc.ProgramInfo
29 , // 17: pulumirpc.GenerateProgramRequest.source:type_name -> pulumirpc.GenerateProgramRequest.SourceEntry
36 , // 18: pulumirpc.GenerateProgramResponse.diagnostics:type_name -> pulumirpc.codegen.Diagnostic
30 , // 19: pulumirpc.GenerateProgramResponse.source:type_name -> pulumirpc.GenerateProgramResponse.SourceEntry
31 , // 20: pulumirpc.GenerateProjectRequest.local_dependencies:type_name -> pulumirpc.GenerateProjectRequest.LocalDependenciesEntry
36 , // 21: pulumirpc.GenerateProjectResponse.diagnostics:type_name -> pulumirpc.codegen.Diagnostic
32 , // 22: pulumirpc.GeneratePackageRequest.extra_files:type_name -> pulumirpc.GeneratePackageRequest.ExtraFilesEntry
33 , // 23: pulumirpc.GeneratePackageRequest.local_dependencies:type_name -> pulumirpc.GeneratePackageRequest.LocalDependenciesEntry
36 , // 24: pulumirpc.GeneratePackageResponse.diagnostics:type_name -> pulumirpc.codegen.Diagnostic
0 , // 25: pulumirpc.RuntimeOptionPrompt.RuntimeOptionValue.promptType:type_name -> pulumirpc.RuntimeOptionPrompt.RuntimeOptionType
7 , // 26: pulumirpc.LanguageRuntime.GetRequiredPlugins:input_type -> pulumirpc.GetRequiredPluginsRequest
9 , // 27: pulumirpc.LanguageRuntime.Run:input_type -> pulumirpc.RunRequest
37 , // 28: pulumirpc.LanguageRuntime.GetPluginInfo:input_type -> google.protobuf.Empty
11 , // 29: pulumirpc.LanguageRuntime.InstallDependencies:input_type -> pulumirpc.InstallDependenciesRequest
13 , // 30: pulumirpc.LanguageRuntime.RuntimeOptionsPrompts:input_type -> pulumirpc.RuntimeOptionsRequest
2 , // 31: pulumirpc.LanguageRuntime.About:input_type -> pulumirpc.AboutRequest
4 , // 32: pulumirpc.LanguageRuntime.GetProgramDependencies:input_type -> pulumirpc.GetProgramDependenciesRequest
16 , // 33: pulumirpc.LanguageRuntime.RunPlugin:input_type -> pulumirpc.RunPluginRequest
18 , // 34: pulumirpc.LanguageRuntime.GenerateProgram:input_type -> pulumirpc.GenerateProgramRequest
20 , // 35: pulumirpc.LanguageRuntime.GenerateProject:input_type -> pulumirpc.GenerateProjectRequest
22 , // 36: pulumirpc.LanguageRuntime.GeneratePackage:input_type -> pulumirpc.GeneratePackageRequest
24 , // 37: pulumirpc.LanguageRuntime.Pack:input_type -> pulumirpc.PackRequest
8 , // 38: pulumirpc.LanguageRuntime.GetRequiredPlugins:output_type -> pulumirpc.GetRequiredPluginsResponse
10 , // 39: pulumirpc.LanguageRuntime.Run:output_type -> pulumirpc.RunResponse
38 , // 40: pulumirpc.LanguageRuntime.GetPluginInfo:output_type -> pulumirpc.PluginInfo
12 , // 41: pulumirpc.LanguageRuntime.InstallDependencies:output_type -> pulumirpc.InstallDependenciesResponse
15 , // 42: pulumirpc.LanguageRuntime.RuntimeOptionsPrompts:output_type -> pulumirpc.RuntimeOptionsResponse
3 , // 43: pulumirpc.LanguageRuntime.About:output_type -> pulumirpc.AboutResponse
6 , // 44: pulumirpc.LanguageRuntime.GetProgramDependencies:output_type -> pulumirpc.GetProgramDependenciesResponse
17 , // 45: pulumirpc.LanguageRuntime.RunPlugin:output_type -> pulumirpc.RunPluginResponse
19 , // 46: pulumirpc.LanguageRuntime.GenerateProgram:output_type -> pulumirpc.GenerateProgramResponse
21 , // 47: pulumirpc.LanguageRuntime.GenerateProject:output_type -> pulumirpc.GenerateProjectResponse
23 , // 48: pulumirpc.LanguageRuntime.GeneratePackage:output_type -> pulumirpc.GeneratePackageResponse
25 , // 49: pulumirpc.LanguageRuntime.Pack:output_type -> pulumirpc.PackResponse
38 , // [38:50] is the sub-list for method output_type
26 , // [26:38] is the sub-list for method input_type
26 , // [26:26] is the sub-list for extension type_name
26 , // [26:26] is the sub-list for extension extendee
0 , // [0:26] is the sub-list for field type_name
2022-06-11 07:52:24 +00:00
}
2022-07-12 13:45:03 +00:00
func init ( ) { file_pulumi_language_proto_init ( ) }
func file_pulumi_language_proto_init ( ) {
if File_pulumi_language_proto != nil {
2022-06-11 07:52:24 +00:00
return
}
2022-07-12 13:45:03 +00:00
file_pulumi_plugin_proto_init ( )
2022-06-11 07:52:24 +00:00
if ! protoimpl . UnsafeEnabled {
2022-07-12 13:45:03 +00:00
file_pulumi_language_proto_msgTypes [ 0 ] . Exporter = func ( v interface { } , i int ) interface { } {
Pass root and main info to language host methods (#14654)
<!---
Thanks so much for your contribution! If this is your first time
contributing, please ensure that you have read the
[CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md)
documentation.
-->
# Description
<!--- Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context. -->
This is two changes rolled together in a way.
Firstly passing some of the data that we pass on language runtime
startup to also pass it to Run/GetRequiredPlugins/etc. This is needed
for matrix testing, as we only get to start the language runtime up once
for that but want to execute multiple programs with it.
I feel it's also a little more consistent as we use the language
runtimes in other contexts (codegen) where there isn't really a root
directory, and aren't any options (and if we did do options the options
for codegen are not going to be the same as for execution). It also
means we can reuse a language host for shimless and substack programs,
as before they heavily relied on their current working directory to
calculate paths, and obviosly could only take one set of options at
startup. Imagine a shimless python package + a python root program, that
would have needed two startups of the python language host to deal with,
this unblocks it so we can make the engine smarter and only use one.
Secondly renaming some of the fields we pass to
Run/GetRequiredPlugins/etc today. `Pwd` and `Program` were not very
descriptive and had pretty non-obvious documentation:
```
string pwd = 3; // the program's working directory.
string program = 4; // the path to the program to execute.
```
`pwd` will remain, although probably rename it to `working_directory` at
some point, because while today we always start programs up with the
working directory equal to the program directory that definitely is
going to change in the future (at least for MLCs and substack programs).
But the name `pwd` doesn't make it clear that this was intended to be
the working directory _and_ the directory which contains the program.
`program` was in fact nearly always ".", and if it wasn't that it was
just a filename. The engine never sent a path for `program` (although we
did have some unit tests to check how that worked for the nodejs and
python hosts).
These are now replaced by a new structure with (I think) more clearly
named and documented fields (see ProgramInfo in langauge.proto).
The engine still sends the old data for now, we need to update
dotnet/yaml/java before we break the old interface and give Virtus Labs
a chance to update [besom](https://github.com/VirtusLab/besom).
## Checklist
- [x] I have run `make tidy` to update any new dependencies
- [x] I have run `make lint` to verify my code passes the lint check
- [ ] I have formatted my code using `gofumpt`
<!--- Please provide details if the checkbox below is to be left
unchecked. -->
- [x] I have added tests that prove my fix is effective or that my
feature works
<!---
User-facing changes require a CHANGELOG entry.
-->
- [ ] I have run `make changelog` and committed the
`changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the
Pulumi Cloud,
then the service should honor older versions of the CLI where this
change would not exist.
You must then bump the API version in
/pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi
Cloud API version
<!-- @Pulumi employees: If yes, you must submit corresponding changes in
the service repo. -->
2023-12-10 17:30:51 +00:00
switch v := v . ( * ProgramInfo ) ; i {
2022-06-11 07:52:24 +00:00
case 0 :
return & v . state
case 1 :
return & v . sizeCache
case 2 :
return & v . unknownFields
default :
return nil
}
}
2022-07-12 13:45:03 +00:00
file_pulumi_language_proto_msgTypes [ 1 ] . Exporter = func ( v interface { } , i int ) interface { } {
2024-06-06 08:21:46 +00:00
switch v := v . ( * AboutRequest ) ; i {
2022-06-11 07:52:24 +00:00
case 0 :
return & v . state
case 1 :
return & v . sizeCache
case 2 :
return & v . unknownFields
default :
return nil
}
}
2022-07-12 13:45:03 +00:00
file_pulumi_language_proto_msgTypes [ 2 ] . Exporter = func ( v interface { } , i int ) interface { } {
2024-06-06 08:21:46 +00:00
switch v := v . ( * AboutResponse ) ; i {
2022-06-11 07:52:24 +00:00
case 0 :
return & v . state
case 1 :
return & v . sizeCache
case 2 :
return & v . unknownFields
default :
return nil
}
}
2022-07-12 13:45:03 +00:00
file_pulumi_language_proto_msgTypes [ 3 ] . Exporter = func ( v interface { } , i int ) interface { } {
2024-06-06 08:21:46 +00:00
switch v := v . ( * GetProgramDependenciesRequest ) ; i {
2022-06-11 07:52:24 +00:00
case 0 :
return & v . state
case 1 :
return & v . sizeCache
case 2 :
return & v . unknownFields
default :
return nil
}
}
2022-07-12 13:45:03 +00:00
file_pulumi_language_proto_msgTypes [ 4 ] . Exporter = func ( v interface { } , i int ) interface { } {
2024-06-06 08:21:46 +00:00
switch v := v . ( * DependencyInfo ) ; i {
2022-06-11 07:52:24 +00:00
case 0 :
return & v . state
case 1 :
return & v . sizeCache
case 2 :
return & v . unknownFields
default :
return nil
}
}
2022-07-12 13:45:03 +00:00
file_pulumi_language_proto_msgTypes [ 5 ] . Exporter = func ( v interface { } , i int ) interface { } {
2024-06-06 08:21:46 +00:00
switch v := v . ( * GetProgramDependenciesResponse ) ; i {
2022-07-25 11:35:16 +00:00
case 0 :
return & v . state
case 1 :
return & v . sizeCache
case 2 :
return & v . unknownFields
default :
return nil
}
}
file_pulumi_language_proto_msgTypes [ 6 ] . Exporter = func ( v interface { } , i int ) interface { } {
2024-06-06 08:21:46 +00:00
switch v := v . ( * GetRequiredPluginsRequest ) ; i {
2022-07-25 11:35:16 +00:00
case 0 :
return & v . state
case 1 :
return & v . sizeCache
case 2 :
return & v . unknownFields
default :
return nil
}
}
file_pulumi_language_proto_msgTypes [ 7 ] . Exporter = func ( v interface { } , i int ) interface { } {
2024-06-06 08:21:46 +00:00
switch v := v . ( * GetRequiredPluginsResponse ) ; i {
2022-07-25 11:35:16 +00:00
case 0 :
return & v . state
case 1 :
return & v . sizeCache
case 2 :
return & v . unknownFields
default :
return nil
}
}
file_pulumi_language_proto_msgTypes [ 8 ] . Exporter = func ( v interface { } , i int ) interface { } {
2024-06-06 08:21:46 +00:00
switch v := v . ( * RunRequest ) ; i {
2022-07-25 11:35:16 +00:00
case 0 :
return & v . state
case 1 :
return & v . sizeCache
case 2 :
return & v . unknownFields
default :
return nil
}
}
file_pulumi_language_proto_msgTypes [ 9 ] . Exporter = func ( v interface { } , i int ) interface { } {
2024-06-06 08:21:46 +00:00
switch v := v . ( * RunResponse ) ; i {
2022-06-11 07:52:24 +00:00
case 0 :
return & v . state
case 1 :
return & v . sizeCache
case 2 :
return & v . unknownFields
default :
return nil
}
}
2022-10-04 08:58:01 +00:00
file_pulumi_language_proto_msgTypes [ 10 ] . Exporter = func ( v interface { } , i int ) interface { } {
2024-06-06 08:21:46 +00:00
switch v := v . ( * InstallDependenciesRequest ) ; i {
2022-10-04 08:58:01 +00:00
case 0 :
return & v . state
case 1 :
return & v . sizeCache
case 2 :
return & v . unknownFields
default :
return nil
}
}
file_pulumi_language_proto_msgTypes [ 11 ] . Exporter = func ( v interface { } , i int ) interface { } {
2024-06-06 08:21:46 +00:00
switch v := v . ( * InstallDependenciesResponse ) ; i {
2022-10-04 08:58:01 +00:00
case 0 :
return & v . state
case 1 :
return & v . sizeCache
case 2 :
return & v . unknownFields
default :
return nil
}
}
2022-10-17 14:21:11 +00:00
file_pulumi_language_proto_msgTypes [ 12 ] . Exporter = func ( v interface { } , i int ) interface { } {
2024-06-17 17:10:55 +00:00
switch v := v . ( * RuntimeOptionsRequest ) ; i {
2022-10-17 14:21:11 +00:00
case 0 :
return & v . state
case 1 :
return & v . sizeCache
case 2 :
return & v . unknownFields
default :
return nil
}
}
file_pulumi_language_proto_msgTypes [ 13 ] . Exporter = func ( v interface { } , i int ) interface { } {
2024-06-17 17:10:55 +00:00
switch v := v . ( * RuntimeOptionPrompt ) ; i {
2022-10-17 14:21:11 +00:00
case 0 :
return & v . state
case 1 :
return & v . sizeCache
case 2 :
return & v . unknownFields
default :
return nil
}
}
file_pulumi_language_proto_msgTypes [ 14 ] . Exporter = func ( v interface { } , i int ) interface { } {
2024-06-17 17:10:55 +00:00
switch v := v . ( * RuntimeOptionsResponse ) ; i {
2022-10-17 14:21:11 +00:00
case 0 :
return & v . state
case 1 :
return & v . sizeCache
case 2 :
return & v . unknownFields
default :
return nil
}
}
file_pulumi_language_proto_msgTypes [ 15 ] . Exporter = func ( v interface { } , i int ) interface { } {
2024-06-17 17:10:55 +00:00
switch v := v . ( * RunPluginRequest ) ; i {
2022-10-17 14:21:11 +00:00
case 0 :
return & v . state
case 1 :
return & v . sizeCache
case 2 :
return & v . unknownFields
default :
return nil
}
}
file_pulumi_language_proto_msgTypes [ 16 ] . Exporter = func ( v interface { } , i int ) interface { } {
2024-06-17 17:10:55 +00:00
switch v := v . ( * RunPluginResponse ) ; i {
2022-10-17 14:21:11 +00:00
case 0 :
return & v . state
case 1 :
return & v . sizeCache
case 2 :
return & v . unknownFields
default :
return nil
}
}
file_pulumi_language_proto_msgTypes [ 17 ] . Exporter = func ( v interface { } , i int ) interface { } {
2024-06-17 17:10:55 +00:00
switch v := v . ( * GenerateProgramRequest ) ; i {
2022-10-17 14:21:11 +00:00
case 0 :
return & v . state
case 1 :
return & v . sizeCache
case 2 :
return & v . unknownFields
default :
return nil
}
}
2023-07-27 21:39:36 +00:00
file_pulumi_language_proto_msgTypes [ 18 ] . Exporter = func ( v interface { } , i int ) interface { } {
2024-06-17 17:10:55 +00:00
switch v := v . ( * GenerateProgramResponse ) ; i {
2023-07-27 21:39:36 +00:00
case 0 :
return & v . state
case 1 :
return & v . sizeCache
case 2 :
return & v . unknownFields
default :
return nil
}
}
file_pulumi_language_proto_msgTypes [ 19 ] . Exporter = func ( v interface { } , i int ) interface { } {
2024-06-17 17:10:55 +00:00
switch v := v . ( * GenerateProjectRequest ) ; i {
Pass root and main info to language host methods (#14654)
<!---
Thanks so much for your contribution! If this is your first time
contributing, please ensure that you have read the
[CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md)
documentation.
-->
# Description
<!--- Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context. -->
This is two changes rolled together in a way.
Firstly passing some of the data that we pass on language runtime
startup to also pass it to Run/GetRequiredPlugins/etc. This is needed
for matrix testing, as we only get to start the language runtime up once
for that but want to execute multiple programs with it.
I feel it's also a little more consistent as we use the language
runtimes in other contexts (codegen) where there isn't really a root
directory, and aren't any options (and if we did do options the options
for codegen are not going to be the same as for execution). It also
means we can reuse a language host for shimless and substack programs,
as before they heavily relied on their current working directory to
calculate paths, and obviosly could only take one set of options at
startup. Imagine a shimless python package + a python root program, that
would have needed two startups of the python language host to deal with,
this unblocks it so we can make the engine smarter and only use one.
Secondly renaming some of the fields we pass to
Run/GetRequiredPlugins/etc today. `Pwd` and `Program` were not very
descriptive and had pretty non-obvious documentation:
```
string pwd = 3; // the program's working directory.
string program = 4; // the path to the program to execute.
```
`pwd` will remain, although probably rename it to `working_directory` at
some point, because while today we always start programs up with the
working directory equal to the program directory that definitely is
going to change in the future (at least for MLCs and substack programs).
But the name `pwd` doesn't make it clear that this was intended to be
the working directory _and_ the directory which contains the program.
`program` was in fact nearly always ".", and if it wasn't that it was
just a filename. The engine never sent a path for `program` (although we
did have some unit tests to check how that worked for the nodejs and
python hosts).
These are now replaced by a new structure with (I think) more clearly
named and documented fields (see ProgramInfo in langauge.proto).
The engine still sends the old data for now, we need to update
dotnet/yaml/java before we break the old interface and give Virtus Labs
a chance to update [besom](https://github.com/VirtusLab/besom).
## Checklist
- [x] I have run `make tidy` to update any new dependencies
- [x] I have run `make lint` to verify my code passes the lint check
- [ ] I have formatted my code using `gofumpt`
<!--- Please provide details if the checkbox below is to be left
unchecked. -->
- [x] I have added tests that prove my fix is effective or that my
feature works
<!---
User-facing changes require a CHANGELOG entry.
-->
- [ ] I have run `make changelog` and committed the
`changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the
Pulumi Cloud,
then the service should honor older versions of the CLI where this
change would not exist.
You must then bump the API version in
/pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi
Cloud API version
<!-- @Pulumi employees: If yes, you must submit corresponding changes in
the service repo. -->
2023-12-10 17:30:51 +00:00
case 0 :
return & v . state
case 1 :
return & v . sizeCache
case 2 :
return & v . unknownFields
default :
return nil
}
}
file_pulumi_language_proto_msgTypes [ 20 ] . Exporter = func ( v interface { } , i int ) interface { } {
2024-06-17 17:10:55 +00:00
switch v := v . ( * GenerateProjectResponse ) ; i {
2024-06-06 08:21:46 +00:00
case 0 :
return & v . state
case 1 :
return & v . sizeCache
case 2 :
return & v . unknownFields
default :
return nil
}
}
file_pulumi_language_proto_msgTypes [ 21 ] . Exporter = func ( v interface { } , i int ) interface { } {
2024-06-17 17:10:55 +00:00
switch v := v . ( * GeneratePackageRequest ) ; i {
case 0 :
return & v . state
case 1 :
return & v . sizeCache
case 2 :
return & v . unknownFields
default :
return nil
}
}
file_pulumi_language_proto_msgTypes [ 22 ] . Exporter = func ( v interface { } , i int ) interface { } {
switch v := v . ( * GeneratePackageResponse ) ; i {
case 0 :
return & v . state
case 1 :
return & v . sizeCache
case 2 :
return & v . unknownFields
default :
return nil
}
}
file_pulumi_language_proto_msgTypes [ 23 ] . Exporter = func ( v interface { } , i int ) interface { } {
switch v := v . ( * PackRequest ) ; i {
case 0 :
return & v . state
case 1 :
return & v . sizeCache
case 2 :
return & v . unknownFields
default :
return nil
}
}
file_pulumi_language_proto_msgTypes [ 24 ] . Exporter = func ( v interface { } , i int ) interface { } {
2023-07-27 21:39:36 +00:00
switch v := v . ( * PackResponse ) ; i {
case 0 :
return & v . state
case 1 :
return & v . sizeCache
case 2 :
return & v . unknownFields
default :
return nil
}
}
2024-06-17 17:10:55 +00:00
file_pulumi_language_proto_msgTypes [ 27 ] . Exporter = func ( v interface { } , i int ) interface { } {
switch v := v . ( * RuntimeOptionPrompt_RuntimeOptionValue ) ; i {
case 0 :
return & v . state
case 1 :
return & v . sizeCache
case 2 :
return & v . unknownFields
default :
return nil
}
}
2022-10-04 08:58:01 +00:00
}
2024-06-17 17:10:55 +00:00
file_pulumi_language_proto_msgTypes [ 16 ] . OneofWrappers = [ ] interface { } {
2022-10-04 08:58:01 +00:00
( * RunPluginResponse_Stdout ) ( nil ) ,
( * RunPluginResponse_Stderr ) ( nil ) ,
( * RunPluginResponse_Exitcode ) ( nil ) ,
2022-06-11 07:52:24 +00:00
}
type x struct { }
out := protoimpl . TypeBuilder {
File : protoimpl . DescBuilder {
GoPackagePath : reflect . TypeOf ( x { } ) . PkgPath ( ) ,
2022-07-12 13:45:03 +00:00
RawDescriptor : file_pulumi_language_proto_rawDesc ,
2024-06-17 17:10:55 +00:00
NumEnums : 1 ,
NumMessages : 33 ,
2022-06-11 07:52:24 +00:00
NumExtensions : 0 ,
NumServices : 1 ,
} ,
2022-07-12 13:45:03 +00:00
GoTypes : file_pulumi_language_proto_goTypes ,
DependencyIndexes : file_pulumi_language_proto_depIdxs ,
2024-06-17 17:10:55 +00:00
EnumInfos : file_pulumi_language_proto_enumTypes ,
2022-07-12 13:45:03 +00:00
MessageInfos : file_pulumi_language_proto_msgTypes ,
2022-06-11 07:52:24 +00:00
} . Build ( )
2022-07-12 13:45:03 +00:00
File_pulumi_language_proto = out . File
file_pulumi_language_proto_rawDesc = nil
file_pulumi_language_proto_goTypes = nil
file_pulumi_language_proto_depIdxs = nil
2020-02-28 11:53:47 +00:00
}