agentleFS
MicrosoftKnown publishermicrosoft/brewlet/integration-tests/AGENTS.md

brewlet / integration-tests

AGENTS.md0 starsChanged 2 months agoMITView on GitHub

The strict scenarios in e2e/live/ are independent of the legacy tiers below. Run python3 integration-tests/e2e/live/hpa.py or python3 integration-tests/e2e/live/admission.py from the repository root. They create their own uniquely named clusters and registries; never pass a shared kube context or run the tier reset helper for them. Mandatory assertions fail instead of skipping. .github/workflows/e2e.yml has separate scheduled/manual live jobs, each running twice on fresh clusters; it has no push/PR triggers. See the live-validation runbook for release pins, capacity, load leases, stabilization, fixture-only…

  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.

    Of the AGENTS.md files we read, the 11,736 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

The file

We split this AGENTS.md into the rules it gives an agent

5 rules. About 0 are common, 3 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Run against the monorepo checkout:

    line 27
  2. Very specific:

    test pods, kubectl run clients, the webhook Deployments and the Helm-installed operator/admission/uninstall pods get a matching …

    line 54
  3. Distinctive:

    Run the fixture safeguards independently with:

    line 170
  4. Distinctive:

    Run tier 19's SBOM sweep logic offline (fake CLI, no cluster) with:

    line 177
  5. Very specific:

    Run ./e2e/run.sh --reset before repeating Kubernetes tiers.

    line 184

≈ “Common” is an estimate: at least 1 in 5 of the 16,597 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

Brewlet E2E runbook

Isolated admission and CPU HPA scenarios

The strict scenarios in e2e/live/ are independent of the legacy tiers below. Run python3 integration-tests/e2e/live/hpa.py or python3 integration-tests/e2e/live/admission.py from the repository root. They create their own uniquely named clusters and registries; never pass a shared kube context or run the tier reset helper for them. Mandatory assertions fail instead of skipping. .github/workflows/e2e.yml has separate scheduled/manual live jobs, each running twice on fresh clusters; it has no push/PR triggers.

See the live-validation runbook for release pins, capacity, load leases, stabilization, fixture-only TLS/HTTP exceptions, evidence, cleanup, and the acceptance mapping. Keep component-test and live-run claims distinct; preserve the preview limitations until the corresponding runs pass.

Offline safeguard checks:

PYTHONDONTWRITEBYTECODE=1 python3 -m unittest discover \
  -s integration-tests/e2e/live -p '*test*.py' -v

Reliable invocation

Run against the monorepo checkout:

integration-tests/e2e/run.sh --reset
integration-tests/e2e/run.sh

Set E2E_KUBE_CONTEXT to pin the run to one context: the harness writes a private, minified kubeconfig into the work directory and exports KUBECONFIG, so a concurrent kubectl config use-context cannot redirect a running suite.

Managed clusters (AKS and other real VMs)

By default the node-side tiers reach nodes with docker exec/docker cp, so only kind/Docker Desktop nodes are provisionable. To run them on real nodes:

E2E_KUBE_CONTEXT=my-aks \
E2E_NODE_ACCESS=kubectl \
E2E_POOLS=javaworkers \
integration-tests/e2e/run.sh --reset --tier 1 --tier 2  # ...or list every tier
  • Live clusters are shared, so with E2E_NODE_ACCESS=kubectl the suite is always confined to the node pool(s) in E2E_POOLS (comma-separated, default javaworkers). run.sh labels those nodes e2e.brewlet.sh/node=true (removed on exit and by --reset) and nothing lands on other pools:
    • test pods, kubectl run clients, the webhook Deployments and the Helm-installed operator/admission/uninstall pods get a matching nodeSelector, and the bare brewlet RuntimeClass the tiers create carries it in scheduling.nodeSelector;
    • catch-all NodeProfiles (tiers 4, 10, 13) are narrowed to the pools, and tier 13 emulates its catch-all with a named profile over the pinned nodes;
    • images are side-loaded and node shells created only on Ready pool nodes.
  • E2E_POOL_KEY is the node label naming the pool. It is detected from kubernetes.azure.com/agentpool (AKS), cloud.google.com/gke-nodepool (GKE), eks.amazonaws.com/nodegroup (EKS), karpenter.sh/nodepool or agentpool; set it for a custom label. The run aborts if no node is in E2E_POOLS.
  • E2E_NODE_ACCESS=kubectl runs node commands through a privileged, hostPID node-shell pod per node in brewlet-e2e-nodeshell (chroot /host nsenter -t 1). The namespace is deleted on exit and by --reset. Override the image with E2E_NODESHELL_IMAGE; it needs only chroot and sleep. Uploads go in retried, checksum-verified chunks (E2E_UPLOAD_CHUNK, default 2m) because API-server exec streams can time out.
  • E2E_NODE_SELECTOR (a label selector, default: the pools) further restricts which pool nodes the provisioning tiers may pick.
  • Tier 13 relabels nodes with E2E_T13_POOL_KEY (default brewlet-e2e-pool in kubectl mode, agentpool otherwise). Use a key without dots or slashes.
  • DOCKER_DEFAULT_PLATFORM defaults to the selected nodes' architecture, so an arm64 workstation builds amd64 images for an amd64 pool.
  • Node-side tiers really modify the selected node: they install the shim, JDKs and launchers under /opt/brewlet, rewrite and restore /etc/containerd/config.toml, and restart containerd. Use a dedicated pool.
  • Tier 5 still skips because the cluster cannot reach a host-bound webhook.

The harness does not switch branches or modify component sources. It uses core/ and kubernetes/ by default. Override BREWLET_CORE_DIR or BREWLET_KUBERNETES_DIR only when testing an external checkout.

Prerequisites

ToolTiers
Goall
Python 32, 4, 12, 13, 16, 17, 19
JDK 21+2, 3, 7, 8, 9, 12, 14-19
Docker3, 6, 7, 8-12, 14-19
kubectl and a reachable cluster4-19
Helm4 (optional), 10, 15, 17
OpenSSL4, 5, 6, 10, 11

Host-only tiers 1-3 need no cluster. Tiers 4-7 and 13 exercise API-server behavior. Tiers 6, 8-12, and 14-19 require containerd nodes the harness can enter: local kind nodes by default, or any Linux node with E2E_NODE_ACCESS=kubectl (see "Managed clusters"). Otherwise managed clusters skip those node-side paths. Tier 13 also proves the control-plane guard: a NodeProfile that does not set nodePool.includeControlPlane never counts or schedules onto a control-plane node. Because kind and Docker Desktop label their single node as the control plane, the node-side tiers set that opt-in explicitly. Tier 14 installs explicit custom JDK and jaz sources and runs a live workload through both. Tier 10 also exercises cert-manager issuance and certificate hot reload when cert-manager is installed. Tier 15 installs the chart with metrics enabled, provisions one node through the real DaemonSet, launches a Brewlet workload, and scrapes all metrics surfaces. Tier 16 covers the SPECIFICATION §14 failure contract on a live node: a missing/unauthorized image surfacing as an ImagePull failure, a JVM OOM exiting under -XX:+ExitOnOutOfMemoryError and being restarted by the kubelet, and an unusable shim surfacing as a containerd task failure — a FailedCreatePodSandBox warning event, since a missing shim fails sandbox creation before any container exists, or a container create/run error on runtimes that fail later — rather than a silently non-running pod. It moves the node's shim aside for the last case and restores it both inline and from its cleanup trap. §14's remaining row, the cgroup-v1 refusal, cannot be produced on a cgroup-v2 CI node and is covered deterministically by provisioner/entrypoint_test.sh over require_cgroup_v2. Tier 17 installs the chart with default stageGC values, verifies they reach the provisioner DaemonSet without the metrics exporter, and proves the upgrade gate blocks GC on a node whose stage root already holds data. It then acknowledges the upgrade with interval=5s and minAge=1s, resets the acknowledgment to prove the per-node compatibility record persists, and shows that a runnable-image stage survives while its pod runs and while containerd still holds the image, then is reclaimed after the image is removed. Once GC is active, it may also reclaim unreferenced stages left on the node by earlier tiers. Tier 18 covers a patched-JDK rollout. It provisions a Temurin 21 digest, runs a Brewlet workload on it, then replaces the NodeProfile digest with a patched release. It asserts that the node re-advertises the new version for the new profile generation, that the DaemonSet and .brewlet-source carry the new digest, and that the previous root is retired rather than deleted. It also checks that the running pod keeps its original JDK and container, and that a retired-root sweep keeps the root that pod still uses. Finally, it asserts that kubectl rollout restart moves the same application image onto the patched JDK, after which an idle sweep reclaims the retired root. Tier 19 rehearses a critical CVE in a library shipped by a managed dependency bundle. It publishes a bundle with a stub log4j-core 2.14.1, composes three thin-JAR apps (two on that bundle, one control on an unrelated bundle), and deploys them to a prod and a staging namespace. e2e/cve_sweep.py then traces every running Brewlet pod from its digest-pinned image through brewlet inspect evidence to the bundle's CycloneDX SBOM. It flags exactly the affected prod workloads and fails closed on images it cannot trace. The tier publishes a patched bundle (2.17.1) and recomposes the unchanged thin JARs onto it, asserting that only the classpath layer changed. It rolls the Deployments by digest (maxUnavailable: 0) while a client polls the Service, and asserts that no request was dropped and that the post-remediation prod sweep is clean. There is no in-place JVM swap: a "hot" redeploy is a recompose plus a rolling update.

Architecture coverage. Tiers pick up the node's architecture automatically, but hosted runners are amd64, so .github/workflows/e2e.yml runs the host-only tiers 1-3 a second time on an ubuntu-24.04-arm runner. That is the only path that actually executes the CLI and the shim-to-runc assembly on arm64; the multi-arch index writer and the strict platform matcher are additionally unit-tested in core/internal/artifact.

Cleanup and diagnostics

Tiers 4 and 13 use invocation-unique, reserved-domain provisioner images that must never execute. Their fixture teardown stops and waits for the test manager, checks worker identity and execution history, and waits for foreground worker deletion before releasing exact fixture-owned claims/finalizers. This is a test-only abort, not proof of production host cleanup. Dirty or foreign workers leave ownership intact and fail the tier.

Run the fixture safeguards independently with:

PYTHONDONTWRITEBYTECODE=1 python3 -m unittest discover \
  -s integration-tests/e2e -p 'nodeprofile_fixtures_test.py' -v

Run tier 19's SBOM sweep logic offline (fake CLI, no cluster) with:

PYTHONDONTWRITEBYTECODE=1 python3 -m unittest discover \
  -s integration-tests/e2e -p 'cve_sweep_test.py' -v

Run ./e2e/run.sh --reset before repeating Kubernetes tiers. It removes only Brewlet-owned labels, annotations, CRDs, runtime classes, webhook configuration, RBAC, and fixed test namespaces. It does not delete application workloads outside the harness namespaces.

Generated artifacts and diagnostic logs are written beneath the printed work directory. Set E2E_WORK to retain them at a known path. For rollout failures, read diag-*.log first.

Common environment-specific skips:

  • Tier 5 skips when a cluster cannot reach a host-bound webhook; tier 6 covers the same assertions in-cluster.
  • Tiers 8, 9, 12, and 14-19 skip if no schedulable containerd node can be provisioned (on managed clusters, set E2E_NODE_ACCESS=kubectl).
  • Tier 12 skips when the node's ctr supports neither images unpack nor import-time unpack; tier 16 applies the same rule.

Specifications belong in specs/, and general project documentation belongs in docs/, not this directory.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.