Commit graph

2783 commits

Author SHA1 Message Date
Matt Ellis 9de9ad2f97 Pass dependency information to the engine
Dependency information can come from one of two places, an explicit
set of resources that you depend on (via the ResourceOptions struct)
and dependencies we infer from output tracking.
2018-06-22 16:53:21 -07:00
Matt Ellis 66ef108516 Add Output<T>
Since resource registration is an async operation, we had been using
Task<T> to represent output properties.  Awaiting the output property
would give you the ground value of the output once the registration
completed.

However, there are cases where we may not have a known value. When
previewing, the resource provider may not be able to give back known
values for all output properties (for example, consider the case where
you are creating a new resource. In this case, the Id property is
unknown, because the resource was not created at all). To handle this
case, we introduce Output<T>. Unlike Task<T>, Output<T> tracks if the
value it represents is "known". In addition, it does not allow you to
observe the underlying value directly. Instead, there is a function
Apply which allows accessing and transforming the value. However, if
the underlying value is unknown (e.g. during preview), Apply will not
allow you to observe this state.

Note that during previews, some output properties may be present, if
the resource provider knows the update would not change them. For
example, if you run and update and then preview without changing your
code, the cloud provider will known many properties are actually
stable. This means applies may run during previews.
2018-06-22 14:23:58 -07:00
Matt Ellis 3a820ddead Rework registration.
Instead of using .ContinueWith all over the place, register a single
ContinueWith call when we begin resource registration. When it
completes, we then call a callback on each resource that uses a
TaskCompletionSource to complete a task that represent the output
property.

This reduces the number of continuations we'll have floating around
and makes the code a little easier to grok.
2018-06-22 11:26:18 -07:00
Matt Ellis 791ff7e941 Use Serilog
I don't know how reason about this library taking dependencies on
something like Serilog long term, but during development we'll use
it.
2018-06-21 11:08:27 -07:00
Matt Ellis 9cdcd77015 Remove Pulumi.Host and CSI, in favor of dotnet run
This feels more natrual, even if the code you end up writing to
describe your application has a little more ceremony. We also don't
have to worry about all the crazy things we likely would have had to
worry about if we continued down the CSI path, or some path where we
had a middle stage that reflection loaded an actual binary and invoked
into it (I had a fear in the back of my mind that at some point we'd
actually have to start using AssemblyLoadContext).

This model is pretty easy to internalize, as well.

The major change from the language plugin point of view is that
instead of passing command line arguments to the executor, we just set
a bunch of `PULUMI_XXX` env-vars, which parts of our system know how
to use.

Next up, Output tracking.
2018-06-21 10:50:08 -07:00
Matt Ellis ea7ce22746 More progress
Introduce Pulum.Input<T> which is either a T or a Task<T> (in the
future, it could also be an Output<T>).

Code (by hand) something that looks like what we might end up using
for `tfgen'`d projections of Bucket and Bucket content. A bunch of
stuff is missing there, but it is sufficent to change the example code
to look a little more in line with what you'd actually end up writing.

The next thing I plan on doing is moving away from CSI, in favor of an
actual .NET binary, so I have nice IntelliSense in the example.
2018-06-19 16:08:35 -07:00
Matt Ellis 73a2d5db27 Flesh out the example a little more
Teach seralize properties about how to handle Task<T>, in a very
limited way.
2018-06-18 16:06:36 -07:00
Matt Ellis deacf9f55e Support string properties in CustomResource creation 2018-06-18 15:31:34 -07:00
Matt Ellis a9e00887a5 Start using Task<T> to model outputs
We'll want something like Output<T> at some point soon, but this is
closer in direction to what we want.
2018-06-18 13:40:48 -07:00
Matt Ellis cdda867a4a Get this building again
Small changes to deal with some changes in Pulumi itself, as well as
writing down all the stuff I had forgotten between now and March, and
add a small example.
2018-06-18 10:30:30 -07:00
Matt Ellis 7deaf24987 The very first cut of .NET Support
Just enough to manually invoke the resource providers, but code like
the following worked:

```
[matell@matell bucket]$ cat Pulumi.yaml
name: bucket
runtime: dotnet
[matell@matell bucket]$ cat main.csx
using Pulumi;
using System;
using System.Runtime.InteropServices;

Config config = new Config("bucket");
CustomResource r = new CustomResource("aws:s3/bucket:Bucket", config["name"]);
[matell@matell bucket]$ pulumi update
Performing changes:
info: Running with 🍹 on .NET Core 4.6.00001.0 on Linux 4.14.11-300.fc27.x86_64 #1 SMP Wed Jan 3 13:52:28 UTC 2018
+ pulumi:pulumi:Stack: (create)
    [urn=urn:pulumi:dotnet-testing:🪣:pulumi:pulumi:Stack::bucket-dotnet-testing]
    + aws:s3/bucket:Bucket: (create)
        [urn=urn:pulumi:dotnet-testing:🪣:aws:s3/bucket:Bucket::hello-aws-from-dotnet]
        acl         : "private"
        bucket      : "hello-aws-from-dotnet-a37c2a3"
        forceDestroy: false
        ---outputs:---
        arn                              : "arn:aws:s3:::hello-aws-from-dotnet-a37c2a3"
        bucketDomainName                 : "hello-aws-from-dotnet-a37c2a3.s3.amazonaws.com"
        hostedZoneId                     : "Z3BJ6K6RIION7M"
        id                               : "hello-aws-from-dotnet-a37c2a3"
        region                           : "us-west-2"
        requestPayer                     : "BucketOwner"
        versioning                       : [
            [0]: {
                enabled  : false
                mfaDelete: false
            }
        ]
info: 2 changes performed:
    + 2 resources created
Update duration: 11.799058053s
[matell@matell bucket]$
```
2018-06-18 08:46:47 -07:00
Matthieu Collé 683f80ded8 docs(readme): fixed typo 2018-06-18 05:29:56 -07:00
joeduffy 4053ce7b86 Remove Private Beta warning 2018-06-18 05:00:38 -07:00
Matt Ellis 1746cc60a2 Fix Windows publishing 2018-06-17 23:16:58 -07:00
Matt Ellis c5b7caa52b
Merge pull request #1506 from pulumi/ellismg/clean-up-build-test-issues
Fix some build and test issues
2018-06-17 23:09:34 -07:00
Matt Ellis 2cfbe81adb Remove dependency on pulumi/home
Stop cloning pulumi/home. This doesn't work in Travis because public
repositories can not have private SSH keys, which we'd need to clone
this repository. All the scripts we consume from there are now in
pulumi/scripts and so we'll just consume them from there.
2018-06-17 22:09:15 -07:00
Sean Gillespie 71f65e65f3
Merge pull request #1522 from pulumi/ellismg/contribute
Add CONTRIBUTING.md
2018-06-17 19:27:03 -07:00
Sean Gillespie e9266a4a07
Add comment about setting GOCACHE to off when using Go 1.10 2018-06-17 17:38:10 -07:00
Matt Ellis 5bd03eade8 Remove extra clause 2018-06-17 16:52:32 -07:00
Matt Ellis 7c5600e955 Add CONTRIBUTING.md 2018-06-17 16:44:26 -07:00
joeduffy 776c538b7f Add a few helpful pointers to the README 2018-06-17 11:15:03 -07:00
joeduffy fcd46c93c5 Settle on just Preview 2018-06-15 13:37:27 -07:00
CyrusNajmabadi 57ee29ebbb
Tweak readme. (#1505) 2018-06-15 13:33:51 -07:00
Matt Ellis 6f80da24d4 Add Apache 2.0 License metadata to Python package 2018-06-15 12:47:51 -07:00
Matt Ellis d0485f11f6 Include Python and Go langhosts in Windows SDK
This change includes the Python and Golang language hosts in the Windows
SDK. As part of this change, I had to adjust how we launched the second
stage of the language host, since we can't depend on the shebang, so now
we invoke `python` passing the executor and then the arguments.

Fixes #1509
2018-06-15 11:12:33 -07:00
Matt Ellis 50c98edd72 Don't set NODE_PATH in dynamic provider
This is a holdover from our old strategy for closure serialization. We
no longer use this module, so we don't need to tell Node where it is
anymore.
2018-06-15 11:12:24 -07:00
Matt Ellis a47babd194 Run export/import rounttrip as part of our lifecycle tests
This allows us to delete the one off export/import test, which is nice
because it failed to run when PULUMI_ACCESS_TOKEN was not set in the
environment (due to an interaction between `pulumi login` and the
bare-bones integration test framework)
2018-06-14 16:01:28 -07:00
Matt Ellis 2669f65b39 Don't dirty work tree when running tests
Because we run our golang integration tests "in tree" (due to
the need to be under $GOPATH and have a vendor folder around), the
"command-output" folder was getting left behind, dirtying the worktree
after building.

This change does two things:

1. On a succecssful run, remove the folder.
2. Ignore the folder via .gitignore (this way if a test fails and you
do `git add .` you don't end up commiting this folder).
2018-06-14 15:58:37 -07:00
Matt Ellis 9ccd07714a Publish SDK builds to get.pulumi.com
Previously, we published builds to rel.pulumi.com and only put actual
released builds (eg. rc's and final builds) on get.pulumi.com. We
should just publish all of the SDK builds to get.pulumi.com.

This also makes a slight tweak to the filename of the package we
upload (we took the switch over to get.pulumi.com to make this change
and now that we are uploading automatically, we need to encode this
change instead of doing it by hand).
2018-06-12 12:23:05 -06:00
Pat Gavlin b47f9ef8ef
Point some scripts to the new scripts repo. (#1499)
All scripts that are generally useful across all builds have been moved
into `pulumi/scripts`. These changes clone that repository and retarget
the various scripts to their new location.
2018-06-12 10:03:43 -07:00
Joe Duffy 12d0f092b1
Merge pull request #1498 from pulumi/login_tidy
Tidy up the login message and colors
2018-06-12 08:46:09 -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
Matt Ellis f0da3f7c10 Publish to pypi.org 2018-06-12 09:10:54 -06: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
Matthew Riley 1b33dbea53
Merge pull request #1496 from pulumi/zip-dates
Use an even more reasonable modtime in ZIP entries
2018-06-11 20:36:13 -07:00
Matthew Riley bdb3e98aa0 Use an even more reasonable modtime in ZIP entries
The ZIP format started with MS-DOS dates, which start in 1980. Other dates
have been layered on, but the ZIP file handler used by Azure websites still
relies on the MS-DOS dates.

Using the Unix epoch here (1970) results in ZIP entries that (e.g.)
OSX `unzip` sees as 12-31-1969 (timezones) but Azure websites sees as
01/01/2098.
2018-06-11 19:36:04 -07:00
Pat Gavlin dc0c604ae7
Enable fork builds. (#1495)
If we're building in CI and do not have an access token, skip any
lifecycle tests.
2018-06-11 16:01:04 -07:00
Matt Ellis 721bc9ccc6 s/docs.pulumi.com/pulumi.io/g
The docs website is moving to https://pulumi.io from
https://docs.pulumi.com
2018-06-11 15:57:47 -06:00
Pat Gavlin f06b50d428
Merge pull request #1494 from pulumi/LinterAppeasement
Appease linters.
2018-06-11 14:52:42 -07:00
Joe Duffy b69ad03625
Merge pull request #1491 from pulumi/go_testing
Fix a few things in the Go test harness
2018-06-11 14:44:07 -07:00
Pat Gavlin e6849a283f Appease linters.
- Fix a couple self-assignment issues in the Go language support
- Disable `megacheck` for `fh.SetModTime`, which we use for go1.9
  compat.
2018-06-11 14:32:27 -07:00
joeduffy c81a5152f0 Skip copying to a temp dir for Go projects
Due to the way GOPATH and vendoring works, copying Go tests out to a
random temp directory simply will not work.  This is largely a holdover
to the days of when .pulumi/ directories would pollute the directory,
but is also done for languages like Node.js whose preparatory and build
steps also pollute the working directory (with bin/ and node_modules/
directories).  Go does not have this problem, so we can safely skip.
2018-06-11 14:24:29 -07:00
Matt Ellis a63f89862a Fix PyPI publish URL 2018-06-11 14:06:31 -07:00
Matt Ellis 479fbae320 Publish to test.pypi.org 2018-06-11 14:23:01 -06:00
joeduffy 6599240861 Default to $HOME/go for GOPATH during tests 2018-06-11 13:08:46 -07:00
Matt Ellis bb6b492d55 Do not include git information in PyPI version.
Previously, we would include information about what git commit a build
came from in the "local" portion of the PEP-440 version. This was a
problem because PyPI does not allow packages to be upload to the
registry if they contain local parts.

So, for now, we'll just never put in the git commit information in the
generate version. We'll continue to add a dirty tag in the local
part. This will be prevent us from publishing dirty builds to PyPI,
but that's in line with what we want.
2018-06-11 13:01:49 -06:00
Sean Gillespie 8a00cb4d3b
Support better previews in Python by mocking out Unknown values (#1482) 2018-06-11 10:30:27 -07:00
Matt Ellis 9d4e24c165 Allow tests to be run by users outside of the Pulumi organization
Today we defaulted our tests to create stacks in the `pulumi`
organization. We did this because our tests run with `pulumi-bot` and
we'd rather create the stacks in our shared organization, so any
Pulumi developer can see them.

Of course, as we prepare to have folks outside of the Pulumi
organization write and run tests, this has now become a bad default.

Remove the ability to explicitly set an owner in
ProgramTestOptions (since that would more or less only lead to pain
going forward) and default to just creating the stacks in whatever
account is currently logged in. In CI, we'll set a new environment
variable "PULUMI_TEST_OWNER" which controls the owner of the stacks,
which we'll set to `pulumi`.

Impact to day to day developers is during test runs locally you'll see
stacks in your list of stacks. If any of the tests fail to clean up,
you'll see these lingering stacks (but you can go clean them up).
2018-06-11 11:03:17 -06:00
Joe Duffy fbb054e742
Protect against nil responses (#1484) 2018-06-11 07:43:41 -07:00
Joe Duffy e772aac3c1
Merge pull request #1456 from pulumi/golang
Support Pulumi programs written in Go
2018-06-10 13:01:37 -07:00