Commit graph

3476 commits

Author SHA1 Message Date
Matt Ellis f78c2f58f6 Update CHANGELOG.md for release 2019-04-17 08:19:52 -07:00
Joe Duffy 644d5dc916
Enable unit testing for Pulumi programs (#2638)
* Enable unit testing for Pulumi programs

This change enables rudimentary unit testing of your Pulumi programs, by introducing a `PULUMI_TEST_MODE` envvar that, when set, allows programs to run without a CLI. That includes

* Just being able to import your Pulumi modules, and test ordinary functions -- which otherwise would have often accidentally triggered the "Not Running in a CLI" error message
* Being able to verify a subset of resource properties and shapes, with the caveat that outputs are not included, due to the fact that this is a perpetual "dry run" without any engine operations occurring

In principle, this also means you can attach a debugger and step through your code.

* Finish the unit testing features

This change

1) Incorporates CR feedback, namely requiring that test mode be
   explicitly enabled for any of this to work.

2) Implements Python support for the same capabilities.

3) Includes tests for both JavaScript and Python SDKs.

* Add a note on unit testing to the CHANGELOG

* Use Node 8 friendly assert API

* Embellish the CHANGELOG entry a bit
2019-04-16 22:20:01 -07:00
Sean Gillespie 47a2acaa7b
Protobuf changes for provider versioning (#2642)
In pursuit of pulumi/pulumi#2389, this commit adds the necessary changes
to the resource monitor protocol so that language hosts can communicate
exactly what version of a provider should be used when servicing an
Invoke, ReadResource, or RegisterResource. The expectation here is that,
if a language host provides a version, the engine MUST use EXACTLY that
version of a provider plugin in order to service the request.
2019-04-16 10:06:43 -07:00
Levi Blackstone bdc687e654
Add a note about quoting to state delete doc (#2641) 2019-04-11 16:10:28 -06:00
Levi Blackstone 2532ce0527
Update changelog for 0.17.6 release (#2639) 2019-04-11 11:53:17 -06:00
Alex Clemmer fac6944781 Warn instead of error when refresh'd resource is unhealthy
Fixes #2633.

Currently when a user runs `refresh` and a resource is in a state of
error, the `refresh` will fail and the resource state will not be
persisted. This can make it vastly harder to incrementally fix
infrastructure. The issue mentioned above explains more of the
historical context, as well as some specific failure modes.

This commit resolves this issue by causing refresh to *not* report an
error in this case, and instead to simply log a warning that the
`refresh` has recognized that the resource is in an unhealthy state
during state sync.
2019-04-10 16:43:33 -07:00
James Nugent ef5e148a73
Merge pull request #2613 from pulumi/jen20/go-modules
Initialize Go modules for pulumi/pulumi
2019-04-10 08:55:19 +04:00
James Nugent edab10e9c8 Use Go Modules for dependency tracking
This commit switches from dep to Go 1.12 modules for tracking Pulumi
dependencies. Rather than _building_ using Go modules, we instead use the `go
mod vendor` command to populate a vendor tree in the same way as `dep ensure`
was previously doing.

In order to prevent checksum mismatches, it was necessary to also update CI to
use Go 1.12 instead of 1.11 - which also necessitated fixing some linting errors
which appeared with the upgraded golangci-lint for 1.12.
2019-04-10 08:37:51 +04:00
CyrusNajmabadi 42812f9b28
Work around a legal code pattern that previous versions of TypeScript complain about. (#2631) 2019-04-08 11:21:01 -07:00
Matt Ellis 44292747d4 Collect logs from Google Cloud Functions
This change adds an operations provider for GCP. Right now, it can
just collect logs from google cloud functions, similar to `gcloud
functions logs read`
2019-04-08 09:44:05 -07:00
Joe Duffy cc7a657628
Make the Python SDK's Config.name argument optional (#2624)
This makes the Python SDK's Config constructor name argument
optional, similar to what we do in the Node.js SDK. If not supplied,
the current project name is used as the default.
2019-04-04 16:55:01 -07:00
Matt Ellis f3379b1190 Fix lint issue
A linter was correctly detecting a case where we were we were doing an
unneeded nil check on `err`. The previous clause in the if/else block
ensures that `err` is non nil.
2019-04-03 17:22:55 -07:00
CyrusNajmabadi 26b7bc7d26
Tweak how often we print 'in progress' messages during tests. (#2612) 2019-03-29 17:34:16 -07:00
CyrusNajmabadi 02f46811db
Add a SxS test for @pulumi/pulumi to help catch when we make breaking changes to core types. (#2610) 2019-03-29 12:27:42 -07:00
CyrusNajmabadi 1f51ec00fc
Revert 'Simplify API for passing providers to a ComponentResource (#2602)' (#2606) 2019-03-28 18:31:03 -07:00
CyrusNajmabadi 49a8e73aa7
Ensure that the values in 'dependsOn' are actually Resources. (#2605) 2019-03-28 17:27:51 -07:00
CyrusNajmabadi 3526f5c4ba
Run nodejs sdk before python sdk. (#2604) 2019-03-28 15:43:54 -07:00
CyrusNajmabadi 7193622183
Simplify API for passing providers to a ComponentResource (#2602) 2019-03-28 15:04:07 -07:00
Matt Ellis 2ace3e7b0c Correctly handle FileArchives when the filename contains a dot
Our logic for how we handled `.tar.gz` archives meant that any other
type of file that had a dot in the filename would not be detected
correctly.

Fixes #2589
2019-03-28 13:26:07 -07:00
CyrusNajmabadi 44150b1fe5
Be resilient to 3rd party libraries placing an __awaiter function on the global object. (#2599) 2019-03-28 11:22:34 -07:00
CyrusNajmabadi fd6ae9cb7e
Suppress further errors at LangHost level if we know the nodejs process reported the errors to the user. (#2596) 2019-03-27 14:40:29 -07:00
CyrusNajmabadi ec05610f2d
Print an unhandled exception as a single error, not multiple errors (#2595) 2019-03-27 12:17:38 -07:00
CyrusNajmabadi b1c9386926
Update changelog (#2594) 2019-03-26 16:53:37 -07:00
CyrusNajmabadi 992952b54f
Revert "Better present interpolated strings during preview. (#2564)" (#2593) 2019-03-26 16:36:43 -07:00
Matt Ellis ccd958777c Don't print error prefix when a confirmation prompt is declined
Use `result.Result` in more places, so when a confirmation prompt is
declined, we just return `result.Bail()` after printing a message
without the `error: ` prefix.

Fixes #2070
2019-03-26 15:17:18 -07:00
Sean Gillespie f34aef2f4d
Prepare CHANGELOG.md for release (#2591) 2019-03-26 14:45:09 -07:00
Sean Gillespie 4d227f7ed2
Load default providers deterministically (#2590)
* Load default providers deterministically

This commit adds a new algorithm for deriving a list of default
providers from the set of plugins reported from the language host and
from the snapshot. If the language host reports a set of plugins,
default providers are sourced directly from that set, otherwise default
providers are sourced from the full set of plugins, including ones from
the snapshot.

When multiple versions of the same provider are requested, the newest
version of that provider is always select as the default provider.

* Add CHANGELOG.md entry

* Skip the language host's plugins if it reports no resource plugins

* CR feedback

* CR: Log when skipping non resource plugin
2019-03-26 13:29:34 -07:00
Dominik-K 3324dc3249 cmd/state_delete: document URN in help (#2475)
Documenting positional arguments must be done manually, still: https://github.com/spf13/cobra/issues/395
2019-03-26 09:59:52 -07:00
Matt Ellis 3621c01f4b Fix spurious warnings when using dynamic provider
When using a dynamic provider, the following messages are printed,
because we did not update the dynamic provider when we added these new
RPCs:

```
Method handler checkConfig for /pulumirpc.ResourceProvider/CheckConfig expected but not provided
Method handler diffConfig for /pulumirpc.ResourceProvider/DiffConfig expected but not provided
```

Given that we don't do anything for the `configure` RPC today, we can
also just no-op these RPCs as well.
2019-03-26 12:04:15 -04:00
CyrusNajmabadi 906488c7d0
Fix issue where we could not serialize an arrow-function with a deconstructed parameter. (#2582) 2019-03-22 16:48:38 -07:00
CyrusNajmabadi be1c3eb05b
Add support for serializing bigints (#2581) 2019-03-22 15:33:37 -07:00
CyrusNajmabadi 3e3e2cbec7
Revert "Revert "Use result.Result pattern in more places. (#2573)" (#2575)" (#2577)
This reverts commit 4abdc88c2e.
2019-03-21 13:23:46 -07:00
CyrusNajmabadi 4abdc88c2e
Revert "Use result.Result pattern in more places. (#2573)" (#2575)
This reverts commit 99496afcfd.
2019-03-21 00:29:34 -07:00
CyrusNajmabadi 99496afcfd
Use result.Result pattern in more places. (#2573) 2019-03-20 18:51:43 -07:00
CyrusNajmabadi f5e7c5fe97
Use result.Result properly (#2572) 2019-03-20 14:56:12 -07:00
CyrusNajmabadi 02369f9d8a
Allows the nodejs launcher to recognize that certain types of errors were printed, ensuring we don't cascade less relevant messages. (#2554) 2019-03-20 11:54:32 -07:00
Aaron Friel c7eb608c63 Support string literal bounds and return types on Config#get and Config#require (#2570) 2019-03-20 11:52:44 -07:00
CyrusNajmabadi c6d87157d9
Use result.Result in more places. (#2568) 2019-03-19 16:21:50 -07:00
CyrusNajmabadi ecb50b9b85
Use interface for 'result.Result' (#2569) 2019-03-19 12:40:10 -07:00
CyrusNajmabadi ca373c1c1e
Fix spelling (#2567) 2019-03-19 11:35:17 -07:00
Matt Ellis a1bb16407d Add pulumi stack rename
`pulumi stack rename` allows you to change the name of an existing
stack. This operation is non-distructive, however it is possible that
the next update will show additional changes to resources, if the
pulumi program uses the value of `getStack()` as part of a resource
name.
2019-03-19 11:04:33 -07:00
Cameron Stokes 0a4bf7b991 Link to 'Supported Clouds' page rather than listing clouds in README. (#2546)
Also, update Python Runtime version.
2019-03-18 20:41:43 -07:00
CyrusNajmabadi 718a0c293b
Better present interpolated strings during preview. (#2564) 2019-03-18 17:09:12 -07:00
Matt Ellis b774917e57 Prepare CHANGELOG.md for release 2019-03-15 15:21:34 -07:00
Sean Gillespie 26cc1085b1
Install missing plugins on startup (#2560)
* Install missing plugins on startup

This commit addresses the problem of missing plugins by scanning the
snapshot and language host on startup for the list of required plugins
and, if there are any plugins that are required but not installed,
installs them. The mechanism by which plugins are installed is exactly
the same as 'pulumi plugin install'.

The installation of missing plugins is best-effort and, if it fails,
will not fail the update.

This commit addresses pulumi/pulumi-azure#200, where users using Pulumi
in CI often found themselves missing plugins.

* Add CHANGELOG

* Skip downloading plugins if no client provided

* Reduce excessive test output

* Update Gopkg.lock

* Update pkg/engine/destroy.go

Co-Authored-By: swgillespie <sean@pulumi.com>

* CR: make pluginSet a newtype

* CR: Assign loop induction var to local var
2019-03-15 15:01:37 -07:00
CyrusNajmabadi 5d66bea92a
Add in some top-down usage of result.Result (#2556) 2019-03-13 18:00:49 -07:00
CyrusNajmabadi 2a6bbf2a14
Cleaner style (#2557) 2019-03-13 17:52:50 -07:00
CyrusNajmabadi aa7f493974
Add checks for common mistake of swapping component/custom resource options. (#2555) 2019-03-13 17:02:17 -07:00
CyrusNajmabadi 55360737c1
Rename some variables that would conflict with the desire to use 'res' or 'result' (#2553) 2019-03-13 14:00:01 -07:00
CyrusNajmabadi fb38fb9ecb
Panic if passing a nil error to Result.FromError. 2019-03-13 13:43:44 -07:00