Commit graph

2615 commits

Author SHA1 Message Date
Justin Van Patten e1edd1e88d
Make the default pulumi new project description empty (#1339)
Previously, we'd default to "A Pulumi project.", which isn't a helpful
description for any real project.
2018-05-08 10:46:39 -07:00
Joe Duffy 24b350ea40
Support -y as shorthand for --yes (#1340) 2018-05-08 09:55:08 -07:00
Pat Gavlin e806b077ba
Merge pull request #1338 from pulumi/SimplifyTraceInit
Simplify cmdutil.InitTracing.
2018-05-07 20:33:50 -07:00
Pat Gavlin 31e829c4b7 Simplify cmdutil.InitTracing.
If no tracing endpoint was specified, just use the default no-op tracer.
2018-05-07 20:17:19 -07:00
Pat Gavlin 97ace29ab1
Begin tracing Pulumi API calls. (#1330)
These changes enable tracing of Pulumi API calls.

The span with which to associate an API call is passed via a
`context.Context` parameter. This required plumbing a
`context.Context` parameter through a rather large number of APIs,
especially in the backend.

In general, all API calls are associated with a new root span that
exists for essentially the entire lifetime of an invocation of the
Pulumi CLI. There were a few places where the plumbing got a bit hairier
than I was willing to address with these changes; I've used
`context.Background()` in these instances. API calls that receive this
context will create new root spans, but will still be traced.
2018-05-07 18:23:03 -07:00
Justin Van Patten 45c7e79766
Include link where to sign up in pulumi login (#1336) 2018-05-07 16:35:08 -07:00
Pat Gavlin a5e92b9497
Cache workspaces based on full path. (#1326)
As it stands, we recompute the workspace for the current directory
potentially many times during some CLI operations, most notably
`stack ls`. These changes add a simple cache based on the complete path
passed to `NewFrom`, and eliminate some lagginess in `stack ls` when
there are multiple stacks.

Another option is to calculate the current workspace once in the CLI and
then fetch it as necessary.
2018-05-07 15:35:58 -07:00
Justin Van Patten d1b49d25f8
pulumi new improvements (#1307)
* Initialize a new stack as part of `pulumi new`
* Prompt for values with defaults preselected
* Install dependencies
* Prompt for default config values
2018-05-07 15:31:27 -07:00
CyrusNajmabadi 092696948d
Restore streaming of plugin outputs to the progress display. (#1333) 2018-05-07 15:11:52 -07:00
Matt Ellis 7b27f00602 Fix python package versions
Our logic for converting npm style versions to PEP-440 style versions
was not correct in some cases. This change fixes this.

As part of this change we no longer produce a NPM version that would
be just X.Y.Z-dev, instead for development versions we always include
both the timestamp of the commit and the commit hash.

Instead of trying to use a bunch of sed logic to do our conversions,
we now have a small go program that uses a newly added library in
pkg/util. A side effect of this is that we can more easily write tests
to ensure the conversion works as expected.

Fixes #1243
2018-05-07 12:38:08 -07:00
Justin Van Patten e62bc37e23
Avoid treating binary files as text (#1335)
If the file contains a zero byte within the first 8000 bytes (or the entire length of the file if shorter), treat the file as binary and do not do any textual transformations. This is the same approach git uses to determine if a file is binary.
2018-05-07 09:41:40 -07:00
Joe Duffy c5b702e0ff
Merge pull request #1290 from pulumi/preview_flag
Revise the way previews are controlled
2018-05-06 14:18:26 -07:00
joeduffy 7c7f6d3ed7 Bring back preview, swizzle some flags
This changes the CLI interface in a few ways:

* `pulumi preview` is back!  The alternative of saying
  `pulumi update --preview` just felt awkward, and it's a common
  operation to want to perform.  Let's just make it work.

* There are two flags consistent across all update commands,
  `update`, `refresh`, and `destroy`:

    - `--skip-preview` will skip the preview step.  Note that this
      does *not* skip the prompt to confirm that you'd like to proceed.
      Indeed, it will still prompt, with a little warning text about
      the fact that the preview has been skipped.

    * `--yes` will auto-approve the updates.

This lands us in a simpler and more intuitive spot for common scenarios.
2018-05-06 13:55:39 -07:00
joeduffy 6ad785d5c4 Revise the way previews are controlled
I found the flag --force to be a strange name for skipping a preview,
since that name is usually reserved for operations that might be harmful
and yet you're coercing a tool to do it anyway, knowing there's a chance
you're going to shoot yourself in the foot.

I also found that what I almost always want in the situation where
--force was being used is to actually just run a preview and have the
confirmation auto-accepted.  Going straight to --force isn't the right
thing in a CI scenario, where you actually want to run a preview first,
just to ensure there aren't any issues, before doing the update.

In a sense, there are four options here:

1. Run a preview, ask for confirmation, then do an update (the default).
2. Run a preview, auto-accept, and then do an update (the CI scenario).
3. Just run a preview with neither a confirmation nor an update (dry run).
4. Just do an update, without performing a preview beforehand (rare).

This change enables all four workflows in our CLI.

Rather than have an explosion of flags, we have a single flag,
--preview, which can specify the mode that we're operating in.  The
following are the values which correlate to the above four modes:

1. "": default (no --preview specified)
2. "auto": auto-accept preview confirmation
3. "only": only run a preview, don't confirm or update
4. "skip": skip the preview altogether

As part of this change, I redid a bit of how the preview modes
were specified.  Rather than booleans, which had some illegal
combinations, this change introduces a new enum type.  Furthermore,
because the engine is wholly ignorant of these flags -- and only the
backend understands them -- it was confusing to me that
engine.UpdateOptions stored this flag, especially given that all
interesting engine options _also_ accepted a dryRun boolean.  As of
this change, the backend.PreviewBehavior controls the preview options.
2018-05-06 13:55:04 -07:00
CyrusNajmabadi 0b3395aae3
Simplify code that decides to show stack outputs. (#1332) 2018-05-06 11:30:20 -07:00
CyrusNajmabadi aaca79ab16
Print stack outputs at the end of an update. (#1327) 2018-05-05 12:54:57 -07:00
Matt Ellis fcefbcb0b8 Remove test token
We now handle test credentials via Travis, so we don't need this
anymore.
2018-05-04 18:02:25 -07:00
Pat Gavlin 2d6579acee
Enhance the engine's tracing support a bit. (#1328)
- Allow callers to provide a parent span for the engine's operations
- Tag each plan context with the name of its associated operation
2018-05-04 17:01:35 -07:00
Joe Duffy f92eb0a4e8 Run Configure calls in parallel (#1321)
As of this change, the engine will run all Configure calls in parallel.
This improves startup performance, since otherwise, we would block
waiting for all plugins to be configured before proceeding to run a
program.  Emperically, this is about 1.5-2s for AWS programs, and
manifests as a delay between the purple "Previewing update of stack"
being printed, and the corresponding grey "Previewing update" message.

This is done simply by using a Goroutine for Configure, and making sure
to synchronize on all actual CRUD operations.  I toyed with using double
checked locking to eliminate lock acquisitions -- something we may want
to consider as we add more fine-grained parallelism -- however, I've
kept it simple to avoid all the otherwise implied memory model woes.

I made the judgment call that GetPluginInfo may proceed before
Configure has settled.  (Otherwise, we'd immediately call it and block
after loading the plugin, obviating the parallelism benefits.)  I also
made the judgment call to do this in the engine, after flip flopping
several times about possibly making it a provider's own decision.
2018-05-04 14:29:47 -07:00
Pat Gavlin c3e4654507
Merge pull request #1322 from pulumi/FixTypo
Fix a typo.
2018-05-04 13:59:04 -07:00
Pat Gavlin a8b41c2324 Fix a typo. 2018-05-04 13:09:35 -07:00
Pat Gavlin 5e672564ef
Use git for detecting a dirty worktree. (#1319)
The `go-git` implementation of `git status` is outrageously expensive,
as it performs a hash-based comparision of the working tree against the
committed state with no caching. In some example runs, this takes
upwards of 15 seconds. Because this is on the startup path for updates,
this results in a rather poor user experience.

These changes replace the `go-git` implementation with a call to `git
status --porcelain -z`, which only writes data to stdout if the working
tree is dirty.

Note that these changes also make all git-related update metadata
best-effort.
2018-05-04 12:59:48 -07:00
Pat Gavlin ded25b11db
Add support for CPU and heap profiling. (#1318)
These changes add a new flag to the CLI, `--profiling`, that enables
CPU and heap profiling as well as execution tracing of the CLI itself.
The argument to this flag serves as a prefix for the profile outputs;
the CPU and heap profiles and execution trace are written to
`[filename].[pid].{cpu,mem,trace}`, respectively.

These changes also fix an issue with `cmdutil.RunFunc` wherein any error
would prevent the command's post-run hooks from executing.
2018-05-04 11:26:53 -07:00
Pat Gavlin 4f3d236606
Merge pull request #1317 from pulumi/IntegrationTestTracing
Enable tracing of integration tests.
2018-05-03 14:07:29 -07:00
Pat Gavlin c0ed11af14 Enable tracing of integration tests.
These changes add a new option to the integration test framework that
allows the specification of a tracing endpoint for Pulumi invocations.
2018-05-03 13:44:21 -07:00
CyrusNajmabadi 5387e78cfa
Support async function serialization. (#1311) 2018-05-03 12:25:52 -07:00
Luke Hoban cc8b87ce3d
Make debuggable promise properties as non-enumerable (#1315)
Fixes #1237.
2018-05-02 23:29:20 -07:00
Matt Ellis 05753ec350 Don't attempt to preview a destroy operation for a PPC hosted stack
The service has no good way to preview a destroy operation for a stack
managed by a PPC. Until it does, just behave as if --force was passed
to the CLI in this case (i.e. skip the preview).

Fixes #1301
2018-05-02 12:03:23 -07:00
Matt Ellis 409477b951 Invoke node directly from the language host
Instead of using a shell script to jump from the language host into
node, just invoke node directly. This makes our start-up path a little
simpler to understand and indirectly fixes pulumi/home#156, where we
would fail on Windows if the `-exec` script was in a folder that had
spaces in it (due to a subtle interaction between how go launches cmd
files and how cmd.exe parses arguments).
2018-05-02 11:16:58 -07:00
Matt Ellis c442ae70ca Use nicer URLs for stacks on the new identity model
When linking back to the service, use the newer, simpler, URLs for a
stack: `https://pulumi.com/<owner>/<stack-name>` instead of
`https://pulumi.com/<owner>/-/-/<stack-name>`
2018-05-02 09:52:43 -07:00
Chris Smith cb66264cf1
Put StartUpdateRequest in POST body (#1305) 2018-05-01 20:40:55 -07:00
Joe Duffy 80eac1c419
Merge pull request #1289 from pulumi/sdkless_brew
Remove SDK dependencies
2018-05-01 19:14:38 -07:00
Pat Gavlin 7ffadd34a8
Merge pull request #1302 from pulumi/Revert1261
Revert the changes from #1261.
2018-05-01 18:14:06 -07:00
Pat Gavlin 16f1930069
Pass "special" properties to Invoke. (#1277)
Rather than filtering out the `id` and `urn` properties when serializing
the inputs to an invoke, pass these properties along. This enables the
use of invoke endpoints that accepts these as inputs (e.g. the endpoint
that backs `aws.ec2.getSubnet`).
2018-05-01 15:05:42 -07:00
Matt Ellis d7d939cfd3 Fix Preview against a PPC
Refactoring to support "preview" and "update" as part of the same
operation interacted poorly with deploying into a PPC via the service.

Per Pat, this is the quickest fix that gets us off the floor.

Part of #1301
2018-05-01 11:15:25 -07:00
Pat Gavlin 639e605bed Revert the changes from #1261.
Restore the provider-first diff logic these changes disabled.

Part of #1251.
2018-05-01 10:01:18 -07:00
Matt Ellis 213c9c3c08 Use newer versions of the build-sdk.sh scripts 2018-04-30 20:44:01 -07:00
Joe Duffy b22a28ed34
Add necessary refresh apitypes (#1299)
This change adds the apitypes required to make refresh-style updates
work in the PPC and in the service.
2018-04-30 17:42:24 -07:00
joeduffy 4ef4eba01a Remove SDK dependencies
This change eliminates our dependencies on the SDK repo.  Now that
SDKs are comprised solely of pulumi/pulumi artifacts, a separate repo
isn't required.  This allows us to simplify some of the distribution.

The install.sh script is modified slightly, to permit overriding the
default install location using $PULUMI_INSTALL_PATH.
2018-04-30 16:39:17 -07:00
CyrusNajmabadi fd3ddda917
Disable interactive mode for a CI/CD server. (#1297) 2018-04-30 15:27:53 -07:00
Joe Duffy 088d6800d9
Improve two minor UX things in the CLI (#1293)
This changes three minor UX things in the CLI's update flow:

1. Use bright blue for column headers, since the dark blue is nearly
   invisible on a black background.

2. Move the operation symbol to the far left, as a sort of "bullet
   point" for each line of output.  This was how they initial symbols
   were designed and this helps to glance at the summary to see what's
   going on.

3. Shorten some of the column headers that didn't add extra clarity.
2018-04-30 12:31:57 -07:00
Matt Ellis e6d2854429 Remove pulumi history command
We already have a great history viewing experience on
Pulumi.com. `pulumi history` in the CLI today is basically unuseable,
and instead of working on trying to improve it, let's just remove it
for now.

Fixes #965
2018-04-30 12:12:27 -07:00
Sean Gillespie b48f230ce3
Fix an issue where errors outside of resource creation got dropped (#1285) 2018-04-30 10:27:04 -07:00
Matthew Riley 8ea6b24e21
Merge pull request #1282 from pulumi/etc-hosts
Add static entries for Pulumi backends to /etc/hosts
2018-04-29 14:54:46 -07:00
Joe Duffy 578f18831e
Add commands to generate goodies (#1288)
This change adds two new (hidden) CLI commands:

* `gen-bash-completion`: This command generates a bash completion
  script for the CLI, storing it in the file specified by the 1st arg.
  This fixes pulumi/pulumi#1172.

* `gen-markdown`: This command generates a directory of Markdown files,
  one per command, documenting the CLI commands and their usage.

I originally did these as separate scripts that we can use in our
build processes, but it was actually even easier to make `pulumi` able
to generate them for itself.  The nice part about this is that we don't
even need to bundle additional assets in order to distribute e.g. the
bash completion scripts, we can simply tell people to run

    $ pulumi gen-bash-completion /etc/bash_completion.d/pulumi

This can also be used in our upcoming Brew installer.
2018-04-28 11:18:21 -07:00
Matt Ellis b7b80f7ea1 Use glog instead of printf
When running `pulumi logs -f` we'd also see these messages printed to
standard out:

Getting more logs for /aws/lambda/urlshortenereeb67ce9-d8fa6fa...

This could be useful diagnostics information, but we should be
glog'ing it not unconditionally writing it to the terminal.
2018-04-27 18:27:37 -07:00
Luke Hoban 7dac925bcf
Fix handling of nested archives (#1283)
AssetArchives which include nested archives were not embedding content from the nested archive underneath the key of the nest archive.

Fixes #1272.
2018-04-27 17:10:50 -07:00
Sean Gillespie 5decc10cbb
Improve the error message if Pulumi runtime SDK isn't installed (#1286)
* Improve the error message when npm/yarn install hasn't been run

* Same thing, but for Python

* Use PULUMI_RUN in batch script

* Use -e, -f doesn't work for symlinked paths (e.g. yarn link)
2018-04-27 16:55:41 -07:00
Matt Ellis 94d11884f8 Fix login/logout issue against non api.pulumi.com clouds
Pat ran into a weird error when trying to do some development agains
the testing cloud:

```
$ pulumi logout
$ pulumi login --cloud-url [test-cloud-url]
Logged into [test-cloud-url]
$ pulumi stack ls
Enter your Pulumi access token from https://pulumi.com/account:
```

In his case, we did not have `current` set in our credentials.json
file (likely due to him calling `pulumi logout` at some point) but we
did have stored credentials for that cloud. When he logged in the CLI
noticed we could reuse the stored credentials but did not update the
the current setting to set the current cloud.

While investigating, I also noticed that `logout` did not always do
the right thing when you were logged into a different backend than
pulumi.com
2018-04-27 15:41:50 -07:00
Matt Ellis 943b8ff554
Merge pull request #1274 from pulumi/ellismg/minor-cli-improvements
Minor CLI improvements
2018-04-27 09:29:48 -07:00