Skip to content

sow.yml Reference

Every sow.yml field with its default and validation rule, plus key references, the password-file contract, and publication targets.

sow.yml is the configuration file of a workspace, the directory that holds your standard repositories. It declares which repositories exist, which Dists each one serves and with what package policy, how indexes and packages are signed, and where builds are published. Look here when you edit the file by hand or need the exact default or validation rule for a field. A simple repository has no configuration file: sow create and sow prune never read it.

Complete example

This file uses every section. Comments give the default that applies when a field is omitted. Only schema and each Dist’s format are required: schema: sow/v3 alone is a valid, empty workspace.

schema: sow/v3                         # required
architectures: [x86_64, aarch64]       # default; amd64 and arm64 are accepted aliases

repos:
  pgsql:                               # public tree at <workspace>/pgsql/
    protected: true                    # refuse `sow repo rm`; default false
    signing:                           # omit for unsigned indexes and untouched packages
      rpm:
        packages:                      # sign RPM files with the host rpm and GPG
          mode: fill                   # default: fill with a key, never without
          key: agent://7F721C4AD40F4A9D8CA578BFAC7E4690B50CCF3B
          passfile: /run/secrets/rpm-password
          trusted_keys: [keys/upstream.asc]
        metadata:                      # writes repodata/repomd.xml.asc
          key: keys/repo-signing.asc
          passfile: /run/secrets/gpg-password
      deb:
        metadata:                      # writes InRelease and Release.gpg
          key: keys/repo-signing.asc
          passfile: /run/secrets/gpg-password
    dists:
      el9:
        format: rpm                    # required: rpm or deb; fixed after creation
        limit: 2                       # newest versions kept; default 0 keeps all
        exclude:
          - kind: [debuginfo, debugsource, llvmjit]
      el10:
        format: rpm
        architectures: [x86_64]        # default: the workspace list
      bookworm:
        format: deb
        exclude:
          - kind: [dbgsym, dbg]
          - name: ["*-experimental"]
            arch: [aarch64]

targets:
  mirror:                              # copy to a local directory
    repository: pgsql
    provider: filesystem
    endpoint: file:///srv/www          # must already exist
    prefix: pgsql
    public_endpoint: https://repo.example.com/pgsql/
    max_cache_ttl: 5m
  cdn:                                 # upload to Cloudflare R2
    repository: pgsql
    provider: r2
    endpoint: https://0123456789abcdef.r2.cloudflarestorage.com
    bucket: packages                   # region defaults to auto
    prefix: pgsql
    credential: env://SOW_R2_CREDENTIAL
    public_endpoint: https://cdn.example.com/pgsql/
    max_cache_ttl: 24h

Check the file after every edit, then look at what SOW will actually use:

sow config check
sow config show -r pgsql

config check parses the file, compares it with the recorded state of each repository, and resolves every signing reference. It exits 0 when the file is usable, and otherwise:

  • 2: the file itself is invalid, such as a YAML error, an unknown field, a bad name, or a value outside its rule.
  • 6: the file is valid but cannot be applied. A signing reference does not resolve, the file drops a repository or Dist that already has state, or it drops an architecture that members or built Generations still use.
  • 5: a Dist’s format differs from the one it was created with.

config show prints the effective configuration with every default filled in and the resolved key fingerprints added. In a workspace with several repositories, select one with -r, or print the whole workspace with --all.

File rules

  • The file is one YAML document with schema: sow/v3. Unknown fields, duplicate keys, and a second document are errors.
  • It is named sow.yml or sow.yaml and sits at the workspace root as a regular file of at most 16 MiB. Reads follow a symlink to a regular file; sow init creates sow.yml and refuses a symlink. Having both sow.yml and sow.yaml as regular files is an error. With sow.yml, a repository directory named sow.yaml is allowed.
  • sow init, repo new/rm, and dist new/rm edit the file as part of their work. Policy, signing, and target settings are yours to edit. SOW applies defaults when it reads the file and never writes them back.
  • A repository or Dist you add by hand is only declared. Run sow init to create its state, or use sow repo new and sow dist new, which do both. To remove one, use sow repo rm or sow dist rm; deleting it from the file instead fails config check with exit 6, because its state still exists.
  • A frozen sow/v2 workspace is readable by config check, repo ls, repo show, dist ls, and dist show until you upgrade it with repo migrate.

Workspace

Field Type Default Meaning
schema string Required Must be sow/v3
architectures string list [x86_64, aarch64] CPU families that Dists in this workspace may build
repos map Empty Repository names and settings
targets map Empty Publication target names and settings

SOW knows two architecture families, x86_64 and aarch64. It accepts amd64 for x86_64 and arm64 for aarch64, and stores the canonical name. A list you write must not be empty or name the same family twice after that normalization. noarch and all are package architectures, not families, so they are rejected here; SOW adds those neutral packages to every view of a Dist on its own.

Repositories

Field Type Default Meaning
protected boolean false Refuses repo rm, even with -f
signing map Unsigned metadata; package mode: never Signing settings
dists map Empty Dist names and settings

protected guards against deleting the whole repository by mistake. It does not block package changes or dist rm. To remove a protected repository, set it to false, run sow config check, then sow repo rm.

Repository, Dist, and target names must match [a-z0-9][a-z0-9._-]* and must not be one of the reserved names ., .., .sow, pool, dists, sow.yml, workspace.lock, workspace-ops, or repo-locks. Each repository needs separate paths for its state directory, database, and SQLite sidecar files. For example, the database of repository db and the state directory of repository db.db would both be .sow/db.db, so the names cannot coexist.

Dists

Field Type Default Meaning
format string Required rpm or deb; cannot change after the Dist is created
architectures string list Workspace list Nonempty subset of the workspace families
limit integer 0 Newest versions to keep per binary package name and canonical architecture; 0 keeps all
exclude rule list Empty Exclusion rules

Adding an architecture marks the Dist dirty. sow build then generates the new view. Removing an architecture is rejected while members or built Generations still reference it. A build also rejects changes that withdraw a protected entry point, such as a published RPM architecture’s repomd.xml. See Published entry points.

limit must be zero or positive. RPM versions compare by epoch-version-release, with a caret snapshot sorting before the next point release (2.0^20250611 < 2.0.1); DEB versions use Debian ordering. Neutral packages (noarch, all) form their own group. limit removes older members when newer ones arrive, and relaxing it later does not bring them back: add their package files again.

Exclusion rules

exclude:
  - kind: [debuginfo, debugsource, dbgsym, dbg, llvmjit]
  - name: ["test-*", "*-experimental"]
    arch: [aarch64]

A package is excluded when any rule matches. A rule matches when all of its fields match, and a field matches when any of its patterns does. In the example, every debug package is excluded, and so is any test-* or *-experimental package built for aarch64. Exclusion runs before limit, over every candidate member of the Dist.

Field Matches
name Binary package name
source Normalized RPM SOURCERPM or DEB Source name
arch x86_64, aarch64, or neutral
kind From the package-name suffix. RPM: debuginfo, debugsource, llvmjit; DEB: dbgsym, dbg; all others: main
format rpm or deb

Patterns are case-sensitive exact strings or shell globs (*, ?, [...]). An empty rule, an empty or untrimmed pattern, a pattern repeated within one field, or an invalid glob is an error. Values are not checked against what packages can contain, so a typo such as kind: [debuginf] is accepted and matches nothing. See Membership policy for how to read the results.

Signing

Signing is configured per repository, in three independent blocks. Leave all three out and SOW publishes unsigned indexes and stores package files exactly as they arrived.

Block Signs Output
signing.rpm.metadata RPM index manifest repodata/repomd.xml.asc
signing.deb.metadata APT release manifest InRelease, Release.gpg
signing.rpm.packages RPM package files Signature embedded in each RPM

DEB package files are never re-signed; APT trusts them through the signed Release. Signing model explains key rotation, package reuse, and client setup.

RPM package settings

rpm.packages field Default Meaning
mode never without a key; fill with a key never, fill, or always
key None Key reference for the signer; required by fill and always
passfile None Password file; requires key
trusted_keys Empty Further public-key references whose signatures fill keeps
Mode Behavior Use when
never Store input bytes unchanged You do not sign packages, or must keep upstream bytes exactly
fill Keep packages whose signature verifies with key or a trusted key; sign the rest You mix upstream-signed packages with your own builds
always Keep packages already signed by key; re-sign every other package Every package must carry your signature

The public half of key is trusted automatically. A reference listed twice in trusted_keys is an error.

Package signing runs the host rpm command on a staged copy, so the private key must already be in the GPG environment that rpm uses. Naming a key file in key identifies the signer; it does not import the private key into that environment.

Metadata settings

rpm.metadata and deb.metadata take the same fields:

Field Default Meaning
key None Key reference; without it the index is unsigned
passfile None Password file; requires key
passphrase None Legacy password reference; requires key; cannot be combined with passfile

Key references

Form Example Resolves to
Path keys/repo.asc OpenPGP key file; a relative path starts at the workspace root
file:// file:///secure/repo.asc OpenPGP key file
env:// env://SOW_METADATA_KEY Variable holding armored key material, a file path, or a GPG key identifier
agent:// agent://7F721C4AD40F4A9D8CA578BFAC7E4690B50CCF3B Key in the local GPG environment

Environment variable names match [A-Za-z_][A-Za-z0-9_]*. A GPG key identifier is a 16-digit key ID or a 40- or 64-digit fingerprint, in either letter case.

A key file holds ASCII-armored or binary OpenPGP data, at most 16 MiB; comment lines outside the armor are tolerated. It can be a regular file or a symlink to one, such as a Kubernetes Secret mount. When SOW has the private key material, it signs metadata itself and supports RSA, EdDSA (Ed25519, Ed448), ECDSA, and DSA keys. When a reference resolves to a GPG key identifier, through agent:// or an environment variable, SOW calls external gpg instead.

A signing key must resolve to exactly one primary key. A trusted_keys file can hold several complete public keys, including consecutive armored blocks; SOW reads the whole bundle and rejects malformed or truncated input rather than silently using the first key.

Password files

A protected private key needs its password at signing time. SOW reads it from a file you name, so the password never appears in sow.yml, in a command line, or in an environment variable value. The same mechanism serves RPM packages, RPM metadata, and APT metadata, for key files and agent:// keys alike.

Which source applies. For each signing key, SOW takes the first source that is set:

  1. --passfile PATH on the command line, for every key the invocation uses.
  2. The key’s own passfile in sow.yml, or its legacy passphrase reference.
  3. SOW_GPG_PASSFILE, a default path for keys without a configured source.
  4. None: unlocking is left to the existing key, GPG, or RPM setup.
sow create ./packages -S 0123456789ABCDEF --passfile /run/secrets/gpg-password
export SOW_GPG_PASSFILE=/run/secrets/gpg-password
sow config check
sow build -r demo

passfile sits next to key under repos.<name>.signing.rpm.packages, signing.rpm.metadata, or signing.deb.metadata; there is no top-level setting. passfile: "" counts as unset. The command-line override does not bypass validation: a metadata key with both passfile and passphrase set is still rejected.

Paths. passfile takes a literal filesystem path, not a URL such as file:// and not a variable name. Paths from the command line or SOW_GPG_PASSFILE are relative to the process working directory, even with -C; paths in sow.yml are relative to the workspace root. SOW does not expand ~ or $VARIABLE in configuration or environment values (your shell expands them in command-line arguments), and it searches no default location. To reuse one file across commands, set SOW_GPG_PASSFILE to an absolute path. An empty SOW_GPG_PASSFILE is an error when it is the selected source and a password is needed; unset the variable instead.

File format. The file contains the password itself:

  • One nonempty line, at most 64 KiB including an optional line ending. An optional UTF-8 BOM is removed.
  • A final newline is optional; exactly one final LF or CRLF is removed.
  • Nothing is trimmed: leading and trailing spaces and tabs belong to the password. Quotes, #, and backslashes are literal; there are no comments, escapes, or NAME=value lines.
  • Rejected: an empty file, an empty line, NUL, a CR or LF inside the password, a bare final CR, and extra blank lines. A password made only of spaces is not empty.
  • The path can be a regular file, a symlink (including a Kubernetes Secret mount), or a named pipe. A pipe writer has two seconds to write the line and close its end.

Keep the file outside the repository and any public document root, normally with mode 0600 in a private directory. SOW does not insist on exactly 0600, so a read-only secret mount with suitable access control also works. Anyone who can read the file can read the password.

When it is read and how it fails. SOW reads the selected source only to sign or to run a signing check. A missing, unreadable, or malformed source fails the command; SOW does not try the next source or open a password prompt. With an explicit source, external GPG runs in batch loopback mode, which the agent must allow; a hardware key that requires a touch or PIN still requires it.

Without any source, an encrypted metadata key file still needs a password reference. External GPG metadata signing can use a key the agent has already unlocked, but runs with pinentry disabled. RPM package signing keeps its usual agent and macro behavior. An unprotected key needs no password file. SOW_GPG_PASSFILE only supplies a password: sow create still needs --sign-with to sign anything.

Commands that accept --passfile. create (with --sign-with), init, config check, repo new/rm/migrate, dist new/rm, add, rm, build, and export rpm-leaf. add --skip can still sign packages, and rm --check can render signed preview metadata. publish, local and target gc, and log prune accept it too, because finishing an interrupted operation can need a signer; recovery selects the source again from the current invocation and configuration. Query commands, config show, and check (which only verifies public signatures) never read password files. retain and prune do not accept --passfile.

What SOW does with the password. It never writes the value to logs, journals, configuration output, repository state, or public files. External GPG metadata signing receives it through a private file descriptor. RPM may call GPG several times per package, so RPM signing writes it to a 0600 file in a private sow-gpg-pass-* directory under $TMPDIR (or /tmp), then overwrites the file with zeros and removes it when the call returns; a process killed by force can leave it behind. If a signing tool fails, SOW reports a diagnostic drawn from at most 4 KiB of its stderr. Changing only a passfile path does not change a signing identity or mark any Dist dirty.

Passphrase references (legacy)

Metadata keys still accept the older passphrase field, as a path, file://, or env:// reference, including with GPG key identifiers. It has the same priority as a per-key passfile: it beats SOW_GPG_PASSFILE and loses to --passfile. Setting both passfile and passphrase on one key is an error. Prefer passfile in new configuration. Switching an existing key from passphrase to passfile can trigger one metadata rebuild, because the recorded configuration identity includes the old reference.

Legacy references keep their byte-oriented rules: at most 64 KiB, nonempty, no NUL; one final LF and then one final CR are removed. In-process signing accepts other bytes in such a password; external GPG requires a single line. Relative legacy file paths resolve from the workspace root, like key files.

Check signing settings

config check exits 2 for a malformed reference and 6 for one that does not resolve or cannot sign. It unlocks metadata key files and checks that they can sign; external GPG metadata keys also sign a probe. A wrong or missing password for an encrypted metadata key is reported as the key being unusable for signing. For RPM package signing, the check covers the password file’s format, the tools, and whether the secret key is available. It signs no package, so it cannot prove the password is correct; that happens when a package first needs signing.

config show adds public identities to the signing settings: key_fingerprint, and for active RPM package signing also key_snapshot_sha256, trusted_key_fingerprints, and trusted_key_snapshot_sha256s. The fingerprint and snapshot arrays are sorted independently, so do not pair them by index. These are output fields only; sow.yml does not accept them.

Publication targets

A target copies one repository’s public tree (pool/ and dists/) to a directory or an R2 bucket, so clients can install from somewhere other than the workspace host. sow publish TARGET uploads packages before the indexes that reference them and verifies the result at public_endpoint.

Field Provider Required Rule
repository Both Yes A repository defined in repos
provider Both Yes filesystem or r2
endpoint Both Yes Filesystem: file:///absolute/path, not /. R2: https://host with no path; http:// only for localhost, 127.0.0.1, or ::1
region R2 No Default auto; letters, digits, and -, 1–64 characters, case-insensitive
bucket R2 Yes DNS-safe name: 1–63 characters of a-z, 0-9, ., -, starting and ending with a letter or digit, no ..
prefix Both No Relative path under the endpoint; empty means the storage root
credential R2 Yes env://NAME or file:///absolute/path
public_endpoint Both Yes URL where SOW verifies published files. R2: http(s)://; filesystem: http(s):// or file://
max_cache_ttl Both Yes Go duration from 0 up, such as 0s, 5m, or 24h
authoritative_workspace Both No Default true; false or null is rejected
single_writer Both No Default true; false or null is rejected
exclusive_write_authority Both No Default true; false or null is rejected

A filesystem target rejects region, bucket, and credential. SOW normalizes what it can: scheme and host case, default ports, a trailing slash on endpoint, the trailing / that public_endpoint always gets, and durations (24h becomes 24h0m0s). The rest must already be canonical:

  • prefix has no leading or trailing /, no empty, ., or .. segment, no backslash, ?, #, or percent-encoded separator, and only visible ASCII characters.
  • endpoint and public_endpoint carry no user name, query, or fragment, and the public_endpoint path has no . or empty segments.
  • A file:// public_endpoint must name the published directory itself, the endpoint path plus prefix; publish rejects any other directory.

Cache lifetime. max_cache_ttl is the longest time a client, proxy, or CDN may keep a published file. Target GC keeps the files a publication superseded for at least that long after the publication, so stale indexes in caches still find their packages. Set it to the longest cache lifetime your HTTP service uses. With 0s, superseded files may become candidates at the next target GC, subject to existing deadlines and live references. R2 reports candidates by default and requires --delete for deletion. The maximum accepted value is Go’s maximum duration minus 24 hours, inclusive.

Ownership. The three authority fields state the assumption target GC depends on: this workspace is the only writer under the target’s prefix. They default to true and cannot be turned off. For the same reason two targets cannot overlap. On the same storage, their prefixes must not be equal or nested, and an empty prefix overlaps everything; two R2 targets with the same endpoint and bucket count as the same storage whatever their region. Filesystem targets must not resolve to the same or nested directories.

Filesystem endpoint. Create the endpoint directory before the first publish. It must be a real directory, not a symlink; SOW creates the prefix below it.

R2 credentials. The variable or file named by credential holds one JSON document:

{"access_key_id":"YOUR_ACCESS_KEY_ID","secret_access_key":"YOUR_SECRET_ACCESS_KEY"}

session_token is also accepted. Unknown fields, trailing data, missing keys, and values over 64 KiB are rejected. A credential file must resolve to a regular file; a symlink to one is accepted. config check validates only the form of the reference; an unset variable or unreadable file shows up when publish or target gc runs, which then exits 5. Credentials never appear in the public tree or in config show.

Published entry points. A configured target protects the paths in its published Generation for repomd.xml, Release, InRelease, Release.gpg, and repomd.xml.asc. Builds can update these files and rotate checksum-named metadata. A change that removes a protected path, such as dropping a published RPM architecture view or disabling its metadata signature, exits 6 with mutation would withdraw published pointer. Retire or move the target binding before withdrawing that path.

Changing a target. The first publish binds the target to its repository, provider, storage identity (endpoint, region, bucket), and prefix. To change the target name, public_endpoint, or max_cache_ttl afterwards, edit the file and accept the change with publish --rebind. The repository, provider, endpoint, region, bucket, and prefix cannot be rebound; configure a new target instead. Pending target maintenance can block a TTL or public_endpoint change until it completes.

Fixed settings

Some things have no field because SOW derives them. A repository always lives at <workspace>/<name>. APT indexes always use the component main. Architecture views follow from Dist configuration and package headers. Generations are kept with retain, not with a count in the file.

See Repository layout for where these paths land and Exit codes for scripting against config check.

Table reader