Bootstrap CA certs before HTTPS apt in CICD base image
Some checks failed
CICD / Build and Publish CICD Base Image (pull_request) Successful in 30m5s
CICD / Build and Push CICD Image (pull_request) Successful in 12m56s
CICD / Build CICD Image Failure Postmortem (pull_request) Has been skipped
CICD / Backend Dependency Audit (pull_request) Failing after 51s
CICD / Frontend Dependency Audit (pull_request) Failing after 31m5s
CICD / Source Checks (pull_request) Successful in 39m28s
CICD / CICD Tests Complete (pull_request) Successful in 6s
CICD / Build E2E Tester Image (pull_request) Failing after 10m4s
CICD / Build Integration Tester Image (pull_request) Failing after 10m16s
CICD / Build Frontend Base Image (pull_request) Failing after 10m24s
CICD / Build Backend Base Image (pull_request) Successful in 19m52s
CICD / Source Lanes Failure Postmortem (pull_request) Has been skipped
CICD / Build Frontend Main Image (pull_request) Has been skipped
CICD / Build Backend Main Image (pull_request) Successful in 2m28s
CICD / Production Images Complete (pull_request) Failing after 7s
CICD / Runtime Black-Box Integration Tests (pull_request) Has been skipped
CICD / End-to-End Tests (pull_request) Has been skipped
CICD / Integration Tests Failure Postmortem (pull_request) Has been skipped
CICD / E2E Tests Failure Postmortem (pull_request) Has been skipped
CICD / Production Image Failures Postmortem (pull_request) Successful in 16s

This commit is contained in:
copilotcoder
2026-07-15 13:50:42 -04:00
parent a12301f2bd
commit 3197e4e1f6

View File

@@ -19,28 +19,41 @@ ENV TZ=America/New_York
# Configure timezone
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# Force apt repositories onto HTTPS so runner network policy does not depend on plain HTTP access.
RUN set -eux; \
find /etc/apt -type f \( -name 'sources.list' -o -name '*.sources' -o -name '*.list' \) -print0 \
| xargs -0 sed -i 's|http://ports.ubuntu.com/ubuntu-ports|https://ports.ubuntu.com/ubuntu-ports|g; s|http://archive.ubuntu.com/ubuntu|https://archive.ubuntu.com/ubuntu|g; s|http://security.ubuntu.com/ubuntu|https://security.ubuntu.com/ubuntu|g'
# Configure apt timeouts and retries
RUN echo 'Acquire::Retries "3";' > /etc/apt/apt.conf.d/80retries && \
echo 'Acquire::http::Timeout "60";' >> /etc/apt/apt.conf.d/80retries && \
echo 'Acquire::https::Timeout "60";' >> /etc/apt/apt.conf.d/80retries && \
echo 'Acquire::ftp::Timeout "60";' >> /etc/apt/apt.conf.d/80retries
# Install system dependencies using plain apt-get for runner compatibility.
# Bootstrap certificates over HTTP, then enforce HTTPS for all remaining package operations.
RUN set -eux; \
apt-get clean; \
rm -rf /var/lib/apt/lists/*; \
find /etc/apt -type f \( -name 'sources.list' -o -name '*.sources' -o -name '*.list' \) -print0 \
| xargs -0 sed -i 's|https://ports.ubuntu.com/ubuntu-ports|http://ports.ubuntu.com/ubuntu-ports|g; s|https://archive.ubuntu.com/ubuntu|http://archive.ubuntu.com/ubuntu|g; s|https://security.ubuntu.com/ubuntu|http://security.ubuntu.com/ubuntu|g'; \
for i in 1 2 3; do \
echo "Attempt $i: Updating package lists..."; \
echo "Attempt $i: Bootstrapping CA certificates..."; \
if apt-get update && apt-get install -y --no-install-recommends ca-certificates; then \
break; \
fi; \
if [ "$i" -lt 3 ]; then \
echo "Bootstrap attempt $i failed, retrying..."; \
sleep 10; \
else \
exit 1; \
fi; \
done; \
update-ca-certificates; \
find /etc/apt -type f \( -name 'sources.list' -o -name '*.sources' -o -name '*.list' \) -print0 \
| xargs -0 sed -i 's|http://ports.ubuntu.com/ubuntu-ports|https://ports.ubuntu.com/ubuntu-ports|g; s|http://archive.ubuntu.com/ubuntu|https://archive.ubuntu.com/ubuntu|g; s|http://security.ubuntu.com/ubuntu|https://security.ubuntu.com/ubuntu|g'; \
rm -rf /var/lib/apt/lists/*; \
for i in 1 2 3; do \
echo "Attempt $i: Updating package lists over HTTPS..."; \
if apt-get update; then \
break; \
fi; \
if [ "$i" -lt 3 ]; then \
echo "Update attempt $i failed, retrying..."; \
echo "HTTPS update attempt $i failed, retrying..."; \
sleep 10; \
else \
exit 1; \