Commit graph

1872 commits

Author SHA1 Message Date
Joe Duffy fbf13ec4d7
Use full state during updates (#526)
In our existing code, we only use the input state for old and new
properties.  This is incorrect and I'm astonished we've been flying
blind for so long here.  Some resources require the output properties
from the prior operation in order to perform updates.  Interestingly,
we did correclty use the full synthesized state during deletes.

I ran into this with the AWS Cloudfront Distribution resource,
which requires the etag from the prior operation in order to
successfully apply any subsequent operations.
2017-11-03 19:45:19 -07:00
Luke Hoban 13b10490c2
Only call Configure on a package once (#520)
We were previously calling configure on each package once per time it was mentioned in the config.  We only need to call it once ever as we pass the full bag of relevent config through on that one call.
2017-11-03 13:52:59 -07:00
Joe Duffy 0290283e6f
Skip unknown properties (#524)
It's legal and possible for undefined properties to show up in
objects, since that's an idiomatic JavaScript way of initializing
missing properties.  Instead of failing for these during deployment,
we should simply skip marshaling them to Terraform and let it do
its thing as usual.  This came up during our customer workload.
2017-11-03 13:40:15 -07:00
Matt Ellis 5067d77db1 Pass branch name to AppVeyor badge
Without this, we were getting the status for the most recent run,
which could include a broken run from a topic branch someone was using
for a PR.
2017-11-03 11:40:39 -07:00
joeduffy 5bf8b5cd3b Fix an error message typo 2017-11-03 11:20:33 -07:00
Pat Gavlin 6cd074fc38 Fix a test.
This test was not updated for the change to EventIndex.
2017-11-03 11:07:19 -07:00
Pat Gavlin ab9eae439b Update the type of EventIndex to match the API./service type. 2017-11-03 11:02:22 -07:00
Matt Ellis 538c45a744
Merge pull request #486 from pulumi/local-config
Suport workspace local configuration and use it by default
2017-11-02 13:21:19 -07:00
Matt Ellis 44d432a559 Suport workspace local configuration and use it by default
Previously, we stored configuration information in the Pulumi.yaml
file. This was a change from the old model where configuration was
stored in a special section of the checkpoint file.

While doing things this way has some upsides with being able to flow
configuration changes with your source code (e.g. fixed values for a
production stack that version with the code) it caused some friction
for the local development scinerio. In this case, setting
configuration values would pend changes to Pulumi.yaml and if you
didn't want to publish these changes, you'd have to remember to remove
them before commiting. It also was problematic for our examples, where
it was not clear if we wanted to actually include values like
`aws:config:region` in our samples.  Finally, we found that for our
own pulumi service, we'd have values that would differ across each
individual dev stack, and publishing these values to a global
Pulumi.yaml file would just be adding noise to things.

We now adopt a hybrid model, where by default configuration is stored
locally, in the workspace's settings per project. A new flag `--save`
tests commands to actual operate on the configuration information
stored in Pulumi.yaml.

With the following change, we have have four "slots" configuration
values can end up in:

1. In the Pulumi.yaml file, applies to all stacks
2. In the Pulumi.yaml file, applied to a specific stack
3. In the local workspace.json file, applied to all stacks
4. In the local workspace.json file, applied to a specific stack

When computing the configuration information for a stack, we apply
configuration in the above order, overriding values as we go
along.

We also invert the default behavior of the `pulumi config` commands so
they operate on a specific stack (i.e. how they did before
e3610989). If you want to apply configuration to all stacks, `--all`
can be passed to any configuration command.
2017-11-02 13:05:01 -07:00
Matt Ellis ede8f303f9
Merge pull request #506 from pulumi/pulumi-cli-to-cloud
Add cloud variants to remaining pulumi CLI commands
2017-11-02 11:41:10 -07:00
Matt Ellis a27d2bde72 Pass cloud name in options bag instead of an explicit parameter 2017-11-02 11:19:00 -07:00
Matt Ellis ab7c4c121f Do not expect a response from the destory endpoint
On success, the POST returns 204 (No Content)
2017-11-02 11:19:00 -07:00
Matt Ellis 07b4d9b36b Add Pulumi.com backend, unify cobra Commands
As part of the unification it became clear where we did not support
features that we had for the local backend. I opened issues and added
comments.
2017-11-02 11:19:00 -07:00
Matt Ellis 328734f874 Define backend interface, move local implementation behind it
This change introduces an abstraction for a `backend` which manages
the implementation of some CLI commands. As part of defining the
interface, we introduce a new local backend implementation that just
uses data local to the machine.

This will let us share argument parsing and some display information
between the local case and the pulumi.com case in the CLI. We can
continue to refine this interface over time (e.g. today we have the
implementation of the Destroy/Update/Preview actually writing output
but instead they should be returning strongly typed data that the CLI
knows how to display and is unified across Pulumi.com deploys and
local deploys).

But this is a good first step.
2017-11-02 11:19:00 -07:00
Chris Smith e0b67e1060 Address PR feedback 2017-11-02 11:19:00 -07:00
Chris Smith 693d940ee5 Fix lint warnings 2017-11-02 11:19:00 -07:00
Chris Smith 1557eb9f2e Add 'pulumi destroy' 2017-11-02 11:19:00 -07:00
Chris Smith 9f19c89397 Add 'pulumi preview' 2017-11-02 11:19:00 -07:00
Chris Smith fc82e71f21 Update Stack tests 2017-11-02 11:19:00 -07:00
Chris Smith 8b99c9a63f Bring in API types from the Pulumi Service 2017-11-02 11:19:00 -07:00
Chris Smith 11e217b869 Add 'stack select' 2017-11-02 11:19:00 -07:00
Chris Smith d66b792ecc Add 'stack rm' 2017-11-02 11:19:00 -07:00
Chris Smith 71f44f40b4 Add 'pulumi ls' 2017-11-02 11:19:00 -07:00
Chris Smith 76f5e832c2 Add 'pulumi login' test 2017-11-02 11:19:00 -07:00
Matt Ellis cfdf62511d
Merge pull request #512 from pulumi/makefile-cleanup
Small Makefile improvements
2017-11-01 11:00:01 -07:00
Matt Ellis 41562527f7
Merge pull request #511 from pulumi/use-vs2017
Use VS2017
2017-11-01 10:59:52 -07:00
Matt Ellis 0815ef5ec9 Drop explicit vet target
Gometalinter runs `vet` as one of the many linters, so we need not run
it again.
2017-10-31 16:49:15 -07:00
Matt Ellis ba368fde0d Simplify go test invocation 2017-10-31 16:42:16 -07:00
Matt Ellis 9b1671721e Rename lint_quiet to lint
We have some lint debt (around exported functions being
underdocumented) so we have a custom target that ignores some lint
warnings. However, that target (which is the only lint target that
needs to be clean to check in) is called `lint_quiet` instead of
`lint` which is our normal linting target.

Rename the target so your fingers can learn that `make lint` is always
the right way to run linting before checkin.
2017-10-31 16:39:23 -07:00
Matt Ellis c1a47dcb80 Use VS2017 2017-10-31 15:43:48 -07:00
Chris Smith dfcc165840
Update API types to match HEAD (#509)
Add `Name` (Pulumi project name) and `Runtime` (Pulumi runtime, e.g. "nodejs") properties to `UpdateProgramRequest`; as they are now required.

The long story is that as part of the PPC enabling destroy operations, data that was previously obtained from `Pulumi.yaml` is now required as part of the update request. This PR simply provides that data from the CLI.

This is the final step of a line of breaking changes.
pulumi-ppc 8ddce15b29
pulumi-service 8941431d57 (diff-05a07bc54b30a35b10afe9674747fe53)
2017-10-31 15:03:07 -07:00
CyrusNajmabadi 89b5a4be71
remove use of 'eval' in tests. (#510)
* remove use of 'eval' in tests.

* Remove another eval.

* Remove usage of eval.
2017-10-31 14:41:58 -07:00
Joe Duffy 8d916dc00c
Improve promise leak diagnostics (#508)
This change adds more context information to debuggable promises
to aid with leak detection.  This was super helpful for me just now!
2017-10-31 07:48:59 -07:00
joeduffy b3c4a52933 Add a diagnostics messages for the serialized promise chain 2017-10-31 06:52:42 -07:00
Matt Ellis 67426833a4
Merge pull request #505 from pulumi/FixWindows
Get windows integration tests working again
2017-10-31 00:19:20 -07:00
Pat Gavlin 660c4257be
Merge pull request #507 from pulumi/FixStackSelectTest
Fix the "stack select" test.
2017-10-31 00:02:58 -07:00
Matt Ellis 25552b8432 Remove unused import 2017-10-30 23:35:18 -07:00
Matt Ellis fd64125daf Aggregate process termination errors 2017-10-30 23:35:11 -07:00
Pat Gavlin 6be6b9a854 Fix the "stack select" test.
PR #501 regressed this test due to a change in its error message. We
should consider updating the rest of the `stack` commands to use a
similar message (rather than the "file not found" they currently emit).
2017-10-30 23:24:09 -07:00
Matt Ellis c3abe9de56 Don't error when no lingering node.exe processes exist 2017-10-30 23:22:22 -07:00
Matt Ellis 1a38abaa71 Fix published zip for Windows
- `go build` handles appending .exe to the built binary, so we need not do
it ourselves. In fact, when we did we generated a binary called
`pulumi.exe.exe` which is not what we wanted.

- Remove the development versions of the langhost and dynamic provider,
from the `<root>/node_modules/pulumi` folder. The `dist` version gets
copied into bin.

- Add the dummy_argument workaround to the dist version of the langhost.
2017-10-30 23:22:21 -07:00
Matt Ellis 95ee6d85f6 Kill plugin child processes as well on Windows
On windows, we have to indirect through a batch file to launch plugins,
which means when we go to close a plugin, we only kill cmd.exe that is
running the batch file and not the underlying node process. This
prevents `pulumi` from exiting cleanly. So on Windows, we also kill any
direct children of the plugin process

Fixes #504
2017-10-30 23:22:14 -07:00
Chris Smith c286712d28
Remove args we can now get from the repository and package (#501)
This PR removes three command line parameters from Cloud-enabled Pulumi commands (`update` and `stack init`). Previously we required users to pass in `--organization`, `--repository`, and `--project`. But with the recent "Pulumi repository" changes, we can now get that from the Pulumi workspace. And the project name from the `Pulumi.yaml`.

This PR also fixes a bugs that block the Cloud-enabled CLI path: `update` was getting the stack name via `explicitOrCurrent`, but that fails if the current stack (e.g. the one just initialized in the cloud) doesn't exist on the local disk.

As for better handling of "current stack" and and Cloud-enabled commands, https://github.com/pulumi/pulumi/pull/493 and the PR to enable `stack select`, `stack rm`, and `stack ls` do a better job of handling situations like this.
2017-10-30 17:47:12 -07:00
Matt Ellis 3fcf5889c1 Don't change cd in Windows launch scripts
Previously, we would CD into the directory of the launch script and
invoke node.exe from there. We did this because the require statement
was a relative path and so we needed to be in the langhost directory for
things to work.

This behavior differs from how we launch things on *nix and was causing
some issues with relative paths, since the CWD would now differ between
Windows and *nix. So instead we construct a full path for our require
statements and don't cd anymore. The only tricky thing is to change path
separators from \ to / when computing the path to the root folder we
should do our require from.
2017-10-30 15:37:06 -07:00
Matt Ellis 9ac7af2aa7
Merge pull request #499 from pulumi/misc-init-fixes
Fix up some pulumi init error cases
2017-10-30 15:18:41 -07:00
Chris Smith defe0038ca
Add integration tests for pulumi CLI (#493)
This PR adds integration tests for exercising `pulumi init` and the `pulumi stack *` commands. The only functional change is merging in https://github.com/pulumi/pulumi/pull/492 , which I found while writing the tests and (of course 😁 ) wrote a regression for.

To do this I introduce a new test driver called `PulumiProgram`. This is different from the one found in the `testing/integration`package in that it doesn't try to prescribe a workflow. It really just deals in executing commands, and confirming strings are in the output.

While it doesn't hurt to have more tests for `pulumi`, my motivation here was so that I could reuse these to ensure I keep the same behavior for my pending PR that implements Cloud-enabled variants of some of these commands.
2017-10-30 15:17:13 -07:00
Matt Ellis f9b0528b97 Use correct parameter name 2017-10-30 14:43:49 -07:00
Joe Duffy 0383c24087
Drain the message queue before exiting (#498)
This change remembers that we failed due to an uncaught exception,
and defers the process.exit(1) until we actually reach the process's
exit event.  This ensures that we drain the message queue before
exiting, which ensures that outbound messages actually reach their
destination.
2017-10-30 11:48:54 -07:00
Matt Ellis 62efc1b441 Fix up some pulumi init error cases
- When looking for a `.pulumi` folder to reuse, only consider ones
  that have a `settings.json` in them.
- Make the error message when there is no repository a little more
  informative by telling someone to run `pulumi init`
2017-10-30 11:40:32 -07:00
pat@pulumi.com 8fd2d3e9e0 Fix require paths in closure serialization on Windows.
We were ending up with unescaped backslashes in require paths, which was
causing the requires to fail.
2017-10-30 08:55:18 -07:00