Skip to content
TrianaLabPublic

About

Pacto tells you which services a change breaks before it ships, and checks what is actually running. One YAML contract per service in your OCI registry; opt-in delivery (alpha) ships what the contract graph clears.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

39 stars

Watchers

0 watching

Forks

Latest commit

 

History

499 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CI Docs PkgGoDev codecov GitHub Release Artifact Hub License: MIT

Pacto

Pacto tells you which services a change breaks before it ships, and checks what is actually running.

A contract is one YAML file per service: who owns it, what it offers, which services it calls and which of their versions it accepts. You publish it to the OCI registry you already run.

Documentation · Quickstart · Specification · Examples · Live demo

Why Pacto exists: MANIFEST.md

The Pacto dashboard overview on the demo fleet: it answers "Is anything wrong?" with three running targets that break their contract, one that fails its health check and four invalid revisions, warns that the snapshot is missing data and shows the declared ↔ observed match and contract completeness above the fleet map The Pacto dashboard overview on the demo fleet: it answers "Is anything wrong?" with three running targets that break their contract, one that fails its health check and four invalid revisions, warns that the snapshot is missing data and shows the declared ↔ observed match and contract completeness above the fleet map


Who breaks before you ship

When auth is about to ship 3.0 and both consumer contracts are in the current folder, pacto impact reads the version range each consumer declares:

pacto impact ./auth-2.1.0 ./auth-3.0.0 --local .

pacto impact for auth 2.1.0 to 3.0.0: classification BREAKING with one breaking change, two affected consumers (checkout incompatible, owned by commerce; reporting compatible by range, owned by analytics) and release gate unverified because nothing says where the consumers run

The folder says nothing about where the consumers run, so the release gate is unverified and the command exits 2. It exits 1 when an incompatible consumer runs on a known target.

pacto diff works in any pull request and says whether a change is breaking. pacto impact says which consumers it breaks once Pacto can see your fleet: pass the consumer contracts with --root, or read a live fleet with --k8s or --evidence-url. With --local alone it sees only the contracts in that folder, so it cannot know who else consumes the service.

- name: Check for breaking changes
  run: pacto diff oci://ghcr.io/acme/contracts/my-service .

pacto diff exits 1 when the change is BREAKING, so the check fails. Put it in your repository sets up the whole job.

The dashboard's Change analysis shows both answers on one page. Here it compares two versions of payments-service in the live demo:

Change analysis in the dashboard for payments-service 1.2.1 to 2.0.1: breaking and blocked, with four affected consumers, two of them incompatible Change analysis in the dashboard for payments-service 1.2.1 to 2.0.1: breaking and blocked, with four affected consumers, two of them incompatible

Check what is actually running

Pacto compares what a running service does on the network with what its contract declares. It watches TCP connections in the Linux kernel with eBPF (small programs the kernel runs on events) and reports a declared port nobody listens on, or a declared dependency the service keeps failing to reach. pacto run wraps one command, pacto agent watches a host and the Kubernetes operator can deploy the same agent on every node (opt-in, nodeAgent.enabled).

Full results need Linux 5.11 or later with BTF (kernel type information) and cgroup v2. They also need root or the BPF, PERFMON and SYS_PTRACE capabilities. Off Kubernetes, Linux 5.8 to 5.10 also works with the SYS_RESOURCE capability. On Kubernetes the node agent has no SYS_RESOURCE, so plan for 5.11 or later. See Runtime conformance.

Generate contracts from what you have

pacto init reads a service's Dockerfile and Kubernetes manifests and writes a contract, with a list of what it could not tell. The workload's environment becomes a configuration schema, a URL that names another service becomes a dependency and a probe becomes a health check. It takes many folders at once, and --plan shows the result without writing anything:

pacto init --plan --output-format json services/checkout services/payments
pacto init --cluster --namespace shop --out drafts --plan

--cluster drafts a contract for every workload in the namespace that no Pacto resource describes. See Generate contracts from what you already have.

Where Pacto is going: delivery and the autonomy ladder

When you are ready, Pacto's opt-in delivery component ships the changes the contract graph clears. Flux or Argo CD still apply every version.

Status: alpha. Needs Kubernetes 1.30 or later with Flux; Argo CD is experimental. Signed records, and so the two automatic autonomy levels, need a registry that serves the OCI Referrers API. GHCR does not serve it.

Each Stage, one service in one environment, climbs the autonomy ladder from observe, where Pacto moves nothing, to autonomous. A person confirms every step up. A change that breaks a consumer waits for that consumer's owners, and when Pacto cannot see enough it answers Unknown and waits for a person.

GitlessOps means signed artifacts in your registry and evidence decide which version runs where, while your code and manifests stay in git. Read how delivery works and what GitlessOps means.

Pacto delivery builds on Flux's Gitless GitOps, ConfigHub's configuration as data and Anthropic's Scion; the manifesto says what it takes from each.

Known limitations

  • A default Helm install probes health and observes metrics only in namespaces labelled pacto.trianalab.io/observe; elsewhere it observes health passively and reports declared metrics Unsupported. Set controller.probing and controller.metricsObservation to on to check them in every namespace; see opt-in features.
  • The opt-in node agent needs Linux 5.11 or later with BTF on every node; see requirements.
  • Signed delivery records and evidence need a registry that serves the OCI Referrers API; see registry conformance.
  • Delivery is alpha and runs only on Kubernetes; see delivery.
  • pacto init skips Helm chart templates and does not read Compose files; see Generate contracts from what you already have.

The operator's limits are listed in Limitations.

What you keep if you stop using Pacto

Pacto invents three files: pacto.yaml, an optional .pactoignore and the pacto.lock that pacto lock writes. Nothing outside Pacto reads any of them. In a cluster, the Pacto and delivery custom resources are Pacto's too. That is the whole of the lock-in. Everything those files wrap stays yours, and you can check that:

  • The contract source is yours already. pacto.yaml and the files beside it are plain YAML and JSON living in your repository, and the interfaces inside are the OpenAPI, AsyncAPI, gRPC and JSON Schema documents you maintained before Pacto existed. Delete the tooling and those files are unchanged.
  • The registry is yours already. A published bundle is an ordinary OCI artifact in your own registry, such as GHCR, ECR, ACR or Artifactory. Signed delivery records and evidence also need a registry that serves the OCI Referrers API, which GHCR does not. Nothing is stored on infrastructure operated by the project. Pacto can record what it catches as unsigned statistics in a registry you name; pacto stats and the dashboard Metrics page total them, and nothing leaves your registry. Measure what Pacto does shows how.
  • A published bundle opens without Pacto. It is a gzipped tar layer, so standard OCI tooling is enough to get the files back out (below).
  • Removing the runtime side leaves your workloads untouched. The operator controller observes workloads and never modifies them, so uninstalling it stops the checking and leaves every workload exactly as it was. The opt-in delivery component writes only the version digest on the Flux or Argo CD source that applies each environment, so removing it leaves each environment on the last version it moved. Uninstalling does take Pacto's own components with it: the managed dashboard and Evidence Server are garbage-collected along with the controller, and a few cluster-scoped objects outlive the release and need deleting by hand. Both removal paths, and every object that survives them, are written down: uninstall the CLI and uninstall the operator.

Unpacking a published bundle with no Pacto binary anywhere in reach needs oras and jq, neither of which is a Pacto tool:

REPO=ghcr.io/your-org/your-service
TAG=1.0.0
DIGEST=$(oras manifest fetch "$REPO:$TAG" | jq -r '.layers[0].digest')
oras blob fetch --output bundle.tar.gz "$REPO@$DIGEST"
tar -xzf bundle.tar.gz    # pacto.yaml, interfaces/, configuration/, sbom/

How Pacto fits with other tools

Pacto composes the interface tools it sits between, such as OpenAPI and config schemas, and complements the deploy tools, such as Helm and Terraform. Its core makes no deployment decisions. The opt-in delivery component decides which version runs where and leaves applying it to Flux or Argo CD.

How Pacto relates to other tools compares Pacto with nearby projects, with the criteria, a source for each row and where each tool wins.

Installation

curl -fsSL https://raw.githubusercontent.com/TrianaLab/pacto/main/scripts/get-pacto.sh | bash

Installation covers go install, building from source, pinning a version, installing without sudo and uninstalling.

Documentation

Full documentation at pacto.run.

Where to start picks the page for what you came to do.

Every term is in the glossary, and every command in the CLI reference.


License

Fully open source under the MIT license, delivery included, with no hosted service.

About

Pacto tells you which services a change breaks before it ships, and checks what is actually running. One YAML contract per service in your OCI registry; opt-in delivery (alpha) ships what the contract graph clears.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

39 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages