|
| 1 | +# Container for running bcvk ephemeral tests on C10S |
| 2 | +# This mirrors the CI workflow in .github/workflows/main-c10s.yml |
| 3 | + |
| 4 | +ARG base=quay.io/centos/centos:stream10 |
| 5 | +FROM $base as build |
| 6 | + |
| 7 | +# Install build dependencies |
| 8 | +RUN dnf clean all && \ |
| 9 | + dnf -y install dnf-utils && \ |
| 10 | + dnf config-manager --set-enabled crb && \ |
| 11 | + dnf install -y pkgconfig go-md2man gcc make openssl-devel openssh-clients |
| 12 | + |
| 13 | +# Install Rust |
| 14 | +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable |
| 15 | +ENV PATH="/root/.cargo/bin:${PATH}" |
| 16 | + |
| 17 | +# Install nextest |
| 18 | +RUN cargo install cargo-nextest --locked |
| 19 | + |
| 20 | +# Copy source code |
| 21 | +COPY . /src |
| 22 | +WORKDIR /src |
| 23 | + |
| 24 | +# Build bcvk and create integration test archive |
| 25 | +RUN make && \ |
| 26 | + cargo nextest archive --release -P integration -p integration-tests --archive-file integration-tests.tar.zst |
| 27 | + |
| 28 | +# Runtime stage |
| 29 | +FROM $base |
| 30 | + |
| 31 | +# Install runtime dependencies for running VMs |
| 32 | +RUN dnf clean all && \ |
| 33 | + dnf -y install dnf-utils && \ |
| 34 | + dnf config-manager --set-enabled crb && \ |
| 35 | + dnf install -y \ |
| 36 | + libvirt-daemon \ |
| 37 | + libvirt-daemon-driver-qemu \ |
| 38 | + libvirt-client \ |
| 39 | + qemu-kvm \ |
| 40 | + virtiofsd \ |
| 41 | + podman && \ |
| 42 | + dnf clean all |
| 43 | + |
| 44 | +# Install Rust (needed for cargo nextest) |
| 45 | +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable |
| 46 | +ENV PATH="/root/.cargo/bin:${PATH}" |
| 47 | + |
| 48 | +# Install nextest |
| 49 | +RUN cargo install cargo-nextest --locked |
| 50 | + |
| 51 | +# Copy built artifacts |
| 52 | +COPY --from=build /src/target/release/bcvk /usr/local/bin/bcvk |
| 53 | +COPY --from=build /src/integration-tests.tar.zst /tests/integration-tests.tar.zst |
| 54 | + |
| 55 | +# Copy source tree metadata needed by nextest |
| 56 | +# Nextest needs the workspace structure even when using archives |
| 57 | +COPY --from=build /src/Cargo.toml /src/Cargo.lock /tests/ |
| 58 | +COPY --from=build /src/.config /tests/.config |
| 59 | +COPY --from=build /src/crates /tests/crates |
| 60 | + |
| 61 | +# Set up environment |
| 62 | +ENV BCVK_PATH=/usr/local/bin/bcvk |
| 63 | +ENV LIBVIRT_DEFAULT_URI=qemu:///system |
| 64 | +WORKDIR /tests |
| 65 | + |
| 66 | +# Create entrypoint script that pulls images and runs tests |
| 67 | +RUN printf '#!/bin/bash\n\ |
| 68 | +set -euo pipefail\n\ |
| 69 | +echo "Pulling test images..."\n\ |
| 70 | +podman pull -q quay.io/fedora/fedora-bootc:42 quay.io/centos-bootc/centos-bootc:stream9 quay.io/centos-bootc/centos-bootc:stream10\n\ |
| 71 | +echo "Running ephemeral integration tests..."\n\ |
| 72 | +exec cargo nextest run --archive-file integration-tests.tar.zst --workspace-remap /tests ephemeral\n\ |
| 73 | +' > /usr/local/bin/run-tests.sh && \ |
| 74 | + chmod +x /usr/local/bin/run-tests.sh |
| 75 | + |
| 76 | +# Default command runs the test script |
| 77 | +CMD ["/usr/local/bin/run-tests.sh"] |
0 commit comments