Skip to main content

Continuous Delivery

Massdriver models continuous delivery around the environment. A project's blueprint defines the components. Each environment of the project has one instance of each component, and the environment decides what reaches those instances: which bundle versions, which configuration, who can deploy, whether a change needs approval, and when changes are frozen.

A change reaches production by moving from one environment to the next. It can be a new bundle version, a configuration that was validated in another environment, or a whole new environment forked from an existing one. Every change runs as a deployment on an instance, with the instance's credentials and policy. No requester needs cloud credentials or a pipeline of their own.

What an environment holds​

Set onUsed for
InstancesThe environment, one for each componentParams, version constraint, release strategy, secrets, and connections of each component
Environment defaultsThe environmentShared resources, such as a network, a cluster, or cloud credentials, that every instance in the environment connects to
AttributesThe project, the environment, and the componentConditions of access policies, event destination filters, and automation opt-ins, such as md-environment=prod
Separation of dutyThe environmentRequiring a second person to approve each proposal. Refer to Separation of duty.
Decommission protectionThe environmentRefusing decommissionEnvironment, and every DECOMMISSION deployment of an instance in the environment

Policies with an md-environment condition set what each group can do in each environment. A common setup lets developers deploy to dev and staging and propose in prod, where a release manager approves. Refer to Access control.

How a change moves​

  1. Publish. mass bundle publish releases a bundle version. Instances on a release channel, such as ~1 or latest, deploy it. Other instances show it as an available upgrade. Refer to Versions.
  2. Validate in a lower environment. Fork staging into a new environment, stand up a preview environment for each pull request, or give each developer a sandbox.
  3. Promote. mass instance promote copies the validated params, version constraint, and release channel of an instance to the same component in the next environment, and plans the destination.
  4. Pass the environment's gate. The deployment runs when the requester has instance:deploy in that environment. A requester with only instance:propose makes a proposal that someone with instance:deploy approves. Refer to Two ways to deploy a change.
  5. Recover. Roll back an instance to a past deployment's bundle version, params, and connections.

Primitives​

Each step is one CLI command or one GraphQL mutation. Each is safe to run again, so a CI job or a script does not need to track what already ran.

StepCLIMutation
Fork an environmentmass environment forkforkEnvironment
Create or update a preview environmentmass environment previewforkEnvironment, setEnvironmentDefault, copyInstance, deployEnvironment
Compare two environmentsmass environment compare
Promote an instance's configurationmass instance promotecopyInstance
Deploy an instancemass instance deploycreateDeployment
Deploy every instance of an environmentmass environment deploydeployEnvironment
Approve or reject a proposalmass deployment approve, mass deployment rejectapproveDeployment, rejectDeployment
Roll back an instancemass instance rollbackrollbackDeployment
Tear down an environmentmass environment decommissiondecommissionEnvironment

forkEnvironment run again on an existing fork seeds it again. setEnvironmentDefault is an upsert. copyInstance deep-merges and plans. deployEnvironment and decommissionEnvironment cancel a rollout in progress and replace it.

mass environment fork ecomm-production pr42 --copy-environment-defaults
mass environment default ecomm-pr42 <shared-vpc-resource-id>
mass instance copy ecomm-production-db --to ecomm-pr42-db --copy-secrets
mass environment deploy ecomm-pr42

Automations​

Every change above writes an event to the audit log. Automations are small services that receive those events through an event destination and act on them with a service account: approve proposals from Slack, freeze production on weekends, deploy dependents after an upstream change, roll back a failed deployment, or check for drift.

StageAutomations
Publishrelease-notes, bundle-scanner
Environmentssandbox-on-join
Gateproposal-chatops, freeze-guard
Deployautodeploy-downstream, github-deployments
Recoverrollback-on-failure, drift
Reportstatuspage, audit-archiver
Anything elsebuild your own with router, or write your own