Commit graph

2058 commits

Author SHA1 Message Date
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
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
Joe Duffy 971f6189f2
Fix pending delete replacement failure (#658)
The two-phase output properties change broke the ability to recover
from a failed replacement that yields pending deletes in the checkpoint.
The issue here is simply that we should remember pending registrations
only for logical operations that *also* have a "new" state (create or
update).  This commit fixes this, and also adds a new step test with
fault injection to probe many interesting combinations of steps.
2017-12-07 09:44:38 -08:00
Joe Duffy 9680fc3604
Issue an error when a project file isn't found 2017-12-06 17:26:45 -08:00
Matt Ellis ffdee8bb23 Relax error check when trying to kill child processes
If the process we are trying to kill has already exited, don't treat
this as an error. This can happen when we snapshot the process tree
before the process exits but it has exited by the time we get to
trying to kill it.

Fixes #654
2017-12-06 09:52:26 -08:00
Joe Duffy 41beb257b0
Write a test for parenting and URNs 2017-12-05 19:14:28 -08:00
Joe Duffy 29c2a2e08f
Elide the root stack in parent URNs
Every single resource has a type prefix of

    pulumi:pulumi:Stack$

which makes URNs quite lengthy without adding any value.  Since
they all have this prefix, adding it doesn't help to disambiguate.

This change skips adding the parent URN part when it is the built-in
automatic stack type name.
2017-12-05 13:41:26 -08:00
Joe Duffy 3e84347197
Reenable integration tests
Because of the way we passed packages to test commands, we were skipping
the tests/cloud/ and tests/ints/ tests altogether.  This reenables them.
2017-12-05 13:39:13 -08:00
Joe Duffy 0e1ca4363a
Bring back stack outputs (#650)
At some point, we fixed a bug in the way state is managed for "same"
steps, which meant that we wouldn't see newly added output properties.
This had the effect that, if you had a stack already stood up, and
updated it to have output properties, we would miss them.  (Stacks
stood up from scratch would still have them.)  This fixes that problem,
in addition to two other things: 1) we need to sort output property
names to ensure a deterministic ordering, and 2) we need to also
unconditionally apply the outputs RPC coming in, to ensure that the
resulting resource always has the correct outputs (so that for example
deleting prior output properties actually deletes them).

Also add some testing for this area to make sure we don't break again.

Fixes pulumi/pulumi#631.
2017-12-05 13:01:54 -08:00
Matt Ellis 6843162f98 Ensure correct version is in published package
We need to take the package.json from the folder (which will have been
rewritten by the build to include the version number) instead of the
version we have checked into the tree (which has ${VERSION} as a version)

Windows didn't have this issue, but it did include some stuff we did
not include in the unified release, so I cleaned that up as well.
2017-12-04 23:09:48 -08:00
Pat Gavlin 94645c313a
Merge pull request #643 from pulumi/LateDecrypt
Decrypt configuration nearer to its use.
2017-12-04 17:27:59 -08:00
pat@pulumi.com 7810c824d6 Decrypt configuration nearer to its use.
These changes push the `config.{Map,Value}` interfaces further down into
the deployment engine so that configuration can be decrypted nearer to
its use.

This is the first part of the fix for pulumi/pulumi-ppc#112.
2017-12-04 17:10:40 -08:00