Commit graph

1475 commits

Author SHA1 Message Date
Matt Ellis dee8114556 Add ReplaceConfig to the engine
The deployment service will use this before a deployment to copy the
config from the database to the local files that lumi will use when
deploying.
2017-08-25 10:52:44 -07:00
Matt Ellis 482c051120 Merge pull request #315 from pulumi/engine-refactor
Refactor guts of `lumi` into a package
2017-08-24 18:26:09 -07:00
Matt Ellis 95339b3511 Add comment about the engine 2017-08-24 18:09:37 -07:00
Matt Ellis 971b36b21a Fix lint issues 2017-08-24 18:09:37 -07:00
Matt Ellis fac6c7c91c Fix Makefile on Fedora 2017-08-24 18:09:37 -07:00
Matt Ellis b7388fa99a Clean up Destroy API boundary 2017-08-24 18:09:37 -07:00
Matt Ellis 73d64dc686 Fix prompt for env name in lumi destory 2017-08-24 18:09:37 -07:00
Matt Ellis 865422567c Alow multiple instances of engine.Engine
This refactors the engine so all of the APIs on it are instance
methods on the type instead of raw methods that float around and use
data from a global engine.

A mechcanical change as we remove the global `E` and then make
anything that interacted with that in pkg/engine to be an instance
method and the dealing with the fallout.
2017-08-24 18:09:37 -07:00
Matt Ellis be586a1fbf Wire up sink to custom stdout and stderr 2017-08-24 18:00:46 -07:00
Matt Ellis 14c2474e6f Remove use of ambient cmdutil.Diag(), instead consult the engine 2017-08-24 18:00:46 -07:00
Matt Ellis 5ae02ad581 Remove use of ambient stdout/stderr streams
Instead of talking directly to stdout or stderr via methods on fmt,
indirect through an Engine type (presently a global, but soon to
change) to allow control of where the streams actually end up.
2017-08-24 18:00:46 -07:00
Matt Ellis cdacc46931 Clean up the engine API a small amount
Prevously, we would throw raw args arrays across the interface and the
engine would do some additional parsing. Clean this up so we don't do
that and all the parsing stays in `lumi`
2017-08-24 18:00:46 -07:00
Matt Ellis a6eabdc34b Move a bunch of code around
Move most of the guts of `lumi` into the newly created `engine`
package.
2017-08-24 18:00:46 -07:00
Matt Ellis dcc549d9ec Prepare for moving command implementations to the engine
The plan is to take all the logic that actually implements the
commands exposed by `lumi` into a helper type that can be used by both
`lumi` and the Pulumi Service. This is step one, which was to decouple
the implementation of these commands from the command line parsing and
CLI interface they are presented to the user from.
2017-08-24 18:00:46 -07:00
Matt Ellis 158fe21026 Refactor how args are used in the engine
This change pushes the teasing apart of a `pkgarg` from `args` "up"
towards the entry point of the CLI functions.
2017-08-24 18:00:46 -07:00
Matt Ellis 9e5b1987fa Remove unused parameter 2017-08-24 18:00:46 -07:00
Matt Ellis c3b8972dce Don't flow entire args array into the core of the engine
We were passing along the entire args array to the implementation of
most commands, but the only place this was used was to pass one piece
of information to the compiler we create in one case. Let's get
explicit about the stuff we share from the CLI layer into the
implementation of the commands and make this stuff well typed instead
of a bag of strings.
2017-08-24 18:00:46 -07:00
Matt Ellis b00c84a792 Use args local in config
Just use the args local directly instead of using the reference from
envCmdInfo. Doing this will make it easier to remove the Args field of
envCmdInfo, which I want to refactor to be more specific to the
boundary between the CLI and Planning/Deploying.
2017-08-24 18:00:46 -07:00
Matt Ellis 9fa92c0236 Remove cobra.Command from some deployment methods 2017-08-24 18:00:46 -07:00
Luke Hoban c837aa6024 Fix indexing outside array length in Lumi runtime 2017-08-19 14:39:50 -07:00
Luke Hoban 575102c704 Add support for serializaing captured arrays
Previous logic had assumed arrays were treated like objects
in the runtime (like in ECMAScript), but they are a unique
value kind in current Lumi runtime, so must be handled separately.
2017-08-19 13:34:47 -07:00
Luke Hoban e5c4827975 Fix gometalinter issue 2017-08-17 22:32:25 -07:00
Luke Hoban e5405accab Ensure ExtraRuntimeValidation is optional 2017-08-17 22:24:15 -07:00
Luke Hoban 85a95f9353 Add ability to run runtime validation in test harness
Adds an `ExtraRuntimeValidation` hook to the test harness.

This runs after the test app is deployed, and can be used to test publically
exposed endpoints on the example to validate additional runtime correctness
of the Lumi app under test.
2017-08-17 22:12:58 -07:00
Luke Hoban 127519129b Suport ternary operator
Also allows relational operators to take string arguments.
2017-08-10 13:21:59 -07:00
joeduffy a626dcf6a3 Prettify the CLI in a few places
This changes a few things in the CLI, mostly just prettying it up:

    * Label all steps more clearly with the kind of step.  Also
      unify the way we present this during planning and deployment.

    * Summarize the changes that *did not* get made just as clearly
      as those that did.  In other words, stuff like this:

        info: 2 resources changed:
            +1 resource created
            -1 resource deleted
            5 resources unchanged

      and

        info: no resources required
            5 resources unchanged

    * Always print output properties when they are pertinent.
      This includes creates, replacements, and updates.

    * Show replacement creates and deletes very distinctly.  The
      create parts show up minty green and the delete parts show up
      rosey red.  These are the "physical" steps, compared to the
      "logical" step of replacement (which remains marigold).

      I still don't love where we are here.  The asymmetry between
      planning and deployment bugs me, and could be surprising.
      ("Hey, my deploy doesn't look like my plan!")  I don't know
      what developers will want to see here and I feel like in
      general we are spewing far too much into the CLI to make it
      even useful for anything but diagnosing failures afterwards.

      I propose that we should do a deep dive on this during the
      CLI epic, pulumi/pulumi-service#2.

This resolves pulumi/pulumi-fabric#305.
2017-08-06 10:05:51 -07:00
joeduffy 4ea7a55aca Make all by default 2017-08-06 08:52:32 -07:00
joeduffy 60f23243ef Install before test
The tests can depend on the lumi binary (e.g., for integration testing),
so we need to run install before test in the Makefile.
2017-08-06 08:44:04 -07:00
joeduffy 2f4d7a9789 Run integration tests
This change runs the examples integration tests for every test
run.  They used to be split out because the AWS tests take so long,
but now those are in their own separate package.  Running the
integration tests here more frequently will prevent breaking the
most basic Lumi CLI commands and capabilities.
2017-08-06 08:26:20 -07:00
joeduffy d7273b1e9e Perform updates during integration tests
This adds the ability to apply "edits" during integration tests, so
that we can test update and replacement paths.

This fixes pulumi/pulumi-fabric#310.
2017-08-05 17:49:48 -07:00
joeduffy ed58a2cbd1 Run empty plan/deploy in integration tests
This change tests that a plan and deploy immediately following another
deploy, when no edits have taken place, correctly results in no action.

I also cleaned up a few things in the code, like using fmt.Printf rather
than fmt.Fprintf(os.Stdout, ...), to clean up error paths, giving the
package a slightly shorter name, and adding missing copyright headers.

This is part of pulumi/pulumi-fabric#310.
2017-08-05 11:37:14 -07:00
joeduffy ff0eb81944 Export urnName constants
This avoids us needing to hard-code the urnName property in
various tools, in case we ever need to change it again down the road.
2017-08-05 08:32:50 -07:00
joeduffy 007c2f216d Rename name property to urnName
At the moment, we permit resources to carry a name, which the
engine uses as part of URN creation.  Unfortunately, the property
"name" has a very high chance of conflicting with meaningful
user-authored properties.  And furthermore this sort of name,
although key to creating URNs which are core to how the overall
system performs deployments and manages resources, are seldom
used programmatically in Lumi programs.  As a result, it's a real
nuisance that we stole the good name.

This change renames that property from "name" to "urnName".  This
not only has a lower likelihood of conflicting, but it also looks
reasonable sitting alongside the "urn" property.  In fact, in some
future universe, after some of the upcoming runtime changes, we
may not even need the name property on the objects whatsoever.

I had originally toyed with the idea of eliminating the Resource
versus NamedResource distinction.  This is certainly simpler and
remains a possibility.  I didn't do that right now, however, because
the flexibility of letting resource providers name resources however
they see fit still seems possibly useful.  For example, we keep
talking about whether functions can be auto-named based on hashes.
Until we've run those conversations to ground, I'd hate to do some
work that just needs to be undone in order to enable a scenario that
has a non-trivial likelihood of us wanting to explore.
2017-08-05 08:20:57 -07:00
joeduffy c0e4bdb03b This shouldn't be here!
😬
2017-08-03 18:09:14 -07:00
joeduffy a160741931 Tolerate computed and output properties
We are now freely flowing computed and output properties across the
RPC boundary with providers.  As such, we need to tolerate them in
a few more places.  Namely, mapping to and from regular non-resource
property values, and also when copying RPC resource state back onto
live runtime objects.
2017-08-03 11:01:38 -07:00
joeduffy 7e09bd055a Fix variable shadowing 2017-08-02 15:40:07 -07:00
joeduffy 1df1792d84 Ensure all exit paths call OnDone
If certain early errors occurred, like failing to find a default module
or main entrypoint, we never properly invoked OnDone (or, sometimes,
OnStart, for that matter).  This meant that callers like the eval source
in the deployment engine could end up missing signals; in this particular
case, it led to a failure to signal a rendezvous synchronization object,
which itself led to a hang.

The fix is simple: make sure to call the On* methods in the right places.
I've added tests to probe the interesting paths, including failures.

This fixes pulumi/pulumi-fabric#281.
2017-08-02 15:28:48 -07:00
joeduffy a9939c8e6a Remove workaround for pulumi/pulumi-fabric#276 2017-08-02 13:31:38 -07:00
joeduffy 35aa6b7559 Rename pulumi/lumi to pulumi/pulumi-fabric
We are renaming Lumi to Pulumi Fabric.  This change simply renames the
pulumi/lumi repo to pulumi/pulumi-fabric, without the CLI tools and other
changes that will follow soon afterwards.
2017-08-02 09:25:22 -07:00
joeduffy c77e975464 Redirect to the main Pulumi repo's CONTRIBUTING.md 2017-08-02 07:49:47 -07:00
Joe Duffy 5da78c036b Convert to Dep 2017-08-01 18:37:06 -07:00
joeduffy 4699b874db Revert "The Go vendoring saga continues"
This reverts commit f939651c64.

This particular saga appears to never end...
2017-08-01 17:51:38 -07:00
joeduffy ceec05f627 Fix up a few stale Dep/Godeps references 2017-08-01 15:48:08 -07:00
joeduffy f939651c64 The Go vendoring saga continues
We are now on our fourth vendoring tool: Govendor.  This appears to
be about 10X faster than Dep, fails less frequently, and has a rich,
well documented set of commands (that make far more intuitive sense
to me, particularly when compared to Dep).  I could never really get
Godep to work with vendor/ correctly, whereas Govendor did the trick
right away.  Lastly, Terraform uses it, so we'll probably have fewer
headaches in that department also.
2017-08-01 06:23:14 -07:00
joeduffy 5fb014e53c Explicitly track default properties
This changes the RPC interfaces between Lumi and provider ever so
slightly, so that we can track default properties explicitly.  This
is required to perform accurate diffing between inputs provided by
the developer, inputs provided by the system, and outputs.  This is
particularly important for default values that may be indeterminite,
such as those we use in the bridge to auto-generate unique IDs.
Otherwise, we fail to reapply defaults correctly, and trick the
provider into thinking that properties changed when they did not.

This is a small step towards pulumi/lumi#306, in which we will defer
even more responsibility for diffing semantics to the providers.
2017-07-31 18:26:15 -07:00
joeduffy 300af62747 Fix erroneous assert when unmarshaling computed properties 2017-07-31 11:44:34 -07:00
Luke Hoban 6016146750 Fix up RPC generation to align with recent RPC changes
Fixes #304.
2017-07-25 16:07:10 -07:00
Luke Hoban e4e9710f30 Make install_release.sh script executable 2017-07-24 22:54:42 -07:00
Luke Hoban 916dd6b235 Report failing error code on Lumi compilation errors
Report an error when Lumi runtime compilation fails.

Also adds a reusable install_release.sh script to use
for installing Lumi package releases, plus expansion
of symlinks in package Makefiles.
2017-07-24 22:43:37 -07:00
joeduffy 2952c3624d Copy NPM package files
This change copies the NPM package files to the installation directory
so that the result is a valid NPM package.  This is a temporary workaround
until (😨) the day that we actually publish/consume real NPM packages...
2017-07-23 12:13:44 -06:00