Commit graph

1912 commits

Author SHA1 Message Date
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
Chris Smith bd5e54d63e
Fix panic when using commands w/o Pulumi.yaml (#492)
Calls to `NewProjectWorkspace` will panic if there is no Pulumi.yaml found in the folder hierarchy. Simple repo:

```
git init
pulumi init
pulumi stack init x
```

`DetectPackage` will search until it gets to the `.pulumi` directory or finds a `Pulumi.yaml` file. In the case of the former, we pass "" to `LoadPackage` which then asserts because the file doesn't exist.

We now detect this condition and surface an error to the user. The error text is patterned after running a git command when there is no .git folder found:

fatal: Not a git repository (or any of the parent directories): .git
2017-10-28 18:07:03 -07:00
Joe Duffy cdb2c79e8e
Exit with an error code in the face of unhandled errors (#495)
As part of fixing the exit bug recently, we accidentally made errors
lead to zero exit codes.  As a result, the Pulumi CLI thought the
prgoram exited ordinarily, and proceeded to do its usual planning and
deployment, rather than terminating abruptly.

This is a byproduct of how Node's process.uncaughtException handler
works.  It hijacks and replaces all usual error logic, including the
process.exit part.  This change simply adds back the non-zero exit.

I also added a test (and fixed one other that began failing
afterwards), so that we can prevent regressions down the road.
2017-10-28 17:05:05 -07:00
Joe Duffy 2344f9e079
Merge pull request #490 from pulumi/int_test_stackdir
Fix where integration tests look for checkpoints
2017-10-27 20:12:07 -07:00
joeduffy 6d74b3ca27 Add minimal runtime verification test
This adds a minimal runtime verification test to our basic
test suite, to at least exercise the portions of the integration
test library that load up and parse checkpoint files.
2017-10-27 20:03:38 -07:00
joeduffy 7835305b82 Fix where integration tests look for checkpoints 2017-10-27 19:42:17 -07:00
Matt Ellis 8d7a87f694
Merge pull request #488 from pulumi/windows-hang
Fix AppVeyor hang when tests fail
2017-10-27 18:00:08 -07:00
Matt Ellis 51250c42db Lower timeout
The tests usually complete in about 15 seconds, so let's lower the
timeout to fail a little faster in cases where we have hangs in
`pulumi` itself.
2017-10-27 15:54:16 -07:00
Matt Ellis 786e1b92e1 Ensure we always kill leaking node processes
When go test fails, we would not kill any extra node processes lying
around. In AppVeyor, not killing these causes the job to hang until we
reach the AppVeyor timeout. Explicitly killing the jobs ensures
AppVeyor ends quickly.
2017-10-27 15:54:16 -07:00
Matthew Riley 90e53482dc
Merge pull request #485 from pulumi/remove-proccnt
Remove unused PROCCNT variable
2017-10-27 15:43:24 -07:00
Chris Smith d80cba135a
Add newline after update completes (#487)
The last status message from the PPC doesn't include a newline. So the `pulumi` CLI renders any error messages on the same line as the last diagnostic message. Not ideal.
2017-10-27 15:40:15 -07:00