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

Lockfile Format

Status: 🟢 Implemented — generated, read, and verified on every build.

Kargo.lock records the exact resolution of your dependency graph: every artifact, its version, its checksum, and where it came from. A build with a current lockfile performs no version resolution.

You do not edit this file. kargo add, kargo remove, kargo update, and kargo lock write it.

Shape

[[package]]
name = "kotlinx-coroutines-core"
group = "org.jetbrains.kotlinx"
version = "1.8.0"
checksum = "sha256:1a2b3c…"
source = "https://repo.maven.apache.org/maven2"
scope = "compile"
targets = ["jvm", "ios-arm64"]

[[package.dependencies]]
name = "kotlin-stdlib"
group = "org.jetbrains.kotlin"
version = "1.9.21"

[[package]]
name = "kotlin-stdlib"
group = "org.jetbrains.kotlin"
version = "1.9.21"
checksum = "sha256:4d5e6f…"
source = "https://repo.maven.apache.org/maven2"
scope = "compile"
targets = ["jvm", "ios-arm64"]

[[package]]

FieldTypeDescription
namestringMaven artifact id.
groupstringMaven group id.
versionstringThe exact resolved version.
checksumstringsha256: or sha1: digest of the artifact.
sourcestringRepository URL the artifact came from.
scopestringResolved scope: compile, runtime, provided, test, ksp, kapt. tool marks a jar Kargo provisions for itself, such as the test launcher.
targetslistTargets whose graph includes this package.
packagingstringWhat the package publishes, when that is not a jar: aar for an Android library.

[[package.dependencies]]

The edges of the graph, as name, group, and version triples pointing at other [[package]] entries. Storing edges rather than a flat list is what lets kargo tree --why reconstruct the path to any artifact without re-resolving.

Properties

Deterministic. Packages are written in sorted order with sorted fields, so resolving the same manifest twice produces byte-identical output. A diff shows dependency changes, not reordering noise.

Complete. Every transitive artifact appears, not just your direct dependencies.

Verified. Checksums are checked on download and on cache reads. A corrupted or substituted artifact fails the build rather than reaching the compiler.

Atomic. The file is written to a temporary file in the same directory and then renamed, so an interrupted write cannot leave a truncated lockfile.

Per-target aware. The targets field records which targets include each package, so a multiplatform project can resolve different artifacts per platform within one lockfile.

Commands

kargo lock              # resolve the manifest and rewrite the lockfile
kargo fetch             # download everything the lockfile names
kargo fetch --verify    # re-verify checksums of cached artifacts
kargo update            # move to newer compatible versions
kargo update --dry-run  # show what would change

Committing it

ProjectCommitReason
ApplicationYesEvery machine and CI run builds an identical graph.
LibraryUsually notConsumers resolve their own graph; yours has no effect on them.

For a library, committing the lockfile pins only what your own CI tests against. That is a defensible choice — just know it does nothing for your users.

When it is regenerated

ActionEffect
kargo add / kargo removeIncremental update for the changed dependency.
kargo updateVersions re-resolved within the allowed range.
kargo lockFull re-resolution from the manifest.
Editing Kargo.toml by handThe next build detects the mismatch and re-resolves.
kargo build with a current lockfileNo resolution at all.

Merge conflicts

A conflict in Kargo.lock is not worth resolving by hand. Take either side and regenerate:

git checkout --theirs Kargo.lock
kargo lock

The result is deterministic, so you will get the correct file regardless of which side you started from.

Next