Source ingestion
pl up packages your local checkout and uploads it to Pushleft before the build starts. This page shows what the CLI sends and which files it leaves out. It also shows how the API checks and stores the upload, and when Pushleft deletes old sources.
Quick start
- Run
pl upin your checkout. The CLI packages the source and uploads it toPUT /v1/deployments/{id}/source. It prints a verified source receipt. - To keep files out of the upload, list them in
.gitignoreor.plignore. As in git, a file that git tracks is uploaded even when a.gitignorerule matches it (it was added withgit add -f). To leave out such a file, list it in a.plignore. Both files use the.gitignorepattern rules: a name without a leading slash matches at any depth.apps/leaves out every folder namedapps, alsomodels/applications/apps. Write/apps/to leave out only the folder in the root. In a git checkoutplneedsgitto list those files. Without it (a CI image with no git, or a checkout git refuses as unsafe), the upload stops. - Keep secrets out of the checkout. Use secret references in your manifest.
The build executor then downloads the verified archive through the agent gateway and builds it.
Configuration
Operators enable ingestion with two settings. Both are required together:
PUSHLEFT_SOURCE_ROOT: a dedicated private local directory. Its parent must already exist.PUSHLEFT_BUILD_REGISTRY: an administrator-controlled registry origin, with optional port, without a scheme or path.
The API still refuses non-loopback binding with development authentication (modes). Storage is not exposed as a static directory or a public download endpoint.
Shared-UID attackers and concurrent hostile changes to the checkout or the private storage tree are outside the filesystem threat model. A production deployment needs a dedicated service identity and private storage mount with durable backup, or the verified S3-compatible store.
Transport and limits
The wire type is application/vnd.pushleft.source+tar.zstd. The X-Source-SHA256 header contains the lowercase SHA-256 of the compressed bytes.
- The server verifies the bytes itself.
- The archive must contain a
.pl.yamlbyte-for-byte equal to the deployment’s immutable manifest. The CLI includes inferred manifests. - Git metadata describes the checkout but does not prove that its contents match a commit. The snapshot digest is authoritative, including local changes.
| Limit | Value |
|---|---|
| Compressed size | 2 GiB |
| Expanded size | 4 GiB |
| Per file | 1 GiB |
| Files | 20,000 |
| Path length | 240 bytes |
| Path components | 32 |
Each API process has six upload slots, so a CI job can deploy several previews at once. A request acquires a slot before buffering and has a 30-minute body deadline (2 GiB at about 10 Mbit/s). Archives are buffered in memory, so each slot can hold up to 2 GiB: 12 GiB in all. When every slot is taken, the request gets 429 source_upload_busy; retry it after a short wait. The slot stays owned by the blocking decode and store work even if the HTTP future is cancelled. A public service still needs multi-replica or global rate limiting.
Archive format
The API accepts only regular USTAR entries and one bounded-window Zstandard frame. It rejects:
- Symlinks, hardlinks, devices and sparse files.
- Extension headers, traversal, duplicate names and file or ancestor aliases.
- Unsafe mode bits.
- Malformed or truncated archives, and trailing frames or data.
The API does not extract the archive. The extractor must create fresh private files with explicit modes, and must not restore archive ownership or other privileged metadata. The CLI normalizes ownership and timestamps. It keeps only whether a regular source file is executable. The CLI refuses symlink and hardlink source files, and does not dereference them.
Excluded files
The CLI honours .gitignore and .plignore. It always excludes dependency and build directories, VCS internals and common credential paths and extensions, whatever the ignore negations say.
This filename policy is not secret scanning. Credentials inside ordinary source or configuration files can still be uploaded. Use secret references, check what the upload includes, and keep secrets out of repositories. Content scanning and a source-inclusion preview are planned.
Admission, durability and retries
The API admits an upload in four steps:
- Authenticate, bound the request body and validate the archive, digest and manifest.
- Lock the build job, then the active deployment. Verify the undispatched provenance and serialize organization storage admission. Commit one immutable
source_upload_claimsrow per deployment. This row reserves the exact digest and object key, registry repository, byte and file counts, and stable snapshot and artifact IDs before any object write. It also recordstree_sha256, a digest of every file’s path, mode and content except.pl.yaml, which build reuse matches on. - Store only those exact bytes under a key scoped to the deployment and organization. Use a private staging file, fsync and no-overwrite publication. On a replay, existing objects are byte-checked and fsynced. A changed digest is rejected before object publication, so it leaves no orphan.
- Recheck the durable claim, build intent and active deployment. In one step, insert the verified snapshot, attach stable source and artifact provenance to the queued untargeted build job, and emit one
source_verifiedevent. Nothing about capacity, build completion or runtime readiness is inferred.
Retries. A cancel after the claim commit or object publication leaves one bounded, resumable claim or object.
- Retrying the same upload resumes the same IDs. Different bytes need a new deployment.
- If a teardown wins before final publication, the snapshot and job are not published.
Quota. Claims stay charged to quota until retention GC releases them (below). Cancelling an upload cannot evade storage admission.
- The defaults are 20 GiB and 1,000 unreleased claims per organization.
PUSHLEFT_SOURCE_MAX_ORG_BYTESandPUSHLEFT_SOURCE_MAX_ORG_CLAIMSset those limits.- Tenant SQL policies permit claim reads, but never writes or assertions of verification.
Tests.
npm run test:source-ingestionruns migrated PostgreSQL tests for claims, quota, replay and lifecycle. It also runs the body-deadline and blocking-cancellation checks, and real probes from the CLI through HTTP to the object and SQL.cargo test -p pushleft-sourcecovers deterministic packaging, exclusion rules, private immutable storage and hostile archive forms.
Retention and verified garbage collection
Retention releases the sources and images of old releases, so they stop counting against quota. The code is migration 0028_source_retention.sql and scheduler src/retention.rs.
Admission rows are never deleted. A release is recorded once on the immutable row, in these columns:
source_upload_claims.released_atandrelease_reason(abandoned,retired,torn_down), andobject_deleted_at.source_snapshots.object_released_at.release_artifacts.image_released_atandimage_release_status(deleted,unsupported,failed).
The immutability trigger lets only these columns change, and only from NULL. The one exception: a failed registry status may be retried. Identity changes and DELETE are still refused. Quota counts only claims where released_at IS NULL.
Eligibility:
- Abandoned: a claim with no verified snapshot, older than
PUSHLEFT_SOURCE_CLAIM_TTLseconds (default 86400), on a deployment that is not in a protected state. - Finished, source only (decided 2026-11-10): Pushleft can fetch the source again from git, so a finished release keeps no archive. A
supersededorcancelleddeployment releases its source at once. Afailedone releases it after 24 hours, so you can retry it. The live release keeps its archive for the daily source scan. The rules below still apply to the image. - Retired, production: the deployment is
superseded,cancelledorfailed, and itsupdated_atis older thanPUSHLEFT_RELEASE_RETENTIONseconds (default 604800) or the organization’ssource_retention_days. It must not be among the environment’s lastPUSHLEFT_RETAINED_RELEASES(default 3, or the organization’sretained_releases) successful releases. A successful release is aliveorsupersededdeployment with an artifact. These releases are kept for rollback. - Retired, not production: in a preview or test environment, a
superseded,cancelledorfaileddeployment is released at once. The window and the release count apply to production only, so these environments have no rollback targets (decided 2026-11-05). - Torn down: the deployment is
destroyed, or it is finished and its project is deleted. It is released at once (deleted projects). - Always: no
application_instancesrow of the deployment isdeployingorready, and no ingress route of the deployment ispublishing,activeordraining. Protected states are never released:queued,building,deploying,ready,running,live,degradedandteardown_queued.
The scheduler runs at most one pass per minute, and only when PUSHLEFT_SOURCE_ROOT is set. It must be the same private tree as the API’s. Each pass has two phases:
- Mark. One transaction locks eligible deployments and claims
FOR UPDATE SKIP LOCKED.SKIP LOCKEDskips an upload that holds the deploymentFOR SHARE. The transaction sets the release columns and appends onesource_releasedand/orartifact_releaseddeployment event. No filesystem or registry I/O happens inside it. - Delete, outside DB locks.
SourceStore::remove_verifiedchecks the key grammar again. It refuses symlinked components, non-regular files and hard-linked files.- It deletes only bytes that hash to the recorded digest, then fsyncs the parent. A missing object is a no-op. On success, it sets
object_deleted_at. On a mismatch, it refuses and logs, and the next pass retries. - Registry manifests are deleted with
DELETE /v2/<name>/manifests/<digest>on the snapshot’s recorded repository. The scheduler uses adelete-only token from the gateway’s realm. The registry’s own GC reclaims the blobs (registry blob GC). - 2xx and 404 record
deleted. 405 (delete disabled) recordsunsupported. Anything else recordsfailed, which is retried. - A digest that an unreleased artifact still references is not deleted. Without a realm, images stay marked until one is configured.
A crash between the phases leaves rows marked and bytes present. The next pass deletes them. PUT /v1/deployments/{id}/source on a released claim returns 409 source_retired (“deployment is retired …”), and the CLI prints that message.
npm run test:retention runs these tests:
- The migrated-PostgreSQL eligibility, idempotency, crash, trigger and per-organization policy tests.
- The reaper, idle-preview and event-retention tests, the policy API test, and a stub-registry status test (retention).
- The real build E2E. It ends by retiring its release against the token-auth zot registry. It checks that the object is gone, the manifest returns 404, the rows and events remain, and the quota dropped.
Retention describes the per-organization settings, the stale-deployment reaper, idle preview teardown, event retention, registry blob GC and the S3 source store.
Remaining retention gaps:
- Registries with delete disabled record
unsupportedand keep the image. - The scheduler deletes with a
delete-only bearer token from the gateway’s realm (registry tokens). Plain HTTP is used only for a loopback registry. - A rebuild could push an identical digest into the same repository between the reference check and the
DELETE. That rebuild could lose its manifest. A registry-side reference lock is needed. - On the S3 store, GC’s read-verify-delete is not atomic (no conditional delete on the ETag).
- The throttle is in-process. Several scheduler replicas are safe (row locks) but do redundant work.
Builder source delivery
The mTLS agent gateway serves POST /v1/agent/jobs/{id}/source. It returns the exact archive only to the node that holds the current targeted build_image lease. All of these must be true:
- The node is a build-pool node with isolated-build capabilities.
- The deployment is active.
- The claim, snapshot, artifact and plan provenance agree.
The gateway reads the bytes and checks them against the claimed length and SHA-256 outside database locks. Then it repeats authorization before it sends any byte.
Remaining gaps:
- With the local store, the gateway and API must share one private filesystem tree, with a service identity that can read it. With
PUSHLEFT_SOURCE_S3_*(S3-compatible store), they can run on separate hosts. That mode is proven against Garage (the R2 stand-in) at the store level. No full upload-build run has tested it yet. - The gateway does not re-run full archive validation (
verify). It trusts the ingest-time verification through the immutable digest. The digest check catches any later change to the bytes. - Slots are per gateway process. There is no global or per-organization download rate limit.
- The migrated tests inject the race between the read and the reauthorization (teardown or lease loss) by calling those steps directly. No test cancels a live HTTP download during the blocking read.
Related
- Isolated build executor: how the archive becomes an image.
- Agent gateway: how a build node gets the source.
- Retention: per-organization windows and the S3 store.
- The .pl.yaml manifest: the manifest that every upload must carry.