Commit graph

2118 commits

Author SHA1 Message Date
Chris Smith decf814278
Enable running integration tests against the service (#775)
This PR updates the `pkg/testing/integration` package to support running integration tests against the Pulumi Service if desired. This is done through adding new options to `ProgramTestOptions`. (Generally adding support for providing values to flags that were previously inaccessible.)

I added an integration test to confirm that it all works if the PULUMI_API environment variable is set. These tests aren't run in Travis, only manually. Since we cannot reliably run tests from `master` against the service because of the delay in rolling out updates to the Pulumi SDK, etc.
2018-01-03 21:26:50 -08:00
Matt Ellis c052e24370
Merge pull request #771 from pulumi/no-all-for-secrets
Do not allow encrypted global configuration
2018-01-03 15:04:00 -08:00
joeduffy fcaf2a5145 Add a missing await for dynamic provider deletes 2017-12-28 17:47:10 -08:00
joeduffy b3ee139b91 Fix error message for stack select failures 2017-12-28 16:51:53 -08:00
Matt Ellis f510f3c914 Do not allow encrypted global configuration
The cloud backend does not support this because it computes an
encryption key per stack, so we should not support this in the CLI.

Fixes #770
2017-12-27 19:00:55 -08:00
Joe Duffy d419229301
Add additional linting (#768)
This adds additional linting checks.  Most importantly, it will
check calls to our custom format routines for missing arguments.
2017-12-27 17:10:12 -08:00
joeduffy 5ac81c2818 Add missing Infof argument 2017-12-27 14:54:27 -08:00
joeduffy acc9147ea1 Lock gRPC to v1.7.2 2017-12-27 06:35:52 -08:00
Joe Duffy 86c1e7ad39
Merge pull request #764 from pulumi/763_wait_for_update_resiliency
Make the CLI's waitForUpdates more resilient to transient failure
2017-12-27 06:34:08 -08:00
joeduffy 87079589f1 Use the retry framework for REST API retries
This change incorporates feedback on https://github.com/pulumi/pulumi/pull/764,
in addition to refactoring the retry logic to use our retry framework rather
than hand-rolling it in the REST API code.  It's a minor improvement, but at
least lets us consolidate some of this logic which we'll undoubtedly use more
of over time.
2017-12-26 10:24:08 -08:00
Luke Hoban 56fd8bc257
Fix REST API calls for encrypt/decrypt (#767)
The merge of two recent changes seems to have led to these calls invoking the API incorrectly.
2017-12-26 09:42:42 -08:00
joeduffy db5318b0a5 Make the CLI's waitForUpdates more resilient to transient failure
We saw an issue where a user was mid-update, and got a networking
error stating `read: operation timed out`.  We believe this was simply
a local client error, due to a flaky network.  We should be resilient
to such things during updates, particularly when there's no way to
"reattach" to an in-progress udpate (see pulumi/pulumi#762).

This change accomplishes this by changing our retry logic in the
cloud backend's waitForUpdates function.  Namely:

* We recognize three types of failure, and react differently:

    - Expected HTTP errors.  For instance, the 504 Gateway Timeouts
      that we already retried in the face of.  In these cases, we will
      silently retry up to 10 times.  After 10 times, we begin warning
      the user just in case this is a persistent condition.

    - Unexpected HTTP errors.  The CLI will quit immediately and issue
      an error to the user, in the usual ways.  This covers
      Unauthorized among other things.  Over time, we may find that we
      want to intentionally move some HTTP errors into the above.

    - Anything else.  This covers the transient networking errors case
      that we have just seen.  I'll admit, it's a wide net, but any
      instance of this error issues a warning and it's up to the user
      to ^C out of it.  We also log the error so that we'll see it if
      the user shares their logs with us.

* We implement backoff logic so that we retry very quickly (100ms)
  on the first failure, and more slowly thereafter (1.5x, up to a max
  of 5 seconds).  This helps to avoid accidentally DoSing our service.
2017-12-26 09:40:51 -08:00
Pat Gavlin a7fbdff7ea
Merge pull request #761 from pulumi/UpdateNoMerge
Do not merge old state and inputs for Update.
2017-12-24 14:47:15 -08:00
Pat Gavlin 1bd1eaff50 Do not merge old state and inputs for Update.
This merging causes similar issues to those it did in `Check`, and
differs from the approach we take to `Diff`. This can causes problems
such as an inability to remove properties.
2017-12-22 18:18:14 -08:00
Luke Hoban bc95745fb6
Update regexp to match changes in AWS generated names (#760)
Also keeps support for older name generation pattern.
2017-12-22 14:49:42 -08:00
Pat Gavlin c7f8416836
Merge pull request #757 from pulumi/CloudSecrets
Support secrets for cloud stacks.
2017-12-22 08:30:05 -08:00
Pat Gavlin e4d9eb6fd3 Support secrets for cloud stacks.
Use the new {en,de}crypt endpoints in the Pulumi.com API to secure
secret config values. The ciphertext for a secret config value is bound
to the stack to which it applies and cannot be shared with other stacks
(e.g. by copy/pasting it around in Pulumi.yaml). All secrets will need
to be encrypted once per target stack.
2017-12-22 07:59:27 -08:00
joeduffy af087103b9 Fix more edit directory issues
This fixes a few more edit directory issues, where we didn't
correctly propagate the changes in edit directory required during
subsequent destroy/stack activities.  It also fixes a few error
paths so that we preserve the right directory to be removed.
2017-12-22 06:58:31 -08:00
Luke Hoban 7cc782e856
Add support for pulumi logs --since when targeting cloud backend (#756)
Hooks up the CLI to be able to pass query parameters through to the
service.

Part of pulumi/pulumi-service#431.
2017-12-21 17:16:45 -08:00
Joe Duffy b158e9804b
Fix test edit directories (#755)
The test edit directory logic needs to carry forward the checkpoint
from the *prior edit*, not the *original*, as it sequences through edits.
2017-12-21 11:01:30 -08:00
joeduffy 8417955ddb Add Python generation to our Protobufs/gRPC interfaces
Part of pulumi/pulumi#754.
2017-12-21 09:24:48 -08:00
joeduffy 2eda90d67b Fix a dangling fmt parameter 2017-12-21 09:18:00 -08:00
Joe Duffy bc2cf55463
Implement resource protection (#751)
This change implements resource protection, as per pulumi/pulumi#689.
The overall idea is that a resource can be marked as "protect: true",
which will prevent deletion of that resource for any reason whatsoever
(straight deletion, replacement, etc).  This is expressed in the
program.  To "unprotect" a resource, one must perform an update setting
"protect: false", and then afterwards, they can delete the resource.

For example:

    let res = new MyResource("precious", { .. }, { protect: true });

Afterwards, the resource will display in the CLI with a lock icon, and
any attempts to remove it will fail in the usual ways (in planning or,
worst case, during an actual update).

This was done by adding a new ResourceOptions bag parameter to the
base Resource types.  This is unfortunately a breaking change, but now
is the right time to take this one.  We had been adding new settings
one by one -- like parent and dependsOn -- and this new approach will
set us up to add any number of additional settings down the road,
without needing to worry about breaking anything ever again.

This is related to protected stacks, as described in
pulumi/pulumi-service#399.  Most likely this will serve as a foundational
building block that enables the coarser grained policy management.
2017-12-20 14:31:07 -08:00
Joe Duffy 26021a41a3
Add the ability to do negative tests
This change adds the ability to do very coarse-grained negative
tests in our integration test framework.  Either a test itself,
or one of its edits, may be marked ExpectFailure == true, at which
point either the preview or update MUST fail (and, if one fails
without this being set, we still treat it as an error).
2017-12-20 12:10:46 -08:00
Luke Hoban d5acc3da87
Add option to specify command line flags to pulumi update in integration tests (#749)
And use this in the diff test which needs to apply `--colors=raw`.
2017-12-20 11:17:25 -08:00
Matt Ellis 8effbc0a3c
Merge pull request #746 from pulumi/check-tree-is-clean
Check that worktree is clean before running
2017-12-19 18:56:14 -08:00
Matt Ellis 0e8272746e Update lockfile
At some point it got out of date with what is in the tree, leading dep
ensure to always do a solve and pend changes to the lock file.
2017-12-19 18:32:39 -08:00
Matt Ellis b0efb6960d Check that worktree is clean before running
Without this, we miss cases where the lock files may need to be
updated and we encode a version like v0.9.5-dirty.
2017-12-19 18:32:39 -08:00
Joe Duffy 680a09a164
Add fewer leading prefixes (#741) 2017-12-18 14:51:23 -08:00
Joe Duffy 3311d32c2d
Merge pull request #728 from pulumi/hideGoop
Elide our serialized function preamble and postamble when printing user code
2017-12-18 13:22:13 -08:00
Joe Duffy f0c28db639
Attempt to fix colorization (#740)
Our recent changes to colorization changed from a boolean to a tri-valued
enum (Always, Never, Raw).  The events from the service, however, are still
boolean-valued.  This changes the message payload to carry the full values.
2017-12-18 11:42:32 -08:00
Joe Duffy 662ebcbd94
Merge pull request #666 from pulumi/add-logging-to-stack-reading
Log the error when getting a stack fails
2017-12-18 09:51:29 -08:00
Joe Duffy 6dc16a5548
Make cloud authentication more intuitive (#738)
The prior behavior with cloud authentication was a bit confusing
when authenticating against anything but https://pulumi.com/.  This
change fixes a few aspects of this:

* Improve error messages to differentiate between "authentication
  failed" and "you haven't logged into the target cloud URL."

* Default to the cloud you're currently authenticated with, rather
  than unconditionally selecting https://pulumi.com/.  This ensures

      $ pulumi login -c https://api.moolumi.io
      $ pulumi stack ls

  works, versus what was currently required

      $ pulumi login -c https://api.moolumi.io
      $ pulumi stack ls -c https://api.moolumi.io

  with confusing error messages if you forgot the second -c.

* To do this, our default cloud logic changes to

    1) Prefer the explicit -c if supplied;

    2) Otherwise, pick the "currently authenticated" cloud; this is
       the last cloud to have been targeted with pulumi login, or
       otherwise the single cloud in the list if there is only one;

    3) https://pulumi.com/ otherwise.
2017-12-16 07:49:41 -08:00
Joe Duffy bd2baa5091
Pass planning flag to print resource outputs (#737)
We hadn't previously passed the planning flag when printing resource
outputs, meaning any computed ones now are being printed as "undefined".
Instead, we prefer to see the "computed<string>" type name.
2017-12-16 07:33:58 -08:00
Pat Gavlin 10a1433720
Merge pull request #735 from pulumi/CITimeout
Bump the test timeout in CI.
2017-12-15 12:47:24 -08:00
Pat Gavlin d5f4e0c84b Bump the test timeout in CI.
Parameterize the timeout for the fast tests with a default of 2 minutes
that is bumped to 10 minutes in CI due to slow I/O during macOS builds.
2017-12-15 12:12:06 -08:00
Pat Gavlin 038f5ae806
Merge pull request #734 from pulumi/CheckOldIns
Only pass old inputs to `Check`.
2017-12-15 12:00:17 -08:00
Pat Gavlin 9d038c1d88 Only pass old inputs to Check.
We do not need all of the information in the old state for this call, as
outputs will not be read by the provider during validation or defaults
computation.
2017-12-15 11:04:43 -08:00
Joe Duffy 67d3e0ef64
Merge pull request #729 from pulumi/reject_failed_properties
Ensure resource-op failures lead to termination
2017-12-15 08:40:17 -08:00
Joe Duffy 2d8bdfe012
Merge pull request #733 from pulumi/pulumi/pulumi-service/436_diff_check_outs
Pass old *outputs*, not *inputs*, to Check/Diff
2017-12-15 07:40:21 -08:00
joeduffy 668e56f2c7 Use old.All() to be consistent with Update
This changes the inputs to Check/Diff to match what we also
pass to the Update function later on (old.All() vs. old.Outputs).
2017-12-15 07:37:15 -08:00
joeduffy 675fe38269 Add more tracing context to RPC marshaling
This change adds a bit more tracing context to RPC marshaling
logging so that it's easier to attribute certain marshaling calls.
Prior to this, we'd just have a flat list of "marshaled property X"
without any information about what the marshaling pertained to.
2017-12-15 07:22:49 -08:00
joeduffy 8492e6100f Pass old *outputs*, not *inputs*, to Check/Diff
This change passes a resource's old output state, so that it contains
everything -- defaults included -- for purposes of the provider's diffing.
Not doing so can lead the provider into thinking some of the requisite
state is missing.
2017-12-15 07:01:11 -08:00
pat@pulumi.com a992317d81 Do not serialize output registration.
This can result in circular promise chains if the output values depend
on promises that will only resolve in later turns.
2017-12-14 17:33:11 -08:00
CyrusNajmabadi a5cf6f25d6
Add a framework for baselining and validating pulumi-update diff output. (#700) 2017-12-14 17:10:05 -08:00
Cyrus Najmabadi 84051e84b3 Make linter happy. 2017-12-14 15:41:53 -08:00
joeduffy 30d69e27df Ensure resource-op failures lead to termination
At the moment, we swallow and log errors for rejected promises during
resolution of resource input properties.  This is clearly wrong, and
we should instead let them go rejected so that the unhandled rejected
promise logic triggers, and leads to program failure as expected.
2017-12-14 15:22:01 -08:00
Cyrus Najmabadi 1fc33741cc Strip out even more. 2017-12-14 15:02:13 -08:00
Cyrus Najmabadi 1ab2680df8 Elide our serialized function preamble and postamble when printing user code. 2017-12-14 14:55:27 -08:00
CyrusNajmabadi 9bb9295594
Suppress printing out the variables we capture. (#724) 2017-12-14 14:40:04 -08:00