From 25f81c77480102296e5958aff776edec7a672b29 Mon Sep 17 00:00:00 2001 From: Lari Hotari Date: Wed, 2 Feb 2022 18:06:30 +0200 Subject: [PATCH] Support specifying Ubuntu mirror for docker image builds (#14095) - use UBUNTU_MIRROR environment variable to specify - default to closest mirrors (http://mirrors.ubuntu.com/mirrors.txt) - use Azure's Ubuntu mirror in CI --- .../workflows/ci-integration-backwards-compatibility.yaml | 1 + .github/workflows/ci-integration-cli.yaml | 1 + .github/workflows/ci-integration-function.yaml | 1 + .github/workflows/ci-integration-messaging.yaml | 1 + .github/workflows/ci-integration-process.yaml | 1 + .github/workflows/ci-integration-pulsar-io-ora.yaml | 1 + .github/workflows/ci-integration-pulsar-io.yaml | 1 + .github/workflows/ci-integration-schema.yaml | 1 + .github/workflows/ci-integration-sql.yaml | 1 + .github/workflows/ci-integration-standalone.yaml | 1 + .github/workflows/ci-integration-thread.yaml | 1 + .github/workflows/ci-integration-tiered-filesystem.yaml | 1 + .github/workflows/ci-integration-tiered-jcloud.yaml | 1 + .github/workflows/ci-integration-transaction.yaml | 1 + .github/workflows/ci-shade-test.yaml | 1 + docker/pulsar/Dockerfile | 6 ++++-- docker/pulsar/pom.xml | 1 + tests/docker-images/java-test-image/Dockerfile | 6 ++++-- tests/docker-images/java-test-image/pom.xml | 1 + 19 files changed, 25 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci-integration-backwards-compatibility.yaml b/.github/workflows/ci-integration-backwards-compatibility.yaml index 59efbabe45a805..b02bf76e19fe4d 100644 --- a/.github/workflows/ci-integration-backwards-compatibility.yaml +++ b/.github/workflows/ci-integration-backwards-compatibility.yaml @@ -28,6 +28,7 @@ on: env: MAVEN_OPTS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3 + UBUNTU_MIRROR: http://azure.archive.ubuntu.com/ubuntu/ jobs: diff --git a/.github/workflows/ci-integration-cli.yaml b/.github/workflows/ci-integration-cli.yaml index 7fb9b950c82083..465b4a668d1190 100644 --- a/.github/workflows/ci-integration-cli.yaml +++ b/.github/workflows/ci-integration-cli.yaml @@ -28,6 +28,7 @@ on: env: MAVEN_OPTS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3 + UBUNTU_MIRROR: http://azure.archive.ubuntu.com/ubuntu/ jobs: diff --git a/.github/workflows/ci-integration-function.yaml b/.github/workflows/ci-integration-function.yaml index 1e7e5005f996ea..df27830676d451 100644 --- a/.github/workflows/ci-integration-function.yaml +++ b/.github/workflows/ci-integration-function.yaml @@ -28,6 +28,7 @@ on: env: MAVEN_OPTS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3 + UBUNTU_MIRROR: http://azure.archive.ubuntu.com/ubuntu/ jobs: diff --git a/.github/workflows/ci-integration-messaging.yaml b/.github/workflows/ci-integration-messaging.yaml index 68eeda8aed3508..a4e8fe35502c8f 100644 --- a/.github/workflows/ci-integration-messaging.yaml +++ b/.github/workflows/ci-integration-messaging.yaml @@ -28,6 +28,7 @@ on: env: MAVEN_OPTS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3 + UBUNTU_MIRROR: http://azure.archive.ubuntu.com/ubuntu/ jobs: diff --git a/.github/workflows/ci-integration-process.yaml b/.github/workflows/ci-integration-process.yaml index 10d3b5ebd2def4..5be43eac368011 100644 --- a/.github/workflows/ci-integration-process.yaml +++ b/.github/workflows/ci-integration-process.yaml @@ -28,6 +28,7 @@ on: env: MAVEN_OPTS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3 + UBUNTU_MIRROR: http://azure.archive.ubuntu.com/ubuntu/ jobs: diff --git a/.github/workflows/ci-integration-pulsar-io-ora.yaml b/.github/workflows/ci-integration-pulsar-io-ora.yaml index 33b5d11af8329e..c12c4e759128e3 100644 --- a/.github/workflows/ci-integration-pulsar-io-ora.yaml +++ b/.github/workflows/ci-integration-pulsar-io-ora.yaml @@ -28,6 +28,7 @@ on: env: MAVEN_OPTS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3 + UBUNTU_MIRROR: http://azure.archive.ubuntu.com/ubuntu/ jobs: diff --git a/.github/workflows/ci-integration-pulsar-io.yaml b/.github/workflows/ci-integration-pulsar-io.yaml index 9b811f2b8c540b..bb64143d0f3bc6 100644 --- a/.github/workflows/ci-integration-pulsar-io.yaml +++ b/.github/workflows/ci-integration-pulsar-io.yaml @@ -28,6 +28,7 @@ on: env: MAVEN_OPTS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3 + UBUNTU_MIRROR: http://azure.archive.ubuntu.com/ubuntu/ jobs: diff --git a/.github/workflows/ci-integration-schema.yaml b/.github/workflows/ci-integration-schema.yaml index 84c02c39471a74..da56cf59328ce4 100644 --- a/.github/workflows/ci-integration-schema.yaml +++ b/.github/workflows/ci-integration-schema.yaml @@ -28,6 +28,7 @@ on: env: MAVEN_OPTS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3 + UBUNTU_MIRROR: http://azure.archive.ubuntu.com/ubuntu/ jobs: diff --git a/.github/workflows/ci-integration-sql.yaml b/.github/workflows/ci-integration-sql.yaml index 6b5d7ba0077bc6..1821f1e5f8813b 100644 --- a/.github/workflows/ci-integration-sql.yaml +++ b/.github/workflows/ci-integration-sql.yaml @@ -28,6 +28,7 @@ on: env: MAVEN_OPTS: -Xmx768m -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3 + UBUNTU_MIRROR: http://azure.archive.ubuntu.com/ubuntu/ MALLOC_ARENA_MAX: "1" jobs: diff --git a/.github/workflows/ci-integration-standalone.yaml b/.github/workflows/ci-integration-standalone.yaml index 17499c4741ff32..63c4ac0b55d332 100644 --- a/.github/workflows/ci-integration-standalone.yaml +++ b/.github/workflows/ci-integration-standalone.yaml @@ -28,6 +28,7 @@ on: env: MAVEN_OPTS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3 + UBUNTU_MIRROR: http://azure.archive.ubuntu.com/ubuntu/ jobs: diff --git a/.github/workflows/ci-integration-thread.yaml b/.github/workflows/ci-integration-thread.yaml index 2133a537275210..c5806db32d5f17 100644 --- a/.github/workflows/ci-integration-thread.yaml +++ b/.github/workflows/ci-integration-thread.yaml @@ -28,6 +28,7 @@ on: env: MAVEN_OPTS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3 + UBUNTU_MIRROR: http://azure.archive.ubuntu.com/ubuntu/ jobs: diff --git a/.github/workflows/ci-integration-tiered-filesystem.yaml b/.github/workflows/ci-integration-tiered-filesystem.yaml index 413838faecc6ee..ead40bdb00c35b 100644 --- a/.github/workflows/ci-integration-tiered-filesystem.yaml +++ b/.github/workflows/ci-integration-tiered-filesystem.yaml @@ -28,6 +28,7 @@ on: env: MAVEN_OPTS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3 + UBUNTU_MIRROR: http://azure.archive.ubuntu.com/ubuntu/ jobs: diff --git a/.github/workflows/ci-integration-tiered-jcloud.yaml b/.github/workflows/ci-integration-tiered-jcloud.yaml index 5ba8d357dd1547..62f7bfa0ab065b 100644 --- a/.github/workflows/ci-integration-tiered-jcloud.yaml +++ b/.github/workflows/ci-integration-tiered-jcloud.yaml @@ -28,6 +28,7 @@ on: env: MAVEN_OPTS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3 + UBUNTU_MIRROR: http://azure.archive.ubuntu.com/ubuntu/ jobs: diff --git a/.github/workflows/ci-integration-transaction.yaml b/.github/workflows/ci-integration-transaction.yaml index cd2624865856f3..350f36c9b41065 100644 --- a/.github/workflows/ci-integration-transaction.yaml +++ b/.github/workflows/ci-integration-transaction.yaml @@ -28,6 +28,7 @@ on: env: MAVEN_OPTS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3 + UBUNTU_MIRROR: http://azure.archive.ubuntu.com/ubuntu/ jobs: diff --git a/.github/workflows/ci-shade-test.yaml b/.github/workflows/ci-shade-test.yaml index 1aecf70b17c991..9e54ce40eabe0d 100644 --- a/.github/workflows/ci-shade-test.yaml +++ b/.github/workflows/ci-shade-test.yaml @@ -28,6 +28,7 @@ on: env: MAVEN_OPTS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3 + UBUNTU_MIRROR: http://azure.archive.ubuntu.com/ubuntu/ jobs: diff --git a/docker/pulsar/Dockerfile b/docker/pulsar/Dockerfile index 2dbd78dabead2d..9bdf364f490635 100644 --- a/docker/pulsar/Dockerfile +++ b/docker/pulsar/Dockerfile @@ -41,9 +41,11 @@ RUN mkdir /pulsar/data FROM ubuntu:20.04 ARG DEBIAN_FRONTEND=noninteractive +ARG UBUNTU_MIRROR=mirror://mirrors.ubuntu.com/mirrors.txt # Install some utilities -RUN apt-get update \ +RUN sed -i "s|http://archive\.ubuntu\.com/ubuntu/|${UBUNTU_MIRROR:-mirror://mirrors.ubuntu.com/mirrors.txt}|g" /etc/apt/sources.list \ + && apt-get update \ && apt-get -y dist-upgrade \ && apt-get -y install openjdk-11-jdk-headless netcat dnsutils less procps iputils-ping \ python3 python3-dev python3-setuptools python3-yaml python3-kazoo \ @@ -69,4 +71,4 @@ ENV PULSAR_ROOT_LOGGER=INFO,CONSOLE COPY --from=pulsar /pulsar /pulsar WORKDIR /pulsar -RUN /pulsar/bin/install-pulsar-client.sh \ No newline at end of file +RUN /pulsar/bin/install-pulsar-client.sh diff --git a/docker/pulsar/pom.xml b/docker/pulsar/pom.xml index 20a9c2eaa3676c..6d61417f049ee1 100644 --- a/docker/pulsar/pom.xml +++ b/docker/pulsar/pom.xml @@ -151,6 +151,7 @@ ${project.version} target/pulsar-server-distribution-${project.version}-bin.tar.gz + ${env.UBUNTU_MIRROR} diff --git a/tests/docker-images/java-test-image/Dockerfile b/tests/docker-images/java-test-image/Dockerfile index 91c8448942465c..564182534acaf2 100644 --- a/tests/docker-images/java-test-image/Dockerfile +++ b/tests/docker-images/java-test-image/Dockerfile @@ -33,8 +33,10 @@ RUN chmod a+rx /pulsar/bin/* WORKDIR /pulsar ARG DEBIAN_FRONTEND=noninteractive +ARG UBUNTU_MIRROR=mirror://mirrors.ubuntu.com/mirrors.txt -RUN apt-get update \ +RUN sed -i "s|http://archive\.ubuntu\.com/ubuntu/|${UBUNTU_MIRROR:-mirror://mirrors.ubuntu.com/mirrors.txt}|g" /etc/apt/sources.list \ + && apt-get update \ && apt-get -y dist-upgrade \ && apt-get -y install openjdk-11-jdk-headless @@ -69,4 +71,4 @@ RUN chown -R pulsar:0 /pulsar && chmod -R g=u /pulsar RUN apt-get -y --purge autoremove \ && apt-get autoclean \ && apt-get clean \ - && rm -rf /var/lib/apt/lists/* \ No newline at end of file + && rm -rf /var/lib/apt/lists/* diff --git a/tests/docker-images/java-test-image/pom.xml b/tests/docker-images/java-test-image/pom.xml index 0e9aee1aa3ab11..9c58eae07f5528 100644 --- a/tests/docker-images/java-test-image/pom.xml +++ b/tests/docker-images/java-test-image/pom.xml @@ -165,6 +165,7 @@ true target/pulsar-server-distribution-bin.tar.gz + ${env.UBUNTU_MIRROR}