gunk-dev/the-valley

integrator.nix

source8e6da50db59amain's published tip history
2.2 KiB
1# The integrator: its verdict rules, and the controller over real
2# repositories.
3{ pkgs, packages, ... }:
4{
5 # The integrator's verdict, case by case, with no repository in
6 # sight. Every rule of dcr-439b771 is a function of data, so the
7 # unit tests state each one directly; what a repository does to
8 # produce those inputs is integrator-e2e's.
9 integrator-unit = packages.integrator-unwrapped.unit;
10
11 # The integrator itself, driven end to end over scratch bare
12 # repositories and throwaway keys, running the real binaries: the
13 # helper produces the evidence, the deriver composes the policy,
14 # the controller judges and lands. The scenarios are Phase 3's
15 # exit criteria, observed rather than asserted about, and they live
16 # with the integrator (integrator/e2e/) rather than here.
17 #
18 # Only the nix evaluator is stood in for — a nix build has no
19 # daemon in the sandbox, the same wall attest-e2e meets — and the
20 # stand-in models the one property the pure rule rests on: a
21 # check's input closure is the content of the files it reads.
22 # Everything downstream of it is real: attest builds the manifest
23 # and the digest, and the integrator compares them.
24 integrator-e2e = pkgs.runCommand "valley-integrator-e2e" {
25 nativeBuildInputs = [
26 pkgs.bash
27 pkgs.git
28 pkgs.openssh
29 pkgs.coreutils
30 pkgs.findutils
31 pkgs.gnused
32 pkgs.gnugrep
33 pkgs.jq # the timing line's JSON
34 pkgs.cue
35 packages.attest
36 packages.valley-script
37 packages.integrator
38 ];
39 e2eDir = ../../integrator/e2e;
40 SCHEMA_ATTESTATION = ../../schema/attestation.cue;
41 SCHEMA_VERIFICATION = ../../schema/verification.cue;
42 SCHEMA_EVENTS = ../../schema/events.cue;
43 # The binary without its wrapper, whose PATH puts the real nats first:
44 # one scenario stands a bus that never answers in for it.
45 INTEGRATOR_UNWRAPPED = pkgs.lib.getExe packages.integrator-unwrapped;
46 # No bus in a sandbox: the payloads are still composed and
47 # vetted against the vocabulary, and printed rather than
48 # published. What publishing does is the post-receive hook's
49 # one `nats pub`, which this shares.
50 } (builtins.readFile ./integrator-e2e.sh);
51}