Commit graph

2118 commits

Author SHA1 Message Date
CyrusNajmabadi e4946a6620
Allow users to control if and how output is colorized. (#718)
Part of the work to make it easier to tests of diff output.  Specifically, we now allow users to pass --color=option for several pulumi commands.  'option' can be one of 'always', 'never', 'raw', and 'auto' (the default).  

The meaning of these flags are:

1. auto: colorize normally, unless in --debug 
2. always: always colorize no matter what
3. never: never colorize no matter what.
4. raw: colorize, but preserve the original "<{%%}>" style control codes and not the translated platform specific codes.   This is for testing purposes and ensures we can have test for this stuff across platform.
2017-12-14 11:53:02 -08:00
Joe Duffy 8cce92ff27
Humanize some outputs a little (#723)
This does three things:

* Use nice humanized times for update times, to avoid ridiculously
  long timestamps consuming lots of horizontal space.  Instead of

       LAST UPDATE
       2017-12-12 12:22:59.994163319 -0800 PST

  we now see

       LAST UPDATE
       1 day ago

* Use the longest config key for the horizontal spacing when the key
  exceeds the default alignment size.  This avoids individual lines
  wrapping in awkward ways.

* Do the same for stack names and output properties.
2017-12-14 11:51:58 -08:00
Matt Ellis c47c5b9ad7 Ensure published binaries have the correct version
Ideally we would just use `make build` and `make install` in favor of
having yet another way to build the product, but before we can do that
in general we need to come up with a better story for cross
building. For now, just ensure we pass the correct version string to
go build when building.
2017-12-14 10:57:06 -08:00
Pat Gavlin f449db974d
Merge pull request #719 from pulumi/UnhandledPromiseRejection
Treat unhandled promise rejections as uncaught exceptions.
2017-12-13 17:51:44 -08:00
pat@pulumi.com 4cb7703676 Add a test. 2017-12-13 17:30:43 -08:00
pat@pulumi.com abe91ca018 Treat unhandled promise rejections as uncaught exceptions.
Just as uncaught exceptions cause a Pulumi program to exit with a
failure code, so should unhandled promise rejections.

Fixes pulumi/pulumi-ppc#94.
2017-12-13 17:24:47 -08:00
Luke Hoban 6f15fa8ed8
Pass more stack info to ExtraRuntimeValidation (#717)
This will allow us to remove a lot of current boilerplate in individual tests, and move it into the test harness.

Note that this will require updating users of the integration test framework.  By moving to a property bag of inputs, we should avoid needing future breaking changes to this API though.
2017-12-13 16:09:14 -08:00
joeduffy 92ea5b5bdd Add a test case for delete-before-recreate 2017-12-13 10:47:18 -08:00
joeduffy 3a13621c32 Add rudimentary delete-before-create support
This change adds rudimentary delete-before-create support (see
pulumi/pulumi#450).  This cannot possibly be complete until we also
implement pulumi/pulumi#624, becuase we may try to delete a resource
while it still has dependent resources (which almost certainly will
fail).  But until then, we can use this to manually unwedge ourselves
for leaf-node resources that do not support old and new resources
living side-by-side.
2017-12-13 10:47:18 -08:00
Joe Duffy 36ab8f0087
Make config a little less error prone
As articulated in #714, the way config defaults to workspace-local
configuration is a bit error prone, especially now with the cloud
workflow being the default.  This change implements several improvements:

* First, --save defaults to true, so that configuration changes will
  persist into your project file.  If you want the old local workspace
  behavior, you can specify --save=false.

* Second, the order in which we applied configuration was a little
  strange, because workspace settings overwrote project settings.
  The order is changed now so that we take most specific over least
  specific configuration.  Per-stack is considered more specific
  than global and project settings are considered more specific
  than workspace.

* We now warn anytime workspace local configuration is used.  This
  is a developer scenario and can have subtle effects.  It is simply
  not safe to use in a team environment.  In fact, I lost an arm
  this morning due to workspace config... and that's why you always
  issue warnings for unsafe things.
2017-12-13 10:46:54 -08:00
Joe Duffy dc83a49a0d
Merge pull request #713 from pulumi/712_missing_error_prop
Add a missing error propagation
2017-12-13 09:23:18 -08:00
joeduffy 664d4f3bfe Add a missing error propagation
If the service returns a 504, we happily keep looping around and
retrying until we get a valid update.  Unfortunately, we missed the
else condition, which is what happens when this isn't a 504, leading
us to swallow real errors (500 and the like).  Trivial fix.

Fixes pulumi/pulumi#712.
2017-12-13 08:33:11 -08:00
Joe Duffy 2a8ab4d38e
Merge pull request #708 from pulumi/fix-660
Do not buffer output during planning
2017-12-12 16:02:48 -08:00
Pat Gavlin ba4434f6db
Merge pull request #709 from pulumi/PrintUndefined
Render computeds differently during updates.
2017-12-12 14:52:19 -08:00
pat@pulumi.com 55df0cc201 PR feedback 2017-12-12 14:32:27 -08:00
pat@pulumi.com fcdc3495a4 Render computeds differently during updates.
Rather than displaying `computed` as we do during previews, display
`undefined` instead, as these values may be intentionally undefined by
the user's program.

Fixes #633.
2017-12-12 14:20:44 -08:00
Matt Ellis 8d998fea81 Do not buffer output during preview
Previously, we would compute all the output from the preview operation
and then display it as a single event. Instead, we should do this how
we handle things during deploy. Each logical print operaton gets a
single event and we stream them back over a channel during planning.

Fixes #660
2017-12-12 12:41:56 -08:00
Joe Duffy b6a386995a
Set pwd for plugins (#706)
This change just flows the project's "main" directory all the way
through to the plugins, fixing #667.  In that work item, we discussed
alternative approaches, such as rewriting the asset paths, but this
is tricky because it's very tough to do without those absolute paths
somehow ending up in the checkpoint files.  Just launching the
processes with the right pwd is far easier and safer, and it turns
out that, conveniently, we set up the plugin context in exactly the
same place that we read the project information.
2017-12-12 12:31:09 -08:00
Joe Duffy 1db66e1965
Merge pull request #707 from pulumi/BumpTestTimeout
Bump the test timeout up to 5 minutes.
2017-12-12 12:26:12 -08:00
Pat Gavlin ad18d8ee9b Bump the test timeout up to 5 minutes.
The newly-added archive tests are taking over 2 minutes to run in CI.
2017-12-12 11:36:26 -08:00
Joe Duffy 7e7c041d06
Emit a warning when configuring with plaintext (#705)
Instead of unconditionally emitting a message when configuring
values, which is easy to miss, instead print out a more helpful
warning iff you are configuring a plaintext value that you are
also saving to your project.
2017-12-12 11:13:45 -08:00
Joe Duffy 4d59c70d9e
Merge pull request #704 from pulumi/CloseAssetsInZip
Close assets while creating ZIP archives.
2017-12-12 11:09:08 -08:00
Pat Gavlin d0df98e03b Close assets while creating ZIP archives.
This was an unintentional omission from my earlier change that
refactored the archive code.

Fixes pulumi/pulumi-ppc#133.
2017-12-12 10:38:27 -08:00
Joe Duffy 841616aa5a
Widen stack ls columns slightly (#703) 2017-12-11 17:41:51 -08:00
Joe Duffy b83588a0b8
Add a Dep [[constraint]] to gRPC v1.7.2
See https://github.com/pulumi/pulumi/issues/701 for more details.
2017-12-11 16:57:58 -08:00
CyrusNajmabadi eea5232cce
Break out additional test helper. (#699) 2017-12-11 15:48:45 -08:00
Luke Hoban 3b461ffcb3
Use AWS access key in operations prvider when available (#697)
If the stack config specifies AWS credentials, these should be used in the operations provider instead of ambient credentials.  This is necessary to ensure that we have access to resources in the target account.

Fixes pulumi/pulumi-service#389
2017-12-11 15:40:39 -08:00
CyrusNajmabadi 9bc9ce1505
More test code refactoring.
* Move code down.

* Extact test code out.

* Extract helper and pattern.

* Remove unnecessary code.

* move comment.
2017-12-11 14:42:42 -08:00
Joe Duffy 5a1b1253ab
Save configuration under the stack by default (#696) 2017-12-11 14:41:57 -08:00
Joe Duffy e93fe05efe
Reparameterize NewUniqueHex/ID
This change adds a randlen parameter to NewUniqueHex/ID so that the
caller can decide how long of a random string to generate.
2017-12-10 07:44:11 -08:00
Luke Hoban 90c7305f55
Update logs after changes in pulumi/cloud names (#684) 2017-12-09 17:27:43 -08:00
CyrusNajmabadi 7234cdef02
Take an options pointer so values can change as a test runs. (#679)
* Take an options pointer so values can change as a test runs.

* Don't pass redundant information.

* Extract initialization routine.

* Fix caller.

* Check return value.

* Extract destruction logic.

* Move preview and update into their own function.

* Inline null check.
2017-12-08 16:59:28 -08:00
Pat Gavlin 370c926c80
Merge pull request #680 from pulumi/TestDeserializeAssets
Test the asset deserialization changes from #677.
2017-12-08 16:04:19 -08:00
pat@pulumi.com 5ef0dcf598 Test the asset deserialization changes from #677.
Just what it says on the tin.
2017-12-08 15:37:30 -08:00
CyrusNajmabadi 6e68163cc5
Fix 'this' capture in async functions and lambdas. (#678) 2017-12-08 14:57:51 -08:00
Pat Gavlin 664d9ebb0e
Merge pull request #677 from pulumi/DeserializeAssets
Fix a condition in archive deserialization.
2017-12-08 14:24:01 -08:00
pat@pulumi.com 5c2cbd3172 Fix a condition in archive deserialization.
Asset archives may contain both assets and archives.
2017-12-08 13:48:49 -08:00
Joe Duffy 1681119339
Add a stack output command (#675)
This change adds a `pulumi stack output` command.  When passed no
arguments, it prints all stack output properties, in exactly the
same format as `pulumi stack` does (just without all the other stuff).
More importantly, if you pass a specific output property, a la
`pulumi stack output clusterARN`, just that property will be printed,
in a scriptable-friendly manner.  This will help us automate wiring
multiple layers of stacks together during deployments.

This fixes pulumi/pulumi#659.
2017-12-08 13:14:58 -08:00
CyrusNajmabadi edb7bf849e
Reverts (#676)
* Revert "Make sure we properly update dir so that pulumi-destroy works."

This reverts commit 56bfc57998.

* Revert "Edits needs to continuously pass along the new directory. (#668)"

This reverts commit 8bd1822722.

* Revert "Refactor test code to make it simpler to validate code in the middle. (#662)"

This reverts commit ed65360157.
2017-12-08 12:59:39 -08:00
Joe Duffy d89a2b4e1f
Add a logout --all command (#673)
If a cloud you've previously authenticated with goes away -- as ours
sort of did, because the cloud endpoing in the CLI changed (to actually
be correct) -- then you can't logout without manually editing the
credentials file in your workspace.  This is a little annoying.  So,
rather than that, let's have a `pulumi logout --all` command that just
logs out of all clouds you are presently authenticated with.
2017-12-08 12:14:14 -08:00
CyrusNajmabadi 56bfc57998
Make sure we properly update dir so that pulumi-destroy works. 2017-12-08 11:37:38 -08:00
Chris Smith ebc1776eb9 Absorb breaking change from Service/PPC API 2017-12-08 10:21:25 -08:00
Chris Smith 8c3c2c97f5 Add messages to asserts 2017-12-08 10:21:25 -08:00
Chris Smith 527a1c97e7 Fix panic with nil message entry 2017-12-08 10:21:25 -08:00
CyrusNajmabadi 8bd1822722
Edits needs to continuously pass along the new directory. (#668) 2017-12-08 01:51:35 -08:00
Matt Ellis 94b9489759 Log the error when getting a stack fails 2017-12-07 18:24:51 -08:00
CyrusNajmabadi ed65360157
Refactor test code to make it simpler to validate code in the middle. (#662)
* Refactor test code to make it simpler to validate code in the middle.
2017-12-07 16:29:48 -08:00
Joe Duffy 69f5882b97
Fix two closure bugs (#664)
This fixes two closure bugs.

First, we had special cased `__awaiter` from days of yore, when we had
special cased its capture.  I also think we were confused at some point
and instead of fixing the fact that we captured `this` for non-arrow
functions, which `__awaiter` would trigger, we doubled down on this
incorrect hack.  This means we missed a real bonafide `this` capture.

Second, we had a global cache of captured variable objects.  So, if a
free variable resolved to the same JavaScript object, it always resolved
to the first serialization of that object.  This is clearly wrong if
the object had been mutated in the meantime.  The cache is required to
reach a fixed point during mutually recursive captures, but we should
only be using it for the duration of a single closure serialization
call.  That's precisely what this commit does.

Also add a fix for this case.

This fixes pulumi/pulumi#663.
2017-12-07 16:21:28 -08:00
Joe Duffy aa7c1598ac
Show root stacks and more outputs (#661)
This changes two things:

1) Always show the root stack, even when unchanged.  This ensures
   that you see the outputs during any updates, etc., which is nice.

2) Always show all outputs after operations.  Before, we did some
   diffing between old/new, which actually doesn't make much sense.
2017-12-07 13:33:16 -08:00
Chris Smith e104ebd7f6
Several fixes relating to Pulumi clouds and auth (#651)
- Fix #644 "Re-enable use of local dev stacks". Rather than trying to be smart about using "pulumi.com" and inferring "api.pulumi.com", we just use whatever cloud URL the user provides. (e.g. "http://localhost:8080") We can improve the user experience later by providing friendly names for these things upon login. So we can show "Pulumi" or "Contoso" instead of the URL -- but let's cross that bridge later.

- Fix #640, "Better error on `pulumi login`". We only provide the more friendly error about needing to login IFF you are trying to use an authenticated Pulumi API without having creds.
2017-12-07 10:59:20 -08:00