Skip to content

Add support for MIRROR_URL build attribute#24510

Merged
lihuay merged 10 commits intosonic-net:masterfrom
pavannaregundi:mirror_url
Feb 24, 2026
Merged

Add support for MIRROR_URL build attribute#24510
lihuay merged 10 commits intosonic-net:masterfrom
pavannaregundi:mirror_url

Conversation

@pavannaregundi
Copy link
Contributor

@pavannaregundi pavannaregundi commented Nov 12, 2025

This change adds support for BUILD_PUBLIC_URL and BUILD_SNAPSHOT_URL as a build parameters to sonic-buildimage.

BUILD_SNAPSHOT_URL can be any mirror of https://snapshot.debian.org/archive or http://packages.trafficmanager.net/snapshot
BUILD_PUBLIC_URL can be any mirror of https://packages.trafficmanager.net/public
BUILD_PACKAGES_URL can be any mirror of https://packages.trafficmanager.net/packages

Why I did it

  • Download from packages.trafficmanager.net is flaky. Due to this there is a requirement to create local mirror for the same.
  • Current build options does not give option to set alternative mirror url.
Work item tracking
  • Microsoft ADO (number only):

How I did it

  • Introduced BUILD_PUBLIC_URL variable to replace all occurrences of https://packages.trafficmanager.net/public.
  • Introduced BUILD_SNAPSHOT_URL variable to replace all occurrences of http://packages.trafficmanager.net/snapshot
  • Since packages.trafficmanager.net appears in multiple places with both HTTP and HTTPS links. BUILD_SNAPSHOT_URL is retained with http by default.
  • Support for https BUILD_SNAPSHOT_URL is added for bookworm and trixie dockers.
  • The variable can be overridden by passing it as a build argument.
BUILD_PUBLIC_URL=https://packages.trafficmanager.net/public BUILD_SNAPSHOT_URL=http://packages.trafficmanager.net/snapshot SONIC_VERSION_CONTROL_COMPONENTS=py2,py3,web,git,docker MIRROR_SNAPSHOT=y make configure PLATFORM=marvell-teralynx
BUILD_PUBLIC_URL=https://packages.trafficmanager.net/public BUILD_SNAPSHOT_URL=http://packages.trafficmanager.net/snapshot SONIC_VERSION_CONTROL_COMPONENTS=py2,py3,web,git,docker MIRROR_SNAPSHOT=y make target/sonic-marvell-teralynx.bin

How to verify it

Changes are verified with alternative local mirror of packages.trafficmanager.net.

Which release branch to backport (provide reason below if selected)

  • 202205
  • 202211
  • 202305
  • 202311
  • 202405
  • 202411
  • 202505

Tested branch (Please provide the tested image version)

Description for the changelog

Link to config_db schema for YANG module changes

A picture of a cute animal (not mandatory but encouraged)

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command.

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command.

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@pavannaregundi pavannaregundi force-pushed the mirror_url branch 2 times, most recently from 9294279 to 0bfd53c Compare November 28, 2025 07:21
@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@@ -5,7 +5,7 @@ SHELL = /bin/bash
MAIN_TARGET = $(LLDPD)
DERIVED_TARGETS = $(LIBLLDPCTL) $(LLDPD_DBG)

LLDP_URL = https://packages.trafficmanager.net/public/debian/pool/main/l/lldpd
LLDP_URL = $(MIRROR_URL)/public/debian/pool/main/l/lldpd
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this also be renamed to PACKAGE_MIRROR_URL?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Done.

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

rules/config Outdated
DEBIAN_SNAP_MIRROR_URL ?= http://packages.trafficmanager.net/snapshot

# PACKAGE_MIRROR_URL - Default package mirror url
PACKAGE_MIRROR_URL ?= https://packages.trafficmanager.net
Copy link
Contributor

@liushilongbuaa liushilongbuaa Feb 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's better to use https://packages.trafficmanager.net/public
The following 3 URL are not related. They can share the same domain or not.

http://packages.trafficmanager.net/snapshot      (debian snapshot mirror)
https://packages.trafficmanager.net/public       (Microsoft backup some files to avoid web file change.)
https://packages.trafficmanager.net/packages     (Microsoft hosted to support reproducible build feature.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to know.
Is the current name of PACKAGE_MIRROR_URL fine for "https://packages.trafficmanager.net/public"? Or Should we use PUBLIC_URL_PREFIX similar to PACKAGE_URL_PREFIX as it exists for "https://packages.trafficmanager.net/packages"?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BUILD_SNAPSHOT_URL
BUILD_PUBLIC_URL
BUILD_PACKGES_URL
How about these names. It shows that they are not feature related, just for build.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. Will work on this change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pushed the changes. Please review

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@pavannaregundi
Copy link
Contributor Author

/azpw run Azure.sonic-buildimage

@mssonicbld
Copy link
Collaborator

/AzurePipelines run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@radha-danda
Copy link

/azpw run Azure.sonic-buildimage

@mssonicbld
Copy link
Collaborator

/AzurePipelines run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@lihuay lihuay merged commit d444f1f into sonic-net:master Feb 24, 2026
26 checks passed
FengPan-Frank pushed a commit to FengPan-Frank/sonic-buildimage that referenced this pull request Mar 6, 2026
* 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]>

* Separate Debian snapshot mirror URL from general mirror URL

Signed-off-by: Pavan Naregundi <[email protected]>

* Revert changes for older debians

Signed-off-by: Pavan Naregundi <[email protected]>

* Install ca-certificates in pre_run_buildinfo

Signed-off-by: Pavan Naregundi <[email protected]>

* Change sed delimiter to avoid escape characters

Signed-off-by: Pavan Naregundi <[email protected]>

* Simplify the certificates install by bypassing peer check

Signed-off-by: Pavan Naregundi <[email protected]>

* Pass https verify peer as an argument for apt

Signed-off-by: Pavan Naregundi <[email protected]>

* Add changes for docker-base-trixie

Signed-off-by: Pavan Naregundi <[email protected]>

* Rename to all URL to BUILD_<suffix>_URL

Signed-off-by: Pavan Naregundi <[email protected]>

---------

Signed-off-by: Pavan Naregundi <[email protected]>
Co-authored-by: Lihua Yuan <[email protected]>
Signed-off-by: Feng Pan <[email protected]>
dprital pushed a commit that referenced this pull request Mar 19, 2026
* 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]>

* Separate Debian snapshot mirror URL from general mirror URL

Signed-off-by: Pavan Naregundi <[email protected]>

* Revert changes for older debians

Signed-off-by: Pavan Naregundi <[email protected]>

* Install ca-certificates in pre_run_buildinfo

Signed-off-by: Pavan Naregundi <[email protected]>

* Change sed delimiter to avoid escape characters

Signed-off-by: Pavan Naregundi <[email protected]>

* Simplify the certificates install by bypassing peer check

Signed-off-by: Pavan Naregundi <[email protected]>

* Pass https verify peer as an argument for apt

Signed-off-by: Pavan Naregundi <[email protected]>

* Add changes for docker-base-trixie

Signed-off-by: Pavan Naregundi <[email protected]>

* Rename to all URL to BUILD_<suffix>_URL

Signed-off-by: Pavan Naregundi <[email protected]>

---------

Signed-off-by: Pavan Naregundi <[email protected]>
Co-authored-by: Lihua Yuan <[email protected]>
Signed-off-by: dprital <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants