pulumi/pkg/cmd/pulumi
Fraser Waters 6e986f90af
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
..
convert_testdata Refactor convert command to add entrypoint for pulumi convert debugging 2022-10-01 15:40:17 -07:00
pcl_convert_testdata Support PCL as a convert input (and output) 2022-11-11 10:45:40 +00:00
testdata policy publish: default to default-org if possible (#14090) 2023-10-05 16:51:06 +00:00
about.go [cli] Add support for environments (#14140) 2023-10-10 01:35:39 +00:00
about_env.go [cli] Colorize table headers (#14557) 2023-11-14 22:52:57 +00:00
about_test.go Move about information to language plugins (#10392) 2022-08-15 14:55:04 +01:00
ai.go Kp/adds root pulumi ai command (#13808) 2023-09-05 23:18:03 +00:00
ai_web.go Addresses initial Org Search feedback (#13920) 2023-09-12 00:18:43 +00:00
cancel.go Add tokens.StackName (#14487) 2023-11-15 07:44:54 +00:00
config.go [esc] Add commands for managing stack environments (#14628) 2023-11-22 05:04:14 +00:00
config_env.go [esc] Add a command to create an ESC env from stack config (#14634) 2023-11-22 20:57:02 +00:00
config_env_add.go [esc] Add commands for managing stack environments (#14628) 2023-11-22 05:04:14 +00:00
config_env_add_test.go [esc] Add commands for managing stack environments (#14628) 2023-11-22 05:04:14 +00:00
config_env_init.go [esc] Add a command to create an ESC env from stack config (#14634) 2023-11-22 20:57:02 +00:00
config_env_init_test.go [esc] Add a command to create an ESC env from stack config (#14634) 2023-11-22 20:57:02 +00:00
config_env_rm.go [esc] Add commands for managing stack environments (#14628) 2023-11-22 05:04:14 +00:00
config_env_rm_test.go [esc] Add commands for managing stack environments (#14628) 2023-11-22 05:04:14 +00:00
config_env_test.go [esc] Add a command to create an ESC env from stack config (#14634) 2023-11-22 20:57:02 +00:00
config_test.go [cli] Include config from ESC in `pulumi config` (#14560) 2023-11-21 10:44:45 +00:00
console.go service to cloud 2023-04-08 09:49:37 -07:00
convert-trace.go Reimport appdash from our mirror (#14701) 2023-11-30 14:21:35 +00:00
convert.go Pass root and main info to language host methods (#14654) 2023-12-10 17:30:51 +00:00
convert_test.go Send args from convert to converter plugin (#13973) 2023-09-18 11:01:13 +00:00
crypto.go Fix config set-all saving secret provider configuration 2023-04-12 15:21:29 +01:00
destroy.go Replace ResourceSet with a generic set type (#14724) 2023-12-03 23:20:43 +00:00
doc.go Document Go packages (#6009) 2021-01-11 11:07:59 -07:00
env.go [cli] Include config from ESC in `pulumi config` (#14560) 2023-11-21 10:44:45 +00:00
errors.go Be more consistent about using ` for quoting commands (#10434) 2022-08-18 15:31:22 +01:00
gen_completion.go all: Reformat with gofumpt 2023-03-03 09:00:24 -08:00
gen_markdown.go Consecutive markdown heading levels CLI docs (#13822) 2023-09-28 17:36:24 +00:00
import.go Add --import-file to pulumi preview (#14548) 2023-12-05 08:32:40 +00:00
import_test.go Allow anything in resource names (#14107) 2023-11-20 08:59:00 +00:00
install.go Pass root and main info to language host methods (#14654) 2023-12-10 17:30:51 +00:00
login.go [backend] Separate login and backend creation (#14045) 2023-09-26 14:24:36 +00:00
logout.go Remove Logout logic from Backend interface (#13951) 2023-09-18 17:21:32 +00:00
logs.go [cli] Add support for environments (#14140) 2023-10-10 01:35:39 +00:00
logs_test.go Use `assert.NoError` rather than `assert.Nil` (#14233) 2023-10-13 09:46:07 +00:00
main.go Use slice.Prealloc instead of make([]T, 0, ...) 2023-06-29 11:27:50 +01:00
new.go Pass root and main info to language host methods (#14654) 2023-12-10 17:30:51 +00:00
new_acceptance_test.go [test] fix `TestCreatingProjectWithEmptyConfig` flakiness (#14777) 2023-12-08 23:00:49 +00:00
new_test.go [test] fix `TestCreatingProjectWithEmptyConfig` flakiness (#14777) 2023-12-08 23:00:49 +00:00
org.go Removes PULUMI_DEV flag for org search features (#13888) 2023-09-06 19:32:44 +00:00
org_search.go Add token info to whoami (#13206) 2023-09-23 12:46:11 +00:00
org_search_ai.go Add token info to whoami (#13206) 2023-09-23 12:46:11 +00:00
org_search_ai_test.go Add token info to whoami (#13206) 2023-09-23 12:46:11 +00:00
org_search_test.go Add token info to whoami (#13206) 2023-09-23 12:46:11 +00:00
package.go Add an envar to disable automatic provider installation (#14083) 2023-10-03 15:35:23 +00:00
package_extract_mapping.go Fix index out of range in get-mapping (#14124) 2023-10-06 21:28:38 +00:00
package_extract_schema.go Add gen-sdk sub-command 2022-09-14 17:07:05 +02:00
package_gen_sdk.go Return diagnostics from GeneratePackage (#14661) 2023-12-05 17:47:52 +00:00
package_pack_sdk.go Add hidden sdk-pack command 2023-08-08 17:53:04 +01:00
package_publish.go additional comment as per review 2023-06-01 10:00:31 -07:00
plugin.go Warn about ambient plugins loaded from $PATH 2023-08-08 13:11:34 +01:00
plugin_install.go Check if Plugin is bundled before installing 2023-08-07 15:33:12 +01:00
plugin_install_test.go Check if Plugin is bundled before installing 2023-08-07 15:33:12 +01:00
plugin_ls.go [cli] Colorize table headers (#14557) 2023-11-14 22:52:57 +00:00
plugin_rm.go Adjust output to be more readable 2023-06-20 10:34:56 -07:00
policy.go [breaking] Changing the version of go.mod in sdk / pkg to be v3 2021-04-14 19:32:18 +01:00
policy_disable.go policy publish: default to default-org if possible (#14090) 2023-10-05 16:51:06 +00:00
policy_enable.go policy publish: default to default-org if possible (#14090) 2023-10-05 16:51:06 +00:00
policy_group_ls.go [cli] Colorize table headers (#14557) 2023-11-14 22:52:57 +00:00
policy_ls.go [cli] Colorize table headers (#14557) 2023-11-14 22:52:57 +00:00
policy_new.go Pass root and main info to language host methods (#14654) 2023-12-10 17:30:51 +00:00
policy_new_acceptance_test.go Use context.Background in tests (#14029) 2023-09-25 12:25:26 +00:00
policy_new_test.go Use context.Background in tests (#14029) 2023-09-25 12:25:26 +00:00
policy_publish.go policy publish: default to default-org if possible (#14090) 2023-10-05 16:51:06 +00:00
policy_publish_test.go policy publish: default to default-org if possible (#14090) 2023-10-05 16:51:06 +00:00
policy_rm.go policy publish: default to default-org if possible (#14090) 2023-10-05 16:51:06 +00:00
policy_validate.go policy publish: default to default-org if possible (#14090) 2023-10-05 16:51:06 +00:00
preview.go Add --import-file to pulumi preview (#14548) 2023-12-05 08:32:40 +00:00
preview_test.go Add --import-file to pulumi preview (#14548) 2023-12-05 08:32:40 +00:00
pulumi.go Validate snapshots from service on load (#14046) 2023-12-04 15:12:56 +00:00
pulumi_test.go {cli, httpstate}: Don't retry GetCLIVersionInfo 2023-06-20 10:08:33 -07:00
query.go Replace result.Result in Query with error (#13939) 2023-09-20 15:43:46 +00:00
refresh.go Fixing typo in pulumi_refresh (#14265) 2023-10-16 20:41:21 +00:00
replay_events.go Make `engine.NewEvent` type safe (#14590) 2023-11-16 16:54:03 +00:00
schema.go [codegen/schema] Add a schema checker (#7865) 2021-08-30 19:29:24 -07:00
schema_check.go all: Drop ioutil 2023-01-06 16:35:14 -08:00
stack.go Check qualified type for root stackness (#14714) 2023-12-04 10:36:51 +00:00
stack_change_secrets_provider.go Add tests for stackChangeSecretsProviderCmd (#13791) 2023-08-31 08:56:38 +00:00
stack_change_secrets_provider_test.go [test] fix `TestCreatingProjectWithEmptyConfig` flakiness (#14777) 2023-12-08 23:00:49 +00:00
stack_export.go cmd: Reduce noise from offerNew, setCurrent bool 2023-01-20 15:34:39 -08:00
stack_graph.go Allow anything in resource names (#14107) 2023-11-20 08:59:00 +00:00
stack_history.go Fix config set-all saving secret provider configuration 2023-04-12 15:21:29 +01:00
stack_import.go Add `pulumi state edit` utility. 2023-07-17 09:47:05 -07:00
stack_init.go service to cloud 2023-04-08 09:49:37 -07:00
stack_init_test.go service to cloud 2023-04-08 09:49:37 -07:00
stack_ls.go [cli] Colorize table headers (#14557) 2023-11-14 22:52:57 +00:00
stack_ls_test.go [test] fix `TestCreatingProjectWithEmptyConfig` flakiness (#14777) 2023-12-08 23:00:49 +00:00
stack_output.go Use slice.Prealloc instead of make([]T, 0, ...) 2023-06-29 11:27:50 +01:00
stack_output_fuzz_test.go cli/stack-ouput/test: Fix Powershell test failures 2023-01-30 07:58:47 -08:00
stack_output_test.go fix(cli/stack output): Don't escape HTML characters 2023-06-23 09:11:20 -07:00
stack_rename.go all: Reformat with gofumpt 2023-03-03 09:00:24 -08:00
stack_rm.go Support bailing from RunFunc (#13804) 2023-08-29 07:43:40 +00:00
stack_select.go Set the current project as ambient context on backends. 2023-03-03 20:32:42 +00:00
stack_tag.go [cli] Colorize table headers (#14557) 2023-11-14 22:52:57 +00:00
stack_test.go fix(cli/stack output): Don't escape HTML characters 2023-06-23 09:11:20 -07:00
stack_unselect.go include error in formatted message and explicitly check for an empty stack 2022-03-14 11:32:33 +01:00
state.go Replace Bail result with BailError (#13811) 2023-08-30 13:18:54 +00:00
state_delete.go Update help text for `pulumi state delete` (#14249) 2023-10-16 14:27:38 +00:00
state_edit.go `pulumi new` with existing project now can be bypassed (#14081) 2023-10-20 15:43:29 +00:00
state_edit_encoder.go Add `pulumi state edit` utility. 2023-07-17 09:47:05 -07:00
state_edit_test.go [`pulumi state edit`] handle multi-part EDITOR variables (i.e. `emacs -nw`) (#13922) 2023-09-12 15:34:03 +00:00
state_rename.go When changing parents also fix URNs (#13935) 2023-09-14 19:52:27 +00:00
state_rename_test.go Allow anything in resource names (#14107) 2023-11-20 08:59:00 +00:00
state_unprotect.go Replace Bail result with BailError (#13811) 2023-08-30 13:18:54 +00:00
state_upgrade.go Add tokens.StackName (#14487) 2023-11-15 07:44:54 +00:00
state_upgrade_test.go Add tokens.StackName (#14487) 2023-11-15 07:44:54 +00:00
terminal.go crypto/ssh/terminal is deprecated 2023-01-12 09:07:34 -08:00
terminal_test.go Fix negative page size panic (#10475) 2022-08-23 16:45:47 -04:00
up.go Pass root and main info to language host methods (#14654) 2023-12-10 17:30:51 +00:00
up_test.go all: Reformat with gofumpt 2023-03-03 09:00:24 -08:00
util.go [esc] Add commands for managing stack environments (#14628) 2023-11-22 05:04:14 +00:00
util_remote.go Policy remediations feature (#14080) 2023-10-09 18:31:17 +00:00
util_remote_test.go [cli] Experimental support for remote operations 2022-10-27 16:15:59 -07:00
util_test.go chore: Share unescaped JSON logic with makeJSONString 2023-06-23 09:52:06 -07:00
version.go [breaking] Changing the version of go.mod in sdk / pkg to be v3 2021-04-14 19:32:18 +01:00
view-trace.go Reimport appdash from our mirror (#14701) 2023-11-30 14:21:35 +00:00
watch.go [cli] Add support for environments (#14140) 2023-10-10 01:35:39 +00:00
whoami.go Fix panic in whoami (#14108) 2023-10-06 16:56:36 +00:00
whoami_test.go Fix panic in whoami (#14108) 2023-10-06 16:56:36 +00:00