Commit graph

3184 commits

Author SHA1 Message Date
Matt Ellis 992b048dbf Adopt golangci-lint and address issues
We run the same suite of changes that we did on gometalinter. This
ended up catching a few new issues, some of which were addressed and
some of which were baselined.
2018-11-08 14:11:47 -08:00
Matt Ellis adb0d9aee6 Use pipenv from the toolset
- Remove the forked copy of the toolset
- Stop installing `pipenv` in sdk/python/Makefile

After this, we'll require that you already have `pipenv` present
before building.
2018-11-08 12:09:21 -08:00
Matt Ellis c398e8ba80 Don't write a lock file when installing test packages
The lockfile is not super interesting when running the lifecycle
tests, since the test project is not a long lived artifact. There was
no real harm in writing it, exepct that in some cases `pipenv` gets
very confused when you have dependencies on pre-release
versions (which is the case right now as we are brining up Python 3).

The packages are still installed correctly, even when we don't write a
lock file.
2018-11-08 12:09:10 -08:00
Justin Van Patten 4defd64e0a
Support specifying template names to pulumi up (#2177)
`pulumi up <arg>` does not currently support template names like `pulumi
new`; `up` is hard-coded to only support URLs to templates. This
prevents us from displaying shorter `$ pulumi up ...` commands in the
Pulumi Console when the URL is to one of our standard Pulumi templates.
In such cases, we'd like to be able to show the command with just the
template name instead of a full URL to the template in the
pulumi/templates repo.

This changes `up` to support the standard Pulumi template names
just like `new`.

Also, while making changes here, if a URL specified to `up` contains
multiple templates in subdirectories, allow the user to choose the
template, just like with `new`.
2018-11-08 10:43:10 -08:00
Justin Van Patten d3ec63cd1d
Use proj description when there's no template desc (#2179)
Whenever we need to display a template description, if the Pulumi.yaml
doesn't have it, but has a project description, just use the project
description. This will allow us to avoid having the same description for
both the project and template in our examples.
2018-11-08 10:42:26 -08:00
Justin Van Patten e1d1366f3b
Don't show new prelude when -g is specified (#2178)
The new command shouldn't show you the "this command will walk you
through" prelude when using the `-g` command -- it's not helpful and
generally looks confusing.
2018-11-08 10:42:00 -08:00
Sean Gillespie 9c82082a57
Implement RegisterResourceOutputs for Python 3 (#2173)
* Implement RegisterResourceOutputs for Python 3

RegisterResourceOutputs allows Python 3 programs to export stack outputs
and export outputs off of component resources (which, under the hood,
are the same thing).

Adds a new integration test for stack outputs for Python programs, as
well as add a langhost test for register resource outputs.

Fixes pulumi/pulumi#2163

* CR: Rename stack_output -> export

Fix integration tests that hardcoded paths to stack_outputs

* Fix one more reference to stack_outputs
2018-11-08 09:44:34 -08:00
CyrusNajmabadi 08fc305b7f
Prevent resource registration from overwriting unknown properties at random points in the future. (#2176) 2018-11-07 20:24:16 -08:00
Sean Gillespie 4ae39b8bec
Ask for the newest Python 3 instead of 3.6 specifically (#2165)
* Ask for the newest Python 3 instead of 3.6 specifically

* Remove PythonVersion from test opts
2018-11-06 10:38:46 -08:00
Sean Gillespie 36c88aab37
Fix Python support in integration test framework (#2158)
* Fix Python support in integration test framework

Update the integratino test framework to use pipenv to bootstrap new
virtual environments for tests and use those virtual environments to run
pulumi update and pulumi preview.

Fixes pulumi/pulumi#2138

* Install packages via 'Dependencies' field

* Remove code for installing packages from Dependencies
2018-11-05 13:52:37 -08:00
CyrusNajmabadi 4e2a6aee0f
Ensure we show the properties that changed when doing a multi-stage replace. (#2153) 2018-11-05 12:37:53 -08:00
CyrusNajmabadi 1ea63761d9
Fix log retrieval for lambdas. (#2160) 2018-11-05 12:27:11 -08:00
Matt Ellis aa018081b2 Require Node 11 run to pass
It was alowed to fail when we were bringing up Node 11 support, but
now that we do support it, we should lock in the win.
2018-11-05 11:49:24 -08:00
Matt Ellis e19b1fa029 Run gometalinter once instead of three times
We end up doing a lot of duplicate work by invoking Gometalinter three
times when we do `make lint`. On my machine this decreases the wall
clock time of `make lint` from ~90 sec to ~15 sec, which is a pretty
drastic speedup.
2018-11-05 11:14:25 -08:00
Sean Gillespie 0e868f15fc
Add two new Python tests and fix bugs (#2147)
future_input tests that it's possible to use coroutines as inputs to
Pulumi resources. resource_thens tests that it's possible to use outputs
to chain resource inputs and outputs together and that the SDK reports
correct dependencies to the engine.

This PR also fixes two bugs exposed by the new tests: first, coroutines
needed to be scheduled before awaiting (otherwise we'd deadlock) and
Nones in maps needed to be ignored when serializing and deserializing.
2018-11-02 16:50:10 -07:00
Pat Gavlin 6f37445782
Fix a few issues in the Go language provider (#2113)
1. Add support for first-class providers
2. Make `pulumi.ResourceState` conform to the `pulumi.Resource` interface
3. Wait for inputs to resolve inside RPC goroutines rather than doing so
   before starting the goroutines

Note that (2) involves a breaking change to `pulumi.ResourceState` that
will require adjusting `tfgen`'s code generation.

Fixes https://github.com/pulumi/pulumi-terraform/issues/256
Contributes to #1713
2018-11-01 21:27:35 -07:00
CyrusNajmabadi 901a238fd5
Get closure serialiation working in Node11 (#2101)
* Make v8 primitives async as there is no way to avoid async in node11.

* Simplify API.

* Move processing of well-known globals into the v8 layer.
We'll need this so that we can map from RemoteObjectIds back to these well known values.

* Remove unnecesssary check.

* Cleanup comments and extract helper.

* Introduce helper bridge method for the simple case of making an entry for a string.

* Make functions async.  They'll need to be async once we move to the Inspector api.

* Make functions async.  They'll need to be async once we move to the Inspector api.

* Make functions async.  They'll need to be async once we move to the Inspector api.

* Move property access behind helpers so they can move to the Inspector API in the future.

* Only call function when we know we have a Function.  Remove redundant null check.

* Properly serialize certain special JavaScript number values that JSON serialization cannot handle.

* Only marshall across the 'source' and 'flags' for a RegExp when serializing.

* Add a simple test to validate a regex without flags.

* Extract functionality into helper method.

* Add test with complex output scenarios.

* Output serialization needs to avoid recursively trying to serialize a serialized value.

* Introduce indirection for introspecting properties of an object.

* Use our own introspection API for examining an Array.

* Hide direct property access through API indirection.

* Produce values like the v8 Inspector does.

* Compute the module map asynchronously.  Will need that when mapping mirrors instead.

* Cleanup a little code in closure creation.

* Get serialization working on Node11 (except function locations).

* Run tests in the same order on <v11 and >=v11

* Make tests run on multiple versions of node.

* Rename file to make PR simpler to review.

* Cleanup.

* Be more careful with global state.

* Remove commented line.

* Only allow getting a session when on Node11 or above.

* Promisify methods.
2018-11-01 15:46:21 -07:00
Sean Gillespie 8ca2840577
Enable and fix Pylint warnings (#2146)
* Enable pylint warnings

* Fix or ignore pylint warnings
2018-11-01 14:29:06 -07:00
Sean Gillespie 6fa67329de
Several gardening tasks for Python (#2145)
* Several gardening tasks for Python

1. Update pipenv to 2018.7.1, which is the most recent release that
isn't broken on Python 2
2. Update our pylint dependency to 1.9, the most recently released
version
3. Re-enable pylint for the Pulumi package

* Back out of pipenv upgrade

It's apparently broken in our CI. Also upgrade pylint to 2.1, which is
apparently the "actual" most recently release according to PyPI.

* Fix a bad merge
2018-11-01 12:58:45 -07:00
Chris Smith 0a76923c64
Add CircleCI support (#2143) 2018-11-01 11:20:31 -07:00
Sean Gillespie 946ca655d3
Provide a Py hook for providers to rename props (#2140)
* Provide a Py hook for providers to rename props

This commit adds input and output hooks that can be overridden by
providers if they would like to change the names of dictionary fields
when projecting resources into Python.

* Add syntax sugar for dict outputs

Properly recurse when rewriting input dictionaries
2018-11-01 10:25:47 -07:00
Joe Duffy 9aedb234af
Tidy up some data structures (#2135)
In preparation for some workspace restructuring, I decided to scratch a
few itches of my own in the code:

* Change project's RuntimeInfo field to just Runtime, to match the
  serialized name in JSON/YAML.

* Eliminate the no-longer-used Context and NoDefaultIgnores fields on
  project, and all of the associated legacy PPC-related code.

* Eliminate the no-longer-used IgnoreFile constant.

* Remove a bunch of "// nolint: lll" annotations, and simply format
  the structures with comments on dedicated lines, to avoid overly
  lengthy lines and lint suppressions.

* Mark Dependencies and InitErrors as `omitempty` in the JSON
  serialization directives for CheckpointV2 files. This was done for
  the YAML directives, but (presumably accidentally) omitted for JSON.
2018-11-01 08:28:11 -07:00
Sean Gillespie 56be1a6677
Implement RPC for Python 3 (#2111)
* Implement RPC for Python 3

* Try not setting PYTHONPATH

* Remove PYTHONPATH line

* Implement Invoke for Python 3

* Implement register resource

* progress

* Rewrite the whole thing

* Fix a few bugs

* All tests pass

* Fix an abnormal shutdown bug

* CR feedback

* Provide a hook for resources to rename properties

As dictionaries and other classes come from the engine, the
translate_property hook can be used to intercept them and rename
properties if desired.

* Fix variable names and comments

* Disable Python integration tests for now
2018-10-31 13:35:31 -07:00
Pat Gavlin b748935753
Do not assert on duplicate resources. (#2127)
Just what it says on the tin.
2018-10-31 10:33:00 -07:00
CyrusNajmabadi 76d08f8590
Simplify summary text. (#2136) 2018-10-30 21:57:38 -07:00
James Nugent 95a5ad4a21
Merge pull request #2137 from pulumi/go-1.11-archive-hashes
Add Go 1.10+ versions of archive hashes in tests
2018-10-30 22:47:10 -05:00
James Nugent 59a8a7fbfe Add Go 1.10+ versions of archive hashes in tests
Go 1.10 made some breaking changes to the headers in archive/tar [1] and
archive/zip [2], breaking the expected values in tests. In order to keep
tests passing with both, wherever a hardcoded hash is expect we switch
on `runtime.Version()` to select whether we want the Go 1.9 (currently
supported Go version) or later version of the hash.

Eventually these switches should be removed in favour of using the later
version only, so they are liberally commented to explain the reasoning.

[1]: https://golang.org/doc/go1.10#archive/tar
[2]: https://golang.org/doc/go1.10#archive/zip
2018-10-30 21:59:36 -05:00
CyrusNajmabadi ba6b36a97b
Explicit disable interactive mode if the TERM variable is set to 'dumb' (#2131) 2018-10-30 17:48:55 -07:00
CyrusNajmabadi 73b42d753b
Include diagnostic prefix in the output for the diff display. (#2132) 2018-10-30 17:46:22 -07:00
CyrusNajmabadi 9b1c2ff54d
Round time to the nearest second to clean up our display (#2133) 2018-10-30 17:42:03 -07:00
CyrusNajmabadi 8eff0e3142
Remove need to dynamically determine if we're in preview or not. (#2129) 2018-10-30 15:42:33 -07:00
Pat Gavlin a93bb948c8
Restore the CloudName field of apitype.Stack. (#2128)
This field is necessary in order to support downlevel CLIs.
2018-10-30 13:49:51 -07:00
James Nugent 0ac0cae722
Merge pull request #2126 from pulumi/go-1.11-fixes
Fix some linter errors. which appear with Go 1.11
2018-10-30 09:13:16 -05:00
James Nugent 39742b3239 Spread array argument to variadic function 2018-10-29 18:09:00 -05:00
James Nugent 84d52b1b3e Use formatting directives when using Assertf 2018-10-29 18:08:08 -05:00
James Nugent 5c76b20f70 Use Infof instead of Info when formatting 2018-10-29 18:06:04 -05:00
Matt Ellis 4ba5901aaf Add --json to pulumi logs
When outputing JSON, if we have a fixed number of log entries (i.e. we
are not `--follow`'ing, we wrap each entry in array. Otherwise, we
just emit each log entry as an object at top level.

As part of this change, I've adopted a slightly more precise time
output format in `pulumi stack ls` when using JSON output. These times
now match the default output from `console.log(new Date())`
2018-10-29 12:43:52 -07:00
Sean Gillespie ca540cc736 Use math.MaxInt32 to signal unbounded parallelism
Downlevel versions of the Pulumi Node SDK assumed that a parallelism
level of zero implied serial execution, which current CLIs use to signal
unbounded parallelism. This commit works around the downlevel issue by
using math.MaxInt32 to signal unbounded parallelism.
2018-10-29 12:27:03 -07:00
CyrusNajmabadi c7a46848b9
Ensure method always returns a boolean. (#2120) 2018-10-28 13:02:37 -07:00
CyrusNajmabadi 3e25bc80c8
Add test with complex output scenarios. (#2118) 2018-10-28 13:02:25 -07:00
CyrusNajmabadi 7efd3ddf05
Cleanup a little code in closure creation. (#2122) 2018-10-28 13:02:04 -07:00
CyrusNajmabadi 13d9043771
Produce values like the v8 Inspector does. (#2119) 2018-10-28 01:01:48 -07:00
Joe Duffy 4647aa6cdb
Merge pull request #2114 from pulumi/joeduffy/994_combinators
Add some helpful input/output combinators
2018-10-27 15:41:22 -07:00
joeduffy c5be233f57 Revert formatting changes for Output.all 2018-10-27 13:55:54 -07:00
joeduffy 972d678388 Add an extra layer of Input-ness
CR feedback.
2018-10-27 13:47:15 -07:00
joeduffy 930c86cb50 Fix some lint errors 2018-10-27 13:27:04 -07:00
joeduffy 1daad93ccd Add tests for the new combinators 2018-10-27 12:56:16 -07:00
joeduffy d6f58eb20e Ditch the Map-based combinators in favor of objects 2018-10-27 12:39:22 -07:00
joeduffy 724ae41e1b Add a toObject combinator
This function works like toMap does, except that it returns an
output object with keys and values derived from input values.
2018-10-27 12:31:31 -07:00
joeduffy b261908884 Move combinators to an iterable module
Rather than placing these combinators directly on the Output class,
which feels odd because they are special purpose to iterables, and deal
with not only Outputs but also Inputs, we will place them on a
separate and dedicated iterable module for these utility helpers.
2018-10-27 12:19:42 -07:00