Commit graph

4214 commits

Author SHA1 Message Date
Justin Van Patten 3c1bdff5fd
Allow relative paths to --policy-pack (#3565)
A regression was introduced when we added support for non-Node.js Pulumi programs to run Policy Packs. With that change, we now pass the Policy Pack's full path as the plugin's pwd (so that it would load the `@pulumi/pulumi/cmd/run-policy-pack` Node module from the Policy Pack's node_modules rather than the program's node_modules), but we also pass the path to the policy pack as well. If the path is a full rooted path, this would work fine, and that's what our tests do. However, if a relative path is specified, then it will be looking to load the Policy Pack relative to the pwd, which doesn't produce a correct path leading to failures trying to load the Policy Pack.

Since the pwd is the policy pack path, we can simply pass the path as `"."` to the analyzer plugin, and it will load the policy pack in its pwd.
2019-11-22 17:24:35 +00:00
CyrusNajmabadi 048400b97e
Fix stackoverflow when checking conversion types. (#3559) 2019-11-21 18:36:01 -05:00
Chris Smith 2ff0e6dee3
Persist computed values (#3558) 2019-11-21 14:58:30 -08:00
CyrusNajmabadi d7e93472b3
Filter out internal properties when deserializing data (#3560) 2019-11-21 17:05:39 -05:00
CyrusNajmabadi eedd277cd7 Update copyrights (#3557) 2019-11-21 22:46:14 +01:00
Justin Van Patten 6c84b008d8
Send resource URN and name to analyzer (#3554)
More information we want to make available to policy packs.
2019-11-21 21:01:15 +00:00
Justin Van Patten fbe96394a1
Add ability to opt-in to using yarn instead of npm (#3556)
This change adds support for setting `PULUMI_PREFER_YARN` to true to opt-in to preferring `yarn` over `npm` when installing Node.js dependencies (and publishing Policy Packs). If `PULUMI_PREFER_YARN` is truthy, but `yarn` cannot be found on `$PATH`, we fallback to using `npm`. If `npm` can't be found on `$PATH`, we provide a more helpful error message.
2019-11-21 20:59:48 +00:00
CyrusNajmabadi b28a44063f
Add the concept of a Union type to use for apis that accept disparate types. (#3548) 2019-11-21 14:51:45 -05:00
CyrusNajmabadi 57421c1ab3
Allow arguments to Invokes to be non-inputs. (#3544) 2019-11-21 00:40:38 -05:00
Pat Gavlin a600d16526
Retry failed update steps in integration tests. (#3542)
Add support for a test option that indicates that failed update steps
should be retried. Currently the maximum number of retries (3) is not
configurable.
2019-11-20 12:52:57 -08:00
Mikhail Shilkov 6f55e1a82a
Tests for .NET aliases (#3420)
Tests for .NET aliases
2019-11-20 22:07:56 +03:00
Pat Gavlin 35b32f20c3 Update the CHANGELOG for 1.6.0 2019-11-20 10:53:04 -08:00
Chris Smith 4e59263a9c
Add tests for serializing PropertyMaps (#3533)
* WIP - Add tests for serializing PropertyMaps

* Apply suggestions from code review

Co-Authored-By: Pat Gavlin <pat@pulumi.com>

* Cleanup tests
2019-11-19 21:10:51 -08:00
Pat Gavlin bf16f3a541
Reword step failure message prefix during an update (#3000)
* Reword step failure message prefix during an `update`

The text "Plan applied failed: " is pretty inscrutable given our
current system. While both "plan" and "apply" are concepts inside the
the implementation of the CLI, we usually talk in terms of `preview`
and `update`. I suspect there are some cases where this prefix is not
100% technically correct, and if there's a better short way of saying
something more correct, I would love to adopt that instead, but as is,
I would really love to get rid of the "Plan apply failed" text in our
system, it pains me every time I read it.

* Do not prefix failed operation errors.
2019-11-19 20:09:45 -08:00
Pat Gavlin 91ff3d9434
Skip tests that hang on Node 12.11.x+ (#3534)
Fixes #3484.
2019-11-19 18:48:27 -08:00
Pat Gavlin 9c6f332ebe Do not prefix failed operation errors. 2019-11-19 17:17:17 -08:00
Matt Ellis 7684426f28 Reword step failure message prefix during an update
The text "Plan applied failed: " is pretty inscrutable given our
current system. While both "plan" and "apply" are concepts inside the
the implementation of the CLI, we usually talk in terms of `preview`
and `update`. I suspect there are some cases where this prefix is not
100% technically correct, and if there's a better short way of saying
something more correct, I would love to adopt that instead, but as is,
I would really love to get rid of the "Plan apply failed" text in our
system, it pains me every time I read it.
2019-11-19 17:15:32 -08:00
Cyrus Najmabadi 29d12bef06 Merge branch 'exportFunctions' of github.com:pulumi/pulumi into exportFunctions 2019-11-19 16:32:14 -08:00
Cyrus Najmabadi 2e75146db7 Merge branch 'master' into exportFunctions 2019-11-19 16:31:30 -08:00
Evan Boyle 8dbe6650e7
update setup instructions (#3530) 2019-11-19 15:45:23 -08:00
Alex Clemmer dfd722f5df Fix flaky query test (#3436) 2019-11-19 15:23:08 -08:00
Justin Van Patten 7278a7429c
Don't remove tests from @pulumi/pulumi npm package (#3532)
The test files are currently included in the npm package, and we have packages that depend on the test files currently, so when installing the linkable `@pulumi/pulumi` package locally, don't delete the tests.
2019-11-19 21:29:53 +00:00
CyrusNajmabadi d4aa5fe20d Switch to 'console.log' for our hang warning. Add warning to synchronous StackReference calls. (#3456)
Codepaths which could result in a hang will print a message to the console indicating the problem, along with a link to documentation on how to restructure code to best address it.

`StackReference.getOutputSync` and `requireOutputSync` have been deprecated as they may cause hangs on some combinations of Node and certain OS platforms. `StackReference.getOutput` and `requireOutput` should be used instead.
2019-11-19 12:51:14 -08:00
Luke Hoban f9085bf799
Properly support Dependencies in .NET integration tests (#3527)
Allow any .NET pacakge dependency to be provided instead of hardcoding `Pulumi`.
2019-11-19 12:01:29 -08:00
Maciej Lisiewski bcdd27e092 Updates grpc package to 1.24.2 for js sdk (#3512)
Fixes building grpc package with gcc8 and newer
Fixes building grpc package for node 13.x
Matches minor grpc release (1.24.x) to version used by dotnet sdk
2019-11-19 11:56:26 -08:00
Justin Van Patten 83c5e766a4
Provide a more helpful PaC error (#3525)
To allow Policy Packs to run against Pulumi programs written in all languages, we now look for the `@pulumi/pulumi/cmd/run-policy-pack` module in the Policy Pack's node_modules (instead of in the Pulumi program's node_modules; which doesn't exist for non-node languages). The `@pulumi/policy` library that a Policy Pack will depend on should already depend on a recent enough version of `@pulumi/pulumi`. When we can't find the module, it's more likely it's due to the dependencies for the Policy Pack not being installed. Provide a more helpful error message in this case.
2019-11-19 18:47:47 +00:00
James Nugent 5653642a4b
Merge pull request #3522 from pulumi/jen20/upgrade-go-cloud
Upgrade to go-cloud v0.18
2019-11-19 18:45:53 +00:00
CyrusNajmabadi 225993b9a5
Simplify API for making archives. (#3475) 2019-11-19 13:19:06 -05:00
James Nugent 54e4936afc Provide a default for Azure KeyVault algorithm
If the algorithm is unspecified, we provide a reasonable default. If an
alternative is provided (via an undocumented route), we use that,
however.

This commit brings us into line with the documentation.

Fixes #3359.
2019-11-19 16:15:49 +00:00
James Nugent d5d23ab36d Upgrade to fork of go-cloud 0.18 2019-11-19 16:15:45 +00:00
Paul Stack c4e74d8ffc
Validate stack name on stack init with non default secrets provider (#3519)
Fixes: #3248

Before, we got a panic. in the createStack, when we had a non-default
secrets provider, we were assuming the name of the stack was correct
if we were in non-interactive mode

This commit adds a guard against this by doing a final validation of
the stack name *before* we even get into the createStack func

This means, that we get the following (and not the panic)

```
▶ pulumi stack init -s "org/" --secrets-provider="gcpkms://"
error: A stack name may only contain alphanumeric, hyphens, underscores, and periods
```
2019-11-19 16:58:23 +01:00
CyrusNajmabadi 1908a18d20 Loosen resource targeting restrictions. (#3426)
- If an untargeted create would not affect the inputs of any targeted
  resources, do not fail the update. Untargeted creates that are
  directly dependend on by targeted resources will still cause failures
  that inform the user to add the untargeted resources to the --target
  list.
- Users may now pass the `--target-dependents` flag to allow targeted
  destroys to automatically target dependents that must be destroyed in
  order to destroy an explicitly targeted resource.
2019-11-18 20:28:25 -08:00
Evan Boyle 8547ede659
Add Go support for config.*Object (#3526) 2019-11-18 18:53:27 -08:00
Evan Boyle 3ac8dd5285
Add support to the go sdk for IgnoreChanges (#3514) 2019-11-18 16:47:19 -08:00
Justin Van Patten 022826bac5
Enable policies to run for all languages (#3524) 2019-11-18 18:29:12 +00:00
James Nugent 34611a753a
Merge pull request #3518 from pulumi/go1.13
Move from go 1.12.x to go 1.13.x
2019-11-18 15:31:31 +00:00
stack72 25aeb237ca Move from go 1.12.x to go 1.13.x 2019-11-18 14:49:31 +01:00
CyrusNajmabadi 90061b712e
Add some helpers to make the .net Input/Output experience better. (#3515) 2019-11-16 13:55:40 -08:00
Luke Hoban 445f10a39e
Expose --policy-pack under PULUMI_EXPERIMENTAL (#3516)
We recently moved `pulumi policy` to be available under `PULUMI_EXPERIMENTAL` along with `pulumi query` and `pulumi watch`.  We missed exposing `--policy-pack`.
2019-11-15 10:53:13 -08:00
Evan Boyle 5ae4149af5
Add support for "go run" style execution (#3503) 2019-11-14 09:25:55 -08:00
Mikhail Shilkov 95ce3e2567
Update .NET README file to reflect the preview 2019-11-14 14:48:41 +00:00
Mikhail Shilkov f659f6f33c
Extension methods to navigate Output<Array> (#3481)
Extension methods to navigate Output<Array>: get n-th element, get length, get first.
2019-11-14 05:45:57 +00:00
Pat Gavlin e978eaaf5a
Fix Python package versions. (#3505)
Earlier changes to the get-version script were not adopted by the Python
SDK Makefile. This caused package publishing to skip uploads due to
missing versions.
2019-11-13 11:34:59 -08:00
Pat Gavlin bd2de540b2 Update the CHANGELOG for v1.5.2 2019-11-13 09:31:37 -08:00
Pat Gavlin a7f61a59b0
Reimplement Output for Go. (#3496)
- Use a mutex + condition variable instead of a channel for
  synchronizaiton in order to allow multiple calls to resolve/reject
- Properly handle outputs that are resolved to other outputs, especially
  if those outputs are not of exactly type Output
- Remove the Value() methods that allowed prompt access to output values
- Add variants of `Apply` that take a context parameter
- Ensure that resource outputs properly incorporate their resource as
  a dependency
- Make `Output` a plain struct. Uninitialized outputs will be treated as
   resolved and unknown. This makes conversions between output
   types more ergonomic.

Contributes to #3492.
2019-11-12 14:20:06 -08:00
Mikhail Shilkov d81ac16132
Method to merge input maps (#3485)
A method to merge two input maps
2019-11-12 23:01:08 +01:00
Alex Clemmer b06805ded3 Add StreamInvoke to dynamic provider 2019-11-12 13:51:19 -08:00
Alex Clemmer a40008db41 StreamInvoke should return AsyncIterable that completes
A user who calls `StreamInvoke` probably expects the `AsyncIterable`
that is returned to gracefully terminate. This is currently not the
case.

Where does something like this go wrong? A better question might be
where any of this went right, because several days later, after
wandering into civilization from the great Wilderness of Bugs, I must
confess that I've forgotten if any of it had.

`AsyncIterable` is a pull-based API. `for await (...)` will continuously
call `next` ("pull") on the underlying `AsyncIterator` until the
iterable is exhausted. But, gRPC's streaming-return API is _push_ based.
That is to say, when a streaming RPC is called, data is provided by
callback on the stream object, like:

    call.on("data", (thing: any) => {... do thing ...});

Our goal in `StreamInvoke` is to convert the push-based gRPC routines
into the pull-based `AsyncIterable` retrun type. You may remember your
CS theory this is one of those annoying "fundamental mismatches" in
abstraction. So we're off to a good start.

Until this point, we've depended on a library,
`callback-to-async-iterator` to handle the details of being this bridge.
Our trusting nature and innocent charm has mislead us. This library is
not worthy of our trust. Instead of doing what we'd like it to do, it
returns (in our case) an `AsyncIterable` that will never complete.
Yes,, this `AsyncIterable` will patiently wait for eternity, which
honestly is kind of poetic when you sit down in a nice bath and think
about that fun time you considered eating your computer instead of
finishing this idiotic bug.

Indeed, this is the sort of bug that you wonder where it even comes
from. Our query libraries? Why aren't these `finally` blocks executing?
Is our language host terminating early? Is gRPC angry at me, and just
passive-aggrssively not servicing some of my requests? Oh god I've been
up for 48 hours, why is that wallpaper starting to move? And by the way,
a fun interlude to take in an otherwise very productive week is to try
to understand the gRPC streaming node client, which is code-gen'd, but
which also takes the liberty of generating itself at runtime, so that
gRPC is code-gen'ing a code-gen routine, which makes the whole thing
un-introspectable, un-debuggable, and un-knowable. That's fine, I didn't
need to understand any of this anyway, thanks friends.

But we've come out the other side knowing that the weak link in this
very sorry chain of incredibly weak links, is this dependency.

This commit removes this dependency for a better monster: the one we
know.

It is at this time that I'd like to announce that I am quitting my job
at Pulumi. I thank you all for the good times, but mostly, for taking
this code over for me.
2019-11-12 13:51:19 -08:00
Alex Clemmer b15937aabd Don't send spurious empty stream invoke response 2019-11-12 13:51:19 -08:00
Pat Gavlin 137fd54f1c
Propagate inputs to outputs during preview. (#3327)
These changes restore a more-correct version of the behavior that was
disabled with #3014. The original implementation of this behavior was
done in the SDKs, which do not have access to the complete inputs for a
resource (in particular, default values filled in by the provider during
`Check` are not exposed to the SDK). This lack of information meant that
the resolved output values could disagree with the typings present in
a provider SDK. Exacerbating this problem was the fact that unknown
values were dropped entirely, causing `undefined` values to appear in
unexpected places.

By doing this in the engine and allowing unknown values to be
represented in a first-class manner in the SDK, we can attack both of
these issues.

Although this behavior is not _strictly_ consistent with respect to the
resource model--in an update, a resource's output properties will come
from its provider and may differ from its input properties--this
behavior was present in the product for a fairly long time without
significant issues. In the future, we may be able to improve the
accuracy of resource outputs during a preview by allowing the provider
to dry-run CRUD operations and return partially-known values where
possible.

These changes also introduce new APIs in the Node and Python SDKs
that work with unknown values in a first-class fashion:
- A new parameter to the `apply` function that indicates that the
  callback should be run even if the result of the apply contains
  unknown values
- `containsUnknowns` and `isUnknown`, which return true if a value
  either contains nested unknown values or is exactly an unknown value
- The `Unknown` type, which represents unknown values

The primary use case for these APIs is to allow nested, properties with
known values to be accessed via the lifted property accessor even when
the containing property is not fully know. A common example of this
pattern is the `metadata.name` property of a Kubernetes `Namespace`
object: while other properties of the `metadata` bag may be unknown,
`name` is often known. These APIs allow `ns.metadata.name` to return a
known value in this case.

In order to avoid exposing downlevel SDKs to unknown values--a change
which could break user code by exposing it to unexpected values--a
language SDK must indicate whether or not it supports first-class
unknown values as part of each `RegisterResourceRequest`.

These changes also allow us to avoid breaking user code with the new
behavior introduced by the prior commit.

Fixes #3190.
2019-11-11 12:09:34 -08:00