Commit graph

1494 commits

Author SHA1 Message Date
Luke Hoban 2e22c243bc Adopt Go 1.9 in Travis 2017-09-02 12:10:28 -07:00
Luke Hoban c39c4eda97 Merge pull request #327 from pulumi/defaultsinkmutex
Avoid concurrent map updates in default sink
2017-08-31 14:42:54 -07:00
Luke Hoban 7425c4d106 Avoid concurrent map updates in default sink
Fixes #324
2017-08-31 14:36:19 -07:00
Matt Ellis 9c54af2ef0 Merge pull request #326 from pulumi/add-environment-provider
Add environment provider
2017-08-31 13:54:54 -07:00
Matt Ellis 24ac95c998 Adopt github.com/pkg/errors in a few more places 2017-08-31 10:28:20 -07:00
Matt Ellis cda0fd9bca Add godoc comments 2017-08-31 10:28:02 -07:00
Matt Ellis 4e2d519744 Rename fileSystemEnvironmentProvider to localEnvProvider 2017-08-31 10:27:41 -07:00
Matt Ellis 4ecae0d77d Disable aligncheck linter 2017-08-30 16:47:33 -07:00
Matt Ellis be13c39586 Adopt EnvironmentProvider interface in engine
The existing implementation of the interface (backed by the file
system) has moved into cmd/lumi. The deployment service will start to
provide its own version.
2017-08-30 16:47:33 -07:00
Matt Ellis 34d52cc527 Add EnvironmentProvider interface 2017-08-29 18:47:32 -07:00
Matt Ellis fa033e985e Adopt error at API boundary 2017-08-29 18:47:29 -07:00
Matt Ellis a4c97d7225 Have saveEnv always override an existing environment
`saveEnv` had a flag which would prevent an environment from being
overwritten if it already existed, which was only used by `lumi env
init`. Refactor the code so the check is done inside `lumi` instead of
against this API. We don't need this functionality for the service and
so requiring support for this at the API boundary for environments
feels like a bad idea.
2017-08-29 18:05:42 -07:00
Matt Ellis 871b8ba962 Remove ability to specify a file name when saving an environment
We'd like to abstract out environment CRUD operations and I'd prefer
not to have to bake in the conspect of a file name like thing in the
abstraction. Since we were not really using this feature many places,
let's just get rid of it.
2017-08-29 18:00:28 -07:00
Matt Ellis 3becc6a4f4 Adopt glog for a few functions
The implementation of these functions will be moving out of the engine
and into `lumi` itself, it's a little easier if we move away from
spewing stuff to the diag interface, so just use glog instead (which
`lumi` already uses for logging)
2017-08-29 17:51:58 -07:00
Luke Hoban 24393cfe7b Read path assets into memory instead of holding open file handles
This helps avoid running into file handle limits when creating archives including thousands of node_modules files.

Tracking a more complete fix through all other codepaths related to assets as part of #325.
2017-08-29 13:33:02 -07:00
joeduffy 627d97d83f Close open Blobs
This change ensures we close all Blobs in the asset/archive logic.
In particular, the archive.Read function returns a map of files to
Blobs and after we are done copying the contents we must ensure
that we invoke Close, otherwise we may leak file handles, sockets,
and so on.  This may or may not be the culprit to the "too many
files open" errors we are hitting while deploying the M5 bits.
2017-08-28 18:52:51 -07:00
Matthew Riley fc17c146fd Merge pull request #322 from pulumi/log-plan-error
Bubble up errors from Plan.Apply. Should help debug #321.
2017-08-27 10:25:09 -07:00
Matt Ellis 56606bd649 Merge pull request #320 from pulumi/add-replace-config-to-engine
Add `ReplaceConfig` to the engine
2017-08-27 09:45:47 -07:00
Matthew Riley 63df03c556 Bubble up errors from Plan.Apply 2017-08-27 00:38:17 -07:00
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