Skip to content

Commit 9a81c60

Browse files
Add support for MIRROR_URL build attribute
This change adds support for MIRROR_URL as a build parameters to sonic-buildimage. MIRROR_URL can be mirror of https://packages.trafficmanager.net. Signed-off-by: Pavan Naregundi <[email protected]>
1 parent 30fe000 commit 9a81c60

File tree

37 files changed

+97
-60
lines changed

37 files changed

+97
-60
lines changed

Makefile.work

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ $(shell \
210210
SONIC_VERSION_CACHE_SOURCE=$(SONIC_VERSION_CACHE_SOURCE) \
211211
DBGOPT='$(DBGOPT)' \
212212
MIRROR_SNAPSHOT=$(MIRROR_SNAPSHOT) \
213+
MIRROR_URL=$(MIRROR_URL) \
213214
PIP_HTTP_TIMEOUT=$(PIP_HTTP_TIMEOUT) \
214215
scripts/generate_buildinfo_config.sh)
215216

@@ -220,6 +221,7 @@ $(shell CONFIGURED_ARCH=$(CONFIGURED_ARCH) \
220221
INCLUDE_FIPS=$(INCLUDE_FIPS) \
221222
DOCKER_EXTRA_OPTS=$(DOCKER_EXTRA_OPTS) \
222223
DEFAULT_CONTAINER_REGISTRY=$(DEFAULT_CONTAINER_REGISTRY) \
224+
MIRROR_URL=$(MIRROR_URL) \
223225
FIPS_VERSION=$(FIPS_VERSION) \
224226
FIPS_GOLANG_VERSION=$(FIPS_GOLANG_VERSION) \
225227
j2 $(SLAVE_DIR)/Dockerfile.j2 > $(SLAVE_DIR)/Dockerfile)
@@ -231,16 +233,17 @@ $(shell CONFIGURED_ARCH=$(CONFIGURED_ARCH) \
231233

232234
ifeq ($(CROSS_BUILD_ENVIRON), y)
233235
$(shell SONIC_VERSION_CONTROL_COMPONENTS=$(SONIC_VERSION_CONTROL_COMPONENTS) \
234-
MIRROR_SNAPSHOT=$(MIRROR_SNAPSHOT) scripts/build_mirror_config.sh $(SLAVE_DIR) amd64 $(BLDENV))
236+
MIRROR_SNAPSHOT=$(MIRROR_SNAPSHOT) MIRROR_URL=$(MIRROR_URL) scripts/build_mirror_config.sh $(SLAVE_DIR) amd64 $(BLDENV))
235237
endif
236238
$(shell SONIC_VERSION_CONTROL_COMPONENTS=$(SONIC_VERSION_CONTROL_COMPONENTS) \
237-
MIRROR_SNAPSHOT=$(MIRROR_SNAPSHOT) scripts/build_mirror_config.sh $(SLAVE_DIR) $(CONFIGURED_ARCH) $(BLDENV))
239+
MIRROR_SNAPSHOT=$(MIRROR_SNAPSHOT) MIRROR_URL=$(MIRROR_URL) scripts/build_mirror_config.sh $(SLAVE_DIR) $(CONFIGURED_ARCH) $(BLDENV))
238240

239241
PREPARE_DOCKER=BUILD_SLAVE=y \
240242
DEFAULT_CONTAINER_REGISTRY=$(DEFAULT_CONTAINER_REGISTRY) \
241243
SONIC_VERSION_CACHE=$(SONIC_VERSION_CACHE) \
242244
DBGOPT='$(DBGOPT)' \
243245
MIRROR_SNAPSHOT=$(MIRROR_SNAPSHOT) \
246+
MIRROR_URL=$(MIRROR_URL) \
244247
scripts/prepare_docker_buildinfo.sh \
245248
$(SLAVE_BASE_IMAGE) \
246249
$(SLAVE_DIR)/Dockerfile \
@@ -579,6 +582,7 @@ SONIC_BUILD_INSTRUCTION := $(MAKE) \
579582
MIRROR_URLS=$(MIRROR_URLS) \
580583
MIRROR_SECURITY_URLS=$(MIRROR_SECURITY_URLS) \
581584
MIRROR_SNAPSHOT=$(MIRROR_SNAPSHOT) \
585+
MIRROR_URL=$(MIRROR_URL) \
582586
SONIC_VERSION_CONTROL_COMPONENTS=$(SONIC_VERSION_CONTROL_COMPONENTS) \
583587
ONIE_IMAGE_PART_SIZE=$(ONIE_IMAGE_PART_SIZE) \
584588
SONIC_OS_VERSION=$(SONIC_OS_VERSION) \
@@ -608,6 +612,7 @@ endif
608612
export MIRROR_URLS
609613
export MIRROR_SECURITY_URLS
610614
export MIRROR_SNAPSHOT
615+
export MIRROR_URL
611616
export SONIC_VERSION_CONTROL_COMPONENTS
612617
export PIP_HTTP_TIMEOUT
613618

build_debian.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y install docker-ce=${DOCKER_VERSIO
249249
install_kubernetes () {
250250
local ver="$1"
251251
## Install k8s package from storage
252-
local storage_prefix="https://packages.trafficmanager.net/public/kubernetes"
252+
local storage_prefix="$MIRROR_URL/public/kubernetes"
253253
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT curl -o /tmp/cri-tools.deb -fsSL \
254254
${storage_prefix}/cri-tools_${KUBERNETES_CRI_TOOLS_VERSION}_${CONFIGURED_ARCH}.deb
255255
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT curl -o /tmp/kubernetes-cni.deb -fsSL \
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Acquire::https::Verify-Peer "false";
2+
Acquire::https::Verify-Host "false";
3+

dockers/docker-base-bookworm/Dockerfile.j2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ COPY ["dpkg_01_drop", "/etc/dpkg/dpkg.cfg.d/01_drop"]
1818
COPY ["sources.list.{{ CONFIGURED_ARCH }}", "/etc/apt/sources.list"]
1919
COPY ["no_install_recommend_suggest", "/etc/apt/apt.conf.d"]
2020
COPY ["no-check-valid-until", "/etc/apt/apt.conf.d"]
21+
COPY ["99-no-ssl-check", "/etc/apt/apt.conf.d"]
2122

2223
# Update apt cache and
2324
# pre-install fundamental packages

dockers/docker-base-buster/Dockerfile.j2

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,15 @@ RUN apt-get update && \
6565

6666
# Install redis-tools
6767
{% if CONFIGURED_ARCH == "armhf" %}
68-
RUN curl -k -o redis-tools_6.0.6-1~bpo10+1_armhf.deb "https://packages.trafficmanager.net/public/redis/redis-tools_6.0.6-1_bpo10+1_armhf.deb"
68+
RUN curl -k -o redis-tools_6.0.6-1~bpo10+1_armhf.deb "{{ MIRROR_URL }}/public/redis/redis-tools_6.0.6-1_bpo10+1_armhf.deb"
6969
RUN dpkg -i redis-tools_6.0.6-1~bpo10+1_armhf.deb || apt-get install -f -y
7070
RUN rm redis-tools_6.0.6-1~bpo10+1_armhf.deb
7171
{% elif CONFIGURED_ARCH == "arm64" %}
72-
RUN curl -o redis-tools_6.0.6-1~bpo10+1_arm64.deb "https://packages.trafficmanager.net/public/redis/redis-tools_6.0.6-1_bpo10+1_arm64.deb"
72+
RUN curl -o redis-tools_6.0.6-1~bpo10+1_arm64.deb "{{ MIRROR_URL }}/public/redis/redis-tools_6.0.6-1_bpo10+1_arm64.deb"
7373
RUN dpkg -i redis-tools_6.0.6-1~bpo10+1_arm64.deb || apt-get install -f -y
7474
RUN rm redis-tools_6.0.6-1~bpo10+1_arm64.deb
7575
{% else %}
76-
RUN curl -o redis-tools_6.0.6-1~bpo10+1_amd64.deb "https://packages.trafficmanager.net/public/redis/redis-tools_6.0.6-1~bpo10+1_amd64.deb"
76+
RUN curl -o redis-tools_6.0.6-1~bpo10+1_amd64.deb "{{ MIRROR_URL }}/public/redis/redis-tools_6.0.6-1~bpo10+1_amd64.deb"
7777
RUN dpkg -i redis-tools_6.0.6-1~bpo10+1_amd64.deb || apt-get install -f -y
7878
RUN rm redis-tools_6.0.6-1~bpo10+1_amd64.deb
7979
{% endif %}

dockers/docker-base-stretch/Dockerfile.j2

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,15 @@ RUN apt-get -y -t stretch-backports install rsyslog
6464
# Install redis-tools
6565

6666
{% if CONFIGURED_ARCH == "armhf" %}
67-
RUN curl -o redis-tools_6.0.6-1~bpo10+1_armhf.deb "https://packages.trafficmanager.net/public/redis/redis-tools_6.0.6-1_bpo10+1_armhf.deb"
67+
RUN curl -o redis-tools_6.0.6-1~bpo10+1_armhf.deb "{{ MIRROR_URL }}/public/redis/redis-tools_6.0.6-1_bpo10+1_armhf.deb"
6868
RUN dpkg -i redis-tools_6.0.6-1~bpo10+1_armhf.deb || apt-get install -f -y
6969
RUN rm redis-tools_6.0.6-1~bpo10+1_armhf.deb
7070
{% elif CONFIGURED_ARCH == "arm64" %}
71-
RUN curl -o redis-tools_6.0.6-1~bpo10+1_arm64.deb "https://packages.trafficmanager.net/public/redis/redis-tools_6.0.6-1_bpo10+1_arm64.deb"
71+
RUN curl -o redis-tools_6.0.6-1~bpo10+1_arm64.deb "{{ MIRROR_URL }}/public/redis/redis-tools_6.0.6-1_bpo10+1_arm64.deb"
7272
RUN dpkg -i redis-tools_6.0.6-1~bpo10+1_arm64.deb || apt-get install -f -y
7373
RUN rm redis-tools_6.0.6-1~bpo10+1_arm64.deb
7474
{% else %}
75-
RUN curl -o redis-tools_6.0.6-1~bpo10+1_amd64.deb "https://packages.trafficmanager.net/public/redis/redis-tools_6.0.6-1~bpo10+1_amd64.deb"
75+
RUN curl -o redis-tools_6.0.6-1~bpo10+1_amd64.deb "{{ MIRROR_URL }}/public/redis/redis-tools_6.0.6-1_bpo10+1_amd64.deb"
7676
RUN dpkg -i redis-tools_6.0.6-1~bpo10+1_amd64.deb || apt-get install -f -y
7777
RUN rm redis-tools_6.0.6-1~bpo10+1_amd64.deb
7878
{% endif %}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Acquire::https::Verify-Peer "false";
2+
Acquire::https::Verify-Host "false";

dockers/docker-base/Dockerfile.j2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ COPY ["sources.list", "/etc/apt/sources.list"]
3939
{% endif %}
4040
COPY ["no_install_recommend_suggest", "/etc/apt/apt.conf.d"]
4141
COPY ["apt-retries-count", "/etc/apt/apt.conf.d"]
42+
COPY ["99-no-ssl-check", "/etc/apt/apt.conf.d"]
4243
RUN apt-get update
4344

4445
# Pre-install fundamental packages

dockers/docker-sonic-mgmt/Dockerfile.j2

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -224,13 +224,13 @@ RUN python3 -m pip show protobuf && python3 -m pip uninstall -y protobuf
224224
# Install protobuf 3.21.12 which is from https://deb.debian.org/debian/pool/main/p/protobuf/protobuf_3.21.12-3.dsc
225225
RUN mkdir -p /tmp/protobuf \
226226
&& cd /tmp/protobuf \
227-
&& wget https://packages.trafficmanager.net/public/ubuntu/20.04/libprotobuf-dev_3.21.12-3_amd64.deb \
228-
&& wget https://packages.trafficmanager.net/public/ubuntu/20.04/libprotobuf-lite32_3.21.12-3_amd64.deb \
229-
&& wget https://packages.trafficmanager.net/public/ubuntu/20.04/libprotobuf32_3.21.12-3_amd64.deb \
230-
&& wget https://packages.trafficmanager.net/public/ubuntu/20.04/libprotoc-dev_3.21.12-3_amd64.deb \
231-
&& wget https://packages.trafficmanager.net/public/ubuntu/20.04/libprotoc32_3.21.12-3_amd64.deb \
232-
&& wget https://packages.trafficmanager.net/public/ubuntu/20.04/protobuf-compiler_3.21.12-3_amd64.deb \
233-
&& wget https://packages.trafficmanager.net/public/ubuntu/20.04/python3-protobuf_3.21.12-3_amd64.deb \
227+
&& wget {{ MIRROR_URL }}/public/ubuntu/20.04/libprotobuf-dev_3.21.12-3_amd64.deb \
228+
&& wget {{ MIRROR_URL }}/public/ubuntu/20.04/libprotobuf-lite32_3.21.12-3_amd64.deb \
229+
&& wget {{ MIRROR_URL }}/public/ubuntu/20.04/libprotobuf32_3.21.12-3_amd64.deb \
230+
&& wget {{ MIRROR_URL }}/public/ubuntu/20.04/libprotoc-dev_3.21.12-3_amd64.deb \
231+
&& wget {{ MIRROR_URL }}/public/ubuntu/20.04/libprotoc32_3.21.12-3_amd64.deb \
232+
&& wget {{ MIRROR_URL }}/public/ubuntu/20.04/protobuf-compiler_3.21.12-3_amd64.deb \
233+
&& wget {{ MIRROR_URL }}/public/ubuntu/20.04/python3-protobuf_3.21.12-3_amd64.deb \
234234
&& dpkg -i *.deb \
235235
&& rm -rf /tmp/protobuf
236236

get_docker-base.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ set -x -e
1212
TARGET_PATH=$(sed -n 's/TARGET_PATH\s*=\s*//p' slave.mk)
1313

1414
## [SuppressMessage("Microsoft.Security", "CS002:SecretInNextLine", Justification="Read-only link of Azure Blob storage with shared access signature (SAS)")]
15-
BASE_URL="https://packages.trafficmanager.net/public/docker-base.ea507753d98b0769e2a15be13003331f8ad38d1c15b40a683e05fc53b1463b10.gz"
15+
BASE_URL="$MIRROR_URL/public/docker-base.ea507753d98b0769e2a15be13003331f8ad38d1c15b40a683e05fc53b1463b10.gz"
1616

1717
base_image_name=docker-base
1818
docker_try_rmi $base_image_name

0 commit comments

Comments
 (0)