Skip to content

Commit d1e4096

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 ff937d3 commit d1e4096

File tree

37 files changed

+104
-53
lines changed

37 files changed

+104
-53
lines changed

Makefile.work

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ $(shell \
206206
SONIC_VERSION_CACHE_SOURCE=$(SONIC_VERSION_CACHE_SOURCE) \
207207
DBGOPT='$(DBGOPT)' \
208208
MIRROR_SNAPSHOT=$(MIRROR_SNAPSHOT) \
209+
MIRROR_URL=$(MIRROR_URL) \
209210
PIP_HTTP_TIMEOUT=$(PIP_HTTP_TIMEOUT) \
210211
scripts/generate_buildinfo_config.sh)
211212

@@ -216,6 +217,7 @@ $(shell CONFIGURED_ARCH=$(CONFIGURED_ARCH) \
216217
INCLUDE_FIPS=$(INCLUDE_FIPS) \
217218
DOCKER_EXTRA_OPTS=$(DOCKER_EXTRA_OPTS) \
218219
DEFAULT_CONTAINER_REGISTRY=$(DEFAULT_CONTAINER_REGISTRY) \
220+
MIRROR_URL=$(MIRROR_URL) \
219221
FIPS_VERSION=$(FIPS_VERSION) \
220222
FIPS_GOLANG_VERSION=$(FIPS_GOLANG_VERSION) \
221223
j2 $(SLAVE_DIR)/Dockerfile.j2 > $(SLAVE_DIR)/Dockerfile)
@@ -227,16 +229,17 @@ $(shell CONFIGURED_ARCH=$(CONFIGURED_ARCH) \
227229

228230
ifeq ($(CROSS_BUILD_ENVIRON), y)
229231
$(shell SONIC_VERSION_CONTROL_COMPONENTS=$(SONIC_VERSION_CONTROL_COMPONENTS) \
230-
MIRROR_SNAPSHOT=$(MIRROR_SNAPSHOT) scripts/build_mirror_config.sh $(SLAVE_DIR) amd64 $(BLDENV))
232+
MIRROR_SNAPSHOT=$(MIRROR_SNAPSHOT) MIRROR_URL=$(MIRROR_URL) scripts/build_mirror_config.sh $(SLAVE_DIR) amd64 $(BLDENV))
231233
endif
232234
$(shell SONIC_VERSION_CONTROL_COMPONENTS=$(SONIC_VERSION_CONTROL_COMPONENTS) \
233-
MIRROR_SNAPSHOT=$(MIRROR_SNAPSHOT) scripts/build_mirror_config.sh $(SLAVE_DIR) $(CONFIGURED_ARCH) $(BLDENV))
235+
MIRROR_SNAPSHOT=$(MIRROR_SNAPSHOT) MIRROR_URL=$(MIRROR_URL) scripts/build_mirror_config.sh $(SLAVE_DIR) $(CONFIGURED_ARCH) $(BLDENV))
234236

235237
PREPARE_DOCKER=BUILD_SLAVE=y \
236238
DEFAULT_CONTAINER_REGISTRY=$(DEFAULT_CONTAINER_REGISTRY) \
237239
SONIC_VERSION_CACHE=$(SONIC_VERSION_CACHE) \
238240
DBGOPT='$(DBGOPT)' \
239241
MIRROR_SNAPSHOT=$(MIRROR_SNAPSHOT) \
242+
MIRROR_URL=$(MIRROR_URL) \
240243
scripts/prepare_docker_buildinfo.sh \
241244
$(SLAVE_BASE_IMAGE) \
242245
$(SLAVE_DIR)/Dockerfile \
@@ -575,6 +578,7 @@ SONIC_BUILD_INSTRUCTION := $(MAKE) \
575578
MIRROR_URLS=$(MIRROR_URLS) \
576579
MIRROR_SECURITY_URLS=$(MIRROR_SECURITY_URLS) \
577580
MIRROR_SNAPSHOT=$(MIRROR_SNAPSHOT) \
581+
MIRROR_URL=$(MIRROR_URL) \
578582
SONIC_VERSION_CONTROL_COMPONENTS=$(SONIC_VERSION_CONTROL_COMPONENTS) \
579583
ONIE_IMAGE_PART_SIZE=$(ONIE_IMAGE_PART_SIZE) \
580584
SONIC_OS_VERSION=$(SONIC_OS_VERSION) \
@@ -603,6 +607,7 @@ endif
603607
export MIRROR_URLS
604608
export MIRROR_SECURITY_URLS
605609
export MIRROR_SNAPSHOT
610+
export MIRROR_URL
606611
export SONIC_VERSION_CONTROL_COMPONENTS
607612
export PIP_HTTP_TIMEOUT
608613

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 \

dockers/docker-base-bookworm/Dockerfile.j2

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ FROM $BASE AS base
1313
# Make apt-get non-interactive
1414
ENV DEBIAN_FRONTEND=noninteractive
1515

16+
RUN cp /etc/apt/sources.list.d/debian.sources.back /etc/apt/sources.list.d/debian.sources
17+
RUN apt-get update && apt-get install -y apt-transport-https ca-certificates
18+
RUN rm -f /etc/apt/sources.list.d/debian.sources
19+
1620
# Configure data sources for apt/dpkg
1721
COPY ["dpkg_01_drop", "/etc/dpkg/dpkg.cfg.d/01_drop"]
1822
COPY ["sources.list.{{ CONFIGURED_ARCH }}", "/etc/apt/sources.list"]
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-bullseye/Dockerfile.j2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ 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"]
2121
COPY ["apt-multiple-retries", "/etc/apt/apt.conf.d"]
22+
COPY ["99-no-ssl-check", "/etc/apt/apt.conf.d"]
2223

2324
# Update apt cache and
2425
# pre-install fundamental packages
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-buster/Dockerfile.j2

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ COPY ["sources.list.{{ CONFIGURED_ARCH }}", "/etc/apt/sources.list"]
3131
COPY ["no_install_recommend_suggest", "/etc/apt/apt.conf.d"]
3232
COPY ["no-check-valid-until", "/etc/apt/apt.conf.d"]
3333
COPY ["apt-retries-count", "/etc/apt/apt.conf.d"]
34+
COPY ["99-no-ssl-check", "/etc/apt/apt.conf.d"]
3435

3536
# Update apt cache and
3637
# pre-install fundamental packages
@@ -65,15 +66,15 @@ RUN apt-get update && \
6566

6667
# Install redis-tools
6768
{% 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"
69+
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"
6970
RUN dpkg -i redis-tools_6.0.6-1~bpo10+1_armhf.deb || apt-get install -f -y
7071
RUN rm redis-tools_6.0.6-1~bpo10+1_armhf.deb
7172
{% 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"
73+
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"
7374
RUN dpkg -i redis-tools_6.0.6-1~bpo10+1_arm64.deb || apt-get install -f -y
7475
RUN rm redis-tools_6.0.6-1~bpo10+1_arm64.deb
7576
{% 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"
77+
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"
7778
RUN dpkg -i redis-tools_6.0.6-1~bpo10+1_amd64.deb || apt-get install -f -y
7879
RUN rm redis-tools_6.0.6-1~bpo10+1_amd64.deb
7980
{% endif %}
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-stretch/Dockerfile.j2

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ COPY ["sources.list.{{ CONFIGURED_ARCH }}", "/etc/apt/sources.list"]
3131
COPY ["no_install_recommend_suggest", "/etc/apt/apt.conf.d"]
3232
COPY ["no-check-valid-until", "/etc/apt/apt.conf.d"]
3333
COPY ["apt-retries-count", "/etc/apt/apt.conf.d"]
34+
COPY ["99-no-ssl-check", "/etc/apt/apt.conf.d"]
3435

3536
# Update apt cache and
3637
# pre-install fundamental packages
@@ -64,15 +65,15 @@ RUN apt-get -y -t stretch-backports install rsyslog
6465
# Install redis-tools
6566

6667
{% 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"
68+
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"
6869
RUN dpkg -i redis-tools_6.0.6-1~bpo10+1_armhf.deb || apt-get install -f -y
6970
RUN rm redis-tools_6.0.6-1~bpo10+1_armhf.deb
7071
{% 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"
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"
7273
RUN dpkg -i redis-tools_6.0.6-1~bpo10+1_arm64.deb || apt-get install -f -y
7374
RUN rm redis-tools_6.0.6-1~bpo10+1_arm64.deb
7475
{% 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"
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"
7677
RUN dpkg -i redis-tools_6.0.6-1~bpo10+1_amd64.deb || apt-get install -f -y
7778
RUN rm redis-tools_6.0.6-1~bpo10+1_amd64.deb
7879
{% 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";

0 commit comments

Comments
 (0)