Skip to content

Debian Trixie migration for sonic-mgmt-common#211

Open
amrutasali wants to merge 3 commits intosonic-net:masterfrom
amrutasali:trixie_migration_for_sonic_mgmt_common
Open

Debian Trixie migration for sonic-mgmt-common#211
amrutasali wants to merge 3 commits intosonic-net:masterfrom
amrutasali:trixie_migration_for_sonic_mgmt_common

Conversation

@amrutasali
Copy link
Copy Markdown
Contributor

@amrutasali amrutasali commented Apr 3, 2026

Why I did it -

Required for sonic-net/SONiC#2169 , sonic-mgmt-common is a dependency for sonic-mgmt-framework

How I did it -

Updated the package build configuration to support Trixie distro. Key changes include:
Updated Azure Pipelines to use sonic-slave-trixie container
Added libpcre3 dependencies (not available in Trixie repos)
Bumped Go version to 1.24.4 to align with Trixie's provided version
Fixed Go 1.24+ vendor module requirements for ygot tool

How to verify it -

The sonic-mgmt-framework container builds successfully under BLDENV=trixie which in turn builds sonic-mgmt-common(the .deb was correctlt paced in target/debs/trixie). Installed sonic-mgmt-framework container on a recent SONiC image and verified that the docker OS distribution shows Trixie and basic curl test on REST server hosted within the docker works fine. Also executed the pipeline tests locally.

Note:
Dependent/Related PRs:
sonic-net/sonic-buildimage#26548
sonic-net/sonic-mgmt-framework#158

@mssonicbld
Copy link
Copy Markdown

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Copy Markdown

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Signed-off-by: Amruta Sali <amruta_sali@dell.com>
Signed-off-by: Amruta Sali <amruta_sali@dell.com>
@amrutasali amrutasali force-pushed the trixie_migration_for_sonic_mgmt_common branch from be6236e to 9aa7f8b Compare April 3, 2026 21:51
@mssonicbld
Copy link
Copy Markdown

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@lihuay lihuay requested a review from Copilot April 4, 2026 14:31
@mssonicbld
Copy link
Copy Markdown

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates sonic-mgmt-common build and CI configuration to support Debian Trixie, aligning with the broader SONiC Trixie migration so downstream projects (notably sonic-mgmt-framework) can build and run on the new distro.

Changes:

  • Switch Azure Pipelines build container and artifact paths from Bookworm to Trixie, including installing libpcre3 packages required by libyang.
  • Bump the module Go version to Go 1.24.4.
  • Adjust translib YGOT binding generation to account for Go 1.24+ vendoring behavior.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
azure-pipelines.yml Migrates pipeline container/artifact paths to Trixie and installs additional Debian dependencies.
go.mod Updates declared Go version for the module.
translib/Makefile Attempts to patch vendoring metadata to allow go run of vendored ygot generator under Go 1.24+.
cvl/cvl.go Minor logging call adjustment while parsing schema files.

Comment on lines +72 to 85
# Go 1.24+ changed 'go mod vendor' to only include packages directly
# imported by the module. The ygot tool packages and their dependencies
# are used by 'go run' below but not directly imported, so they are no
# longer vendored automatically. Add them to vendor/modules.txt.
@grep -q 'github.com/openconfig/ygot/ygen' $(TOPDIR)/vendor/modules.txt 2>/dev/null || \
( echo "github.com/openconfig/gnmi/ctree" >> $(TOPDIR)/vendor/modules.txt && \
echo "github.com/openconfig/gnmi/errlist" >> $(TOPDIR)/vendor/modules.txt && \
echo "github.com/openconfig/gnmi/proto/gnmi" >> $(TOPDIR)/vendor/modules.txt && \
echo "github.com/openconfig/ygot/genutil" >> $(TOPDIR)/vendor/modules.txt && \
echo "github.com/openconfig/ygot/generator" >> $(TOPDIR)/vendor/modules.txt && \
echo "github.com/openconfig/ygot/ygen" >> $(TOPDIR)/vendor/modules.txt )
$(GO) run \
--mod=vendor \
$(TOPDIR)/vendor/github.com/openconfig/ygot/generator/generator.go \
Copy link

Copilot AI Apr 4, 2026

Choose a reason for hiding this comment

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

Editing vendor/modules.txt by appending raw package paths is very likely to produce an invalid or misleading modules.txt, because entries are expected to be grouped under a corresponding "# " header (and optionally "## explicit"). Appending at EOF can associate these packages with the wrong module header or leave them without one, and it also makes the build non-reproducible by mutating generated vendoring output during the build. Prefer making vendoring include the needed tool packages (e.g., add a build-tagged tools file with blank imports for the ygot generator/ygen deps and regenerate vendor), rather than patching modules.txt in-place.

Suggested change
# Go 1.24+ changed 'go mod vendor' to only include packages directly
# imported by the module. The ygot tool packages and their dependencies
# are used by 'go run' below but not directly imported, so they are no
# longer vendored automatically. Add them to vendor/modules.txt.
@grep -q 'github.com/openconfig/ygot/ygen' $(TOPDIR)/vendor/modules.txt 2>/dev/null || \
( echo "github.com/openconfig/gnmi/ctree" >> $(TOPDIR)/vendor/modules.txt && \
echo "github.com/openconfig/gnmi/errlist" >> $(TOPDIR)/vendor/modules.txt && \
echo "github.com/openconfig/gnmi/proto/gnmi" >> $(TOPDIR)/vendor/modules.txt && \
echo "github.com/openconfig/ygot/genutil" >> $(TOPDIR)/vendor/modules.txt && \
echo "github.com/openconfig/ygot/generator" >> $(TOPDIR)/vendor/modules.txt && \
echo "github.com/openconfig/ygot/ygen" >> $(TOPDIR)/vendor/modules.txt )
$(GO) run \
--mod=vendor \
$(TOPDIR)/vendor/github.com/openconfig/ygot/generator/generator.go \
# Run the ygot generator through normal module resolution instead of
# mutating vendor/modules.txt at build time. Editing vendor metadata
# in-place is not reproducible and can leave modules.txt invalid.
$(GO) run \
--mod=mod \
github.com/openconfig/ygot/generator \

Copilot uses AI. Check for mistakes.
)

go 1.21
go 1.24.4
Copy link

Copilot AI Apr 4, 2026

Choose a reason for hiding this comment

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

The go.mod "go" directive typically only accepts a major.minor language version (e.g., "go 1.24"); using a patch version like "1.24.4" can make go.mod parsing fail. If you need to pin the toolchain patch level, keep "go 1.24" and add a separate "toolchain go1.24.4" directive.

Suggested change
go 1.24.4
go 1.24
toolchain go1.24.4

Copilot uses AI. Check for mistakes.

- script: |
sudo pip3 install ../target/python-wheels/bookworm/sonic_yang_models-1.0-py3-none-any.whl
sudo pip3 install ../target/python-wheels/trixie/sonic_yang_models-1.0-py3-none-any.whl
Copy link

Copilot AI Apr 4, 2026

Choose a reason for hiding this comment

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

This pip install uses a hard-coded wheel filename (sonic_yang_models-1.0-py3-none-any.whl) but the downloaded artifact pattern is sonic_yang_models*.whl. If the wheel version/build tag changes, the pipeline will fail even though the artifact was downloaded. Consider installing via a wildcard/path discovery (or using the exact filename produced by the buildimage pipeline) to keep this step resilient to version bumps.

Suggested change
sudo pip3 install ../target/python-wheels/trixie/sonic_yang_models-1.0-py3-none-any.whl
set -- ../target/python-wheels/trixie/sonic_yang_models*.whl
if [ "$1" = "../target/python-wheels/trixie/sonic_yang_models*.whl" ]; then
echo "No sonic_yang_models wheel found under ../target/python-wheels/trixie/"
exit 1
fi
if [ "$#" -ne 1 ]; then
echo "Expected exactly one sonic_yang_models wheel, found $#"
ls -1 ../target/python-wheels/trixie/sonic_yang_models*.whl
exit 1
fi
sudo pip3 install "$1"

Copilot uses AI. Check for mistakes.
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.

4 participants