Authoring a kit
Kits live under .ensemble/kits/<role>/<name> and are managed end-to-end
through the ens kit command group — from scaffolding a brand-new one to
sharing a locally-authored one out to its own repository. See
Kits for what a kit's contract looks like per role
(build, pack, deploy) before writing one.
Scaffold a new kit
ens kit new my-deploy-target deploy
Scaffolds .ensemble/kits/deploy/my-deploy-target. <role> is one of build,
pack, deploy, ecosystem, or lib (a kit-shaped package a library
publishes through — see Managing libraries).
The scaffolded kit.yml names the kit's role and the protocol it speaks.
Keep both: ens kit install, pin and eject refuse a kit without them. A
pack kit that declares publish: targets also needs a publish.ts. A build kit
whose apps must belong to an ecosystem adds ecosystem: <name>, and
ens app create declares that ecosystem in a project that doesn't yet. An
ecosystem kit has a contract of its own: see
Writing an ecosystem kit.
To present a kit to people browsing for one, add an about: section. ens runs
nothing from it; ens kit install, pin and eject only check it's
well-formed:
about:
title: AWS
summary: "Deploys a workload to managed services in your own AWS account."
icon: icon.svg # a square SVG in the kit's folder
tags:
- cloud
repository: https://github.com/org/kit-deploy-aws # for ens kit install
title and summary are required once the section is there. icon must be an
.svg inside the kit's folder: it travels and is reviewed with the kit, and
should read on a light background. What a kit can do isn't declared here: the
kits page reads it from the kit itself (a deploy kit's provisioners, a pack
kit's modes and publish targets, a build kit's ecosystem).
Install a kit someone else wrote
ens kit install https://github.com/org/their-kit
ens kit install https://github.com/org/[email protected]
Clones the kit (optionally pinned to a ref with @<ref>) into
.ensemble/kits/<role>/<name>, vendored for inspection and customization —
nothing about a vendored kit is opaque or hidden behind a package registry.
Moving a vendored kit
ens kit pin my-deploy-target v1.3.0 # move to a specific ref
ens kit update my-deploy-target # next patch release (default)
ens kit update my-deploy-target minor # next minor release
update looks at the kit's own tags and moves to the next release within the
given bump scope from whatever ref it's currently pinned to.
Sharing a locally-authored kit
Once you've written a kit in-repo (via ens kit new) and it's ready to be
reused elsewhere:
ens kit eject my-deploy-target [email protected]:org/my-deploy-target.git
Pushes the kit to its own repository and registers this repo's copy as a
vendored checkout of it — from then on it's managed the same way an installed
kit is (pin/update).
Contributing a change back
If you've made a local change to an installed (non-locally-authored) kit and want to upstream it:
ens kit contribute my-deploy-target
Pushes the local change and opens a pull request against the kit's own remote.
When a kit fails
Throw an Error whose message says what's wrong and what to do about it: the
kit prints it, ens adds no line of its own, and the kit exits 1. To see the
stack and the kit's command line as well, set ENS_DEBUG=1, or pass --verbose
to a command that has it. A kit that calls Deno.exit with a code of its own
has that code returned as ens's.
Full reference
See the ens kit CLI reference for every
subcommand's exact arguments.
Ensemble