#!/usr/bin/env bash # Validate an already provisioned agent; never install dependencies in Jenkins. set -euo pipefail fail() { echo "Quality-gate prerequisite missing: $*. Provision the agent image before running this job." >&2 exit 1 } for command in rustup cargo rustc python3 jq git make pkg-config; do command -v "$command" >/dev/null || fail "$command" done components=$(rustup component list --installed) for component in rustfmt clippy llvm-tools-preview; do # rustup accepts llvm-tools-preview for installation but lists llvm-tools. component_pattern="$component" if [[ "$component" == llvm-tools-preview ]]; then component_pattern='llvm-tools(-preview)?' fi if ! grep -Eq "^${component_pattern}(-|$)" <<< "$components"; then fail "Rust component $component" fi done [[ "$(cargo llvm-cov --version 2>/dev/null || true)" == 'cargo-llvm-cov 0.8.5' ]] || fail 'cargo-llvm-cov 0.8.5' if [[ "$(uname -s)" == Linux ]]; then pkg-config --exists alsa || fail 'ALSA development files (libasound2-dev)' fi