Commit graph

839 commits

Author SHA1 Message Date
Evan Boyle c3dc2d54ab
Add user agent to the CLI, Go and Nodejs Automation API SDKs (#6935) 2021-04-30 07:26:23 -07:00
Komal 1ed3445ed4
[automation/*] - Optionally skip Automation API version check (#6882)
Co-authored-by: James Nugent <jen20@apple.com>
2021-04-27 20:54:27 -07:00
Ville Penttinen daa6045381
[automation/*] Add support for getting stack outputs using Workspace (#6859) 2021-04-26 16:32:30 -07:00
Evan Boyle f8a9698ca9
remove erroneous global promise rejection handler (#6864) 2021-04-26 08:27:41 -07:00
Komal 288d67d78b
[auto/*] - Bump min version (#6852) 2021-04-22 16:17:49 -07:00
Komal 61ce479241
Re-add [BREAKING] - Standardize stack select behavior (#6300) (#6840)
Co-authored-by: Paul Stack <public@paulstack.co.uk>
2021-04-22 14:10:39 +01:00
Levi Blackstone a94892aa2b
[sdk/nodejs] Handle providers for RegisterResourceRequest (#6795)
Resolve providers references and include the resulting refs in the
providers field of RegisterResourceRequest that was added in
d297db3.
2021-04-19 16:41:53 -06:00
Ismayil 4bafeee700
Fixes #6775: Duplicated Go modules (#6800) 2021-04-19 08:24:51 -07:00
stack72 9a8b17396d Ensuring the minimum version of the CLI is 3.0.0 for the Automation API in 3.0 release 2021-04-19 09:12:06 +01:00
stack72 5679496127 [deps] Ensuring pulumi/pulumi pkg references pulumi sdk v3.0.0-beta.2 2021-04-14 19:32:18 +01:00
Paul Stack f6fea7fafb [cli] Removing the deprecated pulumi history command (#6724) 2021-04-14 19:32:18 +01:00
Paul Stack e955a6b06a Refactor Mock newResource and call to accept property bag rather than individual args (#6672) 2021-04-14 19:32:18 +01:00
Evan Boyle 036344679a Enable nodejs dynamic provider caching by default on program side (#6704) 2021-04-14 19:32:18 +01:00
pulumi-bot 73a66f48ea [breaking] Changing the version of go.mod in sdk / pkg to be v3 2021-04-14 19:32:18 +01:00
pulumi-bot 3082ebe275 Ensuring that Pulumi automation api is minimum 3.0.0 CLI version 2021-04-14 19:32:18 +01:00
Paul Stack 3fad2e5329 Removing x namespace from go/python/nodejs automation packages (#6518) 2021-04-14 19:32:18 +01:00
Levi Blackstone d297db3d59
[sdk/proto] Add providers field to RegisterResourceRequest (#6761) 2021-04-13 15:19:24 -06:00
Komal 0c4e1a33e0
[automation/python - Expose structured logging (#6527) 2021-04-13 12:58:19 -07:00
Evan Boyle e13b74afe0
do not run the promise checker for inline programs when an error has occured (#6758) 2021-04-13 11:39:34 -07:00
Evan Boyle fd9f2710b6
Revert "[sdk/nodejs] Add multiple VM contexts support to closure serialization (#6648)" (#6759)
This reverts commit ee2f65510b.
2021-04-13 10:27:59 -07:00
Lee Zen 126c7849a3
[nodejs] Fix serialization/deserialization for StackSettings (#6754) 2021-04-12 16:49:49 -07:00
Daniel Sokolowski ee2f65510b
[sdk/nodejs] Add multiple VM contexts support to closure serialization (#6648) 2021-04-12 09:13:47 -07:00
Evan Boyle 3d5ede69af
Set main for default projects in Automation API (#6743) 2021-04-09 20:30:11 -07:00
Justin Van Patten f7cc19f89d
[sdk/nodejs] Keep prompt values prompt in construct (#6522)
In order to support prompt values in multi-lang components, if an input value is prompt, keep it as-is instead of wrapping it in an Output.
2021-04-09 14:36:22 -07:00
Evan Boyle 35b4c18f6d
explicitly create event log file for nodejs automation api (#6730) 2021-04-08 14:31:56 -07:00
Ville Penttinen d93e5acf67
[automation/dotnet] Expose WorkspaceStack.GetOutputsAsync (#6699) 2021-04-07 16:23:38 -07:00
Evan Boyle b6c1319b4e
[sdk/nodejs] Improve handling of log related errors (#6714) 2021-04-06 19:34:15 -07:00
Evan Boyle 322760b243
Add program side dynamic provider caching behind env var (#6673) 2021-04-05 14:37:45 -07:00
Justin Van Patten 394f79f27f
[sdk/nodejs] Fix construct to wait for RPC operations to complete (#6452)
This change fixes the provider implementation of `Construct` for multi-lang components written in Node.js to wait for any in-flight RPCs to finish before returning the results, s.t. all registered child resources are created.

In additional, invocations of `construct` are now serialized so that each call runs one after another, avoiding concurrent runs, since `construct` modifies global state. We'll follow-up with a more general concurrency fix to allow nested `construct` calls within the same provider.
2021-04-05 11:11:27 -07:00
Pat Gavlin 55ecf7a81e
Run SDK lint jobs (#6674)
Just what it says on the tin. Fixes #6628.
2021-04-01 11:23:47 -07:00
Vivek Lakshmanan 2b75dd6027
Merge pull request #6630 from mweathers/restSerialization
Be resilient to 3rd party libraries placing a __rest function on the global object.
2021-04-01 10:33:35 -07:00
Komal 55a0c1fc8e
[automation/go,nodejs,python] - Don't roundtrip project settings if file already exists. (#6669) 2021-03-31 11:00:11 -07:00
Komal 7671e85440
[automation/go,nodejs,python] - Respect existing project settings (#6655) 2021-03-31 07:51:11 -07:00
Evan Boyle d098f9181b
fix nodejs resource functions to properly propagate errors (#6644) 2021-03-30 20:16:25 -07:00
Evan Boyle 1140e9f2bf
Add provider side caching for dynamic provider deserialization (#6657) 2021-03-30 19:15:08 -07:00
Anton Tayanovskyy 65396a25fc
Make .old and .new nullable on StateEventMetadata (#6625) 2021-03-29 10:43:57 -04:00
Matt Weathers aed070c8e6 Be resilient to 3rd party libraries placing a __rest function on the global object. 2021-03-26 21:23:48 -05:00
James Nugent c1ce3da3e6
Make custom available to Mocks::newResource (#6551)
This commit adds a new optional parameter to the `newResource` function
of the `Mocks` interface for TypeScript. This can be useful when writing
tests which assert differing behavior between Custom and Component
resources.

Although the new parameter will always be set, the paramteter is marked
as optional in order to maintain backwards compatibility with existing
implementations of `Mocks`.

The tests are updated to verify that `custom` is set appropriately.

Co-authored-by: Luke Hoban <luke@pulumi.com>
2021-03-25 14:22:14 +11:00
Komal 60cc4be9d3
[automation/*] - Add min version test for prerelease (#6612) 2021-03-24 14:00:33 -07:00
Justin Van Patten 4c1d4f89ee
[sdk/nodejs] Mark an internal function as internal (#6615) 2021-03-24 20:00:08 +00:00
Komal 5e5c6ffb50
[automation/nodejs,go,python] - Expose pulumiVersion as string (#6604) 2021-03-23 15:09:50 -07:00
Komal 768db3e067
[automation/nodejs] - Implement min version checking (#6580) 2021-03-22 23:04:36 -07:00
Anton Tayanovskyy 22f332e094
Fix docstring on node log.error and other SDK equivalents (#6573)
* Fix docstring of log.error across SDKs to explain non-termination

* Accept PR feedback, briefer docstrings.
2021-03-18 13:57:10 -04:00
Paul Stack 1d3c9edb6c
Ensure that make brew works as expected rather than passing empty version (#6566)
Fixes:#6565

As part of #6460, the logic for determing the version of the build was
moved to be a dependency on pulumictl.

Unfortunately, the homebrew installs use the "make dist" command to
build + install Pulumi to the user maching and as that would have a
dependency on pulumictl and it not existing on the user machine, it
would pass an empty version to the ldflag

This then manifested to the user as:

```
▶ pulumi version
warning: A new version of Pulumi is available. To upgrade from version '0.0.0' to '2.22.0', run
   $ brew upgrade pulumi
or visit https://pulumi.com/docs/reference/install/ for manual instructions and release notes.
```

We are able to mitigate this behaviour by bringing back the get-version
script and using that script as part of the make brew installation

We can see that the versions are the same between the 2 different
installation techniques

```
make dist <------- uses pulumict
DIST:
go install -ldflags "-X github.com/pulumi/pulumi/sdk/v2/go/common/version.Version=2.24.0-alpha.1616029310+787eb70a" github.com/pulumi/pulumi/sdk/v2/dotnet/cmd/pulumi-language-dotnet
DIST:
BUILD:
```

```
make brew <----- uses the legacy script
▶ make brew
BREW:
go install -ldflags "-X github.com/pulumi/pulumi/sdk/v2/go/common/version.Version=v2.24.0-alpha.1616029310+g787eb70a2" github.com/pulumi/pulumi/sdk/v2/dotnet/cmd/pulumi-language-dotnet
BREW:
```

A full post mortem will be carried out to ensure we mitigate these
types of errors going forward and that we are able to better test
these types of situations
2021-03-18 02:07:02 +00:00
Ville Penttinen 66f5d50a50
[automation/dotnet,nodejs,python] Specify exec-kind for refresh & destroy (#6530)
dotnet, nodejs and python automation APIs did not specify exec-kind for
refresh or destroy operations. This is now added following the same
logic from the go automation API.
2021-03-16 14:24:32 -07:00
Komal f5dc226a3c
[automation/nodejs] - Fix missing OpTypes and PreviewOptions (#6507) 2021-03-11 16:23:44 -08:00
Komal 1fc2ba48e2
[automation/nodejs] - Expose structured logging (#6454)
Co-authored-by: Luke Hoban <luke@pulumi.com>
2021-03-11 11:45:28 -08:00
Paul Stack c48ba37fcf
Migrate the version calculation to use pulumictl (#6460) 2021-03-10 19:03:29 +00:00
Paul Stack 20e84dfe9e
Upgrading Go to 1.16.x (#6470) 2021-03-09 20:05:23 +00:00
jakzo e78dea4979
serialize default parameters (#6397) 2021-02-25 21:21:10 -08:00
Mike Chen 256e8284d0
[automation] - Add diff to up and preview in automation API (#6413)
Co-authored-by: Mike Chen <mikechen@ip-192-168-1-8.ec2.internal>
2021-02-23 17:38:28 -08:00
Komal 8b665f7131
[automation] - Remove summary from PreviewResult (#6405) 2021-02-23 17:07:16 -08:00
Komal 5f4e687a1d
[automation] - Consume config set-all and rm-all commands (#6388) 2021-02-19 22:59:18 -08:00
Luke Hoban f7397bb798
[sdk/nodejs] Skip re-registrations of same package+version (#6387)
It is possible for the same version of the same provider SDK to be loaded multiple times in Node.js.  In this case, we might legitimately get mutliple registrations of the same resource.  It should not matter which we use, so we can just skip re-registering.  De-serialized resources will always be instances of classes from the first registered package.

Example layout this addresses.  Registrations of resources in `package3` at the same verrsion.

`node_modules`
  `@pulumi/pulumi`
  `package1`
    `node_modules`
      `package3`
  `package2`
    `node_modules`
      `package3`

Fixes #6258.
2021-02-20 10:06:32 +11:00
Komal a6b6437b49
[Automation] Fix python nested config parsing (#6349) 2021-02-17 10:16:35 -08:00
Justin Van Patten 0fe4978a7a
[sdk/nodejs] Update @grpc/grpc-js dependency (#6341) 2021-02-16 08:46:32 -08:00
Evan Boyle 8e58f5d682
Add pagination to pulumi stack history (#6292)
replaces the unreleased `--limit` flag with `--page` and `--page-size` to support full pagination
2021-02-09 16:20:01 -08:00
Evan Boyle eefc104c2b
Add --limit flag to pulumi stack history and consume from automation api (#6257)
Adds a `--limit` flag to `pulumi stack history. This allows limiting to the last few entries rather than fetching the entirety of a stack's update history (which can be quite slow for stacks with lots of updates). Example: `pulumi stack history --limit 1` fetches the last history entry only. 

`stack.up` and related operations in the Automation API have been updated to consume this change, drastically reducing overhead.
2021-02-08 10:49:57 -08:00
Evan Boyle decfed0679
Improve nodejs automation api inline error handling (#6237) 2021-02-02 14:37:03 -08:00
Evan Boyle 8c6865af29
Always read and write nodejs runtime options from/to the environment (#6076) 2021-01-26 14:59:32 -08:00
Luke Hoban 6a598bd704
Avoid toStringing Output in debuggablePromise (#6174)
Promise leak debugging was accidentally toStringing an Output, leading to a red herring for several users trying to understand what was causing promise leaks.

Related to #6153 and #5853.
2021-01-27 05:52:09 +11:00
Paul Stack ae9a6db36e
Add the ability to pulumi.unsecret an existing output (#6086)
Related: #5653

This will take an existing output and then unwrap the secret, and
return a new output

```
import * as pulumi from "@pulumi/pulumi";

const x = pulumi.secret("test")
export const xVal = x;

const y = pulumi.unsecret(x);
export const yVal = y;
```

```
▶ pulumi stack output
Current stack outputs (3):
    OUTPUT         VALUE
    xVal           [secret]
    yVal           test
```

Also adds the ability to check if an output is as secret:

```
import * as pulumi from "@pulumi/pulumi";

const x = pulumi.secret("test")
const isSecret = x.isSecret;

export const isSecretDeets = isSecret;
```
2021-01-14 20:36:52 +00:00
Komal 059402483b
[Automation API] Python Implementation (#5979)
Co-authored-by: evanboyle <evan@pulumi.com>
2021-01-12 16:55:59 -08:00
Roderik van der Veer f5c65c18e8
fix: typo to get the outputs while registering them in a mock (#6040)
Resolves: #6039
2021-01-12 10:49:39 -08:00
Komal 8e8129012e
[automation-api/nodejs] - Support recovery workflow (#6038) 2021-01-04 16:45:57 -08:00
Komal 1ef22c375d
Revert bulk config ops in nodejs auto-api (#6051) 2021-01-04 14:38:55 -08:00
Paul Stack ee776b3c33
Update PulumiStackType comments in dotnet and nodejs (#6028) 2020-12-30 23:02:18 +00:00
Luke Hoban 1ef2f10543
Allow serializeFunction to capture secrets (#6013)
Adds an opt-in `allowSecrets` flag to `serializeFunction` to allow it to capture secrets.  If passed, `serializeFunction` will now report back whether it captured any secrets.  This information can be used by callers to wrap the resulting text in a Secret value.

Fixes #2718.
2020-12-31 09:37:25 +11:00
Komal bc76068ae4
[auto/nodejs] - Parallelize config operations (#6022) 2020-12-29 15:40:22 -08:00
Pat Gavlin 23927e4bb1
Use beforeEach in NodeJS tests. (#5975)
Call `runtime._reset` prior to each test to ensure that the runtime is
in a consistent state.

Co-authored-by: Lee-Ming Zen <lee@pulumi.com>
2020-12-18 16:27:27 -08:00
Pat Gavlin 05a922b431
Add NodeJS resource ref unit tests. (#5969)
These tests cover the same scenarios that are coverted in the engine's
unit tests, but exercise the Node SDK's marshalling paths.

These changes include a few enhancements to the Node SDK's test APIs
that make it easier to more precisely control its behavior, and extend
the `Mocks` interface to allow the registration of component resources
to work properly.

Contributes to #5943.
2020-12-17 10:49:22 -08:00
Evan Boyle 268abea53b
bump nodejs test timeout for automation api (#5966) 2020-12-16 12:47:15 -08:00
Levi Blackstone 4d48ee0517
Enable resource reference feature by default (#5905)
* Enable resource reference feature by default

Unless the PULUMI_DISABLE_RESOURCE_REFERENCES flag
is explicitly set to a truthy value, the resource reference feature is now
enabled by default.

* Set AcceptResources in the language SDKs

This can be disabled by setting the `PULUMI_DISABLE_RESOURCE_REFERENCES` environment variable to a truthy value.

Co-authored-by: Justin Van Patten <jvp@justinvp.com>
2020-12-10 11:21:05 -07:00
Justin Van Patten 918615f072
[sdk/nodejs] Implement getResource in the mock monitor (#5914)
Otherwise, unit tests for programs that reference resources that have been registered with `registerResourceModule` fail with unhandled exceptions.
2020-12-10 09:30:34 -08:00
Justin Van Patten 4747be7b9f
[sdk/nodejs] Use log.error to log uncaught errors (#5910)
`log.error` will call the engine's `log` gRPC endpoint (if the engine is available; otherwise it will write to `console.error`) with `LogSeverity.ERROR`, which tell the engine to stop processing further resource operations.

Without this, any uncaught errors (such as input validation errors done inside `apply`) would be written to stderr, but wouldn't actually result in an update error.
2020-12-10 08:53:25 -08:00
Justin Van Patten 5ab051cd97
Implement GetRequiredPlugins for Python (#5787)
Implement GetRequiredPlugins for Python, which determines the plugins
required by the program.

Also, if the `virtualenv` runtime option is set, and the specified
virtual directory is missing or empty, automatically create it and
install dependencies into it.
2020-12-03 19:22:16 -08:00
Justin Van Patten c27d2921c1
Remove console.log call (#5845)
Remove console.log call that's adding unnecessary diagnostic messages to programs that use multi-lang components.
2020-12-01 16:35:30 -08:00
Justin Van Patten edc79325fe
Add support for getResource to Node.js SDK (#5837)
And update Node's resource ref deserialization to match Python.

Also, fixed a bug in Python resource ref deserialization that I noticed.
2020-12-01 10:58:15 -08:00
Pat Gavlin 807b09d6a6
Fix a few issues with resource references. (#5804)
- Differentiate between resource references that have no ID (i.e. because
  the referenced resource is not a CustomResource) and resource references
  that have IDs that are not known. This is necessary for proper
  backwards-compatible serialization of resource references.
- Fix the key that stores a resource reference's package version in the
  .NET, NodeJS, and Python SDKs.
- Ensure that the resource monitor's marshalling/unmarshalling  of inputs
  and outputs to/from calls to `Construct` retain resource references as
  appropriate.
- Fix serialization behavior for resources -> resource references in the
  Go SDK: if a resource's ID is unknown, it should still be serialized
  as a resource reference, albeit a reference with an unknown ID.
2020-11-23 11:15:10 -08:00
Justin Van Patten 4aab74afc7
Fix bug calling Provider.read (#5716)
The call to `read` wasn't passing the URN. Also delete a comment that doesn't apply here.
2020-11-09 08:48:19 -08:00
Pat Gavlin 44376738f6
Add resource modules. (#5645)
This is necessary due to the way we've factored the libraries imported
by users into modules. The primary alternative is to ensure that each
child module imports the root module for a package and registers itself
with that package where necessary to prevent circular dependencies. This
simplifies the core SDKs slightly at the cost of greater complications
in the generated SDKs; the approach taken by these changes seems like a
more maintainable option.

Contributes to #2430.

Co-authored-by: Justin Van Patten <jvp@justinvp.com>
2020-11-04 10:24:41 -08:00
Lee Briggs 4d96994fd1
switch uuid packages (#5608)
Co-authored-by: Pat Gavlin <pat@pulumi.com>
2020-11-04 03:13:04 +00:00
Pat Gavlin 3d2e31289a
Add support for serialized resource references. (#5041)
Resources are serialized as their URN, ID, and package version. Each
Pulumi package is expected to register itself with the SDK. The package
will be invoked to construct appropriate instances of rehydrated
resources. Packages are distinguished by their name and their version.

This is the foundation of cross-process resources.

Related to #2430.

Co-authored-by: Mikhail Shilkov <github@mikhail.io>
Co-authored-by: Luke Hoban <luke@pulumi.com>
Co-authored-by: Levi Blackstone <levi@pulumi.com>
2020-10-27 10:12:12 -07:00
Komal ec9c02f578
Add tests for ts enums (#5605) 2020-10-22 10:53:29 -07:00
Komal 6949101428
Replace equal and deepEqual with strictEqual and deepStrictEqual (#5607) 2020-10-21 10:21:47 -07:00
Pat Gavlin 89c71bb49e
[cli] Add an import command. (#4765)
Co-authored-by: stack72 <public@paulstack.co.uk>
2020-10-14 12:51:53 +01:00
Pat Gavlin 249140242e
Add support for provider-side preview. (#5443)
These changes add support for provider-side previews of create and
update operations, which allows resource providers to supply output
property values for resources that are being created or updated during a
preview.

If a plugin supports provider-side preview, its create/update methods
will be invoked during previews with the `preview` property set to true.
It is the responsibility of the provider to fill in any output
properties that are known before returning. It is a best practice for
providers to only fill in property values that are guaranteed to be
identical if the preview were instead an update (i.e. only those output
properties whose values can be conclusively determined without
actually performing the create/update operation should be populated).
Providers that support previews must accept unknown values in their
create and update methods.

If a plugin does not support provider-side preview, the inputs to a
create or update operation will be propagated to the outputs as they are
today.

Fixes #4992.
2020-10-09 13:13:55 -07:00
Evan Boyle b86e6ae93e
add plugin management utils to node Automation API (#5536) 2020-10-09 09:03:03 -07:00
evanboyle 42f301ac0f bump node test timeout 2020-10-08 12:19:01 -07:00
evanboyle 39297cb9dd make public declarations implicit 2020-10-08 12:19:01 -07:00
evanboyle 7b766924ec update error strategy to be more idiomatic 2020-10-08 12:19:01 -07:00
evanboyle 97e1d25802 update doc formatting 2020-10-08 12:19:01 -07:00
evanboyle 73a5516958 prefer interfaces over types for object-like specs 2020-10-08 12:19:01 -07:00
evanboyle 9f4461db37 Node Automation API tsdoc 2020-10-08 12:19:01 -07:00
evanboyle 84136e2271 mark exports as internal where appropriate 2020-10-08 12:19:01 -07:00
evanboyle 99574ff555 node automation api structured error design 2020-10-08 12:19:01 -07:00
evanboyle 631e6cbaf1 improve typing for UpdateSummary timestamps, WhoAmI results 2020-10-08 12:19:01 -07:00
evanboyle 2d49cabf68 simplify project and stack settings impl 2020-10-08 12:19:01 -07:00
evanboyle cf194bff4b remove parallelism from node automation api operations 2020-10-08 12:19:01 -07:00
evanboyle 848086fa26 remove stack property getters 2020-10-08 12:19:01 -07:00