diff --git a/Jenkinsfile b/Jenkinsfile index 36637d6..e8d0ab6 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,5 +1,29 @@ pipeline { - agent any + agent { + kubernetes { + label 'lesavka-tests' + defaultContainer 'rust-ci' + yaml """ +apiVersion: v1 +kind: Pod +spec: + nodeSelector: + kubernetes.io/arch: arm64 + node-role.kubernetes.io/worker: "true" + containers: + - name: rust-ci + image: rust:1.82-bookworm + command: ["cat"] + tty: true + volumeMounts: + - name: workspace-volume + mountPath: /home/jenkins/agent + volumes: + - name: workspace-volume + emptyDir: {} +""" + } + } options { disableConcurrentBuilds() @@ -26,33 +50,66 @@ pipeline { } } + stage('Bootstrap CI Toolchain') { + steps { + container('rust-ci') { + sh ''' + set -eu + apt-get update + DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ + python3 \ + curl \ + clang \ + llvm \ + pkg-config \ + libssl-dev \ + ca-certificates + rm -rf /var/lib/apt/lists/* + if ! cargo llvm-cov --version >/dev/null 2>&1; then + cargo install --locked cargo-llvm-cov + fi + ''' + } + } + } + stage('Format') { steps { - sh 'cargo fmt --all -- --check' + container('rust-ci') { + sh 'cargo fmt --all -- --check' + } } } stage('Hygiene') { steps { - sh 'scripts/ci/hygiene_gate.sh' + container('rust-ci') { + sh 'scripts/ci/hygiene_gate.sh' + } } } stage('Testing') { steps { - sh 'cargo test -p lesavka_testing' + container('rust-ci') { + sh 'cargo test -p lesavka_testing' + } } } stage('Quality Gate') { steps { - sh 'QUALITY_GATE_PUSHGATEWAY_URL="${QUALITY_GATE_PUSHGATEWAY_URL}" scripts/ci/quality_gate.sh' + container('rust-ci') { + sh 'QUALITY_GATE_PUSHGATEWAY_URL="${QUALITY_GATE_PUSHGATEWAY_URL}" scripts/ci/quality_gate.sh' + } } } stage('Build Dist') { steps { - sh 'scripts/ci/build-dist.sh' + container('rust-ci') { + sh 'scripts/ci/build-dist.sh' + } } }