Commit graph

2411 commits

Author SHA1 Message Date
joeduffy c50899aca3 Add some TODO refs to pulumi/pulumi#1063 2018-03-19 18:17:57 -07:00
Matt Ellis a3369d3cbc Fix make_release.sh when run from outside scripts directory 2018-03-19 14:24:52 -07:00
Matt Ellis 38ec631753
Merge pull request #1056 from pulumi/change-version-number
Adopt new version strategy
2018-03-19 13:25:12 -07:00
Joe Duffy abbac13655
Assume --remote when --cloud-url is set (#1060)
If you use --cloud-url, as in

    $ pulumi stack init foo --cloud-url https://x.io

we would silently fall back to logic that creates local stacks.

I realize all of this will get better with the new stack identity
model, however in the meantime, let's infer that the user wanted
--remote when --cloud-url is non-"".
2018-03-18 12:44:00 -07:00
CyrusNajmabadi d719e7966e
Only avoid running transformations on outputs we truly do not have values for. (#921) 2018-03-18 00:15:22 -07:00
joeduffy 094c877e32 Add Python language host to the SDK 2018-03-17 10:41:37 -07:00
Matt Ellis e46a665ce4 Add get-version.cmd and use it
Port the .sh script to powershell and use it on Windows.
2018-03-16 16:36:27 -07:00
Matt Ellis 642ee91065 Advise about --plaintext in config warning message
When run without a `--plaintext` or `--secret` argument, `pulumi
config` warns that the value is stored unecrypted and that you can
pass `--secret` to encrypt it. Now, we also mention that `--plaintext`
can be pased explicity on the command line to avoid the warning.

Fixes #752
2018-03-16 12:07:03 -07:00
Joe Duffy 1a475aeb38
Implement Python invoke RPC (#1054)
Implement Python invoke RPC

This change implements the invoke function for resource provider
RPCs.  This is required to support a customer scenario.

There are a few other minor updates:

* Rename pulumi.export to pulumi.output.

* Change register_resource to, like invoke, return the resulting
  object/dictionary, instead of the set_outputs function.

* Initialize the monitor/engine RPC connections to None when not
  attached to the engine, thus ensuring good error messages.

* Fix Python project/stack metadata
2018-03-16 08:39:24 -07:00
Matt Ellis 5c4a31f692 Adopt new version strategy
Our previous strategy of just using `git describe --tags --dirty` to
compute a version caused issues. The major one was that since version
sort lexigrapically, git's strategy of having a commit count without
leading zeros lead to cases where 0.11.0-dev-9 was "newer than"
0.11.0-dev-10 which is not what you want at all.

With this change, we compute a version by first seeing if the commit
is tagged, and if so, we use that tag. Otherwise, we take the closest
tag and to it append the unix timestamp of the commit and then append
a git hash.

Because we use the commit timestamp, things will sort correctly again.

Part of pulumi/home#174
2018-03-15 18:06:04 -07:00
Chris Smith 441f4566c7
Fix panic when getting logs for older stacks (#1053)
* Fix panic when getting logs for older stacks

* Make GetChild return a tuple

* Update tests; add test
2018-03-15 13:26:43 -07:00
Matt Ellis cd64462a9d Export display helper functions
This allows some upstack components that need to consume engine events
use the common display logic we have here.
2018-03-14 14:02:30 -07:00
Joe Duffy 41127c55e9
Add basic config tests (#1049)
This adds a basic config test, for both Node.js and Python runtimes,
that simply reads back and checks configuration and secret values.
2018-03-14 12:24:49 -07:00
Justin Van Patten 31d572e4db
Remove unnecessary os.Stat call (#1048)
Just a nit: It's possible (though, unlikely) that the repo file is
deleted between the call to `os.Stat` and `ioutil.ReadFile`. Instead,
just try to read the file -- if the file doesn't exist,
`ioutil.ReadFile` will return an error that works the same with
`os.IsNotExist(err)` as the error returned from `os.Stat`.
2018-03-14 10:00:15 -07:00
Matt Ellis 05d90a244c Pass legacy config mapping from nodejs langhost
We need to support the current version of the nodejs language host
running programs that use older version of @pulumi/pulumi where the
runtime expected config keys to look like
`<package>:config:<name>`. In the language host we actually did the
transformation from the new format to the old one, for compatability
reasons but we then droped the transfomed value on the floor.
2018-03-13 23:16:38 -07:00
Justin Van Patten c7985ed296
Support offline template descriptions (#1044)
Note: This is a minor issue that I didn't get to for M11 that isn't
required for M11 and would be fine merging for post-M11.

When you specify a template name explicitly (e.g.
`pulumi new typescript`), we'll try to download the template tarball
without first downloading the JSON list of available templates. The JSON
includes a description used when replacing the `${DESCRIPTION}` string
in template files. Since we didn't download the JSON, we won't have a
description, so we fallback to a default value (`"A Pulumi project."`).
This also happens when specifying `--offline` to use an existing
template under `~/.pulumi/templates`; we won't have a description for
the template, so we fallback to a default description. The fallback
value happens to be the same as the description for each of our current
templates, so noone will currently notice an issue.

For M11, I included initial support for a template manifest file where
the description (and any future metadata) could be stored, but didn't go
as far as actually reading the file.

This change makes it so the CLI actually reads the description from the
manifest file (if it exists), otherwise falling back to the default
value as is done currently. Some minor related cleanup is included in
this change.
2018-03-13 16:09:25 -07:00
CyrusNajmabadi 134941dd22
Improve error text when lambda functions are involved. (#1046) 2018-03-13 13:21:07 -07:00
CyrusNajmabadi 304af9cdf1
Split closure serialization into separate files containing the different concerns. (#1045)
The four concerns are:

    parsing a v8 function string so we can figure out captured variables.
    walkgin the function/object graph producing the graph we will serialize.
    rewriting constructors and methods so that 'super' works.
    serializing graph to text.
2018-03-12 18:12:49 -07:00
Joe Duffy 5924f6b8c3
Ensure destroy plugins are present (#1043)
This change uses the prior checkpoint's deployment manifest to pre-
populate all plugins required to complete the destroy operation.  This
allows for subsequent attempts to load a resource's plugin to match the
already-loaded version.  This approach obviously doesn't work in a
hypothetical future world where plugins for the same resource provider
are loaded side-by-side, but we already know that.
2018-03-12 16:27:39 -07:00
CyrusNajmabadi 5b244dbdb1
Use a class for Output serialization to ensure that .apply exists on it. (#1040)
Also, rename/cleanup a bunch of serialization code.

Also, generate better environment names in the serialized closure code. Thsi code should be much easier to make sense of as hte names will better track to the original names in the user code.

Also, dedupe simple non-capturing functions. This helps ensure we don't spit out N copies of __awaiter (one per file it is declared in).
2018-03-12 16:27:00 -07:00
Joe Duffy fc3908b853
Fix two DST bugs in logs test (#1042)
This fixes two different DST bugs in the logs test, one of which
led to the failure in pulumi/pulumi#1041:

1) The assertion was using ANSIC formatting, which does not contain
   a time-zone, and because we are now in DST, the resulting time
   didn't parse and format in a round-trippable way.  Instead, let's
   use RFC3339, and let's be explicit about the timezone.

2) The parseSince("1m30s") would in theory fail if the DST changed
   at just the right moment, since the reference time could end up
   different from the reference time that the test is using.  Let's
   expose the reference time to the caller, so that they may decide
   how to deal with these situations, and let's use UTC here.
2018-03-12 15:49:52 -07:00
CyrusNajmabadi 4e651b0428
Do not hardcode specialized knowledge about resources in closure serialization. (#1039) 2018-03-12 13:47:13 -07:00
Justin Van Patten aa940b40dc
Cleanup pulumi new flag descriptions (#1036)
- Use `templates` instead of `releases`
- Fix typo
2018-03-12 11:22:32 -07:00
CyrusNajmabadi 7e14a09b3b
Do not build sidebranch. (#1033) 2018-03-11 00:28:00 -08:00
CyrusNajmabadi 850130e30f
Capture modules through normal value capture. (#1030) 2018-03-11 00:11:53 -08:00
Matt Ellis dc57119206 Only replace secret text if it is longer than 2 characters
This is inline with what Travis does. Otherwise, for very short
secrets our regex based approach will throw `[secret]` all over the
place.
2018-03-10 13:03:46 -08:00
Matt Ellis 936cab0c22 Add a version property to checkpoints
This takes the existing `apitype.Checkpoint` type and renames it to
`apitype.CheckpointV1` locking in the shape. In addition, we introduce
a `apitype.VersionedCheckpoint` type, which holds a version number and
a json document representing a checkpoint at that version. Now, when
reading a checkpoint, the CLI can determine if it's in a format it
understands, and fail gracefully if it is not.

While the CLI understands the older checkpoint version, it always
writes the newest version format, meaning that if you manage a
fire-and-forget stack with this version of the CLI, it will be
un-readable by previous versions.

Stacks managed by Pulumi.com are not impacted by this change.

Fixes: #887
2018-03-10 13:03:05 -08:00
Sean Gillespie 703a954839
Improve error messages output by the CLI (#1011)
* Improve error messages output by the CLI

This fixes a couple known issues with the way that we present errors
from the Pulumi CLI:
    1. Any errors from RPC endpoints were bubbling up as they were to
    the top-level, which was unfortunate because they contained
    RPC-specific noise that we don't want to present to the user. This
    commit unwraps errors from resource providers.
    2. The "catastrophic error" message often got printed twice
    3. Fatal errors are often printed twice, because our CLI top-level
    prints out the fatal error that it receives before exiting. A lot of
    the time this error has already been printed.
    4. Errors were prefixed by PU####.

* Feedback: Omit the 'catastrophic' error message and use a less verbose error message as the final error

* Code review feedback: interpretRPCError -> resourceStateAndError

* Code review feedback: deleting some commented-out code, error capitalization

* Cleanup after rebase
2018-03-09 15:43:16 -08:00
Justin Van Patten 8906731315
Adds a pulumi new command to scaffold a project (#1008)
This adds a `pulumi new` command which makes it easy to quickly
automatically create the handful of needed files to get started building
an empty Pulumi project.

Usage:

```
$ pulumi new typescript
```

Or you can leave off the template name, and it will ask you to choose
one:

```
$ pulumi new
Please choose a template:
> javascript
  python
  typescript
```
2018-03-09 15:27:55 -08:00
joeduffy f071329238 Update PyPI publish source 2018-03-09 15:27:16 -08:00
Matt Ellis 344d9b4424
Merge pull request #1025 from pulumi/SerializePluginLoads
Serialize plugin loads.
2018-03-09 15:20:42 -08:00
Joe Duffy 98aaf12cdf
Reenable Pylint (#1024)
This change uses virtualenv to insulate us from platform differences
in our building of the Python SDK, and to create an isolated Python 2
environment.  This includes meaning we don't need to worry about the
specific location and behavior of Pylint.  I *think* this will work
no matter whether it's Mac, Ubuntu, ArchLinux, Windows, and so on.

We do install to the --user directory in the install target using
`pip install -e`, however, which enables the machine-wide symlinking
that we need to support various workflows.

This fixes pulumi/pulumi#1007.
2018-03-09 15:11:37 -08:00
Matt Ellis c1a06b14cc
Merge pull request #1002 from pulumi/more-display-refactoring
Make events a little richer; hide secrets from the output
2018-03-09 14:39:42 -08:00
Luke Hoban d1f559bb9b
Export RunError from top level of Node.js SDK (#1021)
This special error kind should be used by all Pulumi components as the error type for user input validation errors.  Although it can already be referenced via `@pulumi/pulumi/errors`, also explicitly export it directly on `@pulumi/pulumi`.
2018-03-09 13:48:42 -08:00
Matt Ellis 8c7ba437a4 Fix some small display issues
We were not colorizing a summary in one case. Also, there were
codepaths that would print to the console without first calling
spinner.Reset(), so the spinner would not be cleared from the screen.
2018-03-09 13:46:54 -08:00
Matt Ellis 225975ae2d Respond to some Pull Request feedback 2018-03-09 13:23:25 -08:00
Matt Ellis 96d39b60d1 Filter secrets from Pulumi's outputs
When a stack has secrets, we now take the secret values and construct
a regular expression which is just an alternation of all the secret
values. Then, before pushing any string data into an Event, we run the
regular expression and replace all matches with '[secret]'.

Fixes #747
2018-03-09 13:23:25 -08:00
Matt Ellis aa482a124a Rename stepParentIndent to getIndent 2018-03-09 13:16:28 -08:00
Matt Ellis db079b1b0a Emit richer events for resource steps
The engine now emits events with richer metadata during the
ResourceOutputs and ResourcePre callbacks. The CLI can then use this
information to decide if it should display the event or not and how
much of the event to display.

Options dealing with what to display and how to display it have moved
into the CLI and the engine now emits all information for each event.
2018-03-09 13:11:42 -08:00
Matt Ellis 55383c46ba Remove unused parameters from stepParentIndent 2018-03-09 11:58:42 -08:00
Matt Ellis ebc8c794fc Remove indent parameter from printStep
It was always set to zero, so we can remove it now.
2018-03-09 11:54:22 -08:00
Matt Ellis ae7008ff85 Remove tracking of Shown resources
This is unused now and can be removed.
2018-03-09 11:49:25 -08:00
Matt Ellis 138b2a4289 Replace possible dead code with an assert
I believe because of the way we have structured the code, it is
impossible to know a resource's parent but not printed it. I've
changed the test which would print the parent resource to an assert
that ensure we have printed it.

The next commit is going to remove the shown array because we no
longer need it, but this commit is here so that if there are display
bugs as part of the larger refactoring in how we display events, we
can bisect back and see this failure.
2018-03-09 11:42:28 -08:00
Matt Ellis 104cbd44ff Mark steps as seen only during the Pre event
The `shouldShow` method always marked a step as seen, and having the
side effect there is a little confusing. Because we call shouldShow in
the StepPre, StepPost and Output handlers, its also hard to ensure an
invarant I think we want, which is that in the Post and Output
handlers, we've already seen the event.

So, let's move the marking out of `shouldShow` and into
`OnResourceStepPre` and then assert we've already seen it in
`OnResourceStepPre` and `OnResourceOutputs` handlers.

This means that shouldShow is now a pure function and makes it easier
to move the decision on if we should print information about a step
out of the engine and into the CLI.
2018-03-09 11:37:54 -08:00
Matt Ellis e1a1e9fab4 Remove indent parementer from printResourceOutputProperties
Callers always passed zero in as this argument, so we can just
initialize a local in the body to zero and clean things up a little.
2018-03-09 11:37:54 -08:00
pat@pulumi.com dc36b9569a Serialize plugin loads.
As it stands, we allow plugin load requests to race. Not only does this
create a situation in which we may load and then immediately throw away
a plugin (potentially leaking its process), it also creates the
possibility of races when reading from/writing to the various plugin
caches. These changes serialize all plugin loads and cache accesses by
running all accesses for a particular host in a single goroutine.

Fixes #1020.
2018-03-09 11:31:02 -08:00
Matt Ellis 02c45f9f10 Move summary printing out of the engine
The engine now emits a special type of summary event, which the CLI
displays.
2018-03-09 11:13:06 -08:00
Matt Ellis 4e2f94df95 Remove UpdateOptions.ShowConfig
The engine now unconditionally emits a new type of event, a
PreludeEvent, which contains the configuration for a stack as well as
an indication if the stack is being previewed or updated. The
responsibility for interpreting the --show-config flag on the command
line is now handled by the CLI, which uses this to decide if it should
print the configuration or not, and then writes the "Previewing
changes" or "Deploying chanages" header.
2018-03-09 11:13:06 -08:00
Matt Ellis 7e84a83f33 Remove deployOptions.Detailed
This value was unused across all of our display code. We did thread it
everywhere, but we never actually used the value to make any
decisions. Since we want to move to a model where the engine does not
decide *what* to display, it's helpful to remove this policy stuff
anyway.
2018-03-09 11:01:57 -08:00
Matthew Riley 52b7bf72ff
Merge pull request #1018 from pulumi/use-upload-scripts
Use upload scripts
2018-03-09 10:53:55 -08:00