Skip to content

Commit 02c893d

Browse files
committed
Merge branch '202505' of https://github.com/sonic-net/sonic-buildimage into 202506
2 parents d5a0dee + 3d89ed0 commit 02c893d

35 files changed

+686
-49
lines changed

.azure-pipelines/azure-pipelines-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ jobs:
121121

122122
buildSteps:
123123
- template: .azure-pipelines/template-skipvstest.yml@buildimage
124-
- template: .azure-pipelines/template-daemon.yml@buildimage
124+
- template: template-daemon.yml
125125
- bash: |
126126
set -ex
127127
if echo $(GROUP_NAME) | grep mellanox; then

.azure-pipelines/azure-pipelines-image-template.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,29 @@ jobs:
8585
BUILD_REASON=$(Build.Reason)
8686
echo "Build.Reason = $BUILD_REASON"
8787
echo "Build.DefinitionName = $BUILD_DEFINITIONNAME"
88+
89+
if [[ "$BUILD_REASON" == "PullRequest" ]]; then
90+
echo "Checking for changes to dockers/docker-ptf/Dockerfile.j2 in PR..."
91+
# Get the target branch and check for changes
92+
TARGET_BRANCH="origin/$(System.PullRequest.TargetBranch)"
93+
echo "Comparing against target branch: $TARGET_BRANCH"
94+
# Fetch target branch to ensure we have the latest
95+
git fetch origin $(System.PullRequest.TargetBranch)
96+
# Check if docker-ptf Dockerfile.j2 has changes
97+
# NOTE: The PTF_MODIFIED template parameter is of type string
98+
# Ensure to set it to "True" or "False" (not boolean true/false)
99+
if git diff --name-only $TARGET_BRANCH...HEAD | grep -q "dockers/docker-ptf/Dockerfile.j2"; then
100+
echo "docker-ptf/Dockerfile.j2 has been modified in this PR"
101+
echo "##vso[task.setvariable variable=PTF_MODIFIED;isOutput=true]True"
102+
else
103+
echo "docker-ptf/Dockerfile.j2 has not been modified in this PR"
104+
echo "##vso[task.setvariable variable=PTF_MODIFIED;isOutput=true]False"
105+
fi
106+
else
107+
echo "Not a PR build, setting PTF_MODIFIED to false"
108+
echo "##vso[task.setvariable variable=PTF_MODIFIED;isOutput=true]False"
109+
fi
110+
88111
if [[ "$BUILD_REASON" != "PullRequest" && "$BUILD_DEFINITIONNAME" == "Azure.sonic-buildimage.official.vs" ]]
89112
then
90113
PORT=443
@@ -103,6 +126,7 @@ jobs:
103126
mv target/* $(Build.ArtifactStagingDirectory)/target/
104127
env:
105128
REGISTRY_PASSWD: $(REGISTRY_PASSWD)
129+
name: PublishAndSetPtfTag
106130
displayName: Publish to Docker Registry and Copy Artifacts
107131
condition: always()
108132
- publish: $(Build.ArtifactStagingDirectory)

.azure-pipelines/template-daemon.yml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,14 @@ steps:
55
do
66
sleep 120
77
now=$(date +%s)
8-
pids=$(ps -C docker-buildx -o pid,etime,args | grep "docker-buildx buildx build" | awk '{print $1}')
8+
pids=$(ps -C docker -o pid,etime,args | grep "docker build" | cut -d" " -f2)
99
for pid in $pids
1010
do
11-
start_ticks=$(awk '{print $22}' /proc/$pid/stat)
12-
boot_time=$(awk '/btime/ {print $2}' /proc/stat)
13-
hertz=$(getconf CLK_TCK)
14-
start_time=$((boot_time + start_ticks / hertz))
15-
ts=$(date -d "@$((now - start_time))" +%s)
16-
17-
if [[ $ts -gt $(DOCKER_BUILD_TIMEOUT) ]]; then
11+
start=$(date --date="$(ls -dl /proc/$pid --time-style full-iso | awk '{print$6,$7}')" +%s)
12+
time_s=$(($now-$start))
13+
if [[ $time_s -gt $(DOCKER_BUILD_TIMEOUT) ]]; then
1814
echo =========== $(date +%F%T) $time_s &>> target/daemon.log
19-
ps -p $pid -o pid,etime,args ww &>> target/daemon.log
15+
ps $pid &>> target/daemon.log
2016
sudo kill $pid
2117
fi
2218
done

azure-pipelines.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,29 @@ stages:
109109
value: veos_vtb
110110
- name: testbed_file
111111
value: vtestbed.csv
112+
- name: PTF_MODIFIED
113+
value: $[ coalesce(stageDependencies.BuildVS.vs.outputs['PublishAndSetPtfTag.PTF_MODIFIED'], stageDependencies.BuildVS.vs.outputs['script.PTF_MODIFIED'], stageDependencies.BuildVS.vs.outputs['script1.PTF_MODIFIED'], 'False') ]
112114

113115
# For every test job:
114116
# continueOnError: false means it's a required test job and will block merge if it fails
115117
# continueOnError: true means it's an optional test job and will not block merge even though it fails(unless a required test job depends on its result)
116118

117119
jobs:
120+
- job: debug_variables
121+
pool: sonictest
122+
displayName: "Debug PTF_MODIFIED Variable"
123+
steps:
124+
- script: |
125+
echo "PTF_MODIFIED variable value: $(PTF_MODIFIED)"
126+
echo "Debug: Checking if PTF_MODIFIED is being passed correctly from BuildVS stage"
127+
if [ "$(PTF_MODIFIED)" = "True" ]; then
128+
echo "SUCCESS: PTF_MODIFIED is True"
129+
elif [ "$(PTF_MODIFIED)" = "False" ]; then
130+
echo "INFO: PTF_MODIFIED is False"
131+
else
132+
echo "ERROR: PTF_MODIFIED has unexpected value: $(PTF_MODIFIED)"
133+
fi
134+
displayName: "Debug PTF_MODIFIED Variable"
118135
- job:
119136
pool: sonictest
120137
displayName: "vstest"
@@ -210,6 +227,7 @@ stages:
210227
MAX_WORKER: $(INSTANCE_NUMBER)
211228
KVM_IMAGE_BRANCH: $(BUILD_BRANCH)
212229
MGMT_BRANCH: $(BUILD_BRANCH)
230+
PTF_MODIFIED: ${{ eq(variables['PTF_MODIFIED'], 'true') }}
213231

214232
- job: impacted_area_t0_2vlans_elastictest
215233
displayName: "impacted-area-kvmtest-t0-2vlans by Elastictest"
@@ -237,6 +255,7 @@ stages:
237255
DEPLOY_MG_EXTRA_PARAMS: "-e vlan_config=two_vlan_a"
238256
KVM_IMAGE_BRANCH: $(BUILD_BRANCH)
239257
MGMT_BRANCH: $(BUILD_BRANCH)
258+
PTF_MODIFIED: ${{ eq(variables['PTF_MODIFIED'], 'true') }}
240259

241260
- job: impacted_area_t1_lag_elastictest
242261
displayName: "impacted-area-kvmtest-t1-lag by Elastictest"
@@ -265,6 +284,7 @@ stages:
265284
MAX_WORKER: $(INSTANCE_NUMBER)
266285
KVM_IMAGE_BRANCH: $(BUILD_BRANCH)
267286
MGMT_BRANCH: $(BUILD_BRANCH)
287+
PTF_MODIFIED: ${{ eq(variables['PTF_MODIFIED'], 'true') }}
268288

269289
- job: impacted_area_dualtor_elastictest
270290
displayName: "impacted-area-kvmtest-dualtor by Elastictest"
@@ -294,6 +314,7 @@ stages:
294314
COMMON_EXTRA_PARAMS: "--disable_loganalyzer "
295315
KVM_IMAGE_BRANCH: $(BUILD_BRANCH)
296316
MGMT_BRANCH: $(BUILD_BRANCH)
317+
PTF_MODIFIED: ${{ eq(variables['PTF_MODIFIED'], 'true') }}
297318

298319
- job: impacted_area_multi_asic_elastictest
299320
displayName: "impacted-area-kvmtest-multi-asic-t1 by Elastictest"
@@ -321,6 +342,7 @@ stages:
321342
NUM_ASIC: 4
322343
KVM_IMAGE_BRANCH: $(BUILD_BRANCH)
323344
MGMT_BRANCH: $(BUILD_BRANCH)
345+
PTF_MODIFIED: ${{ eq(variables['PTF_MODIFIED'], 'true') }}
324346

325347
- job: impacted_area_t0_sonic_elastictest
326348
displayName: "impacted-area-kvmtest-t0-sonic by Elastictest"
@@ -354,6 +376,7 @@ stages:
354376
{"name": "bgp/test_bgp_fact.py", "param": "--neighbor_type=sonic --enable_macsec --macsec_profile=128_SCI,256_XPN_SCI"},
355377
{"name": "macsec", "param": "--neighbor_type=sonic --enable_macsec --macsec_profile=128_SCI,256_XPN_SCI"}
356378
]'
379+
PTF_MODIFIED: ${{ eq(variables['PTF_MODIFIED'], 'true') }}
357380

358381
- job: impacted_area_dpu_elastictest
359382
displayName: "impacted-area-kvmtest-dpu by Elastictest"
@@ -383,3 +406,4 @@ stages:
383406
SPECIFIC_PARAM: '[
384407
{"name": "dash/test_dash_vnet.py", "param": "--skip_dataplane_checking"}
385408
]'
409+
PTF_MODIFIED: ${{ eq(variables['PTF_MODIFIED'], 'true') }}
Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,40 @@
1+
bus "i2c-16" "SCD 0000:03:00.0 SMBus master 1 bus 3"
12
bus "i2c-19" "SCD 0000:06:00.0 SMBus master 0 bus 0"
3+
bus "i2c-35" "SCD 0000:06:00.0 SMBus master 2 bus 4"
4+
bus "i2c-37" "SCD 0000:05:00.0 SMBus master 0 bus 0"
5+
6+
chip "k10temp-pci-00c3"
7+
label temp1 "Cpu temp sensor"
28

39
chip "max6581-i2c-19-4d"
10+
label temp1 "Switch Card temp sensor"
11+
label temp2 "TH5 PCB Left"
12+
label temp3 "TH5 PCB Right"
13+
label temp4 "Inlet Ambiant Air"
414
ignore temp5
515
ignore temp6
16+
label temp7 "TH5 Diode 1"
17+
label temp8 "TH5 Diode 2"
618

719
chip "nvme-pci-0400"
8-
# TODO: sensors complaining about tempX_min and tempX_max
920
ignore temp2
1021
ignore temp3
1122
ignore temp4
1223
ignore temp5
1324
ignore temp6
1425
ignore temp7
26+
27+
chip "pmbus-i2c-35-10"
28+
label temp1 "Power supply 1 internal sensor"
29+
ignore temp2
30+
31+
chip "pmbus-i2c-35-12"
32+
label temp1 "Power supply 2 internal sensor"
33+
ignore temp2
34+
35+
chip "tmp75-i2c-16-48"
36+
label temp1 "Outlet"
37+
38+
chip "tmp75-i2c-37-4a"
39+
label temp1 "Port Card"
40+

device/arista/x86_64-arista_7060x6_16pe_384c_b/sensors.conf

Lines changed: 0 additions & 14 deletions
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../x86_64-arista_7060x6_16pe_384c/sensors.conf

dockers/docker-base-bookworm/Dockerfile.j2

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ RUN apt update && \
6363
libwrap0 \
6464
libatomic1
6565

66+
# Security fixes: upgrade vulnerable base packages (S360 scan remediation)
67+
RUN apt-get update && apt-get upgrade -y
68+
6669
# Add a config file to allow pip to install packages outside of apt/the Debian repos
6770
COPY ["pip.conf", "/etc/pip.conf"]
6871

dockers/docker-ptf/Dockerfile.j2

Lines changed: 67 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,29 @@ RUN apt-get update \
9696
freeradius \
9797
quilt
9898

99+
# Install Go toolchain for building grpcurl and gnoic from source
100+
# to ensure they use a patched Go stdlib (GO-2026-4337: crypto/tls)
101+
{% if CONFIGURED_ARCH == "armhf" %}
102+
RUN GO_ARCH=armv6l \
103+
{% elif CONFIGURED_ARCH == "arm64" %}
104+
RUN GO_ARCH=arm64 \
105+
{% else %}
106+
RUN GO_ARCH=amd64 \
107+
{% endif %}
108+
&& GO_VERSION=1.25.8 \
109+
&& curl -L "https://go.dev/dl/go${GO_VERSION}.linux-${GO_ARCH}.tar.gz" -o /tmp/go.tar.gz \
110+
&& tar -C /usr/local -xzf /tmp/go.tar.gz \
111+
&& rm /tmp/go.tar.gz
112+
113+
ENV PATH="/usr/local/go/bin:$HOME/go/bin:$PATH"
114+
115+
# Build grpcurl from source with patched Go (GO-2026-4337)
116+
RUN go install github.com/fullstorydev/grpcurl/cmd/grpcurl@v1.9.3 \
117+
&& mv "$(go env GOPATH)/bin/grpcurl" /usr/local/bin/grpcurl \
118+
&& chmod +x /usr/local/bin/grpcurl
119+
# Security fixes: upgrade all vulnerable system packages (S360 scan remediation)
120+
RUN apt-get update && apt-get upgrade -y \
121+
&& rm -rf /var/lib/apt/lists/*
99122
{% if PTF_ENV_PY_VER == "py3" %}
100123
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 1 \
101124
&& update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1 \
@@ -116,7 +139,7 @@ RUN rm -rf /debs \
116139
&& rm -f get-pip.py \
117140
&& pip install setuptools \
118141
&& pip install supervisor \
119-
&& pip install ipython==5.4.1 \
142+
&& pip install ipython \
120143
&& git clone https://github.com/p4lang/scapy-vxlan.git \
121144
&& cd scapy-vxlan \
122145
&& python setup.py install \
@@ -176,10 +199,12 @@ RUN rm -rf /debs \
176199
&& wget https://raw.githubusercontent.com/p4lang/ptf/master/ptf_nn/ptf_nn_agent.py
177200

178201
{% if PTF_ENV_PY_VER == "py3" %}
179-
RUN git clone https://github.com/facebook/tac_plus \
202+
RUN curl -L -o tacacs.tar.gz https://shrubbery.net/pub/tac_plus/tacacs-F4.0.4.31.tar.gz\
203+
&& mkdir -p tac_plus\
204+
&& tar -xvzf tacacs.tar.gz -C tac_plus\
180205
&& cd tac_plus \
181-
&& cd tacacs-F4.0.4.28 \
182-
&& ./configure \
206+
&& cd tacacs-F4.0.4.31 \
207+
&& ./configure LDFLAGS="-Wl,-rpath=/usr/local/lib" \
183208
&& make install \
184209
&& ln -s /usr/local/sbin/tac_plus /usr/sbin/tac_plus \
185210
&& ln -s /usr/local/bin/tac_pwd /usr/sbin/tac_pwd \
@@ -196,6 +221,9 @@ ENV VIRTUAL_ENV=/root/env-python3
196221
ARG BACKUP_OF_PATH="$PATH"
197222
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
198223
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 PYTHONIOENCODING=UTF-8
224+
225+
# Upgrade pip to address CVE vulnerabilities in older pip versions
226+
RUN pip3 install --upgrade pip
199227
{% endif %}
200228

201229
{% if PTF_ENV_PY_VER == "mixed" %}
@@ -253,6 +281,9 @@ RUN pip3 install Flask \
253281
&& pip3 install retrying \
254282
&& pip3 install jinja2
255283

284+
# Keep protobuf aligned with generated gNMI stubs.
285+
RUN pip3 install protobuf==6.33.5
286+
256287
{% if docker_ptf_whls.strip() -%}
257288
# Copy locally-built Python wheel dependencies
258289
{{ copy_files("python-wheels/", docker_ptf_whls.split(' '), "/python-wheels/") }}
@@ -266,6 +297,10 @@ RUN pip3 install Flask \
266297
ENV PATH="$BACKUP_OF_PATH"
267298
{% endif %}
268299

300+
# Ensure setuptools stays in a secure range while retaining pkg_resources
301+
# required by grpc_tools.protoc.
302+
RUN pip3 install "setuptools>=70.0.0,<78.0"
303+
269304
## Adjust sshd settings
270305
RUN mkdir /var/run/sshd \
271306
&& echo 'root:root' | chpasswd \
@@ -296,19 +331,35 @@ RUN cd gnxi \
296331
&& quilt push -a \
297332
&& cd gnmi_cli_py \
298333
{% if PTF_ENV_PY_VER == "mixed" %}
299-
&& pip install -r requirements.txt
334+
&& pip install -r requirements.txt \
335+
&& pip3 install protobuf==6.33.5 --no-binary=protobuf
300336
{% else %}
301-
&& pip3 install setuptools==51.0.0 \
302-
&& cat requirements.txt | grep -v futures > /tmp/requirements.txt \
303-
&& pip3 install -r /tmp/requirements.txt
337+
&& pip3 install "setuptools>=70.0.0,<78.0" "grpcio==1.74.0" "grpcio-tools==1.74.0" "protobuf==6.33.5" \
338+
&& rm -f gnmi_pb2.py gnmi_ext_pb2.py gnmi_pb2_grpc.py \
339+
&& wget -q -O gnmi_ext.proto https://raw.githubusercontent.com/openconfig/gnmi/master/proto/gnmi_ext/gnmi_ext.proto \
340+
&& wget -q -O gnmi.proto https://raw.githubusercontent.com/openconfig/gnmi/master/proto/gnmi/gnmi.proto \
341+
&& sed -i 's|github.com/openconfig/gnmi/proto/gnmi_ext/gnmi_ext.proto|gnmi_ext.proto|' gnmi.proto \
342+
&& python3 -m grpc_tools.protoc -I. --python_out=. --grpc_python_out=. gnmi_ext.proto gnmi.proto \
343+
&& if grep -q _internal_create_key gnmi_ext_pb2.py; then echo "ERROR: gnmi stubs generated with incompatible protoc"; exit 1; fi \
344+
&& rm -f gnmi.proto gnmi_ext.proto \
345+
&& cat requirements.txt | grep -Ev '^(futures|grpcio==|grpcio-tools==|protobuf==)' > /tmp/requirements.txt \
346+
&& pip3 install -r /tmp/requirements.txt \
347+
&& pip3 install "setuptools>=70.0.0,<78.0" "grpcio==1.74.0" "grpcio-tools==1.74.0" "protobuf==6.33.5"
304348
{% endif %}
305349
306350
# Install gnoic tool
351+
# Without specifying the version there is a failure
352+
# to determine the latest version automatically.
353+
#
354+
# root@a2014cb5bc54:~/gnoic# ./install.sh
355+
# Warning: Failed to verify the package: https://api.github.com/repos/karimra/gnoic/releases/latest, the version is not specified
356+
# Could not determine the latest release
357+
# Failed to install gnoic
358+
# For support, go to https://github.com/karimra/gnoic/issues
307359
RUN git clone https://github.com/karimra/gnoic.git \
308360
&& cd gnoic \
309-
&& git checkout 57aac3d \
310-
&& chmod +x install.sh \
311-
&& ./install.sh \
361+
&& git checkout 27bc5a6 \
362+
&& go build -o /usr/local/bin/gnoic . \
312363
&& cd .. \
313364
&& rm -rf gnoic
314365
@@ -323,6 +374,10 @@ RUN dpkg -i \
323374
debs/{{ deb }}{{' '}}
324375
{%- endfor %}
325376
377+
# Remove Go toolchain to reduce image size
378+
RUN rm -rf /usr/local/go "$(go env GOPATH 2>/dev/null || echo $HOME/go)"
379+
ENV PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
380+
326381
{% if PTF_ENV_PY_VER == "py3" %}
327382
# Create symlink so that test scripts and ptf_runner invocation path
328383
# is same across python 2 and python 3 envs. Note that for virtual-env
@@ -338,4 +393,4 @@ RUN mkdir -p /root/env-python3/bin \
338393
COPY ["*.ini", "/etc/ptf/"]
339394
EXPOSE 22 8009
340395

341-
ENTRYPOINT ["/usr/local/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"]
396+
ENTRYPOINT ["/usr/local/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"]

dockers/docker-ptf/gnxi-patches/0005-Enhance-gnmi_cli_py-4.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ index dab2db6..e32b3ff 100644
320320
-grpcio-tools==1.15.0
321321
+grpcio==1.41.1
322322
+grpcio-tools==1.41.1
323-
protobuf==3.6.1 --no-binary=protobuf
323+
protobuf==6.33.5 --no-binary=protobuf
324324
six==1.12.0
325325
--
326326
2.48.1.windows.1

0 commit comments

Comments
 (0)