|
| 1 | +# syntax=docker/dockerfile:1 |
| 2 | + |
| 3 | +ARG SANCOV_RUSTFLAGS='["-Cpasses=sancov-module","-Cllvm-args=-sanitizer-coverage-level=3","-Cllvm-args=-sanitizer-coverage-trace-pc-guard","-Clink-args=-Wl,--build-id"]' |
| 4 | + |
| 5 | +############################ |
| 6 | +# Vector SUT — build stage # |
| 7 | +############################ |
| 8 | +FROM rust:1.92-bookworm AS vector-build |
| 9 | +RUN apt-get update && apt-get install -y --no-install-recommends \ |
| 10 | + protobuf-compiler cmake perl build-essential pkg-config libssl-dev clang binutils \ |
| 11 | + && rm -rf /var/lib/apt/lists/* |
| 12 | +WORKDIR /src |
| 13 | +COPY Cargo.toml Cargo.lock rust-toolchain.toml build.rs ./ |
| 14 | +COPY lib ./lib |
| 15 | +COPY src ./src |
| 16 | +COPY proto ./proto |
| 17 | +COPY benches ./benches |
| 18 | +COPY tests ./tests |
| 19 | +COPY vdev ./vdev |
| 20 | +COPY scripts ./scripts |
| 21 | +ARG SANCOV_RUSTFLAGS |
| 22 | +# debug=true keeps DWARF for /symbols. lto=false keeps sancov instrumentation |
| 23 | +# predictable and stops the optimizer from dropping the force-linked runtime. |
| 24 | +RUN --mount=type=cache,target=/usr/local/cargo/registry \ |
| 25 | + --mount=type=cache,target=/src/target \ |
| 26 | + cargo build --release --no-default-features \ |
| 27 | + --features "sources-http_server,sinks-http,sources-internal_metrics,sinks-prometheus,antithesis-scenario-memory" \ |
| 28 | + --bin vector \ |
| 29 | + --config 'build.target = "x86_64-unknown-linux-gnu"' \ |
| 30 | + --config 'profile.release.debug = true' \ |
| 31 | + --config 'profile.release.lto = false' \ |
| 32 | + --config "target.x86_64-unknown-linux-gnu.rustflags = ${SANCOV_RUSTFLAGS}" \ |
| 33 | + && cp target/x86_64-unknown-linux-gnu/release/vector /usr/local/bin/vector \ |
| 34 | + && echo "validating instrumentation symbols..." \ |
| 35 | + && nm /usr/local/bin/vector | grep -q __sanitizer_cov_trace_pc_guard \ |
| 36 | + && nm /usr/local/bin/vector | grep -q antithesis_load_libvoidstar \ |
| 37 | + && echo "instrumentation OK" |
| 38 | + |
| 39 | +################################## |
| 40 | +# Harness (workload) — build stage |
| 41 | +################################## |
| 42 | +# The workload binaries live in the shared `harness` crate, a member of Vector's |
| 43 | +# workspace, so the build needs the workspace root and member manifests. `-p` |
| 44 | +# compiles only the harness bins. |
| 45 | +FROM rust:1.92-bookworm AS workload-build |
| 46 | +RUN apt-get update && apt-get install -y --no-install-recommends binutils \ |
| 47 | + && rm -rf /var/lib/apt/lists/* |
| 48 | +WORKDIR /src |
| 49 | +COPY Cargo.toml Cargo.lock rust-toolchain.toml build.rs ./ |
| 50 | +COPY lib ./lib |
| 51 | +COPY src ./src |
| 52 | +COPY proto ./proto |
| 53 | +COPY benches ./benches |
| 54 | +COPY tests ./tests |
| 55 | +COPY vdev ./vdev |
| 56 | +COPY scripts ./scripts |
| 57 | +ARG SANCOV_RUSTFLAGS |
| 58 | +# debug=true keeps DWARF for /symbols. |
| 59 | +RUN --mount=type=cache,target=/usr/local/cargo/registry \ |
| 60 | + --mount=type=cache,target=/src/target \ |
| 61 | + cargo build --release -p harness \ |
| 62 | + --config 'build.target = "x86_64-unknown-linux-gnu"' \ |
| 63 | + --config 'profile.release.debug = true' \ |
| 64 | + --config "target.x86_64-unknown-linux-gnu.rustflags = ${SANCOV_RUSTFLAGS}" \ |
| 65 | + && D=target/x86_64-unknown-linux-gnu/release \ |
| 66 | + && cp "$D/oracle" "$D/parallel_driver_produce" "$D/eventually_conservation" /usr/local/bin/ \ |
| 67 | + && echo "validating instrumentation symbols..." \ |
| 68 | + && nm /usr/local/bin/oracle | grep -q __sanitizer_cov_trace_pc_guard \ |
| 69 | + && nm /usr/local/bin/oracle | grep -q antithesis_load_libvoidstar \ |
| 70 | + && echo "instrumentation OK" |
| 71 | + |
| 72 | +##################################### |
| 73 | +# Runtime: Vector SUT (the one node) # |
| 74 | +##################################### |
| 75 | +FROM debian:stable-slim AS vector |
| 76 | +RUN apt-get update && apt-get install -y --no-install-recommends curl ca-certificates \ |
| 77 | + && rm -rf /var/lib/apt/lists/* |
| 78 | +COPY --from=vector-build /usr/local/bin/vector /usr/bin/vector |
| 79 | +# Bake the node config plus its benign alternate, which the reload fault swaps in |
| 80 | +# to force a sink rebuild. |
| 81 | +COPY tests/antithesis/scenarios/vector_e2e/vector.yaml /etc/vector/vector.yaml |
| 82 | +COPY tests/antithesis/scenarios/vector_e2e/vector.b.yaml /etc/vector/vector.b.yaml |
| 83 | +# The reload fault is an anytime_ test command that runs IN the node container. |
| 84 | +# The node stays running because its entrypoint is Vector, not a test command. |
| 85 | +COPY --chmod=755 tests/antithesis/scenarios/vector_e2e/anytime_reload.sh /opt/antithesis/test/v1/ve2e/anytime_reload |
| 86 | +RUN mkdir -p /symbols && ln -s /usr/bin/vector /symbols/vector |
| 87 | +ENV NO_COLOR=1 |
| 88 | +EXPOSE 8080 9598 |
| 89 | +ENTRYPOINT ["/usr/bin/vector"] |
| 90 | + |
| 91 | +################################### |
| 92 | +# Runtime: workload (oracle + cmds) # |
| 93 | +################################### |
| 94 | +FROM debian:stable-slim AS workload |
| 95 | +RUN apt-get update && apt-get install -y --no-install-recommends curl ca-certificates \ |
| 96 | + && rm -rf /var/lib/apt/lists/* |
| 97 | +# The oracle is the entrypoint. The two test-command binaries are the test commands: |
| 98 | +# drop them straight into the test template, named by their Antithesis prefix. |
| 99 | +COPY --from=workload-build /usr/local/bin/oracle /usr/bin/oracle |
| 100 | +COPY --from=workload-build /usr/local/bin/parallel_driver_produce /opt/antithesis/test/v1/ve2e/parallel_driver_produce |
| 101 | +COPY --from=workload-build /usr/local/bin/eventually_conservation /opt/antithesis/test/v1/ve2e/eventually_conservation |
| 102 | +# Symbolize all three instrumented binaries: the oracle entrypoint and both |
| 103 | +# test-command bins. A crash in any of them must resolve against /symbols. |
| 104 | +RUN mkdir -p /symbols \ |
| 105 | + && ln -s /usr/bin/oracle /symbols/oracle \ |
| 106 | + && ln -s /opt/antithesis/test/v1/ve2e/parallel_driver_produce /symbols/parallel_driver_produce \ |
| 107 | + && ln -s /opt/antithesis/test/v1/ve2e/eventually_conservation /symbols/eventually_conservation |
| 108 | +ENV NO_COLOR=1 |
| 109 | +# The oracle waits for the SUT, emits setup_complete via the SDK, then serves so |
| 110 | +# Antithesis runs the test commands in this container. |
| 111 | +ENTRYPOINT ["/usr/bin/oracle"] |
0 commit comments