Commit graph

1726 commits

Author SHA1 Message Date
Justin Van Patten 070125e685
[sdk/go] Warn when a secret config is read as a non-secret (#7080) 2021-05-18 15:02:43 -07:00
Justin Van Patten 34a40d2b10
[sdk/dotnet] Warn when a secret config is read as a non-secret (#7079) 2021-05-18 15:01:57 -07:00
Justin Van Patten 480173a57f
[sdk/python] Warn when a secret config is read as a non-secret (#7078) 2021-05-18 15:00:30 -07:00
Justin Van Patten a61e79eb0d
[sdk/nodejs] Warn when a secret config is read as a non-secret (#6896) 2021-05-18 09:48:08 -07:00
Pat Gavlin 354946a1e4
Await outstanding async work in Go. (#6983)
The Pulumi Go SDK does not currently await all outstanding asynchronous
work associated with a Pulumi program. Because all relevant asynchronous
work is created via the Pulumi SDK, we can track this asynchronous work
and ensure that it has all completed prior to returning from
`Context.Run`.

This is complicated by the fact that many of the existing APIs that are
able to create `Output`s--`NewOutput`, `ToOutput`, `Any`,  `ToSecret`,
and `All`--do not have a `*Context` parameter, and so have no
straightforward way to associate themselves with a `*Context`. To address
this, these changes add new versions of each of these APIs as methods on
`*Context`.

Despite these new methods, most Pulumi programs should work without
changes: the bulk of `Output`s are created by the SDK itself as part of
resource registration, and for `Any` and `All`, we can pick up the
context from any `Output`s present in the arguments. The only programs
that should require changes are those that create outputs from whole
cloth using `NewOutput`, `ToOutput`, or `ToSecret` and create unawaited
async work rooted at those outputs.

On an implementation level, these changes track asynchronous work using
a `sync.WaitGroup` associated with each `*Context`. This `WaitGroup` is
passed to each output associated with the context. The SDK increments
this `WaitGroup`'s count prior to starting any asynchronous work and
decrements it once the work (including any callbacks triggered by the
work) is complete.

This fixes the Go portion of #3991.
2021-05-14 12:00:21 -07:00
Anton Tayanovskyy 493bac4c18
Make virtualenv paths relative to root when main points elsewhere (#6966)
* Propagate workspace.Project metadata to plugin init

* Get to a working fix

* Propagate Root via plugin context

* Propagate root instead of yaml path

* Revert out unnecessary parameter propagation

* Root is now always absolute at this point; simplify code and docs

* Drop python conditional and propagate unused -root to all lang hosts

* Add tests that fail before and pass after

* Lint

* Add changelog entry
2021-05-14 13:41:55 -04:00
Pat Gavlin bd18384038
Await outstanding async work in .NET. (#6993)
The Pulumi .NET SDK does not currently await all outstanding asynchronous
work associated with a Pulumi program. Because all relevant asynchronous
work is created via the Pulumi SDK, we can track this asynchronous work
and ensure that it has all completed prior to returning from
`Deployment.RunAsync`.

The implementation here is simpler than that in #6983, and re-uses the
existing support for tracking outstanding RPCs. If this proves to
negatively impact performance (which is a very real possibility for
programs that create many `Output` instances), we can simplify this
using a semaphore and a counter (essentially Go's `sync.WaitGroup`).

This fixes the .NET portion of #3991.
2021-05-12 13:23:47 -07:00
Josh Studt be8183180d
[auto/dotnet] - disable language server host logging and appsettings.json check (#7023) 2021-05-12 11:30:28 -07:00
Komal 17fae620af
Skip flaky python test (#7035) 2021-05-12 09:29:13 -07:00
Komal 840c7a5a13
Create stacks serially before setting config concurrently (#7031) 2021-05-12 01:36:03 -07:00
Anton Tayanovskyy 2288f8b7fb
Fix issue with lazy_import affecting pulumi-eks (#7024)
* Fix issue with lazy_import in presense of modules-as-attrs

* Temporary inline _lazy_import into generated code for smooth updates

* Add CHANGELOG entry

* Rename _lazy_import to lazy_import

* Comments on short-circuit behavior

* Comment fix
2021-05-11 22:48:08 -04:00
Komal 3bac1d68b7
Move comment in python SDK (#7028) 2021-05-11 17:23:18 -07:00
Komal 3ef2648f45
Use test-org from env var (#7016) 2021-05-11 08:41:21 -07:00
Evan Boyle 15418b6789
Fix noisy nodejs runtime errors (#6995) 2021-05-10 15:04:03 -07:00
Evan Boyle 815f42d8a5
Set nodejs automation api test org from env (#6996) 2021-05-10 10:39:36 -07:00
Anton Tayanovskyy d55327db50
Fix tests that used to be skipped on missing async lib (#6941) 2021-05-10 13:27:20 -04:00
Justin Van Patten dad7f2c2f0
Config: Avoid emitting integers in objects using exponential notation (#7005)
Config values that are objects are represented in memory as JSON strings. When a config map is being saved to a file, object values are first unmarshaled from JSON to `interface{}` and then the entire config map is marshaled to YAML (or JSON) and saved to disk. When an object value is unmarshaled from JSON, any numbers in the JSON string were being implicitly unmarshaled as `float64`, which resulted in some numbers in the nested objects being emitted in YAML using exponential notation (e.g. a number `12321123131` in an object value was being saved in the YAML as `1.2321123131e+10`). To address this, when unmarshaling the JSON for an object value, first try to unmarshal any numbers as `int64`, falling back to `float64`.
2021-05-10 10:00:23 -07:00
Anton Tayanovskyy 908ac27219
Fix flaky test that fails on unrelated PRs (#6979) 2021-05-10 11:27:55 -04:00
Josh Studt 31fec05a24
[auto/dotnet] - Add PulumiFn implementation for runtime stack type (#6910)
* add runtime stack type pulumi fn implementation

* add exception propagation test and update changelog

* slight refactor to just bring the identical service provider code into the new PulumiFn implementation.

* get tests passing, need service to be registered as transient so that the stack is instantiated each time because pulumi internal rely on instantiation

* check version command was failing because of additional white space it wasn't accounting for
2021-05-10 11:06:25 -04:00
Komal 59992cff97
[automation/python] - Export ProjectBackend class (#6984) 2021-05-06 19:43:31 -07:00
Paul Stack 3e12b4f7e6
Small change to the logic around ambient plugins on the PATH (#6963) 2021-05-04 18:46:04 +01:00
Komal 37baab9749
Use local backend for concurrency test (#6960) 2021-05-04 09:43:11 -07:00
James Nugent c3c617c51f
[plugins] Allow opt out of loading plugins on PATH (#6944)
This commit makes it possible to opt out of loading plugins from PATH by
setting PULUMI_IGNORE_AMBIENT_PLUGINS to any non-empty value. This is
useful when automatic IDE tooling may build remote component plugins
into GOBIN unbeknownst to the user, and a resulting stale version of the
plugin is loaded in place of newer versions - even those , explicitly
installed.
2021-05-04 16:30:59 +01:00
Justin Van Patten 3746028c38
[sdk/python] Don't error when dict input value has a mismatched type (#6949)
Pulumi 3.0 raises an error when a dict value is passed as an input but the type annotation does not accept a dict. Unfortunately, this prevents historical cases where a dict value is allowed but the type annotation doesn't match. We need to fix the type annotations, but in the meantime, we should not raise an error in the SDK for such cases as it breaks existing programs.
2021-05-03 08:47:55 -07:00
Justin Van Patten 81db03ea2a
Fix Python test file names (#6947)
I'd run these tests individually locally, but they need to start with `test_` to be picked up by pytest.
2021-04-30 20:22:25 -07:00
Sean Fausett 92dd696dda Bump YamlDotNet to 11.1.1
https://github.com/aaubry/YamlDotNet/releases/tag/v11.1.1
2021-05-01 08:03:12 +12:00
Justin Van Patten 8574d40dda
[sdk/python] Fix type-related regression on Python 3.6 (#6942)
Pulumi 3.0 uses type annotations for input values to determine whether dict keys should be translated from snake_case to camelCase or not. This additional inspection of types did not work correctly on Python 3.6 due to some missing functionality on that version of Python which we need to provide an implementation for. Specifically, when inspecting `Union` args to determine whether or not a value is intended to be an input class or user-defined dict. To address the issue, this change improves how we get the args for `Union` types when running on Python 3.6 to behave the same way as later versions of Python (for our purposes). Existing tests fail on Python 3.6 before this change, and pass after.
2021-04-30 11:50:42 -07:00
Justin Van Patten 69d50ced27
[sdk/python] Address issues when using resource subclasses (#6890)
We were only looking at the current resource class's type/name metadata for camelCase <=> snake_case property name translations which prevented it from working correctly when using a subclass of a resource. This change addresses this by looking at metadata of the current class and any base classes.

Additionally, to help resolve forward references when getting type hints, we'd pass along the current resource class's globals, which doesn't work correctly when using a subclass of a resource. This change also addresses this, by using the globals of the current class and any base classes.
2021-04-30 10:07:23 -07:00
James Nugent 71fcbfce5f
[kind/bug] [automation/go]: Look in workspace options for version optout (#6938)
When calling l.GetEnvVars() to evaluate whether version checking should
be skipped because of variables passed into the workspace, they have not
yet been set. This commit modifies the logic to look at the environment
variables in the options instead of in the workspace.

Since the original functionality  has not yet been released, I do not
believe it warrants a CHANGELOG entry.
2021-04-30 09:41:31 -07:00
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 bdcb5ecb3c
[automation/go] - Improve default formatting of auto.autoError (#6924)
Co-authored-by: James Nugent <jen20@apple.com>
2021-04-29 13:04:51 -07:00
Sean Fausett 276d3570ed Enable deterministic builds 2021-04-29 14:24:43 +12:00
Vivek Lakshmanan c0b5339cf3
Merge pull request #6901 from pulumi/vl/FixStackSettings
[auto/go] Fix stack settings save/load typo and add tests
2021-04-28 11:35:29 -07:00
Mikhail Shilkov 6100691262
Merge pull request #6905 from gitfool/gh6904
[automation/dotnet] Enable SourceLink with embedded PDB
2021-04-28 13:12:11 +02:00
Mikhail Shilkov d6477b1fc2
Merge pull request #6871 from gitfool/gh6870
[sdk/dotnet] Bump Grpc NuGet packages to 2.37.0
2021-04-28 11:49:26 +02:00
Sean Fausett 28a7e61daf Enable SourceLink with embedded PDB 2021-04-28 21:08:54 +12:00
Vivek Lakshmanan 4b3d2a57c7 [auto/go] Fix stack settings save/load typo and add tests 2021-04-27 22:27:59 -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
Jonas-Taha El Sesiy 837f75f28b
[auto/go] - Provide GetPermalink for all results (#6875) 2021-04-26 18:18:45 -07:00
Ville Penttinen daa6045381
[automation/*] Add support for getting stack outputs using Workspace (#6859) 2021-04-26 16:32:30 -07:00
Ville Penttinen 3cbfddf870
[automation/dotnet] Use stackName in ImportStack (#6858)
Co-authored-by: Komal <komal@pulumi.com>
2021-04-26 15:12:27 -07:00
Ville Penttinen 52fb4c2d68
[automation/dotnet] Fix EventLogWatcher failing to read events after an exception was thrown (#6821)
* [automation/dotnet] Fix EventLogWatcher failing to read events after exception

* Update CHANGELOG_PENDING.md

Co-authored-by: Anton Tayanovskyy <anton@pulumi.com>
2021-04-26 16:31:55 -04:00
Komal 33f403e7c5
Fix python mock args (#6863) 2021-04-26 13:22:10 -07:00
Komal 5dba5227cc
[sdk/python] - Fix python lint errors (#6872) 2021-04-26 08:56:15 -07:00
Evan Boyle f8a9698ca9
remove erroneous global promise rejection handler (#6864) 2021-04-26 08:27:41 -07:00
Sean Fausett 44cc1684fc Bump Grpc NuGet packages to 2.37.0
https://github.com/grpc/grpc/releases/tag/v1.37.0
2021-04-25 16:57:17 +12:00
Komal 288d67d78b
[auto/*] - Bump min version (#6852) 2021-04-22 16:17:49 -07:00
Komal f523d25868
[automation/python] - Fix deserialization of UpdateSummary (#6838) 2021-04-22 09:00:12 -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
Anton Tayanovskyy 13f63e9648
Fix bug in semver usage by enabling typechecking (#6833)
* Fix bug in semver usage by enabling typechecking

* Add CHANGELOG note
2021-04-21 15:48:57 -04:00
stack72 6279d7b009 Fixing up Pulumi logo in dotnet package 2021-04-21 18:45:21 +01:00
Komal 967cff8550
Remove references to automation api being in alpha (#6828) 2021-04-21 08:44:04 -07: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
Mark Lambert 94d98b4e8a
[automation/dotnet] Use Grpc.AspNetCore.Server package - without Grpc.Tools dependency (#6793)
* Use Grpc.AspNetCore.Server package - without Grpc.Tools dependency

* Changelog message
2021-04-19 15:50:07 -04: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
Justin Van Patten 81810cbb9c
[sdk/go] Support prompt values in Construct (#6790)
Adds support for prompt values. And renames `ConstructInputs.SetArgs` to `ConstructInputs.CopyTo`.
2021-04-18 09:18:25 -07:00
Levi Blackstone f11e8603a2
[sdk/dotnet] Handle providers for RegisterResourceRequest (#6786)
Resolve providers references and include the resulting refs in the
providers field of RegisterResourceRequest that was added in
d297db3.

Co-authored-by: Justin Van Patten <jvp@justinvp.com>
2021-04-16 16:12:53 -06:00
svangordon-fruit 5e495e85e5
Clean the template dir if the remote has changed (#6784) 2021-04-16 13:51:42 -07:00
Justin Van Patten 780a0c8a3d
Support defining remote components in Go (#6403) 2021-04-16 11:49:21 -07:00
Levi Blackstone 59dd665837
[sdk/go] Handle providers for RegisterResourceRequest (#6781)
Resolve providers references and include the resulting refs in the
providers field of RegisterResourceRequest that was added in
d297db3.
2021-04-16 10:43:29 -06:00
Pat Gavlin 1cc084dc0e
Fix inconsistent object type naming. (#6686)
See #6200 for a complete description of the issue. In short, we generate
inconsistent names for object types depending on whether or not they are
transitively reachable from resources or functions, which risks
unintentional breaking changes due to schema updates.

1. Name "input" types differently: `TArgs` for a type that is used in
   resource inputs, having `Input<T>` properties, and `T` for a type
   that is used in invoke inputs. The same schema type can produce both.

2. Always keep the name `T` for output types, avoid appending `Result` to
   the name.

3. As needed, introduce a flag in the existing providers' schemas to avoid
   breaking changes. Consider removing it on a major version bump.

Fixes #6200.
2021-04-15 19:03:28 -07:00
Anton Tayanovskyy b77f32930c
Remote component py SDK (#6715)
* Python support for authoring resource providers for multi-lang

* Support for passing prompt values to Python resource providers
2021-04-15 14:49:51 -04:00
Komal 4dcc0d631e
[automation/python] - Fix stack settings serialization (#6776) 2021-04-15 11:41:25 -07:00
Levi Blackstone 9d4d274b13
[sdk/python] Handle providers for RegisterResourceRequest (#6771)
Resolve providers references and include the resulting refs in the
providers field of RegisterResourceRequest that was added in
d297db3.
2021-04-14 14:56:26 -06:00
Paul Stack 19bd08fb1c fixup linting errors after rebase of master -> feature-3.0 (#6766) 2021-04-14 19:32:18 +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
Paul Stack 3dd3a2bc34 Remove Prefix suffix on Pulumi.automation Package (#6720) 2021-04-14 19:32:18 +01:00
Justin Van Patten 1112c513c0 [sdk/python] Improved dict key translation support (#6695)
This change addresses Python dictionary key translation issues. When the
type of `props` passed to the resource is decorated with `@input_type`,
the type's and resource's property name metadata will be used for dict
key translations instead of the resource's `translate_input_property`
and `translate_output_property` methods.

The generated provider SDKs will be updated to opt-in to this new
behavior:

- FIX: Keys in user-defined dicts will no longer be unintentionally
  translated/modified.

- BREAKING: Dictionary keys in nested output classes are now
  consistently snake_case. If accessing camelCase keys from such output
  classes, move to accessing the values via the snake_case property
  getters (or snake_case keys). Generated SDKs will log a warning
  when accessing camelCase keys.

When serializing inputs:

  - If a value is a dict and the associated type is an input type, the
    dict's keys will be translated based on the input type's property
    name metadata.

  - If a value is a dict and the associated type is a dict (or Mapping),
    the dict's keys will _not_ be translated.

When resolving outputs:

  - If a value is a dict and the associated type is an output type, the
    dict's keys will be translated based on the output type's property
    name metadata.

  - If a value is a dict and the associated type is a dict (or Mapping),
    the dict's keys will _not_ be translated.
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
Luke Hoban 11c2ae3bd2 [sdk/go] Simplify Apply method options to reduce binary size (#6607)
Co-authored-by: Komal <komal@pulumi.com>
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
Pat Gavlin a641b93f96
Provider implementer's guide draft (#6322)
Add the beginnings of a document that describes the semantics
of the Pulumi resource provider model from an implementer's
point-of-view.
2021-04-13 14:11:02 -07: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
Anton Tayanovskyy 0e2d918587
stack.Cancel support in dotnet Automation API (#6729)
* First cut at Cancel

* Add a racecond-based test for Cancel

* Auto-gen xml updates

* Fix code formatting

* Add CHANGELOG entry
2021-04-13 14:09:33 -04: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
Lee Zen 49241d5f74
[dotnet] Fix serialization/deserialization for StackSettings (#6752) 2021-04-12 16:45:00 -07:00
Komal 33ceb1b70e
[automation/python] - Fix (de)serialization of StackSettings (#6749) 2021-04-12 15:50:53 -07:00
Anton Tayanovskyy 737cffc147
dotnet automation api ImportStackAsync and ExportStackAsync (#6728)
* Initial impl of import/export

* Add test

* Address PR comments

* Do not Select stack but pass it as --stack

* Add CHANGELOG entry

* Update sdk/dotnet/Pulumi.Automation/LocalWorkspace.cs

Co-authored-by: Ville Penttinen <villem.penttinen@gmail.com>

* Update sdk/dotnet/Pulumi.Automation/LocalWorkspace.cs

Co-authored-by: Ville Penttinen <villem.penttinen@gmail.com>

* Add helper methods to match node SDK

* Match project settings

* Update CHANGELOG_PENDING.md

Co-authored-by: Komal <komal@pulumi.com>

Co-authored-by: Ville Penttinen <villem.penttinen@gmail.com>
Co-authored-by: Komal <komal@pulumi.com>
2021-04-12 17:41:51 -04:00
Daniel Sokolowski ee2f65510b
[sdk/nodejs] Add multiple VM contexts support to closure serialization (#6648) 2021-04-12 09:13:47 -07:00
svangordon-fruit 3a276bdd5e
Don't return an error if DeleteAllAccounts failed because the creds file doesn't exist (#6741)
Co-authored-by: Paul Stack <public@paulstack.co.uk>
2021-04-11 14:49:42 +01: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
Josh Studt ef9a1e4e40
[sdk/dotnet] - Thread-safe concurrency-friendly global state (#6139)
* changes necessary for concurrent thread safe global deployment state

* update changelog

* backtrack resource package changes, enable test parallelization

* cleanup comment

* add copyright to new file

* resolve paralellization differences after merging automation api preview

* no longer need to null deployment instance

* Update CHANGELOG.md

* whoops - switch to CHANGELOG_PENDING

* Update CHANGELOG_PENDING.md

move note down to improvements

* attempt to exclude dynami assemblies

Co-authored-by: Anton Tayanovskyy <anton.tayanovskyy@gmail.com>
2021-04-09 15:55:34 -04:00
Anton Tayanovskyy e460ab7be5
Method renames for dotnet automation API GA (#6731)
* Method renames

* Add CHANGELOG_PENDING entry
2021-04-08 18:01:18 -04: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
Ville Penttinen 1f15c10b3d
[automation/dotnet] Fix GetConfigValueAsync failing to deserialize (#6698) 2021-04-06 14:10:30 -07:00
Komal 7f226c1cb6
Fix serializing bug if output contains 'items' property (#6705) 2021-04-05 20:36:56 -07:00
Evan Boyle 322760b243
Add program side dynamic provider caching behind env var (#6673) 2021-04-05 14:37:45 -07:00
Levi Blackstone 20b78f49bc
[sdk/go] Use ioutil.ReadFile to avoid forcing 1.16 upgrade (#6703)
#6636 inadvertently changed the minimum Go version
requirement to 1.16 since ReadFile was moved in that
version. Switch back to ioutil.ReadFile to avoid forcing
an upgrade at this time.
2021-04-05 15:02:13 -06:00
Komal 5254e3f01d
[python/sdk] - Fix serialization bug if output contains 'items' property (#6701) 2021-04-05 12:39:56 -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
Anton Tayanovskyy 0b626126c0
Avoid scanning types from some assemblies (#6688) 2021-04-02 12:11:59 -04:00
Ville Penttinen c8fd984488
[automation/dotnet] Allow null environment variables (#6687)
* [automation/dotnet] Allow null environment variables

* Update CHANGELOG_PENDING.md

* Update sdk/dotnet/Pulumi.Automation.Tests/LocalPulumiCmdTests.cs
2021-04-02 10:08:43 -04:00
Anton Tayanovskyy 2c449fd70f
Simplify env var propagation (#6682)
* Simplify env var propagation

* Fix typo
2021-04-01 18:06:03 -04:00
Levi Blackstone 2dad8a6649
Revert "Swap out YAML parser library (#6642)" (#6681)
This reverts commit ff2cf70
2021-04-01 14:44:29 -06:00
Anton Tayanovskyy fc8262bad0
Avoid overriding dotnet proj settings accidentally (#6670)
* Add failing test

* Guard against overrding project settings accidentally

* Throw exception in case of conflct

* Update sdk/dotnet/Pulumi.Automation/DictionaryContentsComparer.cs

Co-authored-by: Ville Penttinen <villem.penttinen@gmail.com>

* Update sdk/dotnet/Pulumi.Automation/ProjectRuntime.cs

Co-authored-by: Ville Penttinen <villem.penttinen@gmail.com>

* Update sdk/dotnet/Pulumi.Automation/ProjectTemplateConfigValue.cs

Co-authored-by: Ville Penttinen <villem.penttinen@gmail.com>

* Update sdk/dotnet/Pulumi.Automation/ProjectTemplate.cs

Co-authored-by: Ville Penttinen <villem.penttinen@gmail.com>

* Update sdk/dotnet/Pulumi.Automation/ProjectRuntimeOptions.cs

Co-authored-by: Ville Penttinen <villem.penttinen@gmail.com>

* Update sdk/dotnet/Pulumi.Automation/ProjectBackend.cs

Co-authored-by: Ville Penttinen <villem.penttinen@gmail.com>

* Update sdk/dotnet/Pulumi.Automation/ProjectSettings.cs

Co-authored-by: Ville Penttinen <villem.penttinen@gmail.com>

* Reduce nesting

* Make the new exception public

* Introduce a CHANGELOG entry since we add to pub API

* Stricter check before throwing

* Address PR feedback, round 1

* Use Reference.Equals check

* Move DictionaryContentsComparer out of top-level

Co-authored-by: Komal Ali <komal@pulumi.com>
Co-authored-by: Ville Penttinen <villem.penttinen@gmail.com>
2021-04-01 15:27:24 -04: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 7f8985ab0f
Revert "Allow environment variables to have a null value (#6520)" (#6677)
This reverts commit 17d1ce509e.
2021-03-31 21:15:38 -07:00
Dan Friedman 17d1ce509e
Allow environment variables to have a null value (#6520) 2021-03-31 18:32:18 -07:00
Vivek Lakshmanan 656ed796a1
Merge pull request #6528 from pulumi/vl/Nested
[codegen/go] Support nested collection types
2021-03-31 14:37:56 -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
Anton Tayanovskyy ce9ab05935
Use CliWrap for subprocess management (#6654)
* Use CliWrap for subprocess management

* Reintroduce .Stop(), fix compilation

* Sanitize command name.
2021-03-31 10:41:02 -04:00
Vivek Lakshmanan 81f35f530f Fix tests for builtins 2021-03-30 22:24:11 -07:00
Vivek Lakshmanan a83910f46a Update builtins to support ArrayArrayMap 2021-03-30 22:24: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
Komal 7d10e8c5be
Fix mypy errors (#6656) 2021-03-30 19:11:13 -07:00
Ville Penttinen 529fe8fc51
[automation/dotnet] Expose structured logging (#6572)
* [automation/dotnet] Start implementing structured event log support

* Add Events and their models

* Introduce new IStringToEnumConverter

This is intended to be used for converting a non-standard enum names
into corresponding enum values. The converter is utilized via
StringToEnumJsonConverter with OperationType and DiffKind.

* Add event-log support to up, refresh, destroy

* Update event-log tests

* Use lock instead of semaphore in EventLogWatcher

* Add ChangeSummary to PreviewResult

* Minor update

* Add doc comments to Events

* Use PropertyDiffModel in StepEventMetadataModel

* Set Events to public

* Set properties to public

* Fix PreludeEvent.Config doc comment

* Remove TODOs

* Update Pulumi.Automation.xml

* Set PULUMI_DEBUG_COMMANDs in Workspace.

* Split Events and their models to separate files

* Rename abbreviated Events

* Remove CancelEventModel

* Rename HandlesEvents test project and stack

* Update CHANGELOG_PENDING.md

* Rename abbreviated EngineEvent properties

* Implement custom exceptions

* Move event-log setup to LocalPulumiCmd

* Update comments

* Implement polling EventLogWatcher

This replaces the previous watcher which utilized FileSystemWatcher.

* Guard against onEvent throwing

* Dispose CancellationTokenSource

* WIP: try more direct error handling in EventLogWatcher

* A bit more tests

* Reformat

* Update sdk/dotnet/Pulumi.Automation.Tests/EventLogWatcherTests.cs

Co-authored-by: Ville Penttinen <villem.penttinen@gmail.com>

* Update sdk/dotnet/Pulumi.Automation/Events/EventLogWatcher.cs

Co-authored-by: Ville Penttinen <villem.penttinen@gmail.com>

* Update sdk/dotnet/Pulumi.Automation/Events/EventLogWatcher.cs

Co-authored-by: Ville Penttinen <villem.penttinen@gmail.com>

* Update sdk/dotnet/Pulumi.Automation.Tests/EventLogWatcherTests.cs

Co-authored-by: Ville Penttinen <villem.penttinen@gmail.com>

* Update sdk/dotnet/Pulumi.Automation/Events/EventLogWatcher.cs

Co-authored-by: Ville Penttinen <villem.penttinen@gmail.com>

* Update sdk/dotnet/Pulumi.Automation/Events/EventLogWatcher.cs

Co-authored-by: Ville Penttinen <villem.penttinen@gmail.com>

* Make race condition workaround more explicit

* Untabify

* Remove unnecessary using and change String to string

* Update doc comments on Events

Co-authored-by: Anton Tayanovskyy <anton@pulumi.com>
Co-authored-by: Anton Tayanovskyy <anton.tayanovskyy@gmail.com>
2021-03-30 14:57:38 -04:00
Komal 35321159fc
[sdk/python] - Await all async tasks (#6606) 2021-03-30 10:56:17 -07:00
Levi Blackstone ff2cf701a7
Swap out YAML parser library (#6642)
Related to #423
2021-03-29 14:49:00 -06:00
Levi Blackstone 0a2452f1f5
[test] Randomize stack names for some .NET tests (#6637) 2021-03-29 13:08:41 -06:00
Pat Gavlin 7c5ec6815e
Make data sources catchable in Python (#6504)
The current logic lets unhandled errors in the RPC invocation
unahandled in the async loop, which crashes the process due to
the way we await completion of RPCs before exiting the process
in Python. Instead of doing that, we can just marshal them back
to the synchronous awaiter as part of the calling convention,
and have that awaiter (which is called by the invoke methods)
re-raise the exception. This should fix pulumi/pulumi#3611.
2021-03-29 12:07:43 -07:00
Komal e5223492c7
[automation/python] - Fix passing of extra environment variables (#6639) 2021-03-29 11:48:17 -07:00
Levi Blackstone 8cdac3e4ca
[cli] Strip Byte-order Mark (BOM) from YAML configs during load (#6636)
Some YAML parsers don't correctly handle Byte-order marks,
so automatically strip it off during load.

Related to #423

Co-authored-by: Justin Van Patten <jvp@justinvp.com>
2021-03-29 11:56:19 -06: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
Justin Van Patten 872d9cb849
[sdk/python] Fix mypy errors (#6627) 2021-03-26 15:41:08 -07: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
Anton Tayanovskyy 4e5828a890
Avoid double-quailfying venv folder path (#6599)
* Avoid double-quailfying venv folder path

* Replace `path` with `filepath`

* Add a Python integration test to cover venv auto-creation

* Merged

* Fix spelling

Co-authored-by: Justin Van Patten <jvp@justinvp.com>

* Make AbsPath and RelPath test variants

* Fix issue on Windows backslash paths

* Debug windows test failure: more logging and aggressive YAML escaping

* Use filepath.IsAbs instead of path.IsAbs

Co-authored-by: Justin Van Patten <jvp@justinvp.com>
2021-03-24 15:51:46 -04:00
Komal 19c055315d
[automation/dotnet] - Implement min version checking (#6590) 2021-03-24 10:43:44 -07:00
Levi Blackstone 7f42d42b2b
[automation/python] Fix Settings file save (#6605)
The Project and Stack save routines were erroneously
dumping the Python objects rather than the __dict__
property, which resulted in some extra annotations
in the resulting YAML files. Some parsers don't handle
these annotations correctly, and consider the resulting
YAML file to be invalid.
2021-03-23 19:26:34 -06:00
Anton Tayanovskyy 980c50c602
Remove MaybeNull from Output/Input.Create to avoid spurious warnings (#6600)
* Remove MaybeNull attr from read-only params on Input/Output constructors

* Update changelog
2021-03-23 19:34:30 -04:00
Komal 5e5c6ffb50
[automation/nodejs,go,python] - Expose pulumiVersion as string (#6604) 2021-03-23 15:09:50 -07:00
Komal b187ce18c2
[automation/python] - Implement min version checking (#6589) 2021-03-23 08:35:11 -07:00
Komal 768db3e067
[automation/nodejs] - Implement min version checking (#6580) 2021-03-22 23:04:36 -07:00
Komal 2fde29642d
[automation/go] - Implement min version checking (#6577) 2021-03-22 23:04:14 -07:00
Luke Hoban aa6fcf9601
Reduce the number of methods on output (#6593)
These methods were getting promoted onto every struct that implemented
the Output interface, and are not necessary.

On a real world program, this saves 4% in binary size overall, and
15% of remaining binary size if `Apply<TypeName>` functions are
removed (https://github.com/pulumi/pulumi/issues/6592).
2021-03-23 14:05:42 +11:00
Josh Studt 3ce5623270
[automation/dotnet] - Fix child process stream capture (#6586) 2021-03-19 19:16:32 -07:00
Komal dd53f58acb
[automation/dotnet] - Isolate project and stack names, defer stack removal for tests (#6584) 2021-03-19 13:23:13 -07:00
Levi Blackstone a2f995d2bb
[sdk/go] Cache loaded configuration files (#6576)
* [sdk/go] Cache loaded configuration files

Previously, the CLI did not cache configuration files, which
required a read from disk + unmarshalling + validation each
time a consumer needed to read one of these configurations.
This change introduces global caches for each type of Pulumi
configuration file (Project, ProjectStack, PolicyPackProject, and
PluginProject). The configuration is cached after the first request
and the cached value will be used for any subsequent operations.

Important note: The global configurations are not concurrency safe,
but this same problem exists using the previous method of
reading/writing config files on disk. Synchronization
will be added in a follow up change to allow for concurrency safe config
operations.
2021-03-19 10:52:12 -06: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
James Nugent 172fdb2e0d
Make template repository URL and ref modifiable (#6545) 2021-03-18 16:31:37 +00: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
pulumi-bot d0490979f7 Merge branch 'master' of github.com:pulumi/pulumi 2021-03-17 18:08:56 +00:00
Josh Studt 2c24efddaf
[sdk/dotnet] - bug fix, resolve deserialization of empty content response (#6560) 2021-03-17 18:08:46 +00:00
pulumi-bot 16a68cfd92 [build] Passing the correct version to the ldflag in the DotNet SDK 2021-03-17 17:57:18 +00:00
Justin Van Patten 8c0a5e79b6
[sdk/go] Implement getResource in the mock monitor (#5923) 2021-03-16 16:59:02 -07: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
Kraig Amador 71ec66aa45
Support locking on filestate logins (#2697)
When using the filestate backend (local files and cloud buckets) there is no protection to prevent two processes from managing the same stack simultaneously.

This PR creates a locks directory in the management directory that stores lock files for a stack. Each backend implementation gets its own UUID that is joined with the stack name. The feature is currently available behind the `PULUMI_SELF_MANAGED_STATE_LOCKING=1` environment variable flag.
2021-03-16 14:00:47 +11:00
Ville Penttinen aa79630ee3
[automation/dotnet] Add ability to capture stderr (#6513) 2021-03-15 09:11:42 -07:00
Anton Tayanovskyy 5235e0818e
Merge pull request #6523 from pulumi/fix/invalid-json-test-data
JSON does not admit trailing commas
2021-03-12 18:02:59 -05:00
Komal 794bae5fd5
Skip breaking dotnet automation api test (#6521) 2021-03-12 13:33:16 -08:00
Anton Tayanovskyy 4de8dddb91 JSON does not admit trailing commas 2021-03-12 16:32:55 -05:00
Ville Penttinen c438cad689
[automation/dotnet] Add ReadDiscard OperationType (#6493)
Co-authored-by: Komal <komal@pulumi.com>
2021-03-12 10:10:56 -08:00
Komal f5dc226a3c
[automation/nodejs] - Fix missing OpTypes and PreviewOptions (#6507) 2021-03-11 16:23:44 -08:00
Paul Stack 975100df6c
Add support when GOPATH has multiple folders (#6506)
Co-authored-by: Youn Den <dendaneys@gmail.com>
2021-03-11 21:11:32 +00:00
Paul Stack 3f2d58ef7b
Fixing up go.mod and go.sum to ensure they don't continually change (#6502) 2021-03-11 20:41:45 +00: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
Komal 10d99b8afb
[automation/go] - Expose structured logging (#6436) 2021-03-10 20:49:48 -08:00
Paul Stack c48ba37fcf
Migrate the version calculation to use pulumictl (#6460) 2021-03-10 19:03:29 +00:00
Paul Stack dc7eb5e2d2
[cli] Add ability to consume arm64 plugins from pulumi cli (#6492)
Related: #4868

Also adds the arm64 build and deployment steps via goreleaser
2021-03-10 16:28:55 +00:00
Meno Abels fad0393288
[sdk/python] mypy was not found (#6478) 2021-03-09 15:02:27 -08:00
Justin Van Patten 0b1414dc6d
[sdk/python] Fix mocks issue when passing a resource more than once (#6479)
This change avoids `RuntimeError: There is no current event loop in thread '<thread_name>'` errors when passing a resource as an input multiple times when using mocks.

The problem is that when using mocks, we deserialize the gRPC inputs before passing them to the user's mock methods. Deserializing inputs doesn't typically require an event loop, however, during deserialization of resource references, we end up creating some instances of `Future`, which does require an event loop to be present for the current thread. If this is done multiple times for a resource, it's possible that `deserialize_properties` will be called on an asyncio thread that doesn't yet have an event loop, resulting in the error being raised.

The error does not occur when only passing the resource reference once because typically the thread (e.g. `asyncio_0`) used in that case will have already had an event loop created for it due to the use of the internal `_syncawait` when _serializing_ the source resource's properties, which ensures an event loop is set for the thread.

The fix is to ensure an event loop is created for the thread in the mocks implementation before calling `deserialize_properties`.
2021-03-09 13:48:24 -08:00
Paul Stack 20e84dfe9e
Upgrading Go to 1.16.x (#6470) 2021-03-09 20:05:23 +00:00
Paul Stack 0241fb282c
Upgrading to go-cloud v0.22.0 (#6473) 2021-03-09 18:59:01 +00:00
Luke Hoban 0ad6f9b63b
[sdk/go] Add To methods to convert array and map values to Inputs (#6337) 2021-03-05 19:43:33 +11:00
Luke Hoban faaba72b63
[sdk/go] Don't panic on Elem and Index operations (#6338)
Fixes #6154.
2021-03-04 12:22:37 +11:00
Komal 48bc267445
[automation/python] - Add missing options to preview and up (#6450) 2021-03-02 10:53:39 -08:00
Josh Studt c921c708e9
[sdk/dotnet] - automation api fix OnOutput (#6435) 2021-02-28 20:06:12 -08:00
jakzo e78dea4979
serialize default parameters (#6397) 2021-02-25 21:21:10 -08:00
Komal 4a59900920
Enable python automation API tests on Windows (#6424) 2021-02-24 17:28:23 -08:00
Komal 24e07ab507
[automation/python] - Use TemporaryFile and seek() (#6421) 2021-02-24 17:21:24 -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
Komal 4882c9fec5
[CLI] - Add commands for config set-all and rm-all (#6373) 2021-02-19 21:55:58 -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
Mikhail Shilkov 9dbb5a979a Publish Pulumi.Automation as a preview NuGet 2021-02-19 12:09:04 +01:00
Mikhail Shilkov c94b3adbe0
Merge pull request #6382 from orionstudt/auto/stack-manip-test
[Automation API] - resolve stack manipulation test assertions
2021-02-18 20:29:05 +01:00
Komal ca5ab18f6d
[sdk/python] - Allow Output.all with no inputs (#6381) 2021-02-18 10:11:13 -08:00
Joshua Studt 2f47060f83 resolve stack manipulation test issue by not making assertions about entire stack collection, plugin manipulation test as example 2021-02-18 12:52:48 -05:00
UnoSD c42d39a24f Support StackOptions in F# functions 2021-02-18 14:08:15 +01:00
Mikhail Shilkov 1ccfd7413e
Fix serialization tests of .NET Automation (#6375) 2021-02-18 14:03:27 +01:00
Josh Studt 963b5ab710
[Automation API] - C# Implementation (#5761)
* Init Workspace interface for C# Automation API

* fleshing out workspace interface and beginning of local workspace implementation

* initial run pulumi cmd implementation

* resolve issue with pulumi cmd cleanup wrapper task after testing

* flesh out local workspace implementation, flesh out stack implementation, cleanup run pulumi cmd implementation and make it an instance so it is mockable/testable, separate serialization in prep for custom converters

* project settings json serialization implemented

* Initial commit of language server

* Add deployment from language server

* Cleanup

* finish json serialization

* project runtime yaml serialization completed. just need stack config value yaml serialization

* Remove typed argument

* Limit concurrency

* Rename file for consistency

* final commit of a semi-working project settings & stack settings serialization so that it is in the commit history

* modify workspace API so that settings accessors aren't fully exposed since we are defering a complete serialization implementation until a later date

* yaml converters wrap any outgoing exceptions so resolve that

* getting the beginning of inline program GRPC communication set up

* stack lifecycle operations implemented, and switched to newtonsoft for JSON serialization

* change back to system.text.json with a custom object converter

* local workspace tests written, working on getting them passing

* fix the encoding on the GO files used for testing

* all tests passing except inline program, pulumi engine not available with inline

* inline program engine is now running as expecting, but inline program is not recognizing local stack config

* All tests passing, but no concurrency capability because of the singleton DeploymentInstance.

* cleanup unnecessary usings

* minor cleanup / changes after a quick review. Make sure ConfigureAwait is used where needed. Remove newtonsoft dependency from testing. Update workspace API to use existing PluginKind enum. Modify LanguageRuntimeService so that its semaphore operates process-wide.

* support for parallel execution of inline program, test included

* Update LocalWorkspaceTests.cs

remove some redundancy from the inline program parallel execution text

* flesh out some comments and make asynclocal instance readonly

* Strip out instance locking since it is no longer necessary with AsyncLocal wrapping the Deployment.Instance. Modify CreateRunner method such that we are ensuring there isn't a chance of delayed synchronous execution polluting the value of Deployment.Instance across calls to Deployment.RunAsync

* resolve conflicts with changes made to Deployment.TestAsync entrypoints

* update changelog

* write a test that fails if the CreateRunnerAndRunAsync method on Deployment is not marked async and fix test project data file ref

* make resource package state share the lifetime of the deployment so that their isn't cross deployment issues with resource packages, add support and tests for external resource packages (resource packages that aren't referenced by the executing assembly)

* enable parallel test collection execution in test suite, add some additional tests for deployment instance protection and ensuring that our first class stack exceptions are thrown when expected

* minor inline project name arg change, and re-add xunit json to build output (whoops)

* strip out concurrency changes since they are now in #6139, split automation into separate assembly, split automation tests into separate assembly

* add copyright to the top of each new file

* resolve some PR remarks

* inline program exception is now properly propagated to the caller on UpAsync and PreviewAsync

* modify PulumiFn to allow TStack and other delegate overloads without needing multiple first class delegates.

* whoops missing a copyright

* resolve getting TStack into IRunner so that outputs are registered correctly and so that there isn't 2 instances of Pulumi.Stack instantiated.

* resolve issue with propagation of TStack exceptions and add a test

* add support for a TStack PulumiFn resolved via IServiceProvider

* update automation API description

* fix comment and remove unnecessary TODOs

* disable packaging of automation api assembly

* re-name automation api documentation file appropriately

* add --limit support to dotnet automation api for stack history per #6257

* re-name XStack as WorkspaceStack

* replace --limit usage with --page-size and --page in dotnet automation api per #6292

Co-authored-by: evanboyle <evan@pulumi.com>
Co-authored-by: Josh Studt <josh.studt@figmarketing.com>
Co-authored-by: Dan Friedman <dan@thefriedmans.org>
Co-authored-by: David Ferretti <David.Ferretti@figmarketing.com>
Co-authored-by: Mikhail Shilkov <github@mikhail.io>
2021-02-18 11:36:21 +01:00
Justin Van Patten 8d5e9bcd6e
Fix copy/paste bug in provider_server.go (#6370) 2021-02-17 16:56:47 -08:00
Komal a6b6437b49
[Automation] Fix python nested config parsing (#6349) 2021-02-17 10:16:35 -08:00
Komal b6f548a599
[sdk/python] - Define __all__ for better autocomplete. (#6351) 2021-02-17 09:09:10 -08:00
Ringo De Smet bcd14d8060
Automation API Go SDK: Expsoe the version in the UpdateSummary struct. (#6339) 2021-02-16 12:16:41 -08:00
Justin Van Patten 0fe4978a7a
[sdk/nodejs] Update @grpc/grpc-js dependency (#6341) 2021-02-16 08:46:32 -08:00
Justin Van Patten f111a53337
Look for python binary first on Windows (#6317)
We previously looked for `python3` and fallback to `python` on all systems. However, our Windows CI images include a `python3.exe` symlink to `python.exe` which does not work with `venv`. So on Windows, just look for `python` first, falling back to `python3`. (The default python.org Windows installation only includes `python.exe`).
2021-02-11 11:34:07 -08:00
Komal 1a9050eaa6
[sdk/python] - Allow kwargs in Output.all() to create a dict (#6269) 2021-02-11 08:52:46 -07: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 3ba0c219db
fix lint error in Go SDK (#6276) 2021-02-08 12:09:20 -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
Komal f374b8a953
[python/sdk] - Correctly handle outputs with properties named "values" (#6264)
Co-authored-by: Justin Van Patten <jvp@justinvp.com>
2021-02-05 17:16:13 -07:00
Komal 3a3b96de72
[sdk/python] - Gracefully handle monitor shutdown (#6249) 2021-02-04 20:28:39 -07:00
Evan Boyle decfed0679
Improve nodejs automation api inline error handling (#6237) 2021-02-02 14:37:03 -08:00
Justin Van Patten 2779de38ea
[sdk/python] from_input: Unwrap nested outputs in input types (#6221)
`Output.from_input` deeply unwraps nested output values in dicts and lists, but doesn't currently do that for the more recently added "input types" (i.e. args classes). This leads to errors when using args classes with output values with `Provider` resources, which uses `Output.from_input` on each input property and then serializes the value to JSON in an `apply`. This changes fixes `Output.from_input` to recurse into values within args classes to properly unwrap any nested outputs.
2021-01-29 15:44:00 -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
Komal 216fd2bed5
Fix the rendering of ResourceOptions.merge (#6206) 2021-01-26 15:44:12 -07:00
Evan Boyle 527b799974
[BREAKING] Remove unidiomatic numerical types from Go SDK (#6143) 2021-01-26 10:58:21 -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
Komal 0f06e03931
Docstring fixups (#6194) 2021-01-25 12:22:17 -07:00
Komal 51521bbe73
Improve automation-api docs (#6178) 2021-01-22 15:12:41 -07:00
Justin Van Patten dab47e9b40
[sdk/dotnet] RegisterResourceOutputs: Check for resource ref support (#6172)
.NET's implementation of RegisterResourceOutputs was always serializing resources as resource references, regardless of the monitor's reported support. This change fixes .NET to check if the monitor supports resource references, which is consistent with all the other languages, and with serialization code elsewhere in the .NET SDK.
2021-01-21 17:04:21 -08:00
Levi Blackstone f6ec691544
Fix malformed resource value bug (#6164)
* Fix resource-ref-as-ID marshaling. (#6125)

This reapplies 2f0dba23ab.

* Fix malformed resource value bug

PR #6125 introduced a bug by marshaling resource
ids as PropertyValues, but not handling that case on
the unmarshaling side. The previous code assumed
that the id was a simple string value. This bug prevents
any stack update operations (preview, update, destroy,
refresh). Since this change was already
released, we must now handle both cases in the
unmarshaling code.

* Add resource ref unit tests for the Go SDK. (#6142)

This reapplies 3d505912b8.

Co-authored-by: Pat Gavlin <pat@pulumi.com>
2021-01-21 16:40:27 -07:00
Paul Stack 9322072146
Revert "Fix resource-ref-as-ID marshaling. (#6125)" (#6167) 2021-01-21 20:37:40 +00:00
Paul Stack 7b80188cd6
Revert "Add resource ref unit tests for the Go SDK." (#6166)
This reverts commit 3d505912b8.
2021-01-21 19:42:08 +00:00
Vivek Lakshmanan 68b655bba6 Test fixes for other languages due to change in schema. 2021-01-20 11:29:01 -08:00
Pat Gavlin 3d505912b8
Add resource ref unit tests for the Go SDK. (#6142)
- Add tests that deserialize known custom and component resources
- Add tests that deserialize missing custom and component resources

These changes also add support for deserializing resources with missing
modules/packages. Such resources are deserialized as generic component,
custom, or provider resources as appropriate.

Contributes to #5943.
2021-01-19 13:11:17 -08:00
Paul Stack 39b640ec9d
[chore] cleanup go formatting of pulumi.Unsecret (#6127) 2021-01-19 18:02:21 +00:00
Paul Stack d84f7fc791
Revert "Add resource ref unit tests for the Go SDK." (#6136)
This reverts commit 940c0eaf62.
2021-01-19 12:01:34 +00:00
Pat Gavlin 940c0eaf62
Add resource ref unit tests for the Go SDK. (#6116)
- Add tests that deserialize known custom and component resources
- Add tests that deserialize missing custom and component resources

These changes also add support for deserializing resources with missing
modules/packages. Such resources are deserialized as generic component,
custom, or provider resources as appropriate.

Contributes to #5943.
2021-01-15 16:33:43 -08:00
Pat Gavlin 2f0dba23ab
Fix resource-ref-as-ID marshaling. (#6125)
When marshaling a resource reference as its ID (i.e. when
opts.KeepResources is false, as it will be in the case of downlevel SDKs
and resource providers), we must take care to marshal/unmarshal an empty
ID as the unknown property value.

This includes the following changes to the resource ref APIs:

- Bifurcate resource reference creation into two methods: one for
  creating references to custom resources and one for creating
  references to component resources.
- Store the ID in a resource reference as a PropertyValue s.t. it can be
  computed.
- Add a helper method for retrieving the ID as a string + an indicator of
  whether or not the reference has an ID.

Fixes #5939.
2021-01-15 16:06:57 -08:00
Paul Stack 475250f82f
Adding pulumi.IsSecret and pulumi.Unsecret to the Go SDK (#6085) 2021-01-15 20:49:48 +00:00
Paul Stack 61ae57da0c
Add support for pulumi logout --all (#6101) 2021-01-15 13:38:58 +00:00
Paul Stack 1cff1a4bcf
[sdk/python] Adding pulumi.unsecret and pulumi.is_secret (#6111) 2021-01-14 20:37:05 +00: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 dd66d8d2ab
Remove annotations import (#6109) 2021-01-14 12:36:11 -08:00
Pat Gavlin 683b4de2f0
Add .NET resource ref unit tests. (#6104)
- Add tests that serialize custom and component resources for targets
  that support resource references
- Add tests that serialize custom and component resources for downlevel
  targets
- Add tests that deserialize known custom and component resources
- Add tests that deserialize missing custom and component resources

These changes also fix a few bugs that were encountered during testing:
- Component resource construction was not supported
- Resources with missing packages could not be deserialized

In the latter case, a missing resource is deserialized as a generic
DependencyResource.

These changes also update the signature of IMocks.NewResourceAsync to
allow the returned ID to be null. This is technically a C# breaking change
with respect to nullability.

Contributes to #5943.

Co-authored-by: Mikhail Shilkov <github@mikhail.io>
2021-01-14 12:24:41 -08:00
Komal a35b61e0b5
[auto/go] - Set DryRun on RunInfo (#6099) 2021-01-13 13:05:36 -08:00
Vivek Lakshmanan 37487d3e61
Merge branch 'master' into vl/AutomationLogging 2021-01-13 10:24:12 -08:00
Komal 89b1d0d2c7
[automation-api/python] - Support recovery workflow (#6037) 2021-01-12 19:27:21 -08:00
Komal 059402483b
[Automation API] Python Implementation (#5979)
Co-authored-by: evanboyle <evan@pulumi.com>
2021-01-12 16:55:59 -08:00
Vivek Lakshmanan 9616bde745 Add debug logging settings for common automation API operations 2021-01-12 13:46:46 -08:00
Vivek Lakshmanan 6a9d5c9822
Merge pull request #6070 from pulumi/vl/FixesForKubeOp
Fixes to support non-pulumi backends in kubernetes operator
2021-01-12 13:28:13 -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
Levi Blackstone 8efd7789bb
Plumb context through RPC interface to support resource construction (#6089)
In order to support resource construction in the Go SDK, the
engine context needs to be available in the RPC unmarshaling
code. This change adds a context parameter to the Construct and
ConstructProvider functions, and plumbs the engine context through
to the relevant calls to these functions.
2021-01-12 11:40:53 -07:00
Justin Van Patten 74580168c2
Fix looking up empty version in ResourcePackages.TryGetResourceType (#6084)
When a resource reference is deserialized, it may not have a version in which case `version` will be an empty string. This change fixes `TryGetResourceType` to work correctly when an empty version is passed.
2021-01-12 08:53:52 -08:00
Mikhail Shilkov 710f385447
[dotnet] Unsecret and IsSecret implementation for .NET (#6092) 2021-01-12 14:54:08 +00:00
Vivek Lakshmanan 7980f047fb Add test to validate impact of setting PULUMI_BACKEND_URL 2021-01-11 16:27:54 -08:00
Vivek Lakshmanan 47fc0f236a Fixes to support non-pulumi backends in kubernetes operator 2021-01-11 11:47:21 -08:00
Vivek Lakshmanan b70c89eeec Allow optional strict enum types to be omitted
Fixes https://github.com/pulumi/pulumi/issues/6068
2021-01-11 09:58:32 -08:00
Nicolas Fløysvik 9fbdc51fcd
[sdk/dotnet] Moved urn value retrieval into if statement (#6081) 2021-01-11 06:39:17 -08:00
Komal ae7d95eb87
[sdk/python] - Don't log if debug and no engine (#6067) 2021-01-07 15:23:23 -08:00
stack72 9d0bac3e08 fixing the install of the DotNet SDK 2021-01-06 20:13:34 +00:00
Luke Hoban db14188526
[sdk/go] Support maps in Invoke outputs and Read inputs (#6014)
* [sdk/go] Support maps in Invoke outputs and Read inputs

These are already supported by the implementation, but were prevented by overzealous input validation in Invoke and ReadResource.

Follow-up to #4522 and #4521.

* Add CHANGELOG

* PR feedback
2021-01-06 15:35:13 +11:00
Komal 8e8129012e
[automation-api/nodejs] - Support recovery workflow (#6038) 2021-01-04 16:45:57 -08:00
stack72 9d228721b6 Merge branch 'master' of github.com:pulumi/pulumi 2021-01-04 22:39:21 +00:00
stack72 83da48e492 Remove UpdateVersion from UpdateInfo struct as it's already covered by Version 2021-01-04 22:39:10 +00:00
Komal 1ef22c375d
Revert bulk config ops in nodejs auto-api (#6051) 2021-01-04 14:38:55 -08:00
stack72 cf91644cd5 Ensure UpdateInfo doesn't have duplicate field names 2021-01-04 21:34:18 +00:00
Paul Stack c047979b16
Export UpdateID as part of the UpdateInfo event that comes from the SaaS (#6049)
Co-authored-by: Chris Smith <chrsmith@users.noreply.github.com>
2021-01-04 21:26:59 +00:00
Paul Stack 60991a5568
[CLI] Provider better user error when Pulumi credentials file is corrupt (#6044)
Fixes: #2779
2021-01-04 20:36:51 +00: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