Commit Graph

74 Commits

Author SHA1 Message Date
Julien P 1fc8707c73
[auto/nodejs] always run cleanup for refresh and destroy commands ()
# Description

Ensure we always wait for the log promise and run cleanup for `refresh`
and `destroy` to ensure log files get removed and any open pipes get
closed.

Fixes https://github.com/pulumi/pulumi/issues/14879

## Checklist

- [ ] I have run `make tidy` to update any new dependencies
- [ ] 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. -->
- [ ] I have added tests that prove my fix is effective or that my
feature works
<!--- 
User-facing changes require a CHANGELOG entry.
-->
- [x] 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-20 09:19:35 +00:00
Julien P 1a387d4c8e
[auto/nodejs] don't mutate original stack settings when saving ()
<!--- 
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

When writing out the stack settings, some keys get renamed
(`secretsProvider` -> `secretsprovider`). We were mutating the stack
settings object in place instead of working on a copy.

Fixes https://github.com/pulumi/pulumi/issues/14003

## Checklist

- [ ] I have run `make tidy` to update any new dependencies
- [ ] 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. -->
- [ ] I have added tests that prove my fix is effective or that my
feature works
<!--- 
User-facing changes require a CHANGELOG entry.
-->
- [x] 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-19 15:24:20 +00:00
Komal bd6c14b66b
[Automation API / Nodejs] - Environment functions ()
<!--- 
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. -->

Add nodejs automation API support for adding and removing environments
for stack configuration.

Fixes https://github.com/pulumi/pulumi/issues/14795

## 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.
-->
- [x] 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-11 16:14:10 +00:00
Fraser Waters eb4bec4dce
Update node sdk to use typescript definitions for grpc and protobufs. ()
Updates the node SDK to have types for the generated protobufs and grpc
services. No more `any`.

I don't think these types show up on any user facing parts of the SDK.
The two places they could show up are the mock monitor (but I've left
that as any for now) and the provider interfaces (which I've also left
alone for now).

But this fixes up most of our sdk internal code to have types, which
flagged a couple of oddities like assuming `Input<string>` was `string`
in the alias code, and a whole load of missing undefined checks.
2023-12-04 15:22:44 +00:00
Robert Fidler f32b16ac0e
add refresh option for up in NodeJS automation API ()
# Description

Adding the `refresh` option to `up` in the NodeJS automation API

Mirror of this PR adding support for `refresh` in `preview`
(https://github.com/pulumi/pulumi/issues/12740)
2023-11-02 11:05:31 +00:00
Thomas Gummerer f278fa9696
stack ls: remove misleading updateInProgress output for file backend ()
File backends currently do not support indicating whether an operation
is currently in progress or not. In the `stack ls --json` output we
always end up with a "updateInProgress = false" field, even when an
update is in progress. This is misleading.

Disable showing this erroneous and misleading output.

Fixes 

Based on Luke's comments in that issue, I believe we should merge this
as bug fix for the issue, and then open a separate feature request
tracking the implementation of tracking whether an update is in progress
in the file backend.

## 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.
-->
- [x] 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-10-27 07:33:07 +00:00
Justin Van Patten 6d37c88fbf
[auto/nodejs] Add support for the path option for config operations ()
Add support for the `--path` flag for config operations in Node.js
Automation API.

Part of https://github.com/pulumi/pulumi/issues/5506
Related: https://github.com/pulumi/pulumi/pull/12265
Related: https://github.com/pulumi/pulumi/pull/13052
Related: https://github.com/pulumi/pulumi-dotnet/pull/191
2023-10-22 06:19:25 +00:00
Justin Van Patten b22087715f
[auto/nodejs] Remove SxS check that's no longer needed ()
This change removes the SxS check in the Node.js Automation API since
it's blocking a customer scenario and isn't needed anymore now that
 has been addressed with .

The check was originally added in  to provide a helpful error
message when multiple versions of `@pulumi/pulumi` were used with inline
programs, which could cause clashes with global state. Since then, we've
changed how state is stored to allow parallel execution of multiple
inline programs with . However, the SxS checks were not removed as
part of that change.

A customer recently hit the error associated with the SxS check. They
are creating a Next.js program that runs Pulumi operations as inline
programs. Next.js ends up loading modules multiple times in a way that
confuses the SxS checker, causing the error to be thrown, even though it
wouldn't have been a problem.

Fixes 
2023-10-11 18:09:58 +00:00
Pat Gavlin af8f3234de [apitype] Add RetainOnDelete to StepEventStateMetadata
This flag is necessary for parity between the CLI's event renderer and
the renderer used by the Cloud.
2023-06-26 12:50:39 -07:00
Joe Duffy 9e8435caec Add a better error message for invalid NodeJS AutoAPI workdir
If you supply a workDir to a NodeJS AutoAPI LocalWorkspace, it
does not validate its correctness, and proceeds to use it when
trying to spawn commands. That leads to misleading and confusing
"Command failed with ENOENT: pulumi version" error messages,
making it look like the issue is a missing `pulumi` binary on
your PATH. This changes to eagerly check and issue a more
friendly error message. Fixes .
2023-06-24 11:57:22 -07:00
susanev 031b2958f1 fix some links
Signed-off-by: susanev <susan.ra.evans@gmail.com>
2023-05-19 19:39:26 -07:00
Robbie McKinstry 9658df87e7
This commit safely replaces empty interfaces with type aliases.
Empty interfaces have no effect, even when they are subtyping
other interfaces. An empty interface is always equivalent to its supertype.
They can be safely replaced with type aliases, which better express
the semantic equivalence between the two types.
2023-05-11 23:10:00 -04:00
Robbie McKinstry d6fd384e63
Eliminate unnecessary double negations.
This commit removes instances of prefix-!! where the value
would already be coerced into a boolean. It also removes
instances where the "optional chaining" operator (?.)
would suffice.
2023-05-09 18:35:59 -04:00
Robbie McKinstry e05a3bd81c
Apply autoformat
This commit applies the Rome autoformatter to the Node SDK.
These changes are automatically produced. To reproduce these
changes, run `make format` from inside sdk/nodejs.
2023-04-28 18:27:10 -04:00
Robbie McKinstry c0c3ac09f0
Update sdk/nodejs/automation/stack.ts
Co-authored-by: Abhinav Gupta <abhinav@pulumi.com>
2023-04-25 16:44:27 -04:00
Robbie McKinstry 7d6b3c9444
Add --refresh flag to preview for NodeJS Automation API 2023-04-25 12:05:17 -04:00
Justin Van Patten 951e474470 [auto/nodejs] Add `excludeProtected` option for `destroy`
This change adds an `excludeProtected` option for `destroy`.
2023-04-24 12:12:11 -07:00
Fraser Waters 7ef6f61b11 Support WhoAmI in automation api for old CLI versions 2023-03-22 13:30:08 +00:00
bors[bot] 8d88744d25
Merge
12374: whoami: Add --json flag, expose everything in Auto API r=abhinav a=mrod-io

<!--- 
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

* Adds `--json` flag to `pulumi whoami` (CLI)
* Adds `url` and `organizations` to WhoAmIResult in NodeJS, Go and Python (automation API)

I sanity tested the auto api in the 3 runtimes and the cli output looks like:

```bash
$ pulumi whoami -j
{
  "user": "me",
  "organizations": [
    "me",
    "company"
  ],
  "url": "https://app.pulumi.com/me"
}
```

<!--- Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. -->

Fixes # https://github.com/pulumi/pulumi/issues/10356

## Checklist

<!--- 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.
-->
- [x] 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 Service,
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 Service API version
  <!-- `@Pulumi` employees: If yes, you must submit corresponding changes in the service repo. -->


12397: Changelog and go.mod updates for v3.57.1 r=abhinav a=pulumi-bot

bors merge

Co-authored-by: Matthew Rodrigues <matthew.rodrigues@starburstdata.com>
Co-authored-by: Abhinav Gupta <abhinav@pulumi.com>
Co-authored-by: github-actions <github-actions@github.com>
2023-03-09 17:11:34 +00:00
Matthew Rodrigues 5e3cb03cf7 Add url and organizations to WhoAmIResult for NodeJS Automation API 2023-03-08 09:30:07 -05:00
Justin Van Patten 980a28f80a [auto/nodejs] Fixes username for remote workspaces
When a git username is specified for remote workspaces, we were using the wrong CLI flag. It should be `--remote-git-auth-username` not `--remote-git-username`. This change fixes this and adds tests to confirm we're using the right flag names for all the various remote workspace options.
2023-02-24 11:31:49 +08:00
bors[bot] d5831927be
Merge
11943: Test and fix for nodejs automation api r=Frassle a=Frassle

nodejs automation api was setting the envvar PULUMI_CONFIG for every pulumi command it called, this tripped up the dotnet sdk which only expects PULUMI_CONFIG to be set to a valid JSON string (not the empty string).

Looks like this was just a slightly confused bit of code to try and deal with parallel programs, I've moved it out of the workspace part of automation api and fixed up the inline server to deal with parallel programs correctly instead.

Fixes 

Co-authored-by: Fraser Waters <fraser@pulumi.com>
2023-01-23 08:52:19 +00:00
Fraser Waters 0251f7331e Test and fix for nodejs automation api 2023-01-23 08:26:58 +00:00
bors[bot] e819661b5a
Merge
11659: Add stack tag support for nodejs automation api sdk r=RobbieMcKinstry a=mrod-io

<!--- 
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

Adds stack tag management support to the **nodejs** automation api sdk (https://github.com/pulumi/pulumi/issues/5681).

Before I move on to other language/runtime SDKs, I'd like to get a quick sanity check on this nodejs implementation, since they will follow a similar pattern 👍 . There is no changelog for now; this won't be merged as-is. Thank you! 🙏😄 

<!--- Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. -->

Fixes: https://github.com/pulumi/pulumi/issues/5681

## Checklist

<!--- 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 Service,
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 Service API version~~
  <!-- `@Pulumi` employees: If yes, you must submit corresponding changes in the service repo. -->


Co-authored-by: Matthew Rodrigues <matthew.rodrigues@starburstdata.com>
Co-authored-by: Robbie McKinstry <robbie@pulumi.com>
2023-01-19 23:47:14 +00:00
Justin Van Patten 396711611e [auto] Add SkipInstallDependencies option for remote workspaces 2022-12-19 10:27:01 -05:00
Matthew Rodrigues dd6ab403b2 Add stack tag support for nodejs automation api sdk 2022-12-14 22:27:56 -05:00
aq17 56d3a2efb3 attempt to select stack then create 2022-11-18 11:06:20 -08:00
Justin Van Patten 31bf640375 [auto/nodejs] Test remote operations
Also cleans up some error messages to be consistent with the CLI and other languages.
2022-11-09 05:26:07 -08:00
Justin Van Patten 4873a7796b [auto/nodejs] Support for remote operations 2022-10-28 12:56:30 -07:00
Zaid Ajaj 80674c00d7 [auto] detect concurrent update error from local backend 2022-10-26 17:02:47 +02:00
bors[bot] 7711564193
Merge
10955: Add new install plugin from server function r=jaxxstorm a=jaxxstorm

Add the ability to install plugins from a server.

Co-authored-by: Lee Briggs <lee@leebriggs.co.uk>
Co-authored-by: Fraser Waters <fraser@pulumi.com>
2022-10-24 02:52:30 +00:00
Fraser Waters 662229e485 Reinstate kind in remove_plugin for backcompat 2022-10-23 19:35:06 +01:00
Lee Briggs beca3116b6
lint 2022-10-21 16:51:19 -07:00
Lee Briggs 979cb865c8
readd default resource kind to ts and python sdks 2022-10-21 09:29:59 -07:00
Kyle Pitzen 5cfad4a909 fix: Allows for parallel pulumi programs to run in the node runtime 2022-10-13 07:15:25 -04:00
Lee Briggs cd442d1e22
remove default kind from plugin commands 2022-10-11 07:51:32 -07:00
Lee Briggs 56e12e9140
Add new install plugin from server function 2022-10-06 18:40:02 -07:00
bors[bot] 5493b82530
Merge
10622: Enable ESModule interoperability r=RobbieMcKinstry a=RobbieMcKinstry

<!--- 
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

This PR enables ESModule interop for the NodeJS SDK. By enabling interop, we should in theory remove subtle bugs from Pulumi programs that assume our libraries are interopable. In practice, only a few modules weren't already interoperable. Nevertheless, enabling this compiler flag will require future code to be compatible with ESModules, potentially eliminating future bugs.

<!--- Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. -->

Fixes https://github.com/pulumi/pulumi/issues/10621

This PR is required for bundling the NodeJS runtime (https://github.com/pulumi/pulumi/issues/10210).

## Checklist

<!--- Please provide details if the checkbox below is to be left unchecked. -->
- [ ] I have added tests that prove my fix is effective or that my feature works
<!--- 
User-facing changes require a CHANGELOG entry.
-->
- [x] I have updated the [CHANGELOG-PENDING](https://github.com/pulumi/pulumi/blob/master/CHANGELOG_PENDING.md) file with my change
<!--
If the change(s) in this PR is a modification of an existing call to the Pulumi Service,
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 Service API version
  <!-- `@Pulumi` employees: If yes, you must submit corresponding changes in the service repo. -->


Co-authored-by: Robbie McKinstry <robbie@pulumi.com>
2022-09-21 22:20:53 +00:00
bors[bot] 4cb43b5a1d
Merge
10806: [sdk/nodejs] Mark internal APIs `@internal` to filter from SDK docs r=justinvp a=justinvp

These exported APIs aren't intended for public use. Marking them as ``@internal`` makes TypeScript remove them from the `.d.ts` files and removes them from our SDK docs.

10810: Update automation api secrets provider docstring link r=Frassle a=mrod-io

<!--- 
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.
-->
Updates an outdated docstring link I stumbled across while using Pulumi Automation API. 

There is no existing issue.

This is a non-code change and I believe it could be labeled `impact/no-changelog-required`; as such I have not made Changelog updates as per the [updated guidelines](385d08218a). If I am mistaken please let me know!

<!--- Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. -->

## Checklist


<!--- Please provide details if the checkbox below is to be left unchecked. -->
- [ ] 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 Service,
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 Service API version
  <!-- `@Pulumi` employees: If yes, you must submit corresponding changes in the service repo. -->


Co-authored-by: Justin Van Patten <jvp@justinvp.com>
Co-authored-by: Matthew Rodrigues <matthew.rodrigues@starburstdata.com>
2022-09-21 17:42:52 +00:00
Matthew Rodrigues 8f995860e1 Update automation api secrets provider docstring link 2022-09-20 20:10:02 -04:00
Justin Van Patten dc7f3f0c66 [sdk/nodejs] Mark internal APIs `@internal` to filter from SDK docs
These exported APIs aren't intended for public use. Marking them as `@internal` makes TypeScript remove them from the `.d.ts` files and removes them from our Node.js SDK docs.
2022-09-20 11:54:06 -07:00
Robbie McKinstry e978311216
Enable ESModule interoperability 2022-09-20 10:34:00 -04:00
Anton Tayanovskyy a13426ded8
[nodejs/auto] Fix incremental behavior of onStdout ()
* Fix incrementality of onStdout

* Test that onOutput is called more than once

* Add a CHANGELOG entry
2022-09-12 12:41:08 -04:00
Kyle Pitzen 490be1cc52
fix(automation): runPulumiCommand failed to call onOutput when provided () 2022-09-06 12:18:31 -04:00
Fraser Waters 615ae91477
Add getOrganization to nodejs and python ()
* Add getOrganization to nodejs and python

* Add to CHANGELOG

* lint

* lint

* format

* Fix python test

* Fix nodejs settings

* Add contextproperty

* Backcompat python kwargs
2022-08-31 10:33:29 +01:00
Kyle Pitzen 26549ab52d
fix(sdk/nodejs): resolves issue with multiple parallel shell processes () 2022-08-29 16:44:03 -04:00
Aaron Friel d54aaf1615
[sdk/nodejs] Use loopback addresses for providers & automation API () 2022-08-25 15:40:07 -07:00
Aaron Friel 7781785aa4
feat(automation): Add options to configure logging, tracing ()
* feat(automation): Add options to configure logging, tracing

* chore: changelog

* chore: Clean up shipped/unshipped

* refactor: consolidate --debug and --tracing opts
2022-08-11 23:30:45 -07:00
Anton Tayanovskyy f6fc099792
Avoid importing typescript unless necessary ()
* Avoid importing typescript in node SDK where possible

* Lazy-load runtime/closure in dynamic/index.ts

* More targeted runtime import in config.ts

* More precise imports in run-policy-pack/run.ts

* More precise imports for dynamic-provider/index.ts

* More precise imports for automation/server.ts

* Share typescript compiler option loading func in run.ts and run-policy-pack/run.ts

* Lazy-load ts-node that depends on TypeScript

* Break module import cycle

* Fix node lint
2022-07-20 17:38:55 -04:00
Ian Wahbe a2d926a156
[auto] Add flag to show secrets ()
* Update TS

* Update Python

* Make backwards compatible

* Add go

* Add C#

* CL

* Fix lints

* Fix python defaults

* Add XML config
2022-06-24 10:00:09 -07:00