Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Global Configuration

Status: 🟢 The file is read and most keys are honored. ⚪ Remote cache keys parse but have no transport yet, and [lint] / [format] defaults await the linter.

~/.kargo/config.toml holds machine-wide settings: parallelism, cache location, credentials, toolchain preferences. On Windows, %USERPROFILE%\.kargo\config.toml.

Project settings in Kargo.toml always win. Global config is for what belongs to the machine, not the project — nothing here should be required for a checkout to build.

A complete example

[build]
jobs = 8
default-target = "jvm"
compiler-backend = "build-tools"

[repositories]
google = "https://maven.google.com"
internal = "https://nexus.example.com/repository/maven-public"

[credentials.my-nexus]
username = "deploy"
token-cmd = "op read 'op://Dev/Nexus/token'"

[cache]
dir = "~/.kargo/build-cache"
max-size = "10GB"
write = true
remote = "https://cache.example.com/kargo"
remote-auth = "${env:KARGO_CACHE_TOKEN}"
remote-push = false

[toolchain]
kotlin-mirror = "https://mirror.example.com/kotlin/releases"
auto-download = true
jdk = "/usr/lib/jvm/java-25-openjdk"

[lint]
default-rules = ["naming", "style"]

[format]
style = "official"

[build]

KeyTypeDefaultDescription
jobsintegerCPU count⚪ Parallel compilation jobs. Parsed and exported as KARGO_JOBS; nothing acts on it yet.
default-targetstringnoneTarget used when a project declares several and you pass no --target.
compiler-backend"cli" | "build-tools""build-tools"How the compiler is invoked. build-tools compiles incrementally; cli spawns kotlinc.
daemonbooltrueReuse a long-lived compiler process between builds.

jobs has no effect today, and setting it will not change a build. Two separate reasons, both worth knowing:

  • There is one compilation unit per build — every main source set is flattened into it — so there is no second compile for a job limit to schedule. See the unit graph.
  • Within that one unit, the only parallelism the Kotlin compiler offers is -Xbackend-threads, and Kargo does not pass it. Its code-generation workers append to unsynchronised lists in every version Kargo supports, so a build that uses it can fail with an internal compiler exception instead of compiling — rarely, and never twice in the same place. You can still pass it yourself through [profile] compiler-args, with that risk.

jobs does not bound downloads either. Those are capped separately at 8 concurrent requests, which is about being a good citizen towards a repository rather than about this machine's cores, so the two are deliberately not the same number.

The default, build-tools, compiles through the Kotlin Build Tools API, so a one-file change recompiles one file rather than the whole source set. It needs Kotlin 2.4 or later and a JVM or Android target, and downloads about 60MB of its own jars once per Kotlin version; a build it cannot serve compiles with kotlinc instead and never fails for the backend's sake.

compiler-backend = "cli" pins the old behaviour, and KARGO_COMPILER_BACKEND=cli (or =build-tools) chooses for a single build. See Incremental Compilation.

[repositories]

A map of name to URL, merged with each project's [repositories]. For repositories every project on this machine should see — an internal mirror, for instance.

[repositories]
internal = "https://nexus.example.com/repository/maven-public"

Credentials do not belong here. Use [credentials].

[credentials]

Named credential sets that a project references by name, so a shared manifest never needs to know how your machine stores secrets.

[credentials.my-nexus]
username = "deploy"
password = "literal-but-please-do-not"

[credentials.ci-registry]
username = "ci"
token-cmd = "secret-tool lookup service registry"
KeyTypeDescription
usernamestringBasic auth user.
passwordstringBasic auth password or token.
token-cmdstringCommand whose stdout is the credential.
# in a project's Kargo.toml
[repositories]
internal = { url = "https://nexus.example.com/maven", auth = "my-nexus" }

Prefer token-cmd. It keeps the secret in your password manager rather than in a plaintext file, and it works with anything that has a CLI — 1Password, pass, secret-tool, Vault.

[cache]

KeyTypeDefaultDescription
dirstring~/.kargo/build-cacheLocal build cache location, which KARGO_HOME moves along with everything else Kargo keeps globally.
max-sizestring10GBLRU eviction threshold. "500MB", "10GB". A value that is not a size is reported and ignored, leaving the default.
writebooltrueWhether a build stores its output here. Reading is unaffected: false still restores from entries that are already there.
remotestringnone⚪ Remote cache base URL.
remote-authstringnone⚪ Bearer token for the remote cache.
remote-pushboolfalse⚪ Whether this machine uploads.

dir is the build cache — your compiled output. Downloaded Maven artifacts are a separate cache with a separate lifetime, and it is not configurable here: it follows KARGO_HOME (see Paths).

Keep remote-push = false on developer machines. A cache any client can write to lets whoever can push an entry decide what your next build compiles to.

See The Build Cache.

[toolchain]

KeyTypeDefaultDescription
kotlin-mirrorstringJetBrains releasesAlternative download source.
auto-downloadbooltrueFetch missing toolchains automatically.
jdkstringdiscoveredA major version, or an absolute path.

auto-download = false is the air-gapped setting: builds then fail naming the missing version instead of attempting a download.

See Toolchains.

[lint] and [format]

⚪ Defaults for projects that declare none. Awaiting the linter.

[lint]
default-rules = ["naming", "style"]

[format]
style = "official"

Precedence

For any setting, later wins:

  1. ~/.kargo/config.toml
  2. Kargo.toml
  3. .kargo.env (for ${env:…} values)
  4. The process environment
  5. Command-line flags

So kargo build --offline beats any configured value, and a project that pins [toolchain] jdk beats your machine's default.

Inspecting

kargo self info     # paths, versions, sizes
kargo env           # resolved environment, secrets masked

Paths

PathContents
~/.kargo/config.tomlThis file
~/.kargo/toolchains/Kotlin compilers, managed JDKs, Android SDK
~/.kargo/cache/Maven artifacts, in Maven layout
~/.kargo/build-cache/Compiled output, content-addressed

~ is expanded in dir values.

Next