Files
floci/.github/ci/prefetch-images.sh
T
Hector Ventura 257e004600 ci: shard Build and Test into a 4-way profile-grouped matrix (#2506)
The suite grew past its timeout: 7,855 tests in mid-July to 11,800 today,
19-20 minute runs against the (now 30-minute) cap, with 51 serialized Quarkus
augmentations before any test executes. Sharding is the only >3x lever.

- 4 shards, each a deterministic slice computed at runtime from the compiled
  test classes, so a new package can never silently fall outside every shard.
- Group-by-profile partitioner: classes sharing a @TestProfile land in one
  shard atomically, since per-shard augmentation cost is distinct profiles
  times ~5.4s and a split group pays its augmentation once per shard.
- ci-summary aggregation gate fails on any shard failure, any class assigned
  to two shards, or any class assigned to none, checked against the same
  commit's own class list rather than a hardcoded count.
- The maven cache step is split into restore (all shards) / save (shard 1
  only) so four shards do not race one save key.
- Best-effort background Docker image prefetch per shard, pulling only the
  images that shard's tests use.
- Per-shard timeout drops to 15 minutes; expected worst shard ~5.5-6.5 min.
2026-08-23 23:11:54 -05:00

24 lines
1.3 KiB
Bash
Executable File

#!/usr/bin/env bash
# Best-effort background prefetch of the Docker images this shard's tests use.
# Never fails the build; a pull that loses the race just means the test pulls
# it itself, exactly as before. Pulls only images implied by shard.txt so four
# shards do not each pull all images (Docker Hub rate-limit exposure).
# Usage: prefetch-images.sh <shard.txt>
set -u
SHARD_FILE="${1:-}"
command -v docker >/dev/null 2>&1 || exit 0
[ -r "$SHARD_FILE" ] || exit 0
pull() { docker pull -q "$1" >/dev/null 2>&1 & }
# package token in shard.txt -> images its tests are known to launch
# (measured inline pulls; update alongside image-catalog changes)
grep -q '/lambda/' "$SHARD_FILE" && { pull public.ecr.aws/lambda/python:3.14; pull public.ecr.aws/lambda/nodejs:18; pull public.ecr.aws/lambda/nodejs:20; pull public.ecr.aws/lambda/python:3.12; }
grep -q '/docdb/' "$SHARD_FILE" && pull mongo:7.0
grep -q '/neptune/' "$SHARD_FILE" && { pull neo4j:5-community; pull tinkerpop/gremlin-server:3.7.3; }
grep -q '/elasticache/' "$SHARD_FILE" && { pull valkey/valkey:8; pull memcached:1.6; }
grep -q '/memorydb/' "$SHARD_FILE" && pull valkey/valkey:8
grep -q '/ecr/' "$SHARD_FILE" && pull registry:2
grep -q '/ec2/' "$SHARD_FILE" && { pull busybox:stable; pull alpine:latest; }
exit 0