Add Ubuntu apt mirror override for CLI E2E images#16753
Add Ubuntu apt mirror override for CLI E2E images#16753danegsta merged 5 commits intomicrosoft:mainfrom
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 16753Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 16753" |
There was a problem hiding this comment.
Pull request overview
This PR makes the CLI E2E Docker images resilient to overloaded default Ubuntu APT servers by adding a configurable Ubuntu APT mirror override, implemented via a shared helper script that writes a deb822 ubuntu.sources file and wired through CI via ASPIRE_E2E_UBUNTU_APT_MIRROR.
Changes:
- Added
UBUNTU_APT_MIRRORbuild arg support across the CLI E2E Dockerfiles and introduced a sharedconfigure-ubuntu-apt-mirror.shhelper. - Plumbed
ASPIRE_E2E_UBUNTU_APT_MIRRORfrom CI/test configuration into Docker build args (including the shared polyglot and Podman base image builds). - Added test coverage to verify the build-arg wiring behavior in
CliInstallStrategy.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Shared/Docker/Dockerfile.e2e-polyglot-java | Adds UBUNTU_APT_MIRROR arg and runs the shared mirror configuration script before installing the JDK. |
| tests/Shared/Docker/Dockerfile.e2e-polyglot-base | Adds mirror build arg and uses the shared script in both build and runtime stages. |
| tests/Shared/Docker/Dockerfile.e2e-podman | Adds mirror build arg and uses the shared script before installing Podman + tooling. |
| tests/Shared/Docker/Dockerfile.e2e | Adds mirror build arg and uses the shared script in build/runtime stages before APT operations. |
| tests/Shared/Docker/configure-ubuntu-apt-mirror.sh | New helper script that writes a deb822 Ubuntu sources file based on the provided mirror URI. |
| tests/Shared/CliInstallStrategy.cs | Plumbs ASPIRE_E2E_UBUNTU_APT_MIRROR into Docker build args via a helper method. |
| tests/Aspire.Cli.EndToEnd.Tests/Helpers/CliInstallStrategyTests.cs | Adds tests asserting build-arg behavior when the environment variable is set/unset. |
| tests/Aspire.Cli.EndToEnd.Tests/Helpers/CliE2ETestHelpers.cs | Ensures the shared polyglot and Podman base image builds receive the Ubuntu APT mirror build arg. |
| .github/workflows/run-tests.yml | Defaults Linux CI jobs to Azure-hosted Ubuntu mirrors (x64 + arm64) via ASPIRE_E2E_UBUNTU_APT_MIRROR. |
Comments suppressed due to low confidence (1)
tests/Shared/Docker/Dockerfile.e2e-polyglot-base:33
- Same as Dockerfile.e2e: configure-ubuntu-apt-mirror.sh runs unconditionally even when SKIP_SOURCE_BUILD=true, but APT isn’t used in that branch. This adds an avoidable dependency on the base image being Ubuntu (the script currently exits non-zero on non-Ubuntu). Consider only running the mirror script in the branch that actually performs apt-get work.
ARG SKIP_SOURCE_BUILD=false
ARG UBUNTU_APT_MIRROR=
# Install native AOT build toolchain.
COPY tests/Shared/Docker/configure-ubuntu-apt-mirror.sh /usr/local/bin/
RUN sh /usr/local/bin/configure-ubuntu-apt-mirror.sh "$UBUNTU_APT_MIRROR" && \
if [ "$SKIP_SOURCE_BUILD" != "true" ]; then \
apt-get update -qq && \
apt-get install -y --no-install-recommends clang zlib1g-dev && \
rm -rf /var/lib/apt/lists/*; \
fi
| echo "UBUNTU_APT_MIRROR can only be used with Ubuntu images. Current image ID is '${ID:-unknown}'." >&2 | ||
| exit 1 |
| TestsRunningOutsideOfRepo: true | ||
| TESTCONTAINERS_HUB_IMAGE_NAME_PREFIX: 'netaspireci.azurecr.io' | ||
| # CLI E2E Dockerfiles consume this as a build arg to avoid overloaded default Ubuntu package servers. | ||
| ASPIRE_E2E_UBUNTU_APT_MIRROR: ${{ runner.os == 'Linux' && (runner.arch == 'ARM64' && 'http://azure.ports.ubuntu.com/ubuntu-ports/' || 'http://azure.archive.ubuntu.com/ubuntu/') || '' }} |
There was a problem hiding this comment.
http://azure.archive.ubuntu.com is the default fallback mirror in GHA ubuntu runners already and there is no https endpoint for the feed. This is at worst no different than running apt-get install on an ubuntu-latest runner.
| PLAYWRIGHT_INSTALLED: ${{ fromJson(inputs.properties).enablePlaywrightInstall != true && 'false' || 'true' }} | ||
| TESTCONTAINERS_HUB_IMAGE_NAME_PREFIX: 'netaspireci.azurecr.io' | ||
| # CLI E2E Dockerfiles consume this as a build arg to avoid overloaded default Ubuntu package servers. | ||
| ASPIRE_E2E_UBUNTU_APT_MIRROR: ${{ runner.os == 'Linux' && (runner.arch == 'ARM64' && 'http://azure.ports.ubuntu.com/ubuntu-ports/' || 'http://azure.archive.ubuntu.com/ubuntu/') || '' }} |
There was a problem hiding this comment.
http://azure.archive.ubuntu.com/ is the default fallback mirror in GHA ubuntu runners already and there is no https endpoint for the feed. This is at worst no different than running apt-get install on an ubuntu-latest runner.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
/deployment-test |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Re-running the failed jobs in the CI workflow for this pull request because 1 job was identified as retry-safe transient failures in the CI run attempt.
|
|
/backport to release/13.3 |
|
Started backporting to |
|
@danegsta backporting to git am output$ git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch
Applying: Add Ubuntu apt mirror override for CLI E2E images
Applying: Move script into conditional block with apt-get operations
Applying: Use Azure apt mirrors for CLI E2E tests
Using index info to reconstruct a base tree...
M tests/Shared/Docker/Dockerfile.e2e
Falling back to patching base and 3-way merge...
Auto-merging tests/Shared/Docker/Dockerfile.e2e
CONFLICT (content): Merge conflict in tests/Shared/Docker/Dockerfile.e2e
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Patch failed at 0003 Use Azure apt mirrors for CLI E2E tests
Error: The process '/usr/bin/git' failed with exit code 128 |
|
@copilot can you start a backport PR for me against release/13.0? Our backport action is failing on the change due to 3way merge conflicts. |
Description
Adds a declarative Ubuntu APT mirror override for the CLI E2E test Dockerfiles. The Dockerfiles now accept
UBUNTU_APT_MIRRORand use a shared helper to write a deb822ubuntu.sourcesfile, rather than patching existing apt config withsed.This also wires
ASPIRE_E2E_UBUNTU_APT_MIRRORthrough the CLI E2E Docker build configuration, including the shared polyglot and Podman base image builds. Linux CI test jobs default to Azure-hosted Ubuntu mirrors, usingazure.archive.ubuntu.comfor x64 andazure.ports.ubuntu.comfor arm64, to reduce failures when the default Ubuntu package servers are overloaded.Validation:
./restore.shgit --no-pager diff --checksh -n tests/Shared/Docker/configure-ubuntu-apt-mirror.shdotnet test --project tests/Aspire.Cli.EndToEnd.Tests/Aspire.Cli.EndToEnd.Tests.csproj --no-launch-profile -- --filter-class "*.CliInstallStrategyTests" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"docker run --rm -v "$PWD/tests/Shared/Docker/configure-ubuntu-apt-mirror.sh:/tmp/configure-ubuntu-apt-mirror.sh:ro" ubuntu:24.04 sh -c 'sh /tmp/configure-ubuntu-apt-mirror.sh http://azure.archive.ubuntu.com/ubuntu/ && cat /etc/apt/sources.list.d/ubuntu.sources'Fixes # (issue)
Checklist
<remarks />and<code />elements on your triple slash comments?aspire.devissue: