Commit graph

881 commits

Author SHA1 Message Date
joeduffy a4e806a07c Remember old moniker to ID mappings
For cerain update shapes, we will need to recover an ID of an already-deleted,
or soon-to-be-deleted resource; in those cases, we have a moniker but want to
serialize an ID.  This change implements support for remembering/recovering them.
2017-02-28 17:03:33 -08:00
joeduffy 7f53727575 Require the full --yes for destroys 2017-02-28 16:44:46 -08:00
joeduffy 632bb357da Remove superfluous indentation 2017-02-28 16:30:20 -08:00
joeduffy 954fd9ae78 Use real configuration in ec2instance example
This change eliminates the hard-coded region from the ec2instance
example, and instead uses the new `aws.config.region` configuration
variable.  This makes the code more amenable to multi-instancing.
2017-02-28 16:14:18 -08:00
joeduffy cf2788a254 Allow restarting from partial failures
This change fixes a couple issues that prevented restarting a
deployment after partial failure; this was due to the fact that
unchanged resources didn't propagate IDs from old to new.  This
is remedied by making unchanged a map from new to old, and making
ID propagation the first thing plan application does.
2017-02-28 16:09:56 -08:00
joeduffy 6a2edc9159 Ensure configuration round-trips in Huskfiles 2017-02-28 15:43:46 -08:00
joeduffy c77329129a Print more details when an unhandled exception occurs 2017-02-28 13:15:28 -08:00
joeduffy a1a8812910 Add a requireRegion helper function
This change adds a requireRegion helper function to the AWS library,
enabling easy fetching of the current region (and/or throwing if the
region hasn't been properly configured).
2017-02-28 12:37:37 -08:00
joeduffy 300f87137c Improve verify; verify packages before install
This change improves the verify command by unifying its package
discovery logic with compile.  All libraries are also now verified
before installing, just to catch silly mistakes (compiler bugs, etc).

This also fixes a verification error in the AWS library due to
pulumi/coconut#104, the inability to use `!` on "anything".
2017-02-28 12:31:50 -08:00
joeduffy b54d343889 Treat Never as dynamic
The TypeScript compiler will often transform Anys into Nevers when it
thinks control flow cannot reach a certain point.  This isn't handled
gracefully at the moment.  This change just erases it back to Any.
2017-02-28 12:08:50 -08:00
joeduffy 7593dd3ce9 Permit dots in names
This is sometimes used for "internal" functionality; and, furthermore,
NPM-style modules can legally contain dots.
2017-02-28 12:07:18 -08:00
joeduffy 36d9251400 Export lib.es5 and lib.es6 modules
This ensures that TypeScript library references to ES5 and ES6-specific
things resolve to the correct CocoJS runtime library types.
2017-02-28 12:05:45 -08:00
joeduffy 6460ccaa83 Disable the ECMAScript runtime layer
For now, we will disable the CocoJS library's ECMAScript runtime
layer, because it's causing some troubles.  The details -- and
reenabling it -- are tracked in pulumi/coconut#103.
2017-02-28 11:38:19 -08:00
joeduffy 923c3150db Fix the cocojs library
* for ..of isn't yet supported yet (see pulumi/coconut#88); in its
  absence, use a regular for loop so that this library can compile.

* List coconut as a dependency.
2017-02-28 11:32:24 -08:00
joeduffy 679a4bf479 Export a first class Region type 2017-02-28 11:12:34 -08:00
joeduffy 1c43abffec Fix some go vet issues 2017-02-28 11:02:33 -08:00
joeduffy 51fc9b1845 Fix a test break 2017-02-28 10:38:29 -08:00
joeduffy ce7f8d130e Change the error prefix from MU to COCO 2017-02-28 10:36:21 -08:00
joeduffy 7f0a97a4e3 Print configuration variables; etc.
This change does a few things:

* First and foremost, it tracks configuration variables that are
  initialized, and optionally prints them out as part of the
  prelude/header (based on --show-config), both in a dry-run (plan)
  and in an actual deployment (apply).

* It tidies up some of the colorization and messages, and includes
  nice banners like "Deploying changes:", etc.

* Fix an assertion.

* Issue a new error

      "One or more errors occurred while applying X's configuration"

  just to make it easier to distinguish configuration-specific
  failures from ordinary ones.

* Change config keys to tokens.Token, not tokens.ModuleMember,
  since it is legal for keys to represent class members (statics).
2017-02-28 10:32:24 -08:00
joeduffy d91b04d8f4 Support config maps
This change adds support for configuration maps.

This is a new feature that permits initialization code to come from markup,
after compilation, but before evaluation.  There is nothing special with this
code as it could have been authored by a user.  But it offers a convenient
way to specialize configuration settings per target husk, without needing
to write code to specialize each of those husks (which is needlessly complex).

For example, let's say we want to have two husks, one in AWS's us-west-1
region, and the other in us-east-2.  From the same source package, we can
just create two husks, let's say "prod-west" and "prod-east":

    prod-west.json:
    {
        "husk": "prod-west",
        "config": {
            "aws:config:region": "us-west-1"
        }
    }

    prod-east.json:
    {
        "husk": "prod-east",
        "config": {
            "aws:config:region": "us-east-2"
        }
    }

Now when we evaluate these packages, they will automatically poke the
right configuration variables in the AWS package *before* actually
evaluating the CocoJS package contents.  As a result, the static variable
"region" in the "aws:config" package will have the desired value.

This is obviously fairly general purpose, but will allow us to experiment
with different schemes and patterns.  Also, I need to whip up support
for secrets, but that is a task for another day (perhaps tomorrow).
2017-02-27 19:43:54 -08:00
joeduffy 2c6616831f Add AWS configuration variables 2017-02-27 16:52:06 -08:00
joeduffy 371a847eb9 Unify a bit of command logic, and hoist some failure modes 2017-02-27 14:13:27 -08:00
joeduffy 73babc13a0 Add confirmation for destroy 2017-02-27 13:53:15 -08:00
joeduffy 9b55505463 Implement AWS security group updates 2017-02-27 13:33:08 -08:00
joeduffy eca5c38406 Fix a handful of update-related issues
* Delete husks if err == nil, not err != nil.

* Swizzle the formatting padding on array elements so that the
  diff modifier + or - binds more tightly to the [N] part.

* Print the un-doubly-indented padding for array element headers.

* Add some additional logging to step application (it helped).

* Remember unchanged resources even when glogging is off.
2017-02-27 11:27:36 -08:00
joeduffy 3bdbf17af2 Rename --show-sames to --show-unchanged
Per Eric's feedback.
2017-02-27 11:08:14 -08:00
joeduffy 09e328e3e6 Extract settings from the correct old/new snapshot 2017-02-27 11:02:39 -08:00
joeduffy afbd40c960 Add a --show-sames flag
This change adds a --show-sames flag to `coco husk deploy`.  This is
useful as I'm working on updates, to show what resources haven't changed
during a deployment.
2017-02-27 10:58:24 -08:00
joeduffy 88fa0b11ed Checkpoint deployments
This change checkpoints deployments properly.  That is, even in the
face of partial failure, we should keep the huskfile up to date.  This
accomplishes that by tracking the state during plan application.

There are still ways in which this can go wrong, however.  Please see
pulumi/coconut#101 for additional thoughts on what we might do here
in the future to make checkpointing more robust in the face of failure.
2017-02-27 10:26:44 -08:00
joeduffy 604370f58b Propagate IDs from old to new during updates 2017-02-26 13:36:30 -08:00
joeduffy d3ce3cd9c6 Implement a coco husk ls command
This command is handy for development, so I whipped up a quick implementation.
All it does is print all known husks with their associated deployment time
and resource count (if any, or "n/a" for initialized husks with no deployments).
2017-02-26 13:06:33 -08:00
joeduffy 7f62740bc5 Add comment about adding cocojs to $PATH 2017-02-26 12:14:49 -08:00
joeduffy ace693290f Fix the directionality of delete edges 2017-02-26 12:05:49 -08:00
joeduffy 44783cffb7 Don't overwrite unmarshaled deployment info 2017-02-26 12:00:00 -08:00
joeduffy ff3f2232db Only use args if non-nil 2017-02-26 11:53:02 -08:00
joeduffy 2116d87f7d Tidy up some messages and error paths 2017-02-26 11:52:44 -08:00
joeduffy 1bdd24395c Recognize TextUnmarshaler and use it
This change recognizes TextUnmarshaler during object mapping, and
will defer to it when we have a string but are assigning to a
non-string target that implements the interface.
2017-02-26 11:51:38 -08:00
joeduffy 2f60a414c7 Reorganize deployment commands
As part of pulumi/coconut#94 -- adding targeting capabilities -- I've
decided to (yet again) reorganize the deployment commands a bit.  This
makes targets ("husks") more of a first class thing.

Namely, you must first initialize a husk before using it:

    $ coco husk init staging
    Coconut husk 'staging' initialized; ready for deployments

Eventually, this is when you will be given a choice to configure it.
Afterwards, you can perform deployments.  The first one is like a create,
but subsequent ones just figure out the right thing to do and do it:

    $ ... make some changes ...
    $ coco husk deploy staging
    ... standard deployment progress spew ...

Finally, should you want to teardown an entire environment:

    $ coco husk destroy staging
    ... standard deletion progress spew for all resources ...
    Coconut husk 'staging' has been destroyed!
2017-02-26 11:20:14 -08:00
joeduffy 2fec5f74d5 Make DeepEquals nullary logic match Diff 2017-02-25 18:24:12 -08:00
joeduffy 39b63daaad Fix a broken link 2017-02-25 10:57:07 -08:00
joeduffy ea7bdd265f Remove bit about symlinking 2017-02-25 10:55:56 -08:00
joeduffy 5d550cea2c Eliminate a redundant paragraph 2017-02-25 10:53:29 -08:00
joeduffy c714aa6d43 Tweak a bit more in the README 2017-02-25 10:52:01 -08:00
joeduffy 15b44c22e5 Tidy up the installation instructions 2017-02-25 10:46:26 -08:00
joeduffy b3859bd78f Use 0755, rather than 0744, for directories 2017-02-25 10:36:28 -08:00
joeduffy bfe084e3aa Fix an errant Git module 2017-02-25 10:35:51 -08:00
joeduffy 977b16b2cc Add basic targeting capability
This change partially implements pulumi/coconut#94, by adding the
ability to name targets during creation and reuse those names during
deletion and update.  This simplifies the management of deployment
records, checkpoints, and snapshots.

I've opted to call these things "husks" (perhaps going overboard with
joy after our recent renaming).  The basic idea is that for any
executable Nut that will be deployed, you have a nutpack/ directory
whose layout looks roughly as follows:

    nutpack/
        bin/
            Nutpack.json
            ... any other compiled artifacts ...
        husks/
            ... one snapshot per husk ...

For example, if we had a stage and prod husk, we would have:

    nutpack/
        bin/...
        husks/
            prod.json
            stage.json

In the prod.json and stage.json files, we'd have the most recent
deployment record for that environment.  These would presumably get
checked in and versioned along with the overall Nut, so that we
can use Git history for rollbacks, etc.

The create, update, and delete commands look in the right place for
these files automatically, so you don't need to manually supply them.
2017-02-25 09:24:52 -08:00
joeduffy 14762df98b Flip the summarization polarity
This change shows detailed output -- resources, their properties, and
a full articulation of plan steps -- and permits summarization with the
--summary (or -s) flag.
2017-02-25 07:55:22 -08:00
joeduffy 32379da4f5 Fix a few lingering issues from rename 2017-02-25 07:51:29 -08:00
joeduffy 08b644a3ba Delete the architecture PNG
It's now out of date (Coconut versus Mu).

And shame on me for ever checking in a binary, anyway.
2017-02-25 07:40:26 -08:00