Commit graph

2456 commits

Author SHA1 Message Date
Joe Duffy f2ae3a7afc
Permit plugin versions to float (#1122)
This change lets plugin versions to float in two ways:

1) If a `pulumi plugin install` detects a newer version is available
   already, there's no need to download and install the older version.

2) If the engine attempts to load a plugin at a particular version,
   if a newer version is available, it will be accepted without error.

As part of this, we permit $PATH to have the final say when determining
which version to accept.  That is, it can always override the choice.

Note that I highly suspect, in the limit, that we'll want to stop doing
this for major version incompatibilities. For now, since we don't
envision any such version changes imminently, this will suffice.
2018-04-05 16:37:50 -07:00
Matt Ellis 68d6df47b9 Fix logic condition in publish script 2018-04-05 14:43:03 -07:00
Matt Ellis bed208ea18 Fix NPM tagging
`npm publish`'s default was to tag the package we published with
`latest` tag. The NPM ecosystem has expected semantics around this
tag (it uses it by default if you don't pass a version).

From the NPM Docs:

> Typically, projects only use the latest tag for stable release
> versions, and use other tags for unstable versions such as
> prereleases.

We were not doing this, but now we will.  We'll have a new tag `dev`
which is the latest build out of CI, and we'll tag builds without a
pre-release tag with "latest".
2018-04-05 14:41:19 -07:00
Joe Duffy 298f479206
Merge pull request #1118 from pulumi/1108_resource_model
Make some resource model changes
2018-04-05 10:50:18 -07:00
Matt Ellis d3240fdc64 Require pulumi login before commands that need a backend
This change does three major things:

1. Removes the ability to be logged into multiple clouds at the same
time. Previously, we supported being logged into multiple clouds at
the same time and the CLI would fan out requests and join responses
when needed. In general, this was only useful for Pulumi employees
that wanted run against multiple copies of the service (say production
and staging) but overall was very confusing (for example in the old
world a stack with the same identity could appear twice (since it was
in two backends) which the CLI didn't handle very well).

2. Stops treating the "local" backend as a special thing, from the
point of view of the CLI. Previouly we'd always connect to the local
backend and merge that data with whatever was in clouds we were
connected to. We had gestures like `--local` in `pulumi stack init`
that meant "use the local mode". Instead, to use the local mode now
you run `pulumi login --cloud-url local://` and then you are logged in
the local backend. Since you can only ever be logged into a single
backend, we can remove the `--local` and `--remote` flags from `pulumi
stack init`, it just now requires you to be logged in and creates a
stack in whatever back end you were logged into. When logging into the
local backend, you are not prompted for an access key.

3. Prompt for login in places where you have to log in, if you are not
already logged in.
2018-04-05 10:19:41 -07:00
joeduffy 5e28a4ab07 Add the ability to read an existing resource
This change wires up the new Read RPC method in such a manner that
Pulumi programs can invoke it.  This is technically not required for
refreshing state programmatically (as in pulumi/pulumi#1081), however
it's a feature we had eons ago and have wanted since (see
pulumi/pulumi#83), and will allow us to write code like

    let vm = aws.ec2.Instance.get("my-vm", "i-07043cd97bd2c9cfc");
    // use any property from here on out ...

The way this works is simply by bridging the Pulumi program via its
existing RPC connection to the engine, much like Invoke and
RegisterResource RPC requests already do, and then invoking the proper
resource provider in order to read the state.  Note that some resources
cannot be uniquely identified by their ID alone, and so an extra
resource state bag may be provided with just those properties required.

This came almost for free (okay, not exactly) and will come in handy as
we start gaining experience with reading live state from resources.
2018-04-05 09:48:09 -07:00
joeduffy 22584e7e37 Make some resource model changes
This commit changes two things about our resource model:

* Stop performing Pulumi Engine-side diffing of resource state.
  Instead, we defer to the resource plugins themselves to determine
  whether a change was made and, if so, the extent of it.  This
  manifests as a simple change to the Diff function; it is done in
  a backwards compatible way so that we continue with legacy diffing
  for existing resource provider plugins.

* Add a Read RPC method for resource providers.  It simply takes a
  resource's ID and URN, plus an optional bag of further qualifying
  state, and it returns the current property state as read back from
  the actual live environment.  Note that the optional bag of state
  must at least include enough additional properties for resources
  wherein the ID is insufficient for the provider to perform a lookup.
  It may, however, include the full bag of prior state, for instance
  in the case of a refresh operation.

This is part of pulumi/pulumi#1108.
2018-04-05 08:14:25 -07:00
Pat Gavlin 0e5046e122
Merge pull request #1115 from pulumi/DeleteRendezvous
Remove `pkg/util/rendezvous`.
2018-04-04 13:42:18 -07:00
Pat Gavlin 716d6fdea4 Remove pkg/util/rendezvous.
This package is unused.
2018-04-04 12:52:51 -07:00
Chris Smith 875736a675
Check GitHubLogin instead of Name for check (#1112)
* Check GitHubLogin instead of Name for check

* Remove unused fields
2018-04-04 11:05:41 -07:00
Sean Gillespie a3a6101e79
Improve the error message arising from missing required configs for resource providers (#1097)
* Improve the error message arising from missing required configs for
resource providers

If the resource provider that we are speaking to is new enough, it will send
across a list of keys and their descriptions alongside an error
indicating that the provider we are configuring is missing required
config. This commit packages up the list of missing keys into an error
that can be presented nicely to the user.

* Code review feedback: renaming simplification and correcting errors in comments
2018-04-04 10:08:17 -07:00
Luke Hoban 5ede33e03d
Run tests against managed stacks backend instead of FnF (#1092)
Tests now target managed stacks instead of local stacks.

The existing logged in user and target backend API are used unless PULUMI_ACCES_TOKEN is defined, in which case tests are run under that access token and against the PULUMI_API backend.

For developer machines, we will now need to be logged in to Pulumi to run tests, and whichever default API backend is logged in (the one listed as current in ~/.pulumi/credentials.json) will be used. If you need to override these, provide PULUMI_ACCESS_TOKEN and possibly PULUMI_API.

For Travis, we currently target the staging service using the Pulumi Bot user.

We have decided to run tests in the pulumi organization. This can be overridden for local testing (or in Travis in the future) by defining PULUMI_API_OWNER_ORGANIZATION and using an access token with access to that organization.

Part of pulumi/home#195.
2018-04-02 21:34:54 -07:00
Matt Ellis 3afc193430
Merge pull request #1110 from pulumi/add-tags-to-stack
Add Tags field to apitype.Stack
2018-04-02 15:00:04 -07:00
Matt Ellis a5d69dd2b8 Add Tags field to apitype.Stack
As part of the new identity model, we're going to use tagging on
stacks to record metadata, let's create a bag for that, as well as a
few well known tag names that map to metadata we know we'll want to set.
2018-04-02 14:44:14 -07:00
Joe Duffy 0810798ca9
Merge pull request #1109 from pulumi/1107_toolchain_failure
Fix master failures (pulumi/pulumi#1107)
2018-04-02 14:44:00 -07:00
joeduffy 4f638beaf5 Add sudo when installing machine-wide virtualenv 2018-04-02 14:18:44 -07:00
joeduffy a71e3f09df Move subshell failure sooner 2018-04-02 11:47:27 -07:00
Joe Duffy 19e6c9c2bc
Fix Python versions (again) (#1106)
This change actually makes our Python version numbers conformant
to PEP440.  Previously we were including the Git commit hash in the
alpha "version number" part, which is incorrect.  This simply led to
warnings upon publication and installation, but that warning very
clearly states that support for invalid versions will stop at some
point.  This change puts any "informative" parts, like the Git hash,
inside of a local version tag, where such things are permitted.

Also move away from the inline sed silliness so that we can more
easily share this logic across all of our repos.
2018-04-02 10:31:05 -07:00
Joe Duffy 0c308efb1d
Install virtualenv to user packages (#1104)
This installs virtualenv to the user packages site, to insulate us from
permission problems in CI, and also invokes that version.
2018-04-01 18:54:57 -07:00
joeduffy e27ad9eb75 Specify virtualenv>=15.2.0
It appears 15.0.2 generates a bad reference to the pip._install module.
I've tested that 15.2.0 does not so, although I don't really understand
why and when this changed (my current guess is the Travis base image
changed), this should fix pulumi/pulumi#1103.
2018-03-31 16:57:37 -07:00
Chris Smith aecf0d8d19
Fix typeo in error message
Adding space in "Use--plaintext to avoid this warning".
2018-03-31 13:48:46 -07:00
CyrusNajmabadi 4b761f9fc1
Include richer information in events so that final display can flexibly chose how to present it. (#1088) 2018-03-31 12:08:48 -07:00
Pat Gavlin e74ea464f3
Merge pull request #1098 from pulumi/FixImport
Fix `stack import`.
2018-03-30 16:37:30 -07:00
Pat Gavlin b7e55108c9 Fix stack import.
At some point--likely when we were tweaking API types--`stack import`
stopped working correctly. These changes straighten things out again.
2018-03-30 15:51:40 -07:00
Joe Duffy 215fee11f8
Add a URL after an update completes (#1090)
This change adds a Pulumi Cloud Console URL at the end of an update
that went through the Pulumi Cloud API.  This is very basic, and is
meant to be just the beginning of adding more cross-linking to the
service.  I'm still thinking through the phrasing to use here.
2018-03-30 09:21:55 -07:00
Sean Gillespie 70cc3f3796
Revert "Upgrade to latest gRPC (#1071)" (#1091)
This reverts commit 8c0d1698b0.
2018-03-29 22:24:26 -07:00
CyrusNajmabadi 0caa5cc5fa
Making linter happy. (#1084) 2018-03-29 15:15:52 -07:00
Joe Duffy be26db3ffa
Eliminate needless level of closure indirection (#1085)
This was CR feedback from @swgillespie.
2018-03-29 08:57:25 -07:00
Sean Gillespie 91c550f1e0
Send structured errors across RPC boundaries (#1072)
* Send structured errors across RPC boundaries

This brings us closer to gRPC best practices where we send structured
errors with error codes across RPC endpoints. The new "rpcerrors"
package can wrap errors from RPC endpoints, so RPC servers can attach
some additional context as to why a request failed.

* Code review feedback:

1. Rename rpcerrors -> rpcerror, better package name
2. Rename RPCError -> Error, RPCErrorCause -> ErrorCause, names
suggested by gometalinter to improve their package-qualified names
3. Fix import organization in rpcerror.go
2018-03-28 17:07:35 -07:00
Pat Gavlin 713a38dcb6
Merge pull request #1083 from pulumi/GetStack
Remove some calls to `...repo/project/stacks`.
2018-03-28 15:48:33 -07:00
Pat Gavlin 7fb48b7658 Fix the local implementation of GetStack. 2018-03-28 15:22:13 -07:00
Joe Duffy 7a9c557a50
Merge pull request #1082 from pulumi/1081_refresh_prep
General prep work for refresh
2018-03-28 13:41:51 -07:00
Pat Gavlin 4c527410a3 Remove some calls to ...repo/project/stacks.
This endpoint is relatively expensive, as it returns a large amount of
data for each stack (essentially the stack's entire checkpoint). We
currently call this endpoint in a few places that really just need
information about a single stack. In these places we should simply
interact with that stack directly.

After these changes, there is only one call to the `stacks` endpoint on
the startup path: `upgradeConfigurationFiles` loops over all of the
stacks in each backend and attempts to upgrade each stack's
configuration. Once we no longer need to do this we will not be hitting
the `stacks` endpoint on each CLI invocation.
2018-03-28 12:47:12 -07:00
joeduffy 16e45dc92a Remove some outdated comments 2018-03-28 07:56:35 -07:00
joeduffy 8b5874dab5 General prep work for refresh
This change includes a bunch of refactorings I made in prep for
doing refresh (first, the command, see pulumi/pulumi#1081):

* The primary change is to change the way the engine's core update
  functionality works with respect to deploy.Source.  This is the
  way we can plug in new sources of resource information during
  planning (and, soon, diffing).  The way I intend to model refresh
  is by having a new kind of source, deploy.RefreshSource, which
  will let us do virtually everything about an update/diff the same
  way with refreshes, which avoid otherwise duplicative effort.

  This includes changing the planOptions (nee deployOptions) to
  take a new SourceFunc callback, which is responsible for creating
  a source specific to the kind of plan being requested.

  Preview, Update, and Destroy now are primarily differentiated by
  the kind of deploy.Source that they return, rather than sprinkling
  things like `if Destroying` throughout.  This tidies up some logic
  and, more importantly, gives us precisely the refresh hook we need.

* Originally, we used the deploy.NullSource for Destroy operations.
  This simply returns nothing, which is how Destroy works.  For some
  reason, we were no longer doing this, and instead had some
  `if Destroying` cases sprinkled throughout the deploy.EvalSource.
  I think this is a vestige of some old way we did configuration, at
  least judging by a comment, which is apparently no longer relevant.

* Move diff and diff-printing logic within the engine into its own
  pkg/engine/diff.go file, to prepare for upcoming work.

* I keep noticing benign diffs anytime I regenerate protobufs.  I
  suspect this is because we're also on different versions.  I changed
  generate.sh to also dump the version into grpc_version.txt.  At
  least we can understand where the diffs are coming from, decide
  whether to take them (i.e., a newer version), and ensure that as
  a team we are monotonically increasing, and not going backwards.

* I also tidied up some tiny things I noticed while in there, like
  comments, incorrect types, lint suppressions, and so on.
2018-03-28 07:45:23 -07:00
Pat Gavlin 528e07477b
Merge pull request #1079 from pulumi/ManagedStackLogs
Enable logs for managed stacks.
2018-03-27 15:29:10 -07:00
Pat Gavlin 75d75a41c0 Enable logs for managed stacks.
Simply fetch the checkpoint and use the local config to process logs.

Fixes #1078.
2018-03-27 14:29:10 -07:00
joeduffy 2ae8d4cc36 Tidy up the README ever-so-slightly 2018-03-25 15:14:30 -07:00
Luke Hoban 8c0d1698b0
Upgrade to latest gRPC (#1071)
We previously locked our dependency on google.golang.org/grpc to 1.7.2 due to issues we had seen on 1.8.x as noted in #701. However, this has prevented us using some other dependencies which require newer grpc. A test in this repo and AWS showed no problems with the latest 1.10.x versions of the library in our tests.

We'll go ahead and remove this constraint and allow grpc to float forward. If we see issues again, we'll use that repro case to investigate an alternative fix in our code.

Resolves #701.
2018-03-22 16:27:28 -07:00
Pat Gavlin 58300f9ee7
Add support for service-managed stacks. (#1067)
These changes add the API types and cloud backend code necessary to
interact with service-managed stacks (i.e. stacks that do not have
PPC-managed deployments). The bulk of these changes are unremarkable:
the API types are straightforward, as are most of the interactions with
the new APIs. The trickiest bits are token and log management.

During an update to a managed stack, the CLI must continually renew the
token used to authorize the operations on that stack that comprise the
update. Once a token has been renewed, the old token should be
discarded. The CLI supports this by running a goroutine that is
responsible for both periodically renewing the token for an update and
servicing requests for the token itself from the rest of the backend.

In addition to token renewal, log output must be captured and uploaded
to the service during an update to a managed stack. Implementing this in
a reasonable fashion required a bit of refactoring in order to reuse
what already exists for the local backend. Each event-specific `Display`
function was replaced with an equivalent `Render` function that returns
a string rather than writing to a stream. This approach was chosen
primarily to avoid dealing with sheared colorization tags, which would
otherwise require clients to fuse log lines before colorizing. We could
take that approach in the future.
2018-03-22 10:42:43 -07:00
Pat Gavlin 7941062d4e
Merge pull request #1070 from pulumi/CloudClient
Extract a Pulumi API client.
2018-03-21 19:16:39 -07:00
Pat Gavlin e884c63104 Extract a Pulumi API client.
These changes refactor direct interactions with the Pulumi API out of
the cloud backend and into a subpackage, `pkg/backend/cloud/client`.
This package exposes a slightly higher-level API that takes care of
calculating paths, performing HTTP calls, and occasionally wrapping
multiple physical calls into a single logical call (notably the creation
of an update and the upload of its program).

This is primarily intended as preparation for some of the changes
suggested in the feedback for #1067.
2018-03-21 16:45:54 -07:00
Pat Gavlin a23b10a9bf
Update the copyright end date to 2018. (#1068)
Just what it says on the tin.
2018-03-21 12:43:21 -07:00
Chris Smith 3d8b7d8e44
Update updates.go (#1061)
We needed to have two types of `UpdateProgramRequest` to serve both newer shapes of Pulumi configuration values as well as the older, untyped version. (The original change was supporting the `ConfigValue` type, which had a flag to indiciate if the configuration value was encrypted or not.)

Now that LM has been migrated to the M10 bits https://github.com/pulumi/home/issues/168 , we can remove this type. (The PR to remove existing references in the `pulumi-service` repo is https://github.com/pulumi/pulumi-service/pull/957.)
2018-03-20 12:06:26 -07:00
joeduffy 7162f6ea52 Publish proper pre-release PyPI packages
The semantic versions we were using for pre-release PyPI packages wasn't
quite right.  We had been using local version identifiers, a la +, rather
than proper pre-release tags, which means that version specifications like
`pulumi==0.11.0` will match `0.11.0+dev.1521506136.g7f043fd.dirty`, in
addition to just `0.11.0`.  This is clearly not what we want.

This change moves us over to proper alpha and release candidate versions,
as specified in https://www.python.org/dev/peps/pep-0440/#pre-releases.
Namely, any `x.y.z-dev-123456789-abcdef` version will get translated into
an alpha `x.y.za12345679-abcdef`, and any `x.y.z-rc1` will get translated
into a proper release candidate `x.y.zrc1` version number.
2018-03-19 18:18:25 -07:00
joeduffy c50899aca3 Add some TODO refs to pulumi/pulumi#1063 2018-03-19 18:17:57 -07:00
Matt Ellis a3369d3cbc Fix make_release.sh when run from outside scripts directory 2018-03-19 14:24:52 -07:00
Matt Ellis 38ec631753
Merge pull request #1056 from pulumi/change-version-number
Adopt new version strategy
2018-03-19 13:25:12 -07:00
Joe Duffy abbac13655
Assume --remote when --cloud-url is set (#1060)
If you use --cloud-url, as in

    $ pulumi stack init foo --cloud-url https://x.io

we would silently fall back to logic that creates local stacks.

I realize all of this will get better with the new stack identity
model, however in the meantime, let's infer that the user wanted
--remote when --cloud-url is non-"".
2018-03-18 12:44:00 -07:00
CyrusNajmabadi d719e7966e
Only avoid running transformations on outputs we truly do not have values for. (#921) 2018-03-18 00:15:22 -07:00