Commit graph

1617 commits

Author SHA1 Message Date
joeduffy b8be7fa5e6 Add a handy Copy function to PropertyMap 2017-07-21 14:00:30 -07:00
Luke Hoban 844b2bf1ea Support for string.split
Adds the string.split intrinsic function and places
it on the String protoype object.
2017-07-21 14:00:30 -07:00
Luke Hoban 18c3caf093 Fix continue in loops
Make sure that continue runs post expression
before looping.
2017-07-21 14:00:30 -07:00
Luke Hoban 9243bd5f3f Fix tests after previous commit 2017-07-21 14:00:30 -07:00
joeduffy 40747a94bf Merge inputs with outputs
For Update and Delete operations, we provided just the input state
for a resource.  This is insufficient, because the provider may need
to depend on output state from the Create or prior Update operations.
This change merges the output atop the input during the step application.
2017-07-21 14:00:30 -07:00
joeduffy 4e02105355 Pass old state to the provider's API 2017-07-21 14:00:30 -07:00
joeduffy ae92e68902 Return state as part of Create and Update¬
As part of the bridge bringup, I've discoverd that the property state
returned from Creates does *not* always equal the state that is then
read from calls to Get.  (I suspect this is a bug and that they should
be equivalent, but I doubt it's fruitfal to try and track down all
occurrences of this; I bet it's widespread).  To cope with this, we will
return state from Create and Update, instead of issuing a call to Get.
This was a design we considered to start with and frankly didn't have
a super strong reason to do it the current way, other than that it seemed
elegant to place all of the Get logic in one place.

Note that providers may choose to return nil, in which case we will read
state from the provider in the usual Get style.
2017-07-21 14:00:29 -07:00
joeduffy 87b7091b35 Remove serverless examples
These have moved to [pulumi/aws-serverless/examples](
https://github.com/pulumi/aws-serverless/examples/).
2017-07-21 14:00:29 -07:00
joeduffy dffdb29799 Install the AWS CLI as a prerequisite 2017-07-21 10:18:55 -07:00
joeduffy f314ab5a36 Let LUMIROOT be overridden during publishes 2017-07-21 09:57:40 -07:00
joeduffy fc1cd2c01e Make a publish script; fix sed for multi-OS compat
This change creates a scripts/ folder, moves our existing shell
script, gocover.sh, underneath it, and factors the publish logic
out of the Makefile and into the publish.sh file.

The syntax for sed differs between Mac OS X and GNU versions of
the tool, which is rather annoying.  This fixes it by leveraging
the fact that `sed -i.bak ...` works, although we now need to
clean up the *.bak file left behind.  (No big deal and way better
than maintaining OS-dependent logic.)
2017-07-21 09:37:14 -07:00
joeduffy f2537ecab8 Force publishes
To workaround the fact that our repos end in a dirty state after
the CI job finishes, I'm adding PUBFORCE=true to the CI script.
pulumi/lumi#300 tracks figuring out the root cause and removing it.
2017-07-21 08:09:23 -07:00
joeduffy 4b505acbcc Also package up LumiJS compiler in binary releases 2017-07-20 15:17:10 -07:00
joeduffy 2670e42c93 Publish built binaries upon successful push CI to master
This adds a new make target, publish, that will create a release
package and upload it to an S3 bucket.  This package simply contains
the built CLI plus the core library packages, lumi, lumirt, and lumijs.

This target is invoked automatically at the end of a successful
Travis run against a push to master.
2017-07-20 14:52:40 -07:00
joeduffy 3b4afc0346 Eliminate a superfluous warning 2017-07-20 13:21:30 -07:00
joeduffy ea3b530434 Delete lib/mantle
You served your purpose, but are no longer useful.  R.I.P.
2017-07-20 10:16:15 -07:00
joeduffy ba1b27a657 Make a few tweaks for better demos
* Alias "run" for "deploy".

* Alias "stop" for "destroy".

* Respect --summary for outputs.
2017-07-18 09:45:04 -07:00
joeduffy ceb32b9e2b Add a sig field to Asset/Archive
This change mirrors the dynamic marshaling structure on the static
definition of the Asset and Archive types.  This ensures that they
marshal correctly even when deeply embedded inside other structures.
2017-07-18 09:30:31 -07:00
joeduffy e518f1ad86 Adopt new pointerless Asset APIs in tests 2017-07-17 17:58:22 -07:00
joeduffy 5bf43743ab Add a rudimentary toString runtime helper
This just works around some limitations that will exist until
we do the runtime work next sprint, and achieve pulumi/lumi#169.
2017-07-17 13:43:59 -07:00
joeduffy 91c90cf2a9 Add diffing logic for assets/archives 2017-07-17 12:11:15 -07:00
joeduffy 002618e605 Add some more asset serialization round-tripping tests 2017-07-17 11:30:10 -07:00
joeduffy 4d708c8567 Fix asset diffing
This change brings the same typed serialization we use for RPC
to the serialization of deployments.  This ensures that we get
repeatable diffs from one deployment to the next.
2017-07-17 10:38:57 -07:00
joeduffy ee1acd365c Add a defaultIfComputed intrinsic
Until we support output-conditional code (pulumi/lumi#170), we
run into cases where we want to make a decision based on a computed
property if it is available, but can't possible know the value.  In
such cases, we get an error ("Unexpected computed value").

In fact, our generated code currently includes client side validation
of properties, since it leads to a(n admittedly only slightly) better
developer experience.  But that triggers the error for required
properties that are computed, basically hosing our ability to plan.

This change introduces a defaultIfComputed intrinsic to the lumirt
library that can be used to work around this.  It takes two arguments,
obj and def, and returns the actual property value obj if it is NOT
computed; if it is computed, def will be substituted in its stead.

The generated code changes to use this.  It's possible it will miss
validation, of course, if a computed property turns out not to match
the precondition.  But this is strictly better than the alternative
of not trying to validate any of them to begin with.
2017-07-16 15:16:48 -07:00
joeduffy f11b06f57b Pretty print assets during planning 2017-07-16 08:28:50 -07:00
joeduffy bda607abd8 Permit -1 for randlen and maxlen
This allows -1 for randlen and maxlen to use defaults.  The default
behavior is that randlen uses sha1.Size and maxlen is "no max".
2017-07-15 09:59:44 -07:00
joeduffy c61dcb5206 Revert "Rename Lumi resource properties"
This reverts commit c3db70849d.

I've opted to take a new strategy to ensure the bridge properties
don't conflict (with manual renames), similar to the name property.
2017-07-15 09:33:23 -07:00
joeduffy 0f18bb40b2 Tolerate some nils in important places 2017-07-14 18:08:33 -07:00
joeduffy a6caef973a Make assets and archives 1st class
This change recognizes assets and archives as 1st class resource
property values.  This is necessary to support them in the new bridge
work, and lays the foundation for fixing pulumi/lumi#153.

I also took the opportunity to clean up some old cruft in the
resource properties area.
2017-07-14 12:28:43 -07:00
joeduffy 84d4840fb9 Rename PID type to ID
We want to change the property name, but not the type.
2017-07-14 09:44:08 -07:00
joeduffy c3db70849d Rename Lumi resource properties
This renames the basemost resource properties, id and urn, to
names that are less likely to conflict with properties that real
resources will want to use, pid and upn (provider ID and Universal
Pulumi Name, respectively).

I actually ran into this with the current bridge work.  An alternative
solution would be to require derived resources to pick different names,
however this is unfortunate because usually they are more "user-facing"
than ours.  Another alternative is to not hijack the object properties
at all, but that too is problematic because we use these properties
during the evaluation of plans and deployments.

This seems like a reasonable middle ground.
2017-07-14 08:55:07 -07:00
Luke Hoban 3efcf91933 Addres PR feedback on #288
Move ByName into the shared tokens package.
2017-07-13 23:03:28 -07:00
Luke Hoban e9f6fbeed0 Merge pull request #288 from pulumi/closure-fixes
Closure fixes
2017-07-13 23:00:10 -07:00
joeduffy 539ccc8f04 Add a --debug option to plan, deploy, and destroy
This change introduces a --debug option to the plan, deploy, and
destroy commands.  Unlike --logtostderr, which merely hooks into the
copious Glogging that we perform (and is therefore meant for developers
of the tools themselves and not end users), --debug hooks into the
user-facing debug stream.  This now includes any debug messages coming
from the resource providers as they perform their tasks.
2017-07-13 17:13:19 -07:00
Luke Hoban 31c62ec8e6 Function update improvements
Remove duplicative call to UpdateFunctionConfiguration.

Also ensure that free variables returns stable variable order
to avoid unnecessary lambda updates.
2017-07-13 17:01:11 -07:00
Luke Hoban 61bcf1d704 Support captured reference to this in lambdas
Lumi returns references to the `this` variable as
`.this`, so we need to rewrite these when emitting
into Lambdas.  In addition, the TypeScript compilation
of lambda functions requires that we create an environment
for executing the generated code where `this` has the
right value, which requires some subtle changes to our code
generation.
2017-07-13 15:51:21 -07:00
Luke Hoban c6ef2f6c66 Fix golint errors in previous commit 2017-07-13 12:40:10 -07:00
Luke Hoban 92418cf687 Refactor integration testing framework
Generalizes Lumi program validation so that it can be applied
to integration testing for other packages (such as the
pulumi/lumi-platform package examples).
2017-07-13 12:20:57 -07:00
joeduffy 8465d39a02 Tidy up some planning/deployment messages 2017-07-13 09:56:49 -07:00
Luke Hoban 0b24ab7070 Serialize lambdas nested in captured objects
Adds support for serializing lambdas which are
properties of captured objects.

For example:

```
let o = {
  f: () => 12
};
let func = new aws.serverless.Function("func", {policies: [aws.iam.AWSLambdaFullAccess]}, (ev, ctx, cb) => {
    console.log(o.f());
    cb(null, null);
});
```
2017-07-12 17:43:17 -07:00
Luke Hoban ac21b5bd82 Add test for serializeClosure 2017-07-12 15:19:20 -07:00
joeduffy a70790b81a Add key replacement functions
This continues to add some handy replacement routines for property
maps, so we can transform keys and values to and fro.
2017-07-12 13:03:18 -07:00
Luke Hoban 15be6850a2 Support cycles and avoid name collisions in closure serialization
Generate names for serialized functions as hashes of the function text, and
bind these to the actual referenced names locally to each serialized closure.
This avoids potential conflicts between different functions which are referenced
with the same name.

For example:
```
function __8c176d768f95567f8c3acd08e486a1da7299fbc1() {
  with({ f: __e61452ceb9d53f3611ed543f3822a85ad29345dd}) {
    return (() => {

return function (cb) { cb(null, f(7)); };

    })().apply(this, arguments);
  }
}
```

Also fixes the stack overflows when there are cycles in the Closure graph by
adding caches of serialized functions.

Fixes #238.
2017-07-12 12:49:04 -07:00
Luke Hoban 1d7792cd83 Allow additional configuration on aws.serverless.Function
We need to provide higher level abstractions with the
ability to set additional properties on a Lambda Function
even when using the closure serialization support of
aws.serverless.Function.

Note that this is an API breaking change, and may require
updates in any other libraries dependent on this API.
2017-07-09 21:03:31 -07:00
Luke Hoban f45e80e28d Support for DeadLetterConfig on aws.lambda.Function resources 2017-07-09 11:34:30 -07:00
Luke Hoban 837d13d393 Merge branch 'typenotfound' 2017-07-08 14:57:30 -07:00
Luke Hoban a2d6e67deb Fix a comment typo 2017-07-08 14:57:11 -07:00
Luke Hoban f2a76c1a5a Address code review feedback on #282 2017-07-07 16:41:33 -07:00
Luke Hoban 87a18e6ad2 Resolve to dynamic instead of error type on TypeNotfound
This unblocks some cases with generics without having to
implement full generics support in the type LumiRT type system
(which we directionally will be removing anyway).
2017-07-07 16:24:52 -07:00
Luke Hoban 1c8ad139f1 Merge pull request #282 from pulumi/asyncawait
Support try/catch in Lumi and async/await in Node.js
2017-07-07 14:44:59 -07:00