From ac706264a353801c360c6a2b0e9f6c61a0d42130 Mon Sep 17 00:00:00 2001 From: Kenshin Okinaka Date: Tue, 29 Sep 2026 13:30:24 +0900 Subject: [PATCH] ci: pull the Firelens router from Docker Hub and correct why (#4622) * ci: pull the Firelens router from Docker Hub and correct why A post-merge run showed the ECR Public quota is per runner IP and per byte, not specific to the docker/library mirror: the Firelens router failed with "toomanyrequests: Data limit exceeded" right after the same job had pulled two Lambda runtimes from ECR Public. The router is the same image AWS publishes on Docker Hub (same manifest, config and layer digests on both architectures), so the Firelens test now names it there, through a TestImages pin the prefetch reads. The Lambda runtimes stay on ECR Public: their Docker Hub copies lag by more than a year and some tags are missing. The TestImages Javadoc now gives the corrected reason. * ci: annotate a stale, unreadable or misrouted prefetch The prefetch already writes a line when a key names a class that no longer exists or when a TestImages pin cannot be read, but only into a log nobody reads unless a shard fails. The results step now turns those lines into workflow warning annotations, and adds one more: an image prefetched from ECR Public that is not a Lambda runtime, since everything else the tests start is carried by Docker Hub and belongs there. The prefetch stays best-effort, so these are annotations, not failures. * ci: warn on a misrouted prefetch whether or not its pull succeeded The routing warning matched only "prefetched" lines, so an image on the wrong registry whose pull failed on the quota, the very case the warning is for, produced only the raw failure line. It now matches "prefetch failed" lines too. --- .github/ci/prefetch-images.sh | 12 +++++++----- .github/workflows/ci.yml | 11 ++++++++++- ...erManagerFirelensDockerIntegrationTest.java | 2 +- .../hectorvent/floci/testing/TestImages.java | 18 +++++++++++------- 4 files changed, 29 insertions(+), 14 deletions(-) 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() { } }