diff --git a/.github/ci/prefetch-images.sh b/.github/ci/prefetch-images.sh index f6c25a7b8b..aeea450d5a 100755 --- a/.github/ci/prefetch-images.sh +++ b/.github/ci/prefetch-images.sh @@ -6,8 +6,8 @@ # ECR Public counts anonymous transfer per runner IP, so an image is keyed on the classes that # start it whenever its package is spread over every shard (Lambda, ECS), and a key that names a # class is checked against src/test/java so a rename cannot silently turn the prefetch off. The -# Docker library images the tests start come from Docker Hub, which GitHub-hosted runners pull -# without a limit; TestImages says why they are not taken through the ECR Public mirror. +# images the tests start come from Docker Hub wherever it carries them, which GitHub-hosted +# runners pull without a limit; TestImages says why, and why the Lambda runtimes cannot. # Each pull writes one line to $PREFETCH_LOG (prefetch-images.log next to shard.txt by default): # "prefetched " or "prefetch failed : ", timestamped, # so a test that pulled the image itself can be told apart from a prefetch that failed or was @@ -71,7 +71,11 @@ starts ContainerHostNetworkDockerIntegrationTest EcsServiceDiscoveryDockerIntegr PYTHON_ALPINE_IMAGE="$(test_image PYTHON_ALPINE)" starts ContainerCaBundleDockerIntegrationTest EcsCredentialsProxyDockerIntegrationTest SageMakerDockerIntegrationTest \ && [ -n "$PYTHON_ALPINE_IMAGE" ] && pull "$PYTHON_ALPINE_IMAGE" -# ECR Public images, in queue order: the Lambda runtimes by size, then the Firelens router. +# The Firelens test names the log router image itself rather than taking it from config. +FLUENT_BIT_IMAGE="$(test_image FLUENT_BIT)" +starts EcsContainerManagerFirelensDockerIntegrationTest && [ -n "$FLUENT_BIT_IMAGE" ] && pull "$FLUENT_BIT_IMAGE" +# ECR Public images, in queue order: the Lambda runtimes by size. They are the only images left +# on ECR Public; everything Docker Hub also carries is pulled from there (see TestImages). # Lambda runtimes, measured from a full four-shard run by pairing each ImageCacheService # "Pulling image" / "Image already present locally" line with the class that logged it. # nodejs:20 is the runtime the API Gateway, ELBv2 and Lambda integration tests resolve and every @@ -80,8 +84,6 @@ starts ContainerCaBundleDockerIntegrationTest EcsCredentialsProxyDockerIntegrati grep -qE '/apigateway/|/apigatewayv2/|/lambda/' "$SHARD_FILE" && ecr public.ecr.aws/lambda/nodejs:20 starts SwfLambdaIntegrationTest && ecr public.ecr.aws/lambda/python:3.12 starts ElbV2LambdaTargetDataPlaneIntegrationTest && ecr public.ecr.aws/lambda/python:3.14 -# The Firelens test names the log router image itself rather than taking it from config. -starts EcsContainerManagerFirelensDockerIntegrationTest && ecr public.ecr.aws/aws-observability/aws-for-fluent-bit:3 # package token in shard.txt -> images its tests are known to launch # (measured inline pulls; update alongside image-catalog changes) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f376fc7d25..eb9d12c5bf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -120,12 +120,21 @@ jobs: # The prefetch runs in the background past its own step, so its per-image # results are only complete once the tests are done. A pull still running - # here (after an early exit) has no result line yet, so list it. + # here (after an early exit) has no result line yet, so list it. The + # prefetch is best-effort by design, so a key that no longer matches a + # class, a pin the script could not read, or an image back on ECR Public + # that Docker Hub also carries (only the Lambda runtimes belong there) is + # an annotation, not a failure. - name: Image prefetch results if: always() run: | cat prefetch-images.log 2>/dev/null || echo "no prefetch log" pgrep -af 'docker pull' | sed 's/^/still running: /' || true + grep -E 'stale prefetch key|prefetch skipped' prefetch-images.log 2>/dev/null \ + | sed 's/^/::warning title=prefetch-images.sh::/' || true + grep -E '(prefetched|prefetch failed) public\.ecr\.aws/' prefetch-images.log 2>/dev/null \ + | grep -vE 'public\.ecr\.aws/lambda/' \ + | sed 's/^/::warning title=prefetch-images.sh::not a Lambda runtime, pull it from Docker Hub: /' || true # Save from main only, and from shard 1 only. Actions caches are ref-scoped: # a pull_request run's write lands in refs/pull/N/merge where no other PR can diff --git a/src/test/java/io/github/hectorvent/floci/services/ecs/container/EcsContainerManagerFirelensDockerIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/ecs/container/EcsContainerManagerFirelensDockerIntegrationTest.java index 8ffae7737a..e403b24be6 100644 --- a/src/test/java/io/github/hectorvent/floci/services/ecs/container/EcsContainerManagerFirelensDockerIntegrationTest.java +++ b/src/test/java/io/github/hectorvent/floci/services/ecs/container/EcsContainerManagerFirelensDockerIntegrationTest.java @@ -37,7 +37,7 @@ class EcsContainerManagerFirelensDockerIntegrationTest { private static final String IMAGE = TestImages.BUSYBOX; /** A real FireLens router image: Floci writes the generated config to its own * {@code /fluent-bit/etc}, which no minimal image carries. */ - private static final String ROUTER_IMAGE = "public.ecr.aws/aws-observability/aws-for-fluent-bit:3"; + private static final String ROUTER_IMAGE = TestImages.FLUENT_BIT; @Inject EcsContainerManager containerManager; diff --git a/src/test/java/io/github/hectorvent/floci/testing/TestImages.java b/src/test/java/io/github/hectorvent/floci/testing/TestImages.java index e10c63edab..973786e373 100644 --- a/src/test/java/io/github/hectorvent/floci/testing/TestImages.java +++ b/src/test/java/io/github/hectorvent/floci/testing/TestImages.java @@ -5,13 +5,14 @@ package io.github.hectorvent.floci.testing; * {@code .github/ci/prefetch-images.sh} reads the values from this file, the way it reads the * sidecar pins from {@code application.yml}, so the prefetch cannot drift from the tests. *

- * The Docker library images are named the Docker Hub way, not through the - * {@code public.ecr.aws/docker/library} mirror. That mirror has an anonymous quota of its own, - * shared by runner IP and often spent before a job starts: on one CI job the first pull of the - * job, {@code docker/library/busybox} from that mirror, failed with - * {@code toomanyrequests: Data limit exceeded}, while the same runner pulled {@code busybox} from - * Docker Hub seven seconds later and a 116 MiB {@code lambda/} image from ECR Public half a - * minute after that. GitHub-hosted runners pull Docker Hub without a limit. + * Every image that Docker Hub also carries is named the Docker Hub way. ECR Public meters + * anonymous pulls by runner IP and by bytes, and GitHub-hosted runners share those IPs, so a job + * can arrive with the quota already spent or spend it itself: on CI the mirror at + * {@code public.ecr.aws/docker/library} failed on the first pull of a job, and the Firelens + * router failed right after the same job had pulled two Lambda runtimes from ECR Public, both + * with {@code toomanyrequests: Data limit exceeded}. GitHub-hosted runners pull Docker Hub + * without a limit. The Lambda runtimes stay on ECR Public: their Docker Hub copies lag by more + * than a year and some tags are missing there. */ public final class TestImages { @@ -26,6 +27,9 @@ public final class TestImages { public static final String PYTHON_ALPINE = "python:3.12-alpine"; + /** The same image AWS publishes at {@code public.ecr.aws/aws-observability/aws-for-fluent-bit:3}. */ + public static final String FLUENT_BIT = "amazon/aws-for-fluent-bit:3"; + private TestImages() { } }