Commit graph

3033 commits

Author SHA1 Message Date
Nate Jones 0ea261baf4 Pass environment through to go language programs (#1965)
This allows those programs to use authentication credentials that are
in the environment to perform extra work.
2018-09-20 15:17:18 -07:00
Pat Gavlin 9c7fff2d7d
Improve integration test usability. (#1960)
Add two command-line options to the test framework, "-dirs" and
"list-dirs". The former accepts a regex that is used to select which
integration tests to run. The latter lists available integration tests
without running them.
2018-09-20 15:08:29 -05:00
Nate Jones 88efd73282 Search for Go project executables in more places than just $PATH (#1955)
* Search for Go project executables in more places than just $PATH

This searches the following in preferred order:

1. Local directory
2. $GOPATH/bin
3. In $PATH

* Check if program is not a directory before executing
2018-09-19 15:22:33 -07:00
Sean Gillespie d3f59831d2
Add URN to dummy row for new events (#1957) 2018-09-19 14:29:16 -07:00
CyrusNajmabadi 4f9db82a43
Stop using black/white colors directly when printing out console text. They can have issues with light/dark terminals. (#1951) 2018-09-19 01:40:03 -07:00
Nate Jones 10449c2991 Implement RegisterResourceOutputs so that outputs in Go work (#1954)
Fixes #1519
2018-09-18 15:32:30 -07:00
Sean Gillespie 2d4a3f7a6a
Move management of root resource state to engine (#1944)
* Protobuf changes

* Move management of root resource state to engine

This commit fixes a persistent side-by-side issue in the NodeJS SDK by
moving the management of root resource state to the engine. Doing so
adds two new endpoints to the Engine gRPC service: 1) GetRootResource
and 2) SetRootResource, which get and set the root resource
respectively.

* Rebase against master, regenerate proto
2018-09-18 11:47:34 -07:00
James Nugent 6af4ebe384 Allow any configured CI to use the GitHub app (#1947)
This commit adds checks for a set of predefined environment variables:

- PULUMI_CI_SYSTEM
- PULUMI_CI_BUILD_ID
- PULUMI_CI_BUILD_TYPE
- PULUMI_CI_BUILD_URL
- PULUMI_CI_PULL_REQUEST_SHA

If PULUMI_CI_SYSTEM is set in the environment, CI configuration is
extracted from the remaining variables for sending to the backend, and
disables the checks for supported systems (currently only Travis CI).

This increases the flexibility of the Pulumi CLI by not requiring
specific support for particular CI systems to be added, provided the
necessary environment variables are configured for the job - this should
be possible for at least TeamCity, Jenkins, AWS CodeBuild, Azure DevOps
Pipelines, and likely most other systems.

This should not replace native support for detecting more CI systems in
future, however, since it requires more work of the user.
2018-09-18 09:50:29 -07:00
Sean Gillespie f284112b4e
Use nightly protoc gRPC plugin for node (#1948)
* Use nightly protoc gRPC plugin for Node

Newer versions of the Node gRPC plugin accept the 'minimum_node_version'
flag, which we can use to instruct protoc to not support Node versions
earlier than Node 6. This allows the compiler to use 'Buffer.from'
instead of the deprecated 'Buffer' constructor, which fixes a
deprecation warning on Node 10.

* Protobuf changes
2018-09-17 15:16:31 -07:00
Sean Gillespie d80db466a6
Display diff when Protect bit changes (#1949)
It's useful to show a diff whenever a user toggles the protect bit on a
resource, so they can be sure that it has actually occured.
2018-09-17 15:03:06 -07:00
Sean Gillespie b98c5bb0d9
Fix preview display for replacements (#1945)
* Fix preview display for replacements

* Make gometalinter happy
2018-09-17 10:50:11 -07:00
CyrusNajmabadi 937391259e
Update linter version. (#1946) 2018-09-15 02:59:01 -07:00
Pat Gavlin d67e04247f
Fix a few dynamic provider issues. (#1935)
- Do not require replacement of dynamic resources due to provider
  changes. This is not necessary, and is almost certainly the wrong
  thing to do if the dynamic provider is managing a physical resource.

- Return all inputs by default from a dynamic provider's check method.
  Currently a dynamic provider that does not implement check will end up
  receiving no inputs. This is confusing, and is not the correct default.
2018-09-14 19:59:06 -07:00
Chris Smith 792c316e5e
Change backend.ListStacks to return a new StackSummary interface (#1931)
* Have backend.ListStacks return a new StackSummary interface

* Update filestake backend to use new type

* Update httpstate backend to use new type

* Update commands to use new type

* lint

* Address PR feedback

* Lint
2018-09-13 20:54:42 -07:00
Matt Ellis 3642cca98f Don't print junk when a unrecognized URL is passed to pulumi login
In order to present a message with a link to a user's access tokens in
the service, we have to convert the API server's URL to the URL for
the console.  We understand how to do this for servers that look like
our servers (i.e. their host name is `api.<whatever>`), but in general
we can't do this.

Rewrite the code such that we only print a message about how to find
your access tokens (and offer browser based login) only in cases where
we are able to construct a URL to the console.

Fixes #1930
2018-09-13 19:36:00 -07:00
Thomas Schersach c01023737e Copy missing pulumi-resource-pulumi-nodejs binary in node lang host dist target 2018-09-13 11:18:06 -07:00
Sean Gillespie 59098fb6b6
Clarify condition for displaying outputs (#1927) 2018-09-13 09:16:19 -07:00
Thomas Schersach 0b728a1c3c Added short description to pulumi root cmd (#1925)
* Added short description to pulumi root cmd

* Fixed formatting
2018-09-13 06:45:52 -07:00
CyrusNajmabadi 1b0780afda
Don't unwrap resources when producing an output. (#1923) 2018-09-11 21:49:36 -07:00
CyrusNajmabadi ba7be6a6dd
Update docts. (#1922) 2018-09-11 21:17:52 -07:00
CyrusNajmabadi 13800a89a0
Produce a strongly-typed 'unwrap' function to help with deep unwrapping of Input values. (#1915) 2018-09-11 19:38:45 -07:00
Matt Ellis c7f9f9d12c More macOS script fixes 2018-09-11 17:14:58 -07:00
Matt Ellis a57bdfbd52 Fix up scripts when running on macOS
macOS doesn't use GNU tools and so some options are missing.
2018-09-11 17:00:40 -07:00
Sean Gillespie 3d5f005c95
Fix several output-related issues (#1919)
* Revert "Don't show stack outputs when update fails (#1916)"

This reverts commit e3f89e82aa.

* Be more precise about printing outputs

This commit prints outputs only if they are known to be complete. This
avoids massive red diffs during previews and when component resources
fail to call registerResourceOutputs.

* CR: Clean up large boolean expression and comment

* CR: boolean compromise
2018-09-11 16:44:06 -07:00
Sean Gillespie 559e1625df
Combine two gRPC servers into one for testing (#1918)
* Combine two gRPC servers into one for testing

For some reason, our current gRPC test setup has become flaky now that
we are spinning up two gRPC servers. Hopefully merging them into one
helps clarify what's going on.

* Add back error logging for CI
2018-09-11 15:45:15 -07:00
leogtzr 3f89b015ca cleanup 2018-09-11 14:59:25 -07:00
Sean Gillespie a35aba137b
Retire pending deletions at start of plan (#1886)
* Retire pending deletions at start of plan

Instead of letting pending deletions pile up to be retired at the end of
a plan, this commit eagerly disposes of any pending deletions that were
pending at the end of the previous plan. This is a nice usability win
and also reclaims an invariant that at most one resource with a given
URN is live and at most one is pending deletion at any point in time.

* Rebase against master

* Fix a test issue arising from shared snapshots

* CR feedback

* plan -> replacement

* Use ephemeral statuses to communicate deletions
2018-09-10 16:48:14 -07:00
Sean Gillespie 33d0c585bb
Use optional parent event stream for cancellation (#1912)
* Close cancellation source before closing events

The cancellation source logs cancellation messages to the engine event
channel, so we must first close the cancellation source before closing
the channel.

* CR: Fix race in shutdown of signal goroutine
2018-09-10 16:42:22 -07:00
Sean Gillespie e3f89e82aa
Don't show stack outputs when update fails (#1916)
* Don't show stack outputs when update fails

It is basically guaranteed that stack outputs are going to be
meaningless if a plan fails, so this commmit doesn't display them if an
error has occured.

* CR: expand on comment
2018-09-10 16:16:31 -07:00
Pat Gavlin 4a550e308f
Fix provider cancellation. (#1914)
We signal provider cancellation by hangning a goroutine off of the plan
executor's parent context. To ensure clean shutdown, this goroutine also
listens on a channel that closes once the plan has finished executing.
Unfortunately, we were closing this channel too early, and the close was
racing with the cancellation signal. These changes ensure that the
channel closes after the plan has fully completed.

Fixes #1906.
Fixes pulumi/pulumi-kubernetes#185.
2018-09-10 15:18:25 -07:00
Chris Smith a7d70fa63b
Have ListStacksResponse include data required for 'stacks ls' (#1908)
* Have ListStacks return data required for 'stacks ls'

* Have ListStacks return data required for 'stacks ls'

* Split out org name and stack name
2018-09-10 12:50:10 -07:00
Sean Gillespie 679f55c355
Validate type tokens before using them (#1904)
* Validate type tokens before using them

When registering or reading a resource, we take the type token given to
us from the language host and assume that it's valid, which resulted in
assertion failures in various places in the engine. This commit
validates the format of type tokens given to us from the language host
and issues an appropriate error if it's not valid.

Along the way, this commit also improves the way that fatal exceptions
are rendered in the Node language host.

* Pre-allocate an exception for ReadResource

* Fix integration test

* CR Feedback

This commit is a lower-impact change that fixes the bugs associated with
invalid types on component resources and only checks that a type is
valid on custom resources.

* CR Take 2: Fix up IsProviderType instead of fixing call sites

* Please gometalinter
2018-09-07 15:19:18 -07:00
Pat Gavlin 8fdc80a7dc
Check for input diffs when eliding same steps. (#1905)
It is possible for the inputs of a "same" resource to have changed even
if the contents of the input bags are different if the resource's
provider deems the physical change to be semantically irrelevant.
2018-09-07 15:10:02 -07:00
Matt Ellis 91827752d5 Use require.resolve to find @pulumi/pulumi/cmd/run
Instead of trying to probe for the normal path ourselves, just use
node's `require.resolve` statement to find `@pulumi/pulumi/cmd/run`.

This allows run to be found in cases where either yarn workspaces are
used, or the module has been installed globally.

Part of #1868
2018-09-07 11:30:54 -07:00
Pat Gavlin d243b49193
Make opts.providers robust to SxS scenarios. (#1901)
`opts.providers` is currently only read by the `Resource` constructor if
either `opts.parent` or `getRootResource` is not `undefined`. In
scnearios where exactly one copy of `@pulumi/pulumi` is loaded, one of
these conditions will always be true. In SxS scenarios, however, it is
possible for neither of these conditions to be true, and the created
resource will end up without a `providers` map. These changes fix that
by always copying the contents of `opts.providers` if it is defined.
2018-09-07 09:42:19 -07:00
Sean Gillespie 2bc3eb7507
Log any errors coming from the langhost during tests (#1899) 2018-09-06 16:35:24 -07:00
CyrusNajmabadi 0d6acebecd
Be resilient to encountering invalid data in a package.json file. (#1897) 2018-09-06 16:35:14 -07:00
Joe Duffy df6d337302
Improve Pulumi command help (#1896)
This change improves the root command help text for the CLI. It
advertises common commands and includes a more prominent link to
our project website. Fixes pulumi/pulumi#1652.
2018-09-06 13:55:12 -07:00
Justin Van Patten 2dd13292a3
Consolidate some new and up functionality (#1884)
Previously `new` was operating under the assumption that it was always
going to be creating a new project/stack, and would always prompt for
these values. However, we want to be able to use `new` to pull down the
source for an existing stack. This change adds a `--stack` flag to `new`
that can be used to specify an existing stack. If the specified stack
already exists, we won't prompt for the project name/description, and
instead just use the existing stack's values. If `--stack` is specified,
but doesn't already exist, it will just use that as the stack name
(instead of prompting) when creating the stack. `new` also now handles
configuration like `up <url>`: if the stack is a preconfigured empty
stack (i.e. it was created/configured in the Pulumi Console via Pulumi
Button or New Project), we will use the existing stack's config without
prompting. Otherwise we will prompt for config, and just like `up
<url>`, we'll use the existing stack's config values as defaults when
prompting, or if the stack didn't exist, use the defaults from the
template.

Previously `up <url>`'s handling of the project name/description wasn't
correct: it would always automatically use the values from the template
without prompting. Now, just like `new`:

 - When updating an existing stack, it will not prompt, and just use the
   existing stack's values.

 - When creating a new stack, it will prompt for the project
   name/description, using the defaults from the template.

This PR consolidates some of the `new`/`up` implementation so it shares
code for this functionality. There's definitely opportunities for a lot
more code reuse, but that cleanup can happen down the line if/when we
have the cycles.
2018-09-06 12:45:56 -07:00
Sean Gillespie 9acafcfe11
Don't call process.exit in exit callback (#1892)
Node calls 'exit' event callbacks when a process is preparing to exit,
via process.exit or otherwise, but it does not execute the next callback
in the chain if a callback calls process.exit.
2018-09-06 10:52:05 -07:00
Mikhail Shilkov 30fccc0773 computeCodePath won't find modules in an organization on Windows (#1889) 2018-09-05 22:07:21 -07:00
Sean Gillespie f83d32390c
Don't close eventChannel when panicking (#1891)
* Don't close eventChannel when panicking

The state of the system is completely unknown when panicking and in
general it's not safe to infer whether or not it is safe to close a
channel when in this tate.

* CR feedback

* Spelling
2018-09-05 17:50:48 -07:00
CyrusNajmabadi 193af7bda8
Simpler way of stating which dependencies need to be available at runtime. (#1890) 2018-09-05 16:18:31 -07:00
Sean Gillespie ca58b8117f
Clarify control flow in step generator (#1843)
* Introduce Result type to engine

The Result type can be used to signal the failure of a computation due
to both internal and non-internal reasons. If a computation failed due
to an internal error, the Result type carries that error with it and
provides it when the 'Error' method on a Result is called. If a
computation failed gracefully, but wished to bail instead of continue a
doomed plan, the 'Error' method provides a value of null.

* CR feedback
2018-09-05 15:08:09 -07:00
Pat Gavlin df1a5e653d
Fail refreshes with init errors. (#1882)
And ensure that refreshes continue on errors.

Fixes #1881.
2018-09-05 14:00:28 -07:00
Joe Duffy 373bc25cfd
Merge pull request #1875 from pulumi/joeduffy/1818_local_backend
Improve the local backend
2018-09-05 13:00:26 -07:00
CyrusNajmabadi 9d0dc65f49
Provide helper to compute whihc sub-packages should be included even if we would exclude a higher package. (#1883) 2018-09-05 12:54:28 -07:00
joeduffy c1967129e7 Fix integration tests
This fixes the integration tests:

* Expect and allow the update header.

* Don't print the local permalink if there's an error.
2018-09-05 11:39:58 -07:00
joeduffy b1f7cf7050 Fix a few lint warnings 2018-09-05 08:25:23 -07:00
joeduffy db48f10412 Update test frameworks to new packages 2018-09-05 08:16:14 -07:00