Skip to content

Commit 2a50b2d

Browse files
xumiaStormLiangMS
authored andcommitted
Merged PR 7734653: Merge code from public to internal
Related work items: sonic-net#276, sonic-net#305, sonic-net#332, sonic-net#338, sonic-net#339, sonic-net#1188, sonic-net#1192, sonic-net#1197, sonic-net#1206, sonic-net#1685, sonic-net#1690, sonic-net#1696, sonic-net#1699, sonic-net#1709, sonic-net#1727, sonic-net#1737, sonic-net#1741, sonic-net#1742, sonic-net#2511, sonic-net#2512, sonic-net#2532, sonic-net#2559, sonic-net#2626, sonic-net#2638, sonic-net#2645, sonic-net#2649, sonic-net#2660, sonic-net#2669, sonic-net#2670, sonic-net#2678, sonic-net#10084, sonic-net#11442, sonic-net#11873, sonic-net#12047, sonic-net#12110, sonic-net#12207, sonic-net#12529, sonic-net#12678, sonic-net#13235, sonic-net#13287, sonic-net#13372, sonic-net#13395, sonic-net#13456, sonic-net#13497, sonic-net#13522, sonic-net#13545, sonic-net#13547, sonic-net#13552, sonic-net#13569, sonic-net#13572, sonic-net#13578, sonic-net#13591, sonic-net#13611, sonic-net#13647, sonic-net#13649, sonic-net#13660, sonic-net#13710, sonic-net#13716, sonic-net#13724, sonic-net#13726, sonic-net#13732, sonic-net#13735, sonic-net#13739, sonic-net#13757, sonic-net#13786, sonic-net#13792, sonic-net#13800, sonic-net#13801, sonic-net#13802, sonic-net#13805, sonic-net#13806, sonic-net#13812, sonic-net#13814, sonic-net#13822, sonic-net#13831, sonic-net#13834, sonic-net#13847, sonic-net#13870, sonic-net#13882, sonic-net#13884, sonic-net#13885, sonic-net#13894, sonic-net#13895, sonic-net#13926, sonic-net#13932, sonic-net#13935, sonic-net#13942, sonic-net#13951, sonic-net#13953, sonic-net#13964
2 parents 3c1b4bb + f9d0f0a commit 2a50b2d

File tree

296 files changed

+20321
-3353
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

296 files changed

+20321
-3353
lines changed

.azure-pipelines/azure-pipelines-UpgrateVersion.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,32 @@ parameters:
4242
- mellanox
4343

4444
stages:
45+
- stage: Prepare
46+
jobs:
47+
- job: Prepare
48+
steps:
49+
- script: |
50+
DEFAULT_MIRROR_URL_PREFIX=http://packages.trafficmanager.net
51+
DEBIAN_TIMESTAMP=$(curl $DEFAULT_MIRROR_URL_PREFIX/snapshot/debian/latest/timestamp)
52+
DEBIAN_SECURITY_TIMESTAMP=$(curl $DEFAULT_MIRROR_URL_PREFIX/snapshot/debian-security/latest/timestamp)
53+
echo "DEBIAN_TIMESTAMP=$DEBIAN_TIMESTAMP, DEBIAN_SECURITY_TIMESTAMP=$DEBIAN_SECURITY_TIMESTAMP"
54+
echo "##vso[task.setvariable variable=DEBIAN_TIMESTAMP;isOutput=true]$DEBIAN_TIMESTAMP"
55+
echo "##vso[task.setvariable variable=DEBIAN_SECURITY_TIMESTAMP;isOutput=true]$DEBIAN_SECURITY_TIMESTAMP"
56+
name: SetVersions
57+
displayName: 'Set snapshot versions'
4558
- stage: Build
59+
dependsOn: Prepare
4660
variables:
4761
- name: CACHE_MODE
4862
value: none
4963
- name: VERSION_CONTROL_OPTIONS
5064
value: 'SONIC_VERSION_CONTROL_COMPONENTS='
65+
- name: SKIP_CHECKOUT
66+
value: true
67+
- name: DEBIAN_TIMESTAMP
68+
value: $[ stageDependencies.Prepare.Prepare.outputs['SetVersions.DEBIAN_TIMESTAMP'] ]
69+
- name: DEBIAN_SECURITY_TIMESTAMP
70+
value: $[ stageDependencies.Prepare.Prepare.outputs['SetVersions.DEBIAN_SECURITY_TIMESTAMP'] ]
5171
- template: .azure-pipelines/template-variables.yml@buildimage
5272
jobs:
5373
- template: azure-pipelines-build.yml
@@ -56,6 +76,21 @@ stages:
5676
buildOptions: '${{ variables.VERSION_CONTROL_OPTIONS }} ENABLE_DOCKER_BASE_PULL=n SONIC_BUILD_JOBS=$(nproc) ENABLE_IMAGE_SIGNATURE=y'
5777
preSteps:
5878
- template: .azure-pipelines/template-clean-sonic-slave.yml@buildimage
79+
- checkout: self
80+
submodules: recursive
81+
fetchDepth: 0
82+
path: s
83+
displayName: 'Checkout code'
84+
- script: |
85+
echo "DEBIAN_TIMESTAMP=$DEBIAN_TIMESTAMP, DEBIAN_SECURITY_TIMESTAMP=$DEBIAN_SECURITY_TIMESTAMP"
86+
if [ "$MIRROR_SNAPSHOT" == y ]; then
87+
mkdir -p target/versions/default/
88+
echo "debian==$DEBIAN_TIMESTAMP" > target/versions/default/versions-mirror
89+
echo "debian-security==$DEBIAN_SECURITY_TIMESTAMP" >> target/versions/default/versions-mirror
90+
cat target/versions/default/versions-mirror
91+
fi
92+
displayName: 'Set snapshot versions'
93+
5994
- stage: UpgradeVersions
6095
jobs:
6196
- job: UpgradeVersions

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@ jobs:
108108
platform_rpc: nephos
109109

110110
buildSteps:
111-
- template: template-skipvstest.yml
111+
- template: .azure-pipelines/template-skipvstest.yml@buildimage
112+
- template: .azure-pipelines/template-daemon.yml@buildimage
112113
- bash: |
113114
set -ex
114115
if [ $(GROUP_NAME) == vs ]; then
@@ -168,4 +169,4 @@ jobs:
168169
make $BUILD_OPTIONS target/sonic-$(GROUP_NAME).bin
169170
fi
170171
displayName: "Build sonic image"
171-
- template: check-dirty-version.yml
172+
- template: .azure-pipelines/check-dirty-version.yml@buildimage

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
jobFilters: ${{ parameters.jobFilters }}
2626
jobVariables: ${{ parameters.jobVariables }}
2727
preSteps:
28-
- template: cleanup.yml
28+
- template: .azure-pipelines/cleanup.yml@buildimage
2929
- ${{ parameters.preSteps }}
3030
- script: |
3131
if [ -n "$(CACHE_MODE)" ] && echo $(PLATFORM_AZP) | grep -E -q "^(vs|broadcom|mellanox|marvell-armhf)$"; then
@@ -67,6 +67,6 @@ jobs:
6767
artifactName: 'sonic-buildimage.$(GROUP_NAME)$(GROUP_EXTNAME)'
6868
publishPrefix: '$(Build.DefinitionName)/$(Build.SourceBranchName)/$(GROUP_NAME)'
6969
- ${{ parameters.postSteps }}
70-
- template: cleanup.yml
70+
- template: .azure-pipelines/cleanup.yml@buildimage
7171
jobGroups: ${{ parameters.jobGroups }}
7272
buildSteps: ${{ parameters.buildSteps }}

.azure-pipelines/cleanup.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
steps:
22
- script: |
3+
set -x
4+
# kill daemon process
5+
ps $(cat /tmp/azp_daemon_kill_docker_pid)
6+
sudo kill $(cat /tmp/azp_daemon_kill_docker_pid)
7+
rm /tmp/azp_daemon_kill_docker_pid
8+
39
if sudo [ -f /var/run/march/docker.pid ] ; then
410
pid=`sudo cat /var/run/march/docker.pid` ; sudo kill $pid
511
fi
@@ -11,4 +17,5 @@ steps:
1117
pid=`sudo cat dockerfs/var/run/docker.pid` ; sudo kill $pid
1218
fi
1319
sudo rm -rf $(ls -A1)
20+
condition: always()
1421
displayName: "Clean Workspace"

.azure-pipelines/template-daemon.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
steps:
2+
- bash: |
3+
(
4+
while true
5+
do
6+
sleep 120
7+
now=$(date +%s)
8+
pids=$(ps -C docker -o pid,etime,args | grep "docker build" | cut -d" " -f2)
9+
for pid in $pids
10+
do
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
14+
echo =========== $(date +%F%T) $time_s &>> target/daemon.log
15+
ps $pid &>> target/daemon.log
16+
sudo kill $pid
17+
fi
18+
done
19+
done
20+
) &
21+
daemon_pid=$!
22+
ps $daemon_pid
23+
echo $daemon_pid >> /tmp/azp_daemon_kill_docker_pid
24+
displayName: start daemon to kill hang docker

.azure-pipelines/template-variables.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ variables:
55
SONIC_BUILD_RETRY_COUNT: 3
66
SONIC_BUILD_RETRY_INTERVAL: 600
77
DOCKER_BUILDKIT: 0
8+
DOCKER_BUILD_TIMEOUT: 3600

Makefile.work

Lines changed: 31 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@
5656
# * GZ_COMPRESS_PROGRAM: Select pigz to reduce build time
5757
# * Default: gzip
5858
# * Values: pigz,gzip
59+
# * UNATTENDED: Don't wait for interactive input from terminal, setting this
60+
# * value to anything will enable it
61+
# * Default: unset
62+
# * Value: y
5963
#
6064
###############################################################################
6165

@@ -495,6 +499,7 @@ SONIC_BUILD_INSTRUCTION := $(MAKE) \
495499
MDEBUG=$(MDEBUG) \
496500
PASSWORD=$(PASSWORD) \
497501
USERNAME=$(USERNAME) \
502+
CHANGE_DEFAULT_PASSWORD=$(CHANGE_DEFAULT_PASSWORD) \
498503
SONIC_BUILD_JOBS=$(SONIC_BUILD_JOBS) \
499504
SONIC_USE_DOCKER_BUILDKIT=$(SONIC_USE_DOCKER_BUILDKIT) \
500505
VS_PREPARE_MEM=$(VS_PREPARE_MEM) \
@@ -558,6 +563,7 @@ endif
558563

559564
export MIRROR_URLS
560565
export MIRROR_SECURITY_URLS
566+
export SONIC_VERSION_CONTROL_COMPONENTS
561567

562568
%:: | sonic-build-hooks
563569
ifneq ($(filter y, $(MULTIARCH_QEMU_ENVIRON) $(CROSS_BUILD_ENVIRON)),)
@@ -613,23 +619,28 @@ init :
613619

614620
.ONESHELL : reset
615621
reset :
616-
$(Q)echo && echo -n "Warning! All local changes will be lost. Proceed? [y/N]: "
617-
$(Q)read ans && (
618-
if [ $$ans == y ]; then
619-
echo "Resetting local repository. Please wait...";
620-
sudo rm -rf fsroot*;
621-
if [ "$(MULTIARCH_QEMU_ENVIRON)" == y ] && [[ "$(CONFIGURED_ARCH)" == "armhf" || "$(CONFIGURED_ARCH)" == "arm64" ]]; then
622-
echo "Stopping march $(CONFIGURED_ARCH) docker"
623-
sudo kill -9 `sudo cat /var/run/march/docker.pid` || true
624-
sudo rm -f /var/run/march/docker.pid || true
625-
fi
626-
git clean -xfdf;
627-
git reset --hard;
628-
git submodule foreach --recursive 'git clean -xfdf || true';
629-
git submodule foreach --recursive 'git reset --hard || true';
630-
git submodule foreach --recursive 'git remote update || true';
631-
git submodule update --init --recursive;
632-
echo "Reset complete!";
633-
else
634-
echo "Reset aborted";
635-
fi )
622+
$(Q)echo && (
623+
if [ -z "$(UNATTENDED)" ]; then
624+
echo -n "Warning! All local changes will be lost. Proceed? [y/N]: "
625+
@read ans
626+
else
627+
ans=y
628+
fi
629+
if [ $$ans == y ]; then
630+
echo "Resetting local repository. Please wait...";
631+
sudo rm -rf fsroot*;
632+
if [ "$(MULTIARCH_QEMU_ENVIRON)" == y ] && [[ "$(CONFIGURED_ARCH)" == "armhf" || "$(CONFIGURED_ARCH)" == "arm64" ]]; then
633+
echo "Stopping march $(CONFIGURED_ARCH) docker"
634+
sudo kill -9 `sudo cat /var/run/march/docker.pid` || true
635+
sudo rm -f /var/run/march/docker.pid || true
636+
fi
637+
git clean -xfdf;
638+
git reset --hard;
639+
git submodule foreach --recursive 'git clean -xfdf || true';
640+
git submodule foreach --recursive 'git reset --hard || true';
641+
git submodule foreach --recursive 'git remote update || true';
642+
git submodule update --init --recursive;
643+
echo "Reset complete!";
644+
else
645+
echo "Reset aborted";
646+
fi )

README.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
*static analysis*:
2-
3-
[![Total alerts](https://img.shields.io/lgtm/alerts/g/Azure/sonic-buildimage.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/Azure/sonic-buildimage/alerts/)
4-
[![Language grade: Python](https://img.shields.io/lgtm/grade/python/g/Azure/sonic-buildimage.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/Azure/sonic-buildimage/context:python)
5-
61
*master builds*:
72

83
[![Barefoot](https://dev.azure.com/mssonic/build/_apis/build/status/barefoot/Azure.sonic-buildimage.official.barefoot?branchName=master&label=Barefoot)](https://dev.azure.com/mssonic/build/_build/latest?definitionId=146&branchName=master)

build_debian.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,16 @@ sudo LANG=C chroot $FILESYSTEM_ROOT umount /proc || true
704704
## Prepare empty directory to trigger mount move in initramfs-tools/mount_loop_root, implemented by patching
705705
sudo mkdir $FILESYSTEM_ROOT/host
706706

707+
708+
if [[ "$CHANGE_DEFAULT_PASSWORD" == "y" ]]; then
709+
## Expire default password for exitsing users that can do login
710+
default_users=$(cat $FILESYSTEM_ROOT/etc/passwd | grep "/home"| grep ":/bin/bash\|:/bin/sh" | awk -F ":" '{print $1}' 2> /dev/null)
711+
for user in $default_users
712+
do
713+
sudo LANG=C chroot $FILESYSTEM_ROOT passwd -e ${user}
714+
done
715+
fi
716+
707717
## Compress most file system into squashfs file
708718
sudo rm -f $ONIE_INSTALLER_PAYLOAD $FILESYSTEM_SQUASHFS
709719
## Output the file system total size for diag purpose

check_install.py

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ def main():
1111
parser = argparse.ArgumentParser(description='test_login cmdline parser')
1212
parser.add_argument('-u', default="admin", help='login user name')
1313
parser.add_argument('-P', default="YourPaSsWoRd", help='login password')
14+
parser.add_argument('-N', default="Test@2022", help='new password')
1415
parser.add_argument('-p', type=int, default=9000, help='local port')
1516

1617
args = parser.parse_args()
@@ -20,6 +21,7 @@ def main():
2021
cmd_prompt = "{}@sonic:~\$ $".format(args.u)
2122
grub_selection = "The highlighted entry will be executed"
2223
firsttime_prompt = 'firsttime_exit'
24+
passwd_change_prompt = ['Current password:', 'New password:', 'Retype new password:']
2325

2426
i = 0
2527
while True:
@@ -36,7 +38,6 @@ def main():
3638
# select default SONiC Image
3739
p.expect(grub_selection)
3840
p.sendline()
39-
4041
# bootup sonic image
4142
while True:
4243
i = p.expect([login_prompt, passwd_prompt, firsttime_prompt, cmd_prompt])
@@ -46,6 +47,30 @@ def main():
4647
elif i == 1:
4748
# send password
4849
p.sendline(args.P)
50+
# Check for password change prompt
51+
try:
52+
p.expect('Current password:', timeout=2)
53+
except pexpect.TIMEOUT:
54+
break
55+
else:
56+
# send old password for password prompt
57+
p.sendline(args.P)
58+
p.expect(passwd_change_prompt[1])
59+
# send new password
60+
p.sendline(args.N)
61+
p.expect(passwd_change_prompt[2])
62+
# retype new password
63+
p.sendline(args.N)
64+
time.sleep(1)
65+
# Restore default password
66+
p.sendline('passwd {}'.format(args.u))
67+
p.expect(passwd_change_prompt[0])
68+
p.sendline(args.N)
69+
p.expect(passwd_change_prompt[1])
70+
p.sendline(args.P)
71+
p.expect(passwd_change_prompt[2])
72+
p.sendline(args.P)
73+
break
4974
elif i == 2:
5075
# fix a login timeout issue, caused by the login_prompt message mixed with the output message of the rc.local
5176
time.sleep(1)

device/arista/x86_64-arista_7050_qx32s/sensors.conf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ bus "i2c-7" "SCD 0000:02:00.0 SMBus master 0 bus 5"
1111
chip "k10temp-pci-00c3"
1212
label temp1 "Cpu temp sensor"
1313

14+
chip "fam15h_power-pci-00c4"
15+
ignore power1
16+
1417
chip "max6658-i2c-2-4c"
1518
label temp1 "Board temp sensor"
1619
set temp1_max 55
@@ -34,7 +37,13 @@ chip "pmbus-i2c-6-58"
3437
label temp2 "Power supply 1 inlet temp sensor"
3538
label temp3 "Power supply 1 sensor"
3639

40+
ignore fan2
41+
ignore fan3
42+
3743
chip "pmbus-i2c-5-58"
3844
label temp1 "Power supply 2 hotspot sensor"
3945
label temp2 "Power supply 2 inlet temp sensor"
4046
label temp3 "Power supply 2 sensor"
47+
48+
ignore fan2
49+
ignore fan3

device/arista/x86_64-arista_7050cx3_32s/sensors.conf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ bus "i2c-14" "SCD 0000:02:00.0 SMBus master 1 bus 4"
1010
chip "k10temp-pci-00c3"
1111
label temp1 "Cpu temp sensor"
1212

13+
chip "fam15h_power-pci-00c4"
14+
ignore power1
15+
1316
chip "max6658-i2c-2-4c"
1417
label temp1 "Cpu board temp sensor"
1518
set temp1_max 75
@@ -33,7 +36,13 @@ chip "pmbus-i2c-13-58"
3336
label temp2 "Power supply 1 inlet temp sensor"
3437
label temp3 "Power supply 1 sensor"
3538

39+
ignore fan2
40+
ignore fan3
41+
3642
chip "pmbus-i2c-14-58"
3743
label temp1 "Power supply 2 hotspot sensor"
3844
label temp2 "Power supply 2 inlet temp sensor"
3945
label temp3 "Power supply 2 sensor"
46+
47+
ignore fan2
48+
ignore fan3

device/arista/x86_64-arista_7060_cx32s/sensors.conf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ bus "i2c-7" "SCD 0000:02:00.0 SMBus master 0 bus 5"
1111
chip "k10temp-pci-00c3"
1212
label temp1 "Cpu temp sensor"
1313

14+
chip "fam15h_power-pci-00c4"
15+
ignore power1
16+
1417
chip "max6697-i2c-2-1a"
1518
label temp1 "Board sensor"
1619
set temp1_max 95
@@ -45,7 +48,13 @@ chip "pmbus-i2c-6-58"
4548
label temp2 "Power supply 1 inlet temp sensor"
4649
label temp3 "Power supply 1 exhaust temp sensor"
4750

51+
ignore fan2
52+
ignore fan3
53+
4854
chip "pmbus-i2c-5-58"
4955
label temp1 "Power supply 2 hotspot sensor"
5056
label temp2 "Power supply 2 inlet temp sensor"
5157
label temp3 "Power supply 2 exhaust temp sensor"
58+
59+
ignore fan2
60+
ignore fan3

0 commit comments

Comments
 (0)