Skip to content

[build] Avoid using jsonpath_ng v1.8.0 in sonic slave image. #26141

Merged
liushilongbuaa merged 1 commit intosonic-net:masterfrom
yijingyan2:pin-jsonpath-ng
Mar 13, 2026
Merged

[build] Avoid using jsonpath_ng v1.8.0 in sonic slave image. #26141
liushilongbuaa merged 1 commit intosonic-net:masterfrom
yijingyan2:pin-jsonpath-ng

Conversation

@yijingyan2
Copy link
Contributor

Why I did it

When the version of jsonpath_ng is 1.8.0, the build fails on target/debs/bookworm/libsai_1.0.0_amd64.deb

./sai_api_gen.py \
	/bmv2/dash_pipeline.bmv2/dash_pipeline_p4rt.json \
	--ir /bmv2/dash_pipeline.bmv2/dash_pipeline_ir.json \
	--ignore-tables=underlay_mac,eni_meter,slb_decap \
	--sai-spec-dir=specs \
	dash
Traceback (most recent call last):
  File "/sonic/src/dash-sai/DASH/dash-pipeline/SAI/./sai_api_gen.py", line 44, in <module>
    var_ref_graph = P4VarRefGraph(p4ir)
                    ^^^^^^^^^^^^^^^^^^^
  File "/sonic/src/dash-sai/DASH/dash-pipeline/SAI/utils/p4ir/p4ir_var_ref_graph.py", line 15, in __init__
    self.__build_graph()
  File "/sonic/src/dash-sai/DASH/dash-pipeline/SAI/utils/p4ir/p4ir_var_ref_graph.py", line 18, in __build_graph
    self.__build_counter_list()
  File "/sonic/src/dash-sai/DASH/dash-pipeline/SAI/utils/p4ir/p4ir_var_ref_graph.py", line 28, in __build_counter_list
    self.ir.walk(
  File "/sonic/src/dash-sai/DASH/dash-pipeline/SAI/utils/p4ir/p4ir_tree.py", line 18, in walk
    on_match(match)
  File "/sonic/src/dash-sai/DASH/dash-pipeline/SAI/utils/p4ir/p4ir_var_ref_graph.py", line 24, in on_counter_definition
    ir_value = P4IRVarInfo.from_ir(match.value)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/sonic/src/dash-sai/DASH/dash-pipeline/SAI/utils/p4ir/p4ir_var_info.py", line 11, in from_ir
    ir_def_node["Source_Info"]["source_fragment"],
    ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
TypeError: list indices must be integers or slices, not str

In the version 1.8.0, dict is flattened to a list, which causes the above TypeError
With this change, jsonpath_ng is pinned to exclude 1.8.0 release

Work item tracking
  • Microsoft ADO (number only):

How I did it

How to verify it

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

  • 202305
  • 202311
  • 202405
  • 202411
  • 202505
  • 202511

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)

@yijingyan2 yijingyan2 requested a review from lguohan as a code owner March 12, 2026 03:50
Copilot AI review requested due to automatic review settings March 12, 2026 03:50
@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Contributor

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 build slave Docker images to avoid pulling a known-bad jsonpath_ng release that breaks DASH pipeline generation during the build (e.g., when producing libsai).

Changes:

  • Exclude jsonpath_ng version 1.8.0 from pip3 install in the bookworm slave image.
  • Exclude jsonpath_ng version 1.8.0 from pip3 install in the trixie slave image.
  • Add inline comments explaining the rationale for the exclusion.

Reviewed changes

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

File Description
sonic-slave-bookworm/Dockerfile.j2 Changes pip3 install jsonpath_ng to jsonpath_ng!=1.8.0 and documents the reason.
sonic-slave-trixie/Dockerfile.j2 Changes pip3 install jsonpath_ng to jsonpath_ng!=1.8.0 (with pyyaml-include) and documents the reason.

# For DASH BMv2
RUN pip3 install jsonpath_ng pyyaml-include
# Exclude jsonpath_ng 1.8.0 because it causes DASH pipeline failures
# In version 1.8.0, dict is flattened to a list, which causes type error in DASH.
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

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

The new explanatory comments could be clearer/grammatically improved (e.g., “dict is flattened to a list” / “type error”). Consider rephrasing to “a dict” and “TypeError” to match the actual exception and make the rationale easier to understand.

Suggested change
# In version 1.8.0, dict is flattened to a list, which causes type error in DASH.
# In version 1.8.0, a dict is flattened to a list, which causes a TypeError in DASH.

Copilot uses AI. Check for mistakes.
@StormLiangMS
Copy link
Contributor

/azpw ms_conflict

1 similar comment
@yxieca
Copy link
Contributor

yxieca commented Mar 12, 2026

/azpw ms_conflict

@liushilongbuaa liushilongbuaa changed the title Pin jsonpath_ng to exclude broken 1.8.0 release [build] Avoid using jsonpath_ng v1.8.0 in sonic slave image. Mar 13, 2026
@liushilongbuaa liushilongbuaa merged commit f7ee7f7 into sonic-net:master Mar 13, 2026
24 checks passed
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.

7 participants