Browse docs
Docs / Guides / Hosted CI
View as Markdown

Hosted CI

On this page

Hosted CI runs the workflows in .swarmfile/ci.yml on Swarmfile-managed containers. There is nothing to install on a build machine and nothing to keep patched: a commit (or a manual dispatch) starts a container, the container streams the job's log back as it runs, and the result lands on the branch as a normal check.

Hosted CI is off for a repository until an owner enables it, and a workflow only runs automatically from a branch with effective protection unless the repository explicitly opts into unprotected branches (see Security). Every job is metered per second while it runs.

The reason to choose it is the data plane, not GitHub-compatibility: a job streams the paths it declares from the repository's block store instead of cloning the whole repository, and a self-hosted runner can claim the same job on hardware that already holds the bytes. The dialect is native and the importer translates the run-centric subset of an existing GitHub workflow; a workflow that depends on a marketplace action is refused rather than silently changed, except a small pinned set of setup-* steps that become native toolchain checks. Do not read it as a drop-in Actions replacement.

For a headless runner you host yourself, see Runner as CI; for a runner that claims hosted-CI jobs on your own hardware, see Self-Hosted CI Runners. The hosted service below shares the check and status vocabulary but not the machine.

Enable it#

  1. Open the repository in the web app → CI tab (or the tray's Repository settings → Hosted CI, or run swarmfile ci enable).
  2. Toggle Enable hosted CI for this repository. This is the cost guard: no workflow runs until an owner turns it on.
  3. Commit a .swarmfile/ci.yml to the branch you want to run from.

The CI tab also holds the repository's secrets and variables and shows the runner-size catalog (every built-in and the org's custom sizes, each with its per-second rate, read-only). Custom sizes are org-wide and are managed in Settings → Hosted CI (or swarmfile ci size).

The Runs tab lists every hosted run on the branch, with a per-job log viewer and a Cancel button; like Files and History it is member-only - external collaborators (guests) are refused.

A finished run can be re-run from its page (swarmfile ci rerun <run-id>), and a single failed job re-queued (swarmfile ci retry <job-id>). A run that ends in failure - including a timeout, a cancel, a queue expiry, a blocked start or an infrastructure fault - notifies its starter, and on a protected branch that branch's recent committers too, by bell/tray and the personal webhook, not email (see Notifications).

A first workflow#

version: 1
name: Build and test

on:
  commit:
    branches: [main]
  manual: true

jobs:
  test:
    size: medium
    timeout: 20m
    steps:
      - name: Install
        run: npm ci
      - name: Test
        run: npm test

Commit that to a protected main and a run starts on the commit. The Runs tab shows it live; swarmfile ci logs <job-id> streams the same text in a terminal, the run view's Download button saves the whole job log as a .log file, and its Search box finds lines in the job's log server-side (case-insensitive, 50 matches by default).

Triggers#

TriggerRuns whenFilters
on.commitA commit landsbranches (globs, ! negates), paths (changed paths; empty match means no run)
on.tagA tag is createdpattern (globs)
on.manualSomeone dispatches it - the Runs tab's Run workflow, the tray, or swarmfile ci runinputs (optional; see below)
on.merge_requestAn MR opens, its head moves, it reopens or becomes ready for reviewtypes, branches (base-branch globs), paths
on.scheduleA 5-field UTC cron expression firescrons, branches (default branch if omitted)
on.metadataA commit changes folder-profile field values (edits made by API keys or CI don't trigger it)branches

A paths filter on a commit or an MR compares against the changed entries; if the change set is unknown the filter matches nothing (a run is never started on a guess). A schedule fires at most once per missed occurrence: a hub that was asleep catches up the latest due firing, not every one.

Manual inputs#

A manual trigger can declare typed inputs. The dispatch form (web or tray) renders them automatically, and the CLI passes them with swarmfile ci run --input name=value (repeatable; values travel as strings and coerce to the declared type):

on:
  manual:
    inputs:
      environment:
        description: Where to deploy
        type: choice
        options: [staging, production]
        default: staging
      dry_run:
        type: boolean
        default: false
      retries:
        type: number
        required: true

Types are string (default), boolean, number and choice (with options). required: true with no default must be supplied; an optional input with no default gets the type's zero ("", false, 0). Values are read as ${{ inputs.<name> }} anywhere an expression is allowed - including a job if:, which is evaluated when the run is created, so a job can be skipped statically. An unknown input name, a missing required one, or a value that does not match the declared type (or choice options) refuses the dispatch with a visible ci_input_invalid blocked run. Input names use letters, digits and underscores.

Contribution (fork) CI#

A merge request whose source is another repository (a fork) can run the workflow from its head - contribution CI - but only as a narrowed, approved run:

  • Off by default. The server operator enables it (CI_FORK_RUNS); without it every contribution run is blocked (ci_fork_disabled).
  • Per-head approval. An organization owner/admin approves the EXACT 64-hex source head on the MR (the MR card, or swarmfile ci fork-status / ci fork-approve). A new commit revokes the approval and it also expires after seven days. Approvers are notified (bell/tray, webhook and email).
  • Read-only and hosted only. The job runs with a read-only token: write: scopes, environment:, secrets:, dependency caches, artifacts/downloads, image:, self-hosted runners and mount: write are refused, and it cannot mint OIDC credentials or touch another run's cache/artifacts.
  • Logs are member-only. The contributor sees pass/fail on the MR, not the log bytes, unless they are a member of the upstream repository.
  • Only the merge request runs it. A manual dispatch on the contribution branch goes through the same approval gate; schedules and plain pushes on that branch are refused (ci_fork_event_refused).

Jobs and steps#

jobs:
  build:
    name: Build
    size: large            # small | medium (default) | large | xlarge, or a custom size
    # runs-on: [self-hosted, linux, x64]   # self-hosted selector (1-8 unique
    #                                     # lower-case labels, self-hosted first)
    image: swarmfile-node  # optional; default swarmfile-standard (see Runner images)
    environment: production # optional; binds the job to an org environment (see Environments)
    approval: true         # optional; force an approval even if the environment names none
    timeout: 30m           # default 30m; 120m maximum (Enterprise up to 360m)
    needs: [setup]         # waits for every listed job
    continue-on-error: true
    if: success()
    env:
      NODE_ENV: production
    secrets: [NPM_TOKEN]   # ONLY these secrets are readable by this job
    outputs: [artifact]
    sparse: ["src/**"]     # optional - check out only these paths
    steps:
      - id: prep
        name: Prepare
        run: echo "sha=$(git rev-parse HEAD)" >> "$CI_OUTPUT"
      - name: Publish
        if: success()
        working-directory: packages/app
        shell: bash
        env:
          TOKEN: ${{ secrets.NPM_TOKEN }}
        run: npm publish --provenance
  • Every job runs in its own fresh container with a clean checkout of the triggering commit.
  • run: is a shell script; the default shell is bash -e -u -o pipefail, overridable per step.
  • if: on a job or a step accepts success(), failure(), always(), canceled(), comparisons, !, &&, ||, parentheses, and the functions contains, startsWith, endsWith, format, join, toJSON, fromJSON. A condition the runner cannot evaluate is treated as false - a job never runs on a condition no one can explain.
  • needs jobs that did not succeed cause their dependents to be skipped (ci_needs_failed) - unless the dependent carries an explicit if: other than a literal success(), which is admitted and evaluated with failure() true for the failed need. A job with continue-on-error: true counts as success for needs.
  • sparse: checks out only the listed paths, so a huge repo only materializes what the job uses - see Partial checkout.

Partial checkout#

Every job gets a clean checkout of the triggering commit. For a large repo, sparse: narrows it to the paths a job needs:

jobs:
  test:
    sparse:
      - "src/**"
      - "*.md"
    steps:
      - run: npm test

A path is checked out when it matches a glob, or when a directory in its ancestry matches. A glob with no / matches by name at any depth (*.md finds docs/notes.md); one containing / is anchored to the repo root (assets/models/*.bin does not match vendor/assets/models/x.bin). Everything else is neither fetched nor written, and a directory holding no matching file is not created.

A leading ! excludes a path that an earlier glob included (gitignore-style, last match wins; at least one non-! glob is required), and # comments are not supported. exclude: [glob] is sugar for those ! negations - and with no sparse: it means "everything except" (check out the whole tree, then drop the exclusions).

At most 64 globs of 1024 characters each. Omit sparse:/exclude: (or leave them empty) for a full checkout. The same globs work for the self-hosted runner and swarmfile materialize --sparse. Importing a GitHub workflow? An actions/checkout step's sparse-checkout becomes this field.

Read-only workspace#

mount: read-only runs the job on a live read-only FUSE mount of the job's commit tree. The mount serves the exact pinned commit (a stored git tree, or the commit's entry listing when nothing has derived a git tree yet - a dashboard/API or manual run), so a step reads files without a local copy and a write fails with a read-only filesystem error. The step and the engine share a uid, so this is a guard against silent divergence, not a security boundary. A mount failure fails the job before any step runs. (On a runner image that predates the live mount, the workspace falls back to the older materialized read-only tree.)

jobs:
  audit:
    mount: read-only
    steps:
      - run: ./scripts/verify-release.sh

Hosted runners are Linux amd64 only; Windows and macOS jobs run on self-hosted runners (see Self-hosted runners). A matrix os: value is a variable you use in steps - it does not select a runner image.

sparse:/exclude:, downloads and cache are refused with mount: read-only (the live mount is full-tree; extraction/cache writes would contradict it). Artifact uploads are reads and remain available. mount: read-write is refused; a writable job uses mount: write with write: [commit] (below).

Writable workspace and CI commits#

mount: write is the read-only mount's writable counterpart: the job's workspace is the run's pinned commit tree, and when every step succeeds the engine commits the step-made changes back to the run's branch as one commit authored by the CI identity (ci/<orgId>/<repositoryId>@<runId>). The workspace is a live writable mount: the pinned tree is mounted read-only and overlaid locally (a userspace overlay), so a step edits the mount directly - there is no separate checkout copy - and writes stay local until the job-end commit. A failed or canceled job commits nothing.

A self-hosted runner provides the same live mount on Linux (the host needs fuse-overlayfs) and macOS (the runner serves the workspace through FUSE-T). It requires write: [commit] (and the scope requires the mount).

The branch must be unprotected - a protected branch refuses a direct CI commit exactly as it refuses a human direct write; use write: [mr] there - and the repository Open-ACL (a CI identity cannot be an entry principal). The branch head must still be the run's pinned commit (ci_commit_base_mismatch refuses a moved head), and a target carrying an explicit ACL deny is refused.

jobs:
  format:
    mount: write
    write: [commit]
    steps:
      - run: ./scripts/format.sh

The diff is exactly the workspace: created, updated and deleted paths, at most 500 per commit. sparse:, downloads, cache and snapshot: are refused with mount: write (they would add files the diff would commit or hide files it would read as deletes), and a symlink or special file left in the workspace refuses the commit by name. A refused commit fails the job, exactly like a refused tag or merge request. A non-Open-ACL repository or a protected branch is refused; use write: [mr] and merge the request there.

Matrix jobs#

jobs:
  test:
    matrix:
      os: [linux, windows]
      node: ["18", "20"]
    steps:
      - run: echo "${{ matrix.os }} on node ${{ matrix.node }}"

Each combination becomes its own job (test (os=linux, node=18)); a job that needs a matrix waits for all of its rows. include: adds or augments combinations and exclude: removes them, with GitHub's semantics. At most 64 combinations per job, 200 declared jobs per workflow and 256 expanded jobs per run - past the combination cap the workflow is refused ci_matrix_too_large; past a job cap, ci_too_many_jobs (declared) or ci_jobs_too_many (expanded).

GitHub's strategy: wrapper is accepted too: strategy.matrix works exactly like matrix:, and strategy.fail-fast and strategy.max-parallel are accepted for compatibility but ignored (concurrency follows your plan). Any other strategy key is refused ci_unsupported_syntax.

Expressions and environment#

${{ … }} works in env:, run:, working-directory and if:. Never interpolate an expression directly into run: for a value a teammate can influence (${{ inputs.* }}, ci.branch, ci.actor, vars.*): like GitHub, the value is substituted into the shell command verbatim, so run: ./deploy.sh ${{ inputs.environment }} lets a dispatcher inject shell syntax.

Pass it through env: instead - env: { TARGET: "${{ inputs.environment }}" } then run: ./deploy.sh "$TARGET". Only steps.* outputs are substituted whole at run time; an expression that combines a step output with other values inside run: or env: is not evaluated (the literal text reaches the shell) - compute it in a step and reference the output.

The context is:

ContextContents
ci.*branch, sha, tag, actor, event, run_id, run_number, status
env.*job env: values in a job if:; a step's own env: is not visible to that step's if: (declare the value at the job level to branch on it)
vars.*repository variables, then org variables (repository wins)
secrets.*the job's declared secrets only
needs.<job>.outputs.*a completed dependency's $CI_OUTPUT values
steps.<id>.outputs.*an earlier step's $CI_OUTPUT values
matrix.*the job's combination values
inputs.*the manual run's resolved workflow_dispatch inputs

The runner exports CI=true, CI_BRANCH, CI_SHA, CI_TAG, CI_ACTOR, CI_RUN_ID, CI_RUN_NUMBER, CI_JOB_KEY, CI_JOB_ID, CI_WORKSPACE, CI_REPOSITORY_ID, CI_ORG_ID, CI_EVENT and CI_OUTPUT (the name=value file for job outputs). Print ::add-mask::<value> and the runner masks that value (and the job token) out of the log from that point on.

Composite actions#

Shared logic can live in a local composite action: a directory under .swarmfile/actions/<name>/ containing an action.yml with inputs: and runs.steps (run-only steps; no nested uses, no timeout). A job step uses it with a repo-relative path and passes inputs with with::

# .swarmfile/actions/setup/action.yml
name: Setup
inputs:
  node:
    default: "20"
runs:
  using: composite
  steps:
    - run: echo "using node ${{ inputs.node }}"
# .swarmfile/ci.yml (jobs.<id>.steps)
- uses: ./.swarmfile/actions/setup
  with:
    node: "22"          # a scalar, or one whole ${{ … }} expression
- uses: ./.swarmfile/actions/setup
  with:
    node: ${{ matrix.node }}   # the outer expression survives

The action's steps are expanded into the job at compile time: every ${{ inputs.<name> }} becomes the caller's with value (or the declared default; a required input with neither refuses the workflow). The caller's env:, if: and continue-on-error: apply to the expanded steps (the action's own step env wins on a name collision). A missing action file refuses the workflow ci_action_not_found; remote/marketplace uses: stays refused in the native dialect (the GitHub importer translates a few pinned setup-* actions - see Migrating from GitHub Actions).

Because the whole expansion happens before the run is created, an action change takes effect on the next run that reads the branch - and swarmfile ci run (manual dispatch) recompiles the branch head like any other run.

Reusable workflows#

Shared job graphs can live in a local workflow file. A job calls one with a repo-relative path; the callee's jobs are expanded into the caller at that call (keys <caller>--<job>), so needs, artifacts, caches and secrets behave like ordinary jobs:

# .swarmfile/workflows/node.yml
on:
  workflow_call:
    inputs:
      node:
        type: string
        default: "20"
jobs:
  test:
    env:
      NODE_VERSION: ${{ inputs.node }}
    steps:
      - run: node --version
# .swarmfile/ci.yml
jobs:
  lint:
    steps:
      - run: npm run lint
  test:
    uses: ./.swarmfile/workflows/node.yml
    needs: lint          # the caller's needs apply to the callee's root jobs
    with:
      node: "22"

The callee is read from the same commit as the caller (a manual run recompiles the branch head). workflow_call.inputs support string, boolean, number and choice; a missing required input, an unknown with: key or a path outside .swarmfile/workflows/ refuses the workflow. v1 limits: local .swarmfile/workflows/<name>.yml only, one level (a callee cannot call another reusable workflow), no secrets: inheritance and no outputs - the callee's jobs read repository secrets directly. A uses: job may set only uses, with, needs and name; at most 10 calls per workflow.

Why a queued job is waiting#

A queued job now shows a non-terminal reason in the run detail and in swarmfile ci status:

ReasonMeaning
self_hosted_runnera self-hosted job has no matching live runner
ci_admission_deferredcompute quota/usage state is being refreshed
ci_pausedhosted CI is paused by the operator
ci_concurrencythe plan's concurrency budget is full

The reason clears when the job starts; waitingSince preserves the original wait start across repeated reports.

Writing a tag from a job (P0)#

A job can create one declarative tag at its own pinned commit after every step succeeds:

jobs:
  release:
    write: tag
    tag: v1.${{ ci.run_number }}
    steps:
      - run: ./build.sh
      - run: ./publish.sh

Rules:

  • Both keys are required: write: tag without tag, or tag without write: tag, fails compilation.
  • The tag is created by the CI identity (ci_job:<job>) at the run's exact commit and branch; a request cannot name another commit.
  • The job's branch must be effectively protected. The repository's allowUnprotectedCi setting does not widen writes.
  • No force or move: an existing tag at another commit is refused; the same commit is idempotent. A CI-created tag does not evaluate tag triggers (no self-trigger loop).
  • tag must resolve when the job is prepared (ci.*, env, vars, matrix). Step outputs are not supported in P0.
  • Writes are opt-in per job and per deployment: a deployment that has not enabled CI write tokens fails the job at preparation (ci_write_disabled) rather than silently skipping the tag.

write: commit is described above (writable mount and CI commits). Artifact attestation is not built yet.

Cloud OIDC and merge requests#

Two more write scopes are available:

jobs:
  deploy:
    write: [oidc, mr]
    environment: production
    steps:
      - run: ./build.sh
      - run: ./deploy.sh "$(swarmfile ci oidc --audience sts.amazonaws.com)"
  • write: [oidc] lets the job mint a short-lived (10 minute) RS256 JWT with sub = ci:<orgId>:<repositoryId>:<jobId> and the repository/ref/commit/run claims. The audience must be one an owner allowed for the organization; an empty allowlist disables OIDC. Use swarmfile ci oidc --audience …; the job token itself never reaches a step. Mints are capped at 10 per job. --aws-role <arn> also writes the AWS web-identity env (AWS_ROLE_ARN, a 0600 AWS_WEB_IDENTITY_TOKEN_FILE, AWS_ROLE_SESSION_NAME) into $GITHUB_ENV (or --export-env FILE), so the AWS SDK/CLI assumes the role itself and the token is never printed. --gcp <provider-resource> writes a Google external-account credentials file and GOOGLE_APPLICATION_CREDENTIALS; --azure --azure-client-id … --azure-tenant-id … writes the Azure workload-identity env. A job that resolved an environment also carries the additive environment and approval claims, so a provider can require a production, approved gate.
  • write: [mr] opens or updates a merge request from the job's pinned branch when every step succeeds. It does not bypass protected-branch rules, force a head, or author as the triggering person; the CI identity is the author and the run is provenance.
  • write: [commit] commits a mount: write workspace as one CI-authored commit on the run's branch (see Writable workspace and CI commits). It never forces a head and never authors as a person.
  • write: [release] publishes a release for the job's release: <tag> through the same pipeline as a manual publish (a public repository, the publish preflight, the publicignore/clone policy, the manifest and the archive build). The tag must already exist - a write: [tag] job in the same run, or an earlier tag - the job must run on an effectively protected branch, and the release is authored by the CI identity. The published release carries a signed provenance statement: GET /orgs/<org>/repositories/<repository>/releases/<id>/provenance (repository read access) returns the statement (workflow/run/job, commit, actor, builder image, attached artifacts), its RS256 signature and the public JWK it was signed with (stored per statement, so a key rotation never orphans older releases). Verify it offline with scripts/verify-release-provenance.mjs (pin the key out of band for a stronger claim); the claim is “signed by the hub, verifiable offline”, and file digests live in the release manifest. The tag must point at the run's own pinned commit and branch, and a release needs a public repository, so a member cannot turn a protected-branch run into a release of another tree.
  • A release attaches the job's artifacts as release assets: release: { tag: v1, attach: all } (or a list of artifact names) copies each stored run artifact into the release's asset store and records its size and SHA-256 in the signed statement (attachments). Limits: 20 artifacts, 1 GiB each, 2 GiB per release; a retry with identical bytes is idempotent, and a different asset with the same name is refused (attachment_conflict).
  • Every CI write beyond a release (commit, tag, merge request) also records a signed job attestation. A member can fetch it from GET /orgs/<org>/repositories/<repository>/ci/jobs/<job>/attestation (add ?kind=commit|tag|mr for one), and verify the JSON offline with swarmfile ci provenance <file.json> (or --pin-key <jwk.json> to pin the key). The statement names the run/job/workflow, commit/seq/branch, the CI actor and the triggering human, the builder image, and the write-specific subject (commit seq, tag, or MR id/number). A self-hosted runner must be updated to an engine that supports job-spec version 4 (the hosted images are current); an older runner fails the job with unsupported job spec version.
  • oidc and mr are only minted for an effectively protected branch (and the run must be allowed there); commit is the opposite - it requires an unprotected branch and a job on an unprotected branch also needs the repository's allowUnprotectedCi setting on.
  • A deployment that has not enabled CI write tokens fails at preparation (ci_write_disabled), and the commit/tag/MR routes re-check the switch per request.
  • The organization must allow the audience before the job runs (/orgs/:org/org-settings/ci-oidc-audiences); a 403 ci_oidc_audience_not_allowed means the audience is missing or the allowlist is empty.

Runner images#

image: selects the container a job runs in. Omit it and the job gets swarmfile-standard (Debian bookworm with git, git-lfs, Node.js 22 LTS, Python 3 and a C/C++ toolchain). The curated catalog is available on every plan:

ImageIncludes
swarmfile-standard (default)git, git-lfs, Node.js 22 LTS, Python 3, curl, build-essential
swarmfile-nodethe standard image plus pnpm and Yarn
swarmfile-pythonthe standard image plus Python pip and venv
swarmfile-toolbeltthe standard image plus jq, zip/unzip, rsync, cmake and sqlite3

The short form (standard, node, python, toolbelt) and the canonical swarmfile-… form are the same image; pick one and stay consistent.

Bring your own image (Pro and above)#

An organization can register its own runner images under Settings → Hosted CI → Runner images. A registration is a name (what the workflow writes in image:) mapped to a digest-pinned reference in our managed registry:

registry.cloudflare.com/<account>/swarmfile-runner/<organization-id>/<repository>@sha256:<64 hex>

The organization-id segment is mandatory: it keeps one organization from selecting another organization's image. A tag, a reference outside registry.cloudflare.com, a missing digest, or a repository path that can escape its namespace is refused with ci_image_ref_invalid.

An organization image may deliberately shadow a catalog name - including the default, so an image named swarmfile-standard (or standard) is what jobs that omit image: use; both the short and canonical spellings shadow together.

A downgrade or a deployment that cannot select an image per start falls back to the catalog default for jobs that never named an image. Re-pointing an existing name (the Edit action) changes what every job selecting that name runs - it does not create a second row.

Importing an external image. Build a source image with Node.js at /usr/bin/node or /usr/local/bin/node, uid 1001 (runner) and a writable /home/runner; the runner base (Dockerfile.runner-base) is the intended starting point.

The base must also carry the engine's runtime libraries (at minimum libssl3, plus FUSE for a mount: job); the layer contract checks Node/uid/paths and the size, not arbitrary shared libraries, so a minimal image that satisfies the contract can still fail the job at runtime.

Push it to a registry and use Settings → Hosted CI → Runner images → Import image with its digest-pinned reference (a public registry, or a private one with its username/password in the same form). Swarmfile copies it into the managed registry, appends the runner agent/engine layer, verifies the layer contract and size, records the digest and prepares it; the source image is never executed.

The source may be a public image, the catalog, or this organization's own swarmfile-runner/<organization-id>/ namespace; another organization's managed image is refused.

Building from a Dockerfile. An organization on Pro or above can skip the registry round-trip and build the image with the hosted builder. In Settings → Hosted CI → Runner images, choose Build from Dockerfile and attach a packed context (.tgz), or use the CLI:

swarmfile ci image build our-rust --context . --dockerfile docker/Dockerfile --wait

The CLI packs the context (default .) as a gzipped tar with .git excluded (64 MiB compressed cap) and pins it to the checkout's HEAD - a dirty working tree is refused unless you pass --allow-dirty - then uploads it to a trusted builder container.

The builder holds no registry credential: its Trivy pre-scan is advisory, it exports the image to the trusted import pipeline, which appends the runner agent/engine layer, scans the exact final image with a fresh database and applies the organization's waivers for that image name. A blocked scan is shown with its findings; the owner waives the CVEs and retries (or re-scans), and only then does the image prepare. --wait also runs the prepare step.

A secret-shaped --build-arg key is refused (secrets are not accepted as build args). --secret NAME (org CI secrets) is operator-gated and disabled by default; when a deployment enables it, --secret resolves server-side, is redacted from the build log, and is consumed with RUN --mount=type=secret,id=NAME.

The layer cache is not available in the trusted-import shape (--cache is refused with ci_build_cache_unavailable). swarmfile ci image build-status|build-logs|build-cancel <id> follow or stop a build; once the image import has started, the build can no longer be canceled. Builds are owner/admin, one at a time per organization and capped per day. Hosted builds are enabled in staging and production (CI_IMAGE_BUILD=on); an environment with the flag off answers ci_build_disabled.

Egress boundary. The importer resolves the source host and runs every fetch through a per-import loopback HTTP/CONNECT proxy; a source that resolves (or redirects) to a private, loopback, link-local or CGNAT address is refused before any pull. This relies on crane honoring HTTP(S)_PROXY.

External-source imports are fail-closed until the operator enables the scanned path, and a passing vulnerability scan is mandatory: every Critical finding and every High with a fix must be waived by an owner or admin, or fixed, before the image can be imported. The scan reads the image without executing it. The first-party catalog and the organization's own managed namespace are exempt.

Settings → Hosted CI → Runner images → Scan shows the latest findings; an owner or admin can grant a time-boxed waiver there (1-30 days) and retry the import, or waive and re-scan an already imported image. Waiver grants and revocations are written to the org audit log on a best-effort basis - a failed audit write is logged and does not block the waiver.

Scanning is gated like the rest of Hosted CI: when the operator has not launched CI for the organization the scan routes answer 404 ci_not_available, and each organization has a daily scan budget that manual re-scans, imported-image scans and the daily re-scan all draw from. A manual scan over that budget is refused with 429 ci_image_scan_quota (the scan never starts); the daily pass simply skips that run. Only owner and admin roles may start a scan or grant/revoke a waiver.

Building from a Dockerfile is a first-class path where the environment sets CI_IMAGE_BUILD=on (Settings → Hosted CI → Runner images → Build from Dockerfile, or swarmfile ci image build); the managed-registry push credential stays server-side, so you never handle one. An environment with the flag off answers ci_build_disabled.

A re-point updates the name first and then prepares the new digest; if preparation fails the name still points at the new reference and jobs selecting it are refused until it is prepared. A re-pointed catalog or this organization's own managed digest is exempt from scanning, while any scan recorded for the previous digest is stale - the Scan panel says so and does not treat its findings or waivers as current.

The image contract. A compatible source image is linux/amd64, runs as uid 1001 (runner), has Node at /usr/bin/node or /usr/local/bin/node, and a writable home. It must be glibc-based (the appended engine links glibc/OpenSSL; a musl/Alpine base will not run) - base built images on the runner base or another Debian-compatible Node image. The importer appends the agent at /opt/swarmfile/job-agent.mjs, the engine at /usr/local/bin/swarmfile-engine, and the launcher. The final image listens on port 8080; Hosted CI overrides the command with node /opt/swarmfile/job-agent.mjs, so you do not have to set a CMD.

The settings surface shows each image's size, preparation state and the organization's storage use, and prepares a saved or re-pointed image automatically (the CLI/tray show the same state). A job never starts an unprepared digest: admission refuses it with ci_image_not_prepared, so the first run cannot silently wait out its timeout.

Using an org image requires the Pro plan or above - a job on a lower plan is refused with ci_byo_image_requires_plan, but existing images stay listed and deletable. An unknown name refuses with ci_image_unknown; a pull that never becomes ready within the 10-minute delivery window fails with ci_image_pull_failed; an agent that answers the contract incorrectly fails with ci_image_contract_invalid; a start the platform rejects for size fails with ci_image_too_large. A run's job row records the exact digest that actually started (catalog map digest or org reference), so history remains attributable even after a name is re-pointed.

Environments and approvals#

An organization defines environments (Settings → Hosted CI → Environments): a name, an optional URL, and a reviewer rule - zero or more reviewers as org members and/or owner/admin/member roles. A job binds to one with environment: <name>; if the environment names reviewers, the job waits for an approval once its needs are satisfied.

Nothing runs and nothing is billed while it waits; a reviewer (any one of the named users, or a member whose role satisfies a named role - role:admin admits owners too) approves or denies it from the run page, and the bell notifies every eligible reviewer. Denial fails the job environment_denied and skips its dependents; approval queues it immediately.

A job may also declare approval: true beside environment: - that adds a gate when the environment names no reviewers (owners and admins then approve). A declaration can only add protection: it never broadens or removes the environment's reviewer set. Each environment can also turn on "the run's starter cannot self-approve", which refuses the person who triggered the run even if they are a listed reviewer.

A job naming an environment the org has not defined is blocked with ci_environment_unknown; retrying a failed gated job asks for approval again rather than starting unapproved. Reviewer changes apply to requests already waiting: removing a reviewer stops that person deciding a pending request, and clearing the reviewer list (with no approval: on the job) un-gates it - any member can then advance it from the run page. Deleting an environment leaves a pending request's reviewer set in place, so it can still be decided.

Reviewer user ids are checked against org membership when the environment is saved.

An environment also has its own secrets and variables scope (Settings → Hosted CI → Environments → Secrets & variables on the environment's row): a job that declares the environment resolves those on top of the repository and org scopes, and the environment wins on a name collision - the natural place for deploy credentials that must not be readable by a job running on a pull request.

Secrets and variables#

Repository secrets and variables live in the repository's CI tab; org-scoped ones are available to every repository and live in the dashboard's Settings → Hosted CI, together with the org's environments (each with its own secret/variable scope), its custom runner sizes, its runner images and its CI policy - the org-level enable/disable control and the Force unprotected runs off override. All of these are owner/admin-managed.

Resolution precedence is environment (only for a job declaring it) → repository → org: the most specific scope wins on a name collision.

  • Secret values are write-only: they are never shown again, in any surface.
  • A job must list the secret names it uses in secrets:. Referencing an undeclared secret fails the workflow before the job starts.
  • Org secrets are only resolvable from private repositories (an environment's secrets inherit this: a public repository's workflows see repository-scope values only).
  • End-to-end encrypted repositories do not run hosted CI: a hosted runner holds no E2E key by design. A self-hosted runner serves them from the owner-maintained plaintext workflow sidecar, with the repository key delivered to a granted runner's device.

Artifacts and dependency caches#

A job can publish files for later jobs, and restore/save a dependency cache between runs:

jobs:
  build:
    artifacts:
      - name: dist
        path: packages/app/dist
        if-no-files-found: error   # warn (default) | error | ignore
    cache:
      key: deps-${{ ci.branch }}-${{ ci.sha }}
      paths: [.npm]
      restore-keys: ["deps-${{ ci.branch }}-"]
    steps:
      - run: npm ci
      - run: npm run build

  deploy:
    needs: [build]
    downloads: [dist]              # fetched after checkout, before steps
    steps:
      - run: ./packages/app/dist/deploy.sh
  • Artifacts are bundled (tar.gz) at job end - on success or failure, or gated by the entry's if: - and downloads: fetches each name from the newest successful producer in the job's transitive needs closure (a missing producer fails the job). Limits: 1 GiB per artifact, 5 GiB per run, 30-day retention; a path that climbs out of the workspace is refused.
  • Caches restore after checkout and before the first step: the exact key, then the newest entry matching any restore-keys prefix, first in the job's own branch and then in the default branch (a branch can restore the default branch's toolchain cache). The save happens only when the job succeeds and always writes to the job's own branch. An organization owner may additionally open an org-shared cache (Settings → Hosted CI): read lets repositories restore from it, write also lets them publish. Sharing is org-wide and a write repository can influence another repository's restore for the same key - enable it only for repositories you trust with each other. Key supports ${{ }} (no secrets). Limit: 5 GiB per entry. Repositories have a 20 GiB cache budget and organizations 100 GiB; when a save would pass the repository budget the least-recently-used entries are evicted, and a save that cannot fit at all is refused ci_cache_quota_exceeded. Entries expire after 30 days (the daily sweep also enforces the org budget). The run view's job table shows hit or miss per job, and ci status prints the same.
  • The GitHub importer maps actions/upload-artifact, actions/download-artifact and actions/cache (or the split restore/save pair) onto these fields when their arguments are literal.

Services#

Integration tests often need a database or broker. A native job can declare services: - processes started inside the same job container before the first step, on a loopback port, and always stopped with the job:

jobs:
  test:
    services:
      cache:
        run: redis-server --port 6379
        port: 6379                            # readiness: tcp
      api:
        # A service runs in its own empty directory, not the workspace: give it
        # an installed command or inline code, not a repo-relative script path.
        run: node -e "require('http').createServer((q,s)=>s.end('ok')).listen(8080)"
        url: http://127.0.0.1:8080/health     # readiness: http
        timeout: 90
    steps:
      - run: npm test
  • readiness is tcp (with port), http (with a loopback url), exec (with a ready shell command or a command: argv, re-run until it exits 0) or alive (a settle delay); the default is derived from the fields present. An http probe may send headers: (for example an authorization value the health endpoint requires); command: runs its argv directly, without a shell, and cannot be combined with ready:. A service that is not ready in time - or exits first - fails the job before its first step. Service output appears in the log as [service:<name>/out] … (stdout) and [service:<name>/err] … (stderr).
  • needs: (a name or a list) starts a service only after the named services are ready, and the compiler refuses an unknown reference, a self-need or a dependency cycle. Services in independent branches still start in parallel.
  • restart: on-failure restarts a service whose process exits non-zero up to max_restarts times (0-5, default 2; never is the default). The restart bound is enforced before readiness and after it; when the bound is reached the service is left stopped and the job's steps see the failure. The job's own timeout still bounds the whole run - there is no unbounded health loop.
  • A service is repository code run as the job's uid with the job's public CI_* variables and its own env: - never the job token or a secret value. It gets SWARMFILE_SERVICE_<NAME>_HOST and, when configured, _PORT and _URL. It runs in a directory outside the workspace, and services: is refused together with a mount: write job (a service could otherwise write the commit). It is killed with the job and never outlives it.
  • image: on a service is refused: the hosted platform runs one container per job, so a service that needs its own image (Postgres, Kafka) is out of scope - use image: on the JOB (an org image that already carries the process) or start it in a run: step. On a self-hosted runner a service is a host process, so it must already be installed there; naming a service image is refused everywhere.
  • At most 5 services per job. Declaring one moves the job spec to version 3, so a runner image that predates services refuses the job instead of running it without them; a depth field (needs, command, headers, restart) moves it to version 6, so a runner that would silently ignore the ordering or the probe refuses instead.

Migrating from GitHub Actions#

swarmfile ci import and the web editor's import translate the run-centric subset of a workflow. A small, pinned set of setup-* steps is translated to a native verification step rather than fetched: actions/setup-node@v3/@v4 and actions/setup-python@v4/@v5 become a check that the selected image: has the requested major (20) or major.minor (3.12).

If the image's toolchain does not match, the step fails naming the image instead of downloading another toolchain; with.cache is refused (use the job-level cache: field). Quote a version with a trailing zero ("3.10") so YAML does not read it as 3.1. Every other marketplace action stays refused and is never executed.

Runner sizes, billing and limits#

SizevCPUMemoryDisk
small0.251 GiB4 GB
medium (default)16 GiB12 GB
large28 GiB16 GB
xlarge412 GiB20 GB

Orgs can define custom sizes (quarter-vCPU steps, up to the platform ceilings); each custom size rounds up to the smallest capacity tier that covers it (the four sizes above, plus a 0.5 vCPU / 4 GiB / 8 GB tier between small and medium), and is billed at that tier's per-second rate.

Sizes are org-wide; manage them in Settings → Hosted CI or with swarmfile ci size (the repository CI tab lists them read-only, with rates). Define one with swarmfile ci size set build-heavy --vcpu 2 --memory 8 --disk 16 (or the size form in Settings → Hosted CI), then ask for it by name in a job: size: build-heavy.

A self-hosted selector is runs-on: [self-hosted, <label>...]. It is accepted while the organization's policy is active (on by default; an owner can disable it), then queues for a registered runner matching the labels (and whose dependency frontier is released); a job with no matching live runner expires after the 2-hour queue TTL. Otherwise the job is refused with self_hosted_runners_not_enabled. The runner is a separate release and operator setup, not something the hosted service runs for you - see Self-Hosted CI Runners.

Billing is per second of job time at the size's rate (at-cost × 1.2), rounded up to the next whole second (a started job bills at least ten seconds). The run list shows each job's billed seconds and charge. Compute counts against the org's spend cap - over the cap, a new job is refused with a blocked spend_cap_reached run and reads keep working.

Every org except Enterprise needs an active, trialing or past-due subscription before its first job (otherwise the run is refused with payment_method_required): paid and trialing Starter and Pro orgs already pass, while a Free org (or one on a Verified-OSS grant) adds a card in Billing first. Enterprise is invoiced and exempt.

A Free org's compute runs under a Free-plan compute ceiling that owners can't change: it scales with account standing (the org's age, and whether its creator has a verified email, a verified card or a seat in a paid org), from about $2.50 up to $15 of compute a month. Platform ceilings apply.

What a job costs#

Rates are the provider's list price for each size, recovered at cost × 1.2, at current provider pricing:

SizevCPU / memory / diskPer minutePer hour
small0.25 / 1 GiB / 4 GB$0.00056$0.03
medium (default)1 / 6 GiB / 12 GB$0.00258$0.15
large2 / 8 GiB / 16 GB$0.00440$0.26
xlarge4 / 12 GiB / 20 GB$0.00802$0.48

A job bills ceil(elapsed) seconds at its resolved size's rate; the run list shows each job's billed seconds and exact charge. If provider pricing moves, this table and the in-app rates move with it.

How this compares to GitHub-hosted runners. Our billing is per second, with no included-minute allowance on any plan. GitHub's is per minute, with partial minutes rounded up, and its private-repo plans include a monthly minute allowance (public-repo jobs are free) - below that allowance, staying on GitHub can be cheaper, and we do not match free public-repo CI.

This comparison is for paid CI. Past it, the comparable Linux job costs less here: our large (2 vCPU / 8 GiB) is $0.00440/min, while GitHub's published 2-core rate works out about 35% higher per paid minute (we're about a quarter cheaper per minute at the quoted $0.006 list). Short jobs save more, because we bill per second with a 10-second minimum and GitHub rounds up to the minute: a 5m30s job bills 330 seconds here instead of six minutes there.

GitHub's larger, macOS and GPU runners are premium-priced and aren't offered on hosted CI; those jobs belong on hardware you run, through Self-Hosted CI Runners when the organization allows them. Verify GitHub's current rates at their pricing calculator, and see the dated side-by-side on the GitHub comparison page.

Job limits#

Other limits: a job's size must resolve (an unknown name fails the job rather than guessing); a job's log is capped at 50 MiB and a run's log at 200 MiB (output past a cap is dropped and the log is marked truncated - the earliest output is what is kept) and logs are retained for 30 days - organization owners can shorten that per repository to 1-29 days; concurrent jobs are capped by plan (Free 1, Starter 2, Pro 8, Enterprise 16, weighted by size: small counts 0.25, medium 1, large 2, xlarge 4).

A size heavier than the plan's whole budget can never run, so Free can't run large or xlarge and Starter can't run xlarge; such a job is refused with ci_size_exceeds_plan_budget.

Public repositories and open source#

Hosted CI is a paid compute service on public repositories too. There is no free public-repo tier and no included minute allowance: a public repository needs a card like any other, bills at the same per-second rate, and its runs and logs stay member-only. A Verified-OSS grant covers the Pro plan, not compute.

Use it when the repository is large enough that streaming a job's declared paths beats a clone, or when a self-hosted runner already has the bytes. If you need free CI for an open-source project, keep GitHub Actions for that. The open-source story here is the community server, the standalone tools and the public repository surface - not free CI compute, and the use of a GitHub-shaped workflow file does not make this an Actions marketplace.

Security#

A workflow can read the repository's secrets, so hosted CI treats it like code that runs with credentials:

  • Automatic runs come only from branches with effective protection (a protected branch rule) - a push to an unprotected branch is refused with a visible blocked run.
  • A repository owner can opt into unprotected branches (the Allow unprotected runs switch in the CI tab, swarmfile ci enable --allow-unprotected). Only do this when everyone who can push to those branches is trusted like a branch protector.
  • A blocked run still writes its check row as a failure, so a required check can never be skipped by breaking CI.
  • Job tokens are scoped to one job, one repository and the triggering ref, expire with the job, and are stripped from every step's environment; the runner also blocks a step from reading the engine's /proc/<pid>/environ and masks the token from logs.
  • A bring-your-own image is trusted organization code: it contains the agent that receives the job spec, so it can read the job token and every secret the job is allowed to read. Register only images you or your security team control; prefer digest pinning and re-point deliberately.

What is not supported#

The dialect is small on purpose and fails closed: anything it does not understand refuses the workflow with a line number.

  • No marketplace/remote uses: (never arbitrary code); a LOCAL composite action under ./.swarmfile/actions/<name> IS supported (see Composite actions).
  • No remote reusable workflows; same-repo uses: ./.swarmfile/workflows/<name>.yml IS supported (see Reusable workflows), including workflow_call inputs. No permissions, and no service containers - in-container services: ARE supported (see Services). environment: + approval: ARE supported (see above). Artifacts and dependency caches are native (see below).
  • No container: (GitHub's per-job container) - use image: instead, which selects one of the curated runner images or an org-registered one; size: selects resources independently.
  • workflow_dispatch inputs ARE supported (typed string/boolean/ number/choice; see Manual inputs). A manual run otherwise takes the branch only.
  • No merge queues and no pull_request_target. A contribution (fork) merge request can run its own workflow through the separate, operator-enabled Contribution CI flow.
  • Self-hosted labels require the organization's policy to be active (on by default; an owner can disable it). runs-on: [self-hosted, ...] queues for a registered runner matching the labels (or expires after the 2-hour queue TTL), and is refused with self_hosted_runners_not_enabled when the org policy is off. See Self-Hosted CI Runners; the branch-watching runner as CI is a separate tool, not a hosted-CI runner.

Going further#

  • swarmfile ci list|status|logs|cancel|run and the secret/variable/size commands: see the CLI reference.
  • The desktop tray shows the same runs, logs and settings per repository.

Something wrong or missing? Report a docs issue.