Commit graph

2883 commits

Author SHA1 Message Date
joeduffy 5460520b53 Fix a *facepalm* 2018-06-10 12:36:14 -07:00
joeduffy 906d2fd2e0 Support string type aliases 2018-06-10 12:09:45 -07:00
joeduffy f1aec12df2 Avoid aliasing *Output when possible 2018-06-10 11:54:11 -07:00
joeduffy 48ddf5b3b0 Fix a few things
1) Use a state block for *Outputs, just to protect against dereferencing
   and aliasing.  These are mutable due to concurrency.

2) Dig into *Output type aliases, like *URNOutput, et. al, during
   RPC marshaling.
2018-06-10 11:45:24 -07:00
joeduffy 9a4bb912ca Do a quick pass over the README 2018-06-10 10:35:51 -07:00
joeduffy b19ecd6602 Add a basic Go configuration integration test 2018-06-10 09:24:57 -07:00
joeduffy b28f643164 Add integration test support for Go
This adds integration test support framework for Go.

It also adds a test case for the basic empty Pulumi Go program.
2018-06-10 09:17:19 -07:00
joeduffy b10b7d9b8a Implement ReadResource RPC functionality 2018-06-10 08:51:30 -07:00
joeduffy b0556c4416 Fix lint warnings on documentation 2018-06-10 08:08:02 -07:00
joeduffy 150ed84636 Implement context invoke function 2018-06-10 08:05:49 -07:00
joeduffy da0667ef45 Add config package
This change adds a config package.  This is syntactic sugar atop the
underlying config functionality in the pulumi.Context, but mirrors what
we do in our other Node.js and Python SDKs more closely.

This includes three families of functions:

    - config.Get*: returns the value or its default if missing.
    - config.Require*: returns the value or panics if missing.
    - config.Try*: returns the value or an error if missing.

In all cases, there are simple Get/Require/Try functions, that just
deal in terms of strings, in addition to type specific functions,
GetT/RequireT/TryT, for the most common Ts that you might need.
2018-06-10 07:24:38 -07:00
joeduffy cf1cb2d61f Get lint clean 2018-06-09 17:23:12 -07:00
joeduffy 20af051caf Implement unknown outputs
This commit implements unknown outputs in the same style as our Node.js
language provider.  That is to say, during previews, it's possible that
certain outputs will not have known values.  In those cases, we want to
flow sufficient information through the resolution of values, so that we
may skip applies.  We also return this fact from the direct accessors.
2018-06-09 16:59:53 -07:00
joeduffy 5a71ab9d12 Add Makefile machinery for Go provider 2018-06-09 16:16:35 -07:00
joeduffy 25b1a0c9c3 Wire up RegisterResource to unmarshalOutputs 2018-06-09 16:16:07 -07:00
joeduffy 6e52490706 Fix a bunch of lint warnings 2018-06-09 11:33:45 -07:00
joeduffy 2e8bbcc9dd Add output marshaling and improve input marsalling
This change primarily does two things:

* Adds output marshaling.

* Adds tests for roundtripping inputs to outputs.

It also

* Fixes a bug in the verification of asset archives.

* Change input types to simply `interface{}` and `map[string]interface{}`.
  There is no need for wrapper types.  This is more idiomatic.

* Reject output properties upon marshaling failure.

* Don't support time.Time as a marshaling concept.  This was getting too
  cute.  It's not clear what its marshaling format ought to be.
2018-06-09 09:11:35 -07:00
joeduffy c3b13348d0 Improve strong typing
This improves the strong typing of output properties, by leveraging the
cast library to support numeric conversions to and from many types,
without hitting interface{}-cast panics.  Also adds strongly typed
applies and adds a number of additional tests for these functions.
2018-06-08 12:57:59 -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
joeduffy 7d8995991b Support Pulumi programs written in Go
This adds rudimentary support for Pulumi programs written in Go.  It
is not complete yet but the basic resource registration works.

Note that, stylistically speaking, Go is a bit different from our other
languages.  This made it a bit easier to build this initial prototype,
since what we want is actually a rather thin veneer atop our existing
RPC interfaces.  The lack of generics, however, adds some friction and
is something I'm continuing to hammer on; this will most likely lead to
little specialized types (e.g. StringOutput) once the dust settles.

There are two primary components:

1) A new language host, `pulumi-language-go`, which is responsible for
   communicating with the engine through the usual gRPC interfaces.
   Because Go programs are pre-compiled, it very simply loads a binary
   with the same name as the project.

2) A client SDK library that Pulumi programs bind against.  This exports
   the core resource types -- including assets -- properties -- including
   output properties -- and configuration.

Most remaining TODOs are marked as such in the code, and this will not
be merged until they have been addressed, and some better tests written.
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
Pat Gavlin 8e12e739c2
Merge pull request #1469 from pulumi/ErrorIDs
Allow duplicate error IDs.
2018-06-08 10:15:29 -07:00
Luke Hoban 858e321110
Make RTTI markers internal (#1479)
Fixes #1477.
2018-06-07 21:34:06 -07:00
Matthew Riley 9916cd5e6b
Merge pull request #1475 from pulumi/zip-header
Use a reasonable value for Modified in ZIP headers
2018-06-07 14:40:10 -07:00
Matthew Riley 2fe284a139 Use a reasonable value for Modified in ZIP headers
Azure websites can't extract the archive without this.

We can't use the `Modified` field of `FileHeader` because it was added in
Go 1.10.
2018-06-07 14:21:03 -07:00
Sean Gillespie b5e4d87687
Improve the error message when data source invocations fail (#1472) 2018-06-07 11:21:38 -07:00
Sean Gillespie 5cbc979e17
Fix a couple of issues when projecting Protobuf and UNKNOWN in Python (#1468)
* Fix a few issues with the Python language host

1. Fix an issue where the UNKNOWN sentinel was leaking into user
programs
2. Fix an issue where Protobuf types were leaking into user programs

In fixing this issues I also added a framework for writing tests against
the Python SDK.

* License headers, and adopt a more idiomatic testing pattern

* Additional idiomatic Python

* That's what I get for trying to be fancy (Travis CI python version is very old and does not respect this form)

* CR feedback: use more comprehensions, typo fix

* Break a circular dependency between resource, runtime.resource, and runtime.rpc

* Don't check in .vscode

* CR: sort inputs, rename global variable, add a test for CustomResource serialization

* Remove accidental code duplication
2018-06-06 16:09:07 -07:00
Pat Gavlin 5ea895d9c7 Remove an unused import 2018-06-06 14:28:49 -07:00
Pat Gavlin 4ee73a0042 Allow duplicate error IDs.
There is no longer a reason to ensure that these IDs are distinct.

Fixes #1464.
2018-06-06 14:10:48 -07:00
Matt Ellis 8a6ffd08b2 Use crypto/rand when generating a stack suffix
math/rand uses a fixed seed, meaning that across runs the Kth call to
`rand.Int63()` will always return the same value.

Given that we want to provide a unique suffix across multiple
concurrent runs, this isn't the behavior we want.

I saw an instance fail in CI where all three legs ran the test
concurrently and they raced on creating the test stack, since they all
generated the same name.
2018-06-05 11:06:01 -07:00
Matt Ellis 4f28f3d44d Allow overriding config location
Now that the "config" member of Pulumi.yaml has been deprecated for a
while, we'll change it's meaning. When set, the value is treated as a
path and joined with the path to Pulumi.yaml, and per stack
configuration is stored in that folder

Fixes #1031
2018-06-05 09:26:48 -07:00
Luke Hoban 3b561392b1
Remove out-of-date files (#1401) 2018-06-05 08:39:19 -07:00
Chris Smith ebfc3458d5
Export GetCommandResults from Environment (#1436) 2018-06-05 08:34:06 -07:00
Matt Ellis e397d76733 Fix publishing issue due to missing *.node files
We no longer need to include these node plugins, so just remove
copying them from our publishing script.
2018-06-04 15:44:33 -07:00
Justin Van Patten 28a05e3085
Suggest npm run build instead of npm build (#1460) 2018-06-04 15:27:29 -07:00
Matt Ellis a38b647652
Merge pull request #1437 from pulumi/ellismg/public-build
Support local build and test runs without AWS credentials
2018-06-04 15:22:17 -07:00
Matt Ellis 4ac1a2f355 Pull tracing and reporting information from the environment
This lets us set these values globaly, in our Travis and AppVeyor
configurations instead of forcing every test to opt-in. It also means
that by default, local builds will not report any of this data (and
will not need access to these endpoints).
2018-06-04 14:28:52 -07:00
Matt Ellis dcb5ae1e1f Stop including native serialization modules
We retained these modules to support using v0.11.X and earlier
versions of @pulumi/pulumi, which required a native module to do
closure serialization. 0.12.X does not need this, so lets stop
including it.
2018-06-04 14:27:01 -07:00
Justin Van Patten 6a11d049b7
Add optional --dir flag to pulumi new (#1459)
Usage:

```
pulumi new <template> --dir folderName
```

Used to specify the directory where to place the generated project.
If the directory does not exist, it will be created.
2018-06-04 13:33:58 -07: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
Luke Hoban 076d8887c9
Compute required packages during closure serialization (#1457)
Closure serialization now keeps track of the `require`d packages it sees in the function bodies that are serialized during a call to `serializeFunction`.

Also, replaces `serializeFunctionAsync` with `serializeFunction` which accepts richer parameters and return type, deprecating the former API (but leaving it available for now to avoid a breaking change).
2018-06-03 21:55:37 -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 466656f6b7 Update Gopkg.lock
Input hash has changed... perhaps because I imported `x/net/http2`?
2018-06-03 01:33:50 -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
Matthew Riley e7498f9468 Send request body on retries
Not sending request body on retry is bad enough, but we keep the original
`Content-Length` and the server ends up expecting a body we never send.
This results in `400 Bad Request` errors from the ALB.
2018-06-03 01:33:50 -07:00
Joe Duffy 16fefda65f
Make the stack graph command always available (#1452)
I hadn't realized this was added as a debug-only command.  No need to
hide this, it's working and generally useful.
2018-06-02 18:13:31 -07:00
Matthew Riley 261fa86586
Merge pull request #1358 from pulumi/retry-bugs
Fix two bugs in retries
2018-06-01 17:11:23 -07:00
joeduffy fb3eaf8c63 Fix main.go copyright header 2018-05-31 08:35:39 -07:00
Matt Ellis 9b24ad9738 Update gRPC to 1.12.2
This version has an updated protobufs dependency, which will remove
the warnings from `npm audit`.

Fixes #1350
2018-05-30 15:42:10 -07:00
Matt Ellis 56eded0673 Revert "Pass --no-audit to npm install during pulumi new"
This reverts commit d11acf5208.
2018-05-30 15:42:10 -07:00