Commit graph

26 commits

Author SHA1 Message Date
Matt Ellis 22fef07fcf Remove existing lock files 2018-11-12 15:33:58 -08:00
Matt Ellis 2a8a54a24b Remove need for tsconfig.json
Set the following compiler defaults:

```
       "target": "es6",
       "module": "commonjs",
       "moduleResolution": "node",
       "sourceMap": true,
```

Which allows us to not even include a tsconfig.json file. If one is
present, `ts-node` will use its options, but the above settings will
override any settings in a local tsconfig.json file. This means if you
want full control over the target, you'll need to go back to the raw
tsc workflow where you explicitly build ahead of time.
2018-08-06 14:00:58 -07:00
Matt Ellis 7074ae8cf3 Use new native typescript support in many tests
We retain a few tests on the RunBuild plan, with `typescript` set to
false in the runtime options, but for the general case, we remove the
build steps and custom entry points for our programs.
2018-08-06 14:00:58 -07:00
Joe Duffy 091c0e1c23
Upgrade Node.js SDK to TypeScript 3.0 (#1669)
Per pulumi/pulumi#1668. No code changes required, just package.json
and lockfile updates.
2018-07-30 23:19:28 -07:00
CyrusNajmabadi b90235c611
Add license fields to package.json. (#1656) 2018-07-24 16:10:13 -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
Sean Gillespie 2c479c172d
Lift snapshot management out of the engine and serialize writes to snapshot (#1069)
* Lift snapshot management out of the engine

This PR is a prerequisite for parallelism by addressing a major problem
that the engine has to deal with when performing parallel resource
construction: parallel mutation of the global snapshot. This PR adds
a `SnapshotManager` type that is responsible for maintaining and
persisting the current resource snapshot. It serializes all reads and
writes to the global snapshot and persists the snapshot to persistent
storage upon every write.

As a side-effect of this, the core engine no longer needs to know about
snapshot management at all; all snapshot operations can be handled as
callbacks on deployment events. This will greatly simplify the
parallelization of the core engine.

Worth noting is that the core engine will still need to be able to read
the current snapshot, since it is interested in the dependency graphs
contained within. The full implications of that are out of scope of this
PR.

Remove dead code, Steps no longer need a reference to the plan iterator that created them

Fixing various issues that arise when bringing up pulumi-aws

Line length broke the build

Code review: remove dead field, fix yaml name error

Rebase against master, provide implementation of StackPersister for cloud backend

Code review feedback: comments on MutationStatus, style in snapshot.go

Code review feedback: move SnapshotManager to pkg/backend, change engine to use an interface SnapshotManager

Code review feedback: use a channel for synchronization

Add a comment and a new test

* Maintain two checkpoints, an immutable base and a mutable delta, and
periodically merge the two to produce snapshots

* Add a lot of tests - covers all of the non-error paths of BeginMutation and End

* Fix a test resource provider

* Add a few tests, fix a few issues

* Rebase against master, fixed merge
2018-04-12 09:55:34 -07:00
CyrusNajmabadi 97c1344035
Disallow capturing 'this' inside a lambda (#1138) 2018-04-09 15:57:39 -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
CyrusNajmabadi 850130e30f
Capture modules through normal value capture. (#1030) 2018-03-11 00:11:53 -08:00
Matt Ellis 1515889a40 Remove the need for the :config: part of a config bag
We now unify new Config("package") and new Config("package:config"),
printing a warning when the new Config("package:config") form is
used and pointing consumers towards just new Config("package")

I've updated our examples to use the newer syntax, but I've added a
test ot the langhost to ensure both forms work.

Fixes #923
2018-03-08 10:52:25 -08:00
Joe Duffy a74aa51662
Rename pulumi package to @pulumi/pulumi (#917)
In order to begin publishing our core SDK package to NPM, we will
need it to be underneath the @pulumi scope so that it may remain
private.  Eventually, we can alias pulumi back to it.

This is part of pulumi/pulumi#915.
2018-02-12 13:13:13 -08:00
CyrusNajmabadi b740c93c18
Remove 'Computed' type. (#883) 2018-02-05 18:37:10 -08:00
Pat Gavlin 5c0b62e1aa
Serialize resource registration after inputs resolve. (#882)
As it stands, we serialize more than is correct when registering
resources: in addition to serializing the RegisterResource RPC, we also
wait for input properties to resolve in the same context. Unfortunately,
this means that we can create cycles in the promise graph when a
resource A is constructed in an earlier turn than some resource B and
one of B's output properties is an input to resource A. These changes
fix this issue by allowing input properties to resolve *before*
serializing the RegisterResource RPC.

Some integration tests had taken a dependency on the ordering of resources in
either the output of the `pulumi` command or the checkpoint file. The
only test that took a dependency on command output was updated s.t. its
resources have exactly one legal topographical sort (and therefore their
ordering is deterministic). The other tests were updated s.t. their
validation did not depend on resource ordering.
2018-02-05 16:29:20 -08:00
CyrusNajmabadi 275670692b
Introduce Output<T> and update Resource construction code to properly handle it. (#834)
This PR adds a new formalisms at the Resource layer.  First all inputs to a Resource are typed as ```Input<T>```.  This is either a T, ```Promise<T>``
2018-02-05 14:44:23 -08:00
Matt Ellis 4422700f0f Run yarn upgrade and commit all resulting lockfiles
This also adds lock files for some of our tests which we previously
did not commit.
2018-01-30 14:46:44 -08:00
Pat Gavlin 172a192e52 Add a test for derived inputs. 2018-01-22 11:47:14 -08:00
Matt Ellis b56e90ab2a Ensure resources are always parented to a stack
It was possiblef for the finally for a stack to complete before all
other resources had been created. In this case, we would put these new
resources at top level, instead of having them as children of the
stack resource.

Since we do not use the langhost across stacks, we can simply set the
stack resource at top level and never remove it.

Fixes #818
2018-01-19 16:54:50 -08:00
Joe Duffy 41beb257b0
Write a test for parenting and URNs 2017-12-05 19:14:28 -08:00
Pat Gavlin f848090479 Return all computed inputs from Provider.Check.
As documented in issue #616, the inputs/defaults/outputs model we have
today has fundamental problems. The crux of the issue is that our
current design requires that defaults present in the old state of a
resource are applied to the new inputs for that resource.
Unfortunately, it is not possible for the engine to decide which
defaults remain applicable and which do not; only the provider has that
knowledge.

These changes take a more tactical approach to resolving this issue than
that originally proposed in #616 that avoids breaking compatibility with
existing checkpoints. Rather than treating the Pulumi inputs as the
provider input properties for a resource, these inputs are first
translated by `Check`. In order to accommodate provider defaults that
were chosen for the old resource but should not change for the new,
`Check` now takes the old provider inputs as well as the new Pulumi
inputs. Rather than the Pulumi inputs and provider defaults, the
provider inputs returned by `Check` are recorded in the checkpoint file.

Put simply, these changes remove defaults as a first-class concept
(except inasmuch as is required to retain the ability to read old
checkpoint files) and move the responsibilty for manging and
merging defaults into the provider that supplies them.

Fixes #616.
2017-12-03 09:33:16 -08:00
Pat Gavlin 84a7d4f3e0 PR feedback. 2017-11-28 12:44:49 -08:00
Pat Gavlin f5b35561c6 Recursively merge properties.
When merging inputs and defaults in order to construct the set of inputs
for a call to `Create`, we must recursively merge each property value:
the provided defaults may contain nested values that must be present in
the merged result.
2017-11-28 12:32:37 -08:00
pat@pulumi.com 97f99d7fa1 Do not disconnect from the engine prematurely.
The `nodejs` language support is implemented as two programs: one that
manages the initial connection to the engine and provides the language
serivce itself, and another that the language service invokes in order
to run a `nodejs` Pulumi program. The latter is responsible for running
the user's program and communicating its resource requests to the
engine. Currently, `run` effectively assumes that the user's program
will run synchronously from start to finish, and will disconnect from
the engine once the user's program has completed. This assumption breaks
if the user's program requires multiple turns of the event loop to
finish its root resource requests. For example, the following program
would fail to create its second resource because the engine will be
disconnected once it reaches its `await`:

```
(async () => {
    let a = new Resource();
    await somePromise();
    let = new Resource();
})();
```

These changes fix this issue by disconnecting from the engine during
process shutdown rather than after the user's program has finished its
first turn through the event loop.
2017-10-26 12:16:32 -07:00
Pat Gavlin 6c14dcd559 s/[Cc]allbacks/[Pprovider/g 2017-10-16 23:06:53 -07:00
Pat Gavlin 1b4ed6cce3 PR feedback 2017-10-16 23:06:53 -07:00
pat@pulumi.com 9453f86c2e Implement dynamic resources.
A dynamic resource is a resource whose provider is implemented alongside
the resource itself. This provider may close over and use orther
resources in the implementation of its CRUD operations. The provider
itself must be stateless, as each CRUD operation for a particular
dynamic resource type may use an independent instance of the provider.
Changes to the definition of a resource's provider result in replacement
of the resource itself (rather than a simple update), as this allows the
old provider definition to delete the old resource and the new provider
definition to create an appropriate replacement.
2017-10-16 23:06:53 -07:00