Skip to content

Commit 6366cca

Browse files
radicalCopilot
andcommitted
Build Java polyglot CLI E2E image via local docker daemon
The CLI E2E Java polyglot image extends the polyglot base via `FROM aspire-e2e-polyglot-base`, which only exists in the local docker daemon (it is loaded there via the `--load` option of the previous buildx build). The docker-container buildx driver cannot see local daemon images, so any attempt to build the Java image through the shared `cli-e2e-builder` instance fails with `pull access denied for docker.io/library/aspire-e2e-polyglot-base`. Branch the `build_image` helper on the cache scope: - non-empty scope → cached buildx docker-container path - empty scope → daemon-driven `DOCKER_BUILDKIT=1 docker build` Route the Java image through `build_with_mirror_retry` with an empty cache scope so it picks the daemon-driven path and the special-case `build_java_image` helper can be removed. Behavior matches what docs/ci/cli-e2e-images.md already calls out: the Java image is built from the local polyglot base and does not use a shared BuildKit cache scope. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 124cad0 commit 6366cca

1 file changed

Lines changed: 26 additions & 28 deletions

File tree

.github/workflows/build-cli-e2e-image.yml

Lines changed: 26 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -75,32 +75,29 @@ jobs:
7575
echo "Building $display_name with the default Ubuntu apt sources"
7676
fi
7777
78-
docker buildx build \
79-
--load \
80-
--cache-from "type=gha,scope=$cache_scope" \
81-
--cache-to "type=gha,scope=$cache_scope,mode=max,ignore-error=true" \
82-
"${build_args[@]}" \
83-
-f "$dockerfile" \
84-
-t "$tag" \
85-
.
86-
}
87-
88-
build_java_image() {
89-
local mirror="$1"
90-
local -a build_args=()
91-
92-
if [[ -n "$mirror" ]]; then
93-
echo "Building Java polyglot image with Ubuntu apt mirror: $mirror"
94-
build_args+=(--build-arg "UBUNTU_APT_MIRROR=$mirror")
78+
if [[ -n "$cache_scope" ]]; then
79+
# Cached path: use the buildx docker-container builder so we can read/write
80+
# BuildKit layers from the GitHub Actions cache.
81+
docker buildx build \
82+
--load \
83+
--cache-from "type=gha,scope=$cache_scope" \
84+
--cache-to "type=gha,scope=$cache_scope,mode=max,ignore-error=true" \
85+
"${build_args[@]}" \
86+
-f "$dockerfile" \
87+
-t "$tag" \
88+
.
9589
else
96-
echo "Building Java polyglot image with the default Ubuntu apt sources"
90+
# Uncached path: build through the default docker daemon driver so the
91+
# image can reference other locally-loaded images via FROM (e.g. the
92+
# polyglot base built earlier in this step). The docker-container buildx
93+
# driver does not have access to the daemon's image store and would try
94+
# to pull such references from a registry.
95+
DOCKER_BUILDKIT=1 docker build \
96+
"${build_args[@]}" \
97+
-f "$dockerfile" \
98+
-t "$tag" \
99+
.
97100
fi
98-
99-
DOCKER_BUILDKIT=1 docker build \
100-
"${build_args[@]}" \
101-
-f tests/Shared/Docker/Dockerfile.e2e-polyglot-java \
102-
-t "$CLI_E2E_POLYGLOT_JAVA_IMAGE_TAG" \
103-
.
104101
}
105102
106103
build_with_mirror_retry() {
@@ -121,10 +118,11 @@ jobs:
121118
build_with_mirror_retry "polyglot base image" "tests/Shared/Docker/Dockerfile.e2e-polyglot-base" "$CLI_E2E_POLYGLOT_BASE_IMAGE_TAG" "$CLI_E2E_POLYGLOT_BASE_IMAGE_CACHE_SCOPE"
122119
docker tag "$CLI_E2E_POLYGLOT_BASE_IMAGE_TAG" "$CLI_E2E_POLYGLOT_IMAGE_TAG"
123120
124-
if ! build_java_image "http://azure.archive.ubuntu.com/ubuntu/"; then
125-
echo "Java polyglot image build failed with the Azure Ubuntu apt mirror; retrying with default Ubuntu apt sources"
126-
build_java_image ""
127-
fi
121+
# The Java polyglot image extends the polyglot base via `FROM
122+
# aspire-e2e-polyglot-base`, which only exists in the local docker daemon.
123+
# Pass an empty cache scope so build_image uses the daemon-backed
124+
# `docker build` path instead of the docker-container buildx driver.
125+
build_with_mirror_retry "Java polyglot image" "tests/Shared/Docker/Dockerfile.e2e-polyglot-java" "$CLI_E2E_POLYGLOT_JAVA_IMAGE_TAG" ""
128126
fi
129127
130128
- name: Save CLI E2E Docker image tarballs

0 commit comments

Comments
 (0)