CI/CD

CI/CD

Run the same deploys you run from your laptop in GitHub Actions, GitLab CI or any other CI system.

Quickstart: GitHub Actions

Terminal
muster ci init github        # shows .github/workflows/muster-deploy.yml
muster ci init github --yes  # writes it
muster ci env                # which secrets to add

The generated workflow:

  • runs a dry run on every pull request (no secrets needed),
  • deploys on push to main and from Run workflow (workflow_dispatch, with a services input),
  • deploys inside the production environment (add required reviewers for an approval gate),
  • uses a concurrency group so two deploys never overlap; a newer push waits instead of cancelling a running deploy.

Or write the step yourself:

YAML
- uses: actions/checkout@v4
- uses: Muster-dev/muster@v0
  with:
    command: deploy
    services: api web          # empty = everything in deploy_order

Each service gets its own log group. The job summary shows a table (service, result, duration, health, commit) and, when something fails, muster's Likely cause / Try. Failed services become ::error annotations pointing at their hook file.

Reach your servers: SSH or Fleet Cloud

YAML
# SSH: host keys are always checked on CI (StrictHostKeyChecking=yes)
- uses: Muster-dev/muster@v0
  with:
    ssh-key: ${{ secrets.MUSTER_SSH_KEY }}
    known-hosts: ${{ secrets.MUSTER_KNOWN_HOSTS }}   # ssh-keyscan -H your.host

# Fleet Cloud: servers behind NAT, no inbound ports or SSH keys
- uses: Muster-dev/muster@v0
  with:
    command: fleet-deploy
    server: prod-1            # or group: production
    cloud-token: ${{ secrets.MUSTER_CLOUD_TOKEN }}

The SSH key goes into an ssh-agent (its temporary file is deleted right away). Release downloads are checked against the release's checksums.txt; pin the action to a commit SHA for maximum pinning. Linux and macOS runners (x64 and arm64) are supported.

Secrets

SecretWhen
MUSTER_CRED_<KEY>A service has credentials.required; read from the environment instead of a prompt
MUSTER_SSH_KEYRemote services or SSH fleet servers (with MUSTER_KNOWN_HOSTS)
MUSTER_CLOUD_TOKENFleet Cloud servers
KUBECONFIGKubernetes services, written to ~/.kube/config by a step

GitLab CI and other systems

Terminal
muster ci init gitlab --yes   # writes .gitlab-ci.yml (dry run on MRs, deploy on default branch)

# any CI with bash, git, jq and curl
export MUSTER_APPROVE_HOOKS=1
muster ci run deploy --services "api web" --stop-on-failure --explain-on-failure \
  --events muster-events.ndjson

muster ci run creates a one-off API token (masked and revoked at the end), runs muster deploy --json, prints readable logs and finishes with a markdown summary.

How muster behaves on CI

  • Nothing waits for input: prompts need a TTY and print the flag or env var to use instead; hooks get /dev/null as stdin; git never asks for credentials.
  • Colours are off unless FORCE_COLOR is set (NO_COLOR always wins).
  • Failed hooks print ::error annotations and failed health checks ::warning (MUSTER_GITHUB_ANNOTATIONS=off disables them).
  • SSH host keys are checked strictly (MUSTER_SSH_HOSTKEY_CHECK=yes; accept-new to opt out).
Unapproved hooks still stop the deploy. The action approves the repo's hooks on the runner by default, because the repo is the reviewed source.

Action inputs

InputDefaultDescription
commanddeploydeploy, rollback, restart, status, fleet-deploy, fleet-rollback, fleet-restart, fleet-status
services""Space- or comma-separated. Empty = all (deploy/status)
server""Fleet server; deploy/rollback/restart/status become fleet-*
group""Fleet group, same mapping as server
dry-runfalsePlan only
stop-on-failuretrueStop at the first failed service; the rest are not_run
working-directory.Directory with muster.json
version""muster to install: empty = this action's ref, X.Y.Z, or latest
version-sha256""Extra pin: SHA-256 of the release tarball
approve-hookstrueApprove the repo's hooks on the runner
explain-on-failuretrueRun muster explain --json for the first failure
cloud-token""Fleet Cloud CLI token; installs muster-tunnel
ssh-key""Private key for SSH deploys, loaded into ssh-agent
known-hosts""known_hosts lines; required with ssh-key
args""Extra arguments for the muster command

Action outputs

OutputExample
resultsuccess or failure
deployed["api","web"]
failed["worker"]
summary-jsonPer-service rows, hints, errors, explain, commit, version
durationSeconds
exit-code0, 1 (failed or timed out), 130 (cancelled)
explain-jsonmuster explain --json for the first failure, or null
muster-versionInstalled muster
YAML
- uses: Muster-dev/muster@v0
  id: muster
  continue-on-error: true
- if: steps.muster.outputs.result == 'failure'
  run: echo "Failed: ${{ steps.muster.outputs.failed }}"