Commit graph

202 commits

Author SHA1 Message Date
CyrusNajmabadi 3d063e200c
Properly display multi-step replaces in the progress UI. (#1679) 2018-08-02 00:48:14 -04:00
Chris Smith 7aa91d69e0
Add optional CI properties to environment metadata (#1678)
* Add optional CI properties to environment metadata

* Address PR feedback
2018-07-31 21:38:07 -07:00
Sean Gillespie 48d095d66f Remove "down" operation for migration - it is not semantically valid in
general.
2018-07-27 14:52:28 -07:00
Sean Gillespie 80c28c00d2
Add a migrate package for migrating to and from differently-versioned API types (#1647)
* Add a migrate package for migrating to and from differently-versioned
API types

* travis: gofmt -s deployment_test.go
2018-07-20 13:31:41 -07:00
CyrusNajmabadi 2e9a2e8a91
When printing message in non-interactive mode, do not keep printing out the worst diagnostic. (#1640) 2018-07-17 13:00:10 -07:00
CyrusNajmabadi 953c082bd8
Use the actual ticker control we already ahve. (#1629) 2018-07-12 11:38:44 -07:00
CyrusNajmabadi e6db67849c
Print out a 'still working' message every 20 seconds when in non-interactive mode. (#1616) 2018-07-10 13:44:18 -07:00
Chris Smith ad3b5e7ee8
Remove references to unused API endpoints (#1608)
* Remove references to unused API endpoints

* Remove vertical whitespace
2018-07-09 13:48:30 -07:00
CyrusNajmabadi 3ca56d1e82
Support the NO_COLOR env variable to suppres any colored output. (#1594)
Also, make --color a viable command option for any pulumi command.
2018-07-06 21:30:00 -07:00
Matt Ellis 2b471bda70 Add pulumi whoami
It's often helpful to understand the user the CLI thinks you are
logged in as, so let's add a command that does that.

Fixes #1507
2018-06-28 10:33:59 -07:00
CyrusNajmabadi 0b0927d257
Fix printing out outputs in a pulumi program. (#1531) 2018-06-18 16:03:26 -07:00
joeduffy 7bce92085d Add a colors.Highlight function
This change makes it a little easier to do the style of highlighting
we are doing now with the login prompt, cleaning up some of the
padding calculations that were otherwise complicated due to ANSI
escape sequences.
2018-06-12 08:14:41 -07:00
joeduffy f4436416e8 Tidy up the login message and colors
This change makes our login prompt a little "friendlier", especially
important since this will be the first thing a new user sees.

The new message is:

    $ pulumi new
    We need your Pulumi account to identify you.
    Enter your access token from https://app.pulumi.com/account
        or hit <ENTER> to log in using your browser            :
2018-06-12 07:52:22 -07:00
joeduffy 74a896bb7a Add strongly typed outputs
This change adds some convenience functions and types, to make strongly
typed outputs more pleasant to interact with.  It also includes tests
for output generally, in addition to these new functions and types.
2018-06-08 10:36:10 -07:00
Matt Ellis 0fcfbf39c3 Support browser based logins to the CLI
During login, if no access token is provided, use our browser
based login.
2018-06-08 11:32:25 -06:00
Matthew Riley d8358f7be3
Merge pull request #1453 from pulumi/retry-post
Send request body on retries
2018-06-04 11:32:19 -07:00
Sean Gillespie 1a2d4d9ff1
Fix an issue where the Version field of an UntypeDeployment was lost (#1450)
The Version field was inadvertently dropped when sending an import
request to the service. Now that we are requiring that the Version field
be set in deployments, this was causing errors.
2018-06-03 14:30:51 -07:00
Matthew Riley 71e9d8c2af Use bytes.Reader instead of bytes.Buffer
Calling `bytes.NewBuffer` gives up ownership of the backing memory and creates
a _mutable_ buffer. We don't need that, so let's use `bytes.NewReader` instead.
2018-06-03 01:33:50 -07:00
Chris Smith 485bb35180
Relax stack name requirements (#1381)
* Relax stack name requirements

* Add error if stack name too long

* Max tag length is 256 chars
2018-05-29 13:52:11 -07:00
Pat Gavlin da9bd9dbff
Merge pull request #1430 from pulumi/AlwaysPrompt
Always prompt for confirmation after a preview.
2018-05-29 09:47:00 -07:00
Sean Gillespie 924c49d7e0
Fail fast when attempting to load a too-new or too-old deployment (#1382)
* Error when loading a deployment that is not a version that the CLI understands

* Add a test for 'pulumi stack import' on a badly-versioned deployment

* Move current deployment version to 'apitype'

* Rebase against master

* CR: emit CLI-friendly error message at the two points outside of the engine calling 'DeserializeDeployment'
2018-05-25 13:29:59 -07:00
Sean Gillespie fe22ade275
Differentiate between warnings and errors when sending an event (#1424)
* Differentiate between warnings and errors when sending an event

* CR: always write severity field if the event is a diagnostic
2018-05-25 13:29:33 -07:00
Sean Gillespie 58ca6f5f19
Fix a confusing error message arising from multiple API calls failing in the same way (#1432) 2018-05-24 15:36:35 -07:00
Pat Gavlin 31739c8840 Always prompt for confirmation after a preview.
An empty preview is not a guarantee that a subsequent update will cause
no changes. As such, we should always offer the user the option to
perform an update even if the preview proposes no changes.

Note that this indirectly fixes #1410 by masking the effects of #1429.
2018-05-24 12:22:20 -07:00
Matt Ellis 9a8f8881c0 Show manifest information for stacks
This change supports displaying manifest information for a stack and
changes the way we handle Snapshots in our backend.

Previously, every call to GetStack would synthesize a Snapshot by
taking the set of resources returned from the
`/api/stacks/<owner>/<name>` endpoint, combined with an empty
manfiest (since the service was not returning the manifest).

This wasn't great for two reasons:

1. We didn't have manifest information, so we couldn't display any of
   its information (most important the last updated time).

2. This strategy required that the service return all the resources
   for a stack anytime GetStack was called. While the CLI did not
   often need this detailed information the fact that we forced the
   Service to produce it (which in the case of stack managed PPC would
   require the service to talk to yet another service) creates a bunch
   of work that we end up ignoring.

I've refactored the code such that `backend.Stack`'s `Snapshot()` method
now lazily requests the information from the service such that we can
construct a `Snapshot()` on demand and only pay the cost when we
actually need it.

I think making more of this stuff lazy is the long term direction we
want to follow.

Unfortunately, right now, it means in cases where we do need this data
we end up fetching it twice. The service does it once when we call
GetStack and then we do it again when we actually need to get at the
Snapshot.  However, once we land this change, we can update the
service to no longer return resources on the apistack.Stack type. The
CLI no longer needs this property.  We'll likely want to continue in a
direction where `apistack.Stack` can be created quickly by the
service (without expensive database queries or fetching remote
resources) and just add additional endpoints that let us get at the
specific information we want in the specific cases when we want it
instead of forcing us to return a bunch of data that we often ignore.

Fixes pulumi/pulumi-service#371
2018-05-23 16:43:34 -07:00
Sean Gillespie 1a51507206
Delete Before Create (#1365)
* Delete Before Create

This commit implements the full semantics of delete before create. If a
resource is replaced and requires deletion before creation, the engine
will use the dependency graph saved in the snapshot to delete all
resources that depend on the resource being replaced prior to the
deletion of the resource to be replaced.

* Rebase against master

* CR: Simplify the control flow in makeRegisterResourceSteps

* Run Check on new inputs when re-creating a resource

* Fix an issue where the planner emitted benign but incorrect deletes of DBR-deleted resources

* CR: produce the list of dependent resources in dependency order and iterate over the list in reverse

* CR: deps->dependents, fix an issue with DependingOn where duplicate nodes could be added to the dependent set

* CR: Fix an issue where we were considering old defaults and new inputs
inappropriately when re-creating a deleted resource

* CR: save 'iter.deletes[urn]' as a local, iterate starting at cursorIndex + 1 for dependency graph
2018-05-23 14:43:17 -07:00
Pat Gavlin f3201baeb5
Fix {computed,output}<> display in preview. (#1409)
At some point the summary and preview parameters to
`engine.GetResourcePropertiesDetails` were flipped s.t. we stopped
rendering computed<> and output<> values properly during previews.
2018-05-22 17:20:03 -07:00
joeduffy 5967259795 Add license headers 2018-05-22 15:02:47 -07:00
Matt Ellis 0732b05c5d Remove pulumi init
`pulumi init` was part of our old identity model with the service and
is no longer used. We can now delete this code.

Fixes #1241
2018-05-22 13:37:08 -07:00
Pat Gavlin b5efe40f04
Fold "global" messages under the stack resource. (#1406)
We currently display at most two rows for messages that are not
associated with a URN: one for those that arrive before the stack
resource is first observed and one for those that arrive after the stack
resource is first observed. The former is labeled "global"; the latter
is the row associated with the stack resource. These changes remove the
duplication by reassociating the row used for events with no URN that
arrive before the stack resource with the stack resource once it has
been observed.

Fixes #1385.
2018-05-22 13:30:52 -07:00
Pat Gavlin c08ede339f Only display preview/no-op resource rows once on non-TTYs.
Our current strategy for the progress display on non-TTYs causes us to
display multiple identical rows for each resource when the row is a
preview or a no-op. This behavior is not particularly useful, and
generally just makes the display noisier than it needs to be.

These changes avoid displaying resource rows without meaningful output
by supressing the display of resource output events that are delivered
during a preview or that correspond to a no-op update.

Fixes #1384.
2018-05-22 11:35:07 -07:00
joeduffy 614a2cdeb3 Simplify previews, initialize plugin events
This changes two things:

1) Eliminates the fact that we had two kinds of previews in our engine.

2) Always initialize the plugin.Events, to ensure that all plugin loads
   are persisted no matter the update type (update, refresh, destroy),
   and skip initializing it when dryRun == true, since we won't save them.
2018-05-18 14:58:06 -07:00
joeduffy 4e9b228089 Don't pass PluginEvents for refresh
The PluginEvents will now try to register loaded plugins which,
during a refresh preview, will result in attempting to save mutations
when a token is missing.  This change mirrors the changes made to
destroy which avoid it panicing similarly, by simply leaving
PluginEvents unset.  Also adds a bit of tracing that was helpful to
me as I debugged through the underlying issues.

Fixes #1377.
2018-05-18 13:54:23 -07:00
Sean Gillespie 7b7870cdaa
Remove unused stack name from deploy.Snapshot (#1386) 2018-05-18 11:15:35 -07:00
Joe Duffy a1d806321e
Enable refresh for managed stacks (#1380) 2018-05-17 11:44:39 -07:00
Sean Gillespie 68911900fd
Graceful shutdown (#1320)
* Graceful RPC shutdown: CLI side

* Handle unavailable resource monitor in language hosts

* Fix a comment

* Don't commit package-lock.json

* fix mangled pylint pragma

* Rebase against master and fix Gopkg.lock

* Code review feedback

* Fix a race between closing the callerEventsOpt channel and terminating a goroutine that writes to it

* glog -> logging
2018-05-16 15:37:34 -07:00
Pat Gavlin 009096239c
Merge pull request #1378 from pulumi/SortPropertyKeys
Sort property keys in the progress display.
2018-05-16 11:28:11 -07:00
Pat Gavlin 3cc8758b85 Sort property keys in the progress display.
This prevents the "updated keys" list from being arbitrarily reordered
upon refresh.
2018-05-16 11:10:52 -07:00
Pat Gavlin 64d90b263d
Merge pull request #1375 from pulumi/ResourceChangesFromBackend
Validate empty previews and updates in tests.
2018-05-16 10:44:48 -07:00
Pat Gavlin e3020e820b Expose change summaries from the backend.
This is a smallish refactoring that exposes the resource change
summaries reported by the engine from the relevant backend methods.
2018-05-15 17:44:35 -07:00
CyrusNajmabadi 72e00810c4
Filter the logs we emit to glog so that we don't leak out secrets. (#1371) 2018-05-15 15:28:00 -07:00
Matt Ellis 387fffd740 Allow retry of REST calls during a deployment
During a deployment, we end up making a bunch of PATCH/PUT/POST style
REST requests. For these calls, it should be safe to retry the
operation if there was a hickup during our REST call, so mark them as
retryable.
2018-05-15 13:08:03 -07:00
Pat Gavlin 782a869765
Add support for passing tracing headers. (#1360)
These changes add support for adding a tracing header to API requests
made to the Pulumi service. Setting the `PULUMI_TRACING_HEADER`
environment variable or enabling debug commands and passing the
`--tracing-header` will change the value sent in this header. Setting
this value to `1` will request that the service enable distributed
tracing for all requests made by a particular CLI invocation.
2018-05-14 13:44:44 -07:00
Matt Ellis 6845f9ed20 Add pulumi config refresh to fetch most recent configuration
The newly added `pulumi config refresh` updates your local copy of the
Pulumi.<stack-name>.yaml file to have the same configuration as the
most recent deployment in the cloud.

This can be used in a varirty of ways. One place we plan to use it is
in automation to clean up "leaked" stacks we have in CI. With the
changes you'll now be able to do the following:

```
$ cd $(mktemp -d)
$ echo -e "name: who-cares\nruntime: nodejs" > Pulumi.yaml
$ pulumi stack select <leaked-stack-name>
$ pulumi config refresh -f
$ pulumi destroy --force
```

Having a simpler gesture for the above is something we'll want to do
long term (we should be able to support `pulumi destory <stack-name>`
from a completely empty folder, today you need a Pulumi.yaml file
present, even if the contents don't matter).

But this gets us a little closer to where we want to be and introduces
a helpful primitive in the system.

Contributes to #814
2018-05-14 10:28:42 -07:00
CyrusNajmabadi 3e787779e5
Fix issue where replacements were not shown in the progress view. (#1357) 2018-05-11 16:48:05 -07:00
CyrusNajmabadi e94e358ddf
Fix small logic bug when printing out messages. (#1348) 2018-05-09 14:25:03 -07:00
Pat Gavlin 97e38bddc8 Enable distributed tracing.
These changes add support for injecting client tracing spans into HTTP
requests to the Pulumi API. The server can then rematerialize these span
references and attach its own spans for distributed tracing.
2018-05-09 11:43:09 -07:00
Matt Ellis c9db62060b Fix preview against a PPC
This will unblock `pulumi preview` against a PPC, which regressed
recently (c5b702e0ff was the likely
cause).
2018-05-08 21:43:17 -07:00
Pat Gavlin 0c04770f5e
Make tokenSource.Close() synchronous. (#1345)
Without these changes, it is possible for a token renewal to race with
CLI shutdown, which appears to be the cause of #1344.

Fixes #1344.
2018-05-08 15:28:42 -07:00
joeduffy b6db2c5763 Capture Git committer and author info
This change captures the Git committer and author's login and email
addresses, so that we can display them prominently in the service.  At
the moment, we only attribute updates to the identity that performed the
update which, in CI scenarios, is often always the same person for an
organization.  This makes Pulumi look like a needlessly lonely place.
2018-05-08 10:31:11 -07:00