Skip to content

Commit

Permalink
Merged PR 7734653: Merge code from public to internal
Browse files Browse the repository at this point in the history
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
  • Loading branch information
xumia authored and StormLiangMS committed Mar 8, 2023
2 parents 3c1b4bb + f9d0f0a commit 2a50b2d
Show file tree
Hide file tree
Showing 296 changed files with 20,321 additions and 3,353 deletions.
35 changes: 35 additions & 0 deletions .azure-pipelines/azure-pipelines-UpgrateVersion.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,32 @@ parameters:
- mellanox

stages:
- stage: Prepare
jobs:
- job: Prepare
steps:
- script: |
DEFAULT_MIRROR_URL_PREFIX=http://packages.trafficmanager.net
DEBIAN_TIMESTAMP=$(curl $DEFAULT_MIRROR_URL_PREFIX/snapshot/debian/latest/timestamp)
DEBIAN_SECURITY_TIMESTAMP=$(curl $DEFAULT_MIRROR_URL_PREFIX/snapshot/debian-security/latest/timestamp)
echo "DEBIAN_TIMESTAMP=$DEBIAN_TIMESTAMP, DEBIAN_SECURITY_TIMESTAMP=$DEBIAN_SECURITY_TIMESTAMP"
echo "##vso[task.setvariable variable=DEBIAN_TIMESTAMP;isOutput=true]$DEBIAN_TIMESTAMP"
echo "##vso[task.setvariable variable=DEBIAN_SECURITY_TIMESTAMP;isOutput=true]$DEBIAN_SECURITY_TIMESTAMP"
name: SetVersions
displayName: 'Set snapshot versions'
- stage: Build
dependsOn: Prepare
variables:
- name: CACHE_MODE
value: none
- name: VERSION_CONTROL_OPTIONS
value: 'SONIC_VERSION_CONTROL_COMPONENTS='
- name: SKIP_CHECKOUT
value: true
- name: DEBIAN_TIMESTAMP
value: $[ stageDependencies.Prepare.Prepare.outputs['SetVersions.DEBIAN_TIMESTAMP'] ]
- name: DEBIAN_SECURITY_TIMESTAMP
value: $[ stageDependencies.Prepare.Prepare.outputs['SetVersions.DEBIAN_SECURITY_TIMESTAMP'] ]
- template: .azure-pipelines/template-variables.yml@buildimage
jobs:
- template: azure-pipelines-build.yml
Expand All @@ -56,6 +76,21 @@ stages:
buildOptions: '${{ variables.VERSION_CONTROL_OPTIONS }} ENABLE_DOCKER_BASE_PULL=n SONIC_BUILD_JOBS=$(nproc) ENABLE_IMAGE_SIGNATURE=y'
preSteps:
- template: .azure-pipelines/template-clean-sonic-slave.yml@buildimage
- checkout: self
submodules: recursive
fetchDepth: 0
path: s
displayName: 'Checkout code'
- script: |
echo "DEBIAN_TIMESTAMP=$DEBIAN_TIMESTAMP, DEBIAN_SECURITY_TIMESTAMP=$DEBIAN_SECURITY_TIMESTAMP"
if [ "$MIRROR_SNAPSHOT" == y ]; then
mkdir -p target/versions/default/
echo "debian==$DEBIAN_TIMESTAMP" > target/versions/default/versions-mirror
echo "debian-security==$DEBIAN_SECURITY_TIMESTAMP" >> target/versions/default/versions-mirror
cat target/versions/default/versions-mirror
fi
displayName: 'Set snapshot versions'
- stage: UpgradeVersions
jobs:
- job: UpgradeVersions
Expand Down
5 changes: 3 additions & 2 deletions .azure-pipelines/azure-pipelines-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ jobs:
platform_rpc: nephos

buildSteps:
- template: template-skipvstest.yml
- template: .azure-pipelines/template-skipvstest.yml@buildimage
- template: .azure-pipelines/template-daemon.yml@buildimage
- bash: |
set -ex
if [ $(GROUP_NAME) == vs ]; then
Expand Down Expand Up @@ -168,4 +169,4 @@ jobs:
make $BUILD_OPTIONS target/sonic-$(GROUP_NAME).bin
fi
displayName: "Build sonic image"
- template: check-dirty-version.yml
- template: .azure-pipelines/check-dirty-version.yml@buildimage
4 changes: 2 additions & 2 deletions .azure-pipelines/azure-pipelines-image-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
jobFilters: ${{ parameters.jobFilters }}
jobVariables: ${{ parameters.jobVariables }}
preSteps:
- template: cleanup.yml
- template: .azure-pipelines/cleanup.yml@buildimage
- ${{ parameters.preSteps }}
- script: |
if [ -n "$(CACHE_MODE)" ] && echo $(PLATFORM_AZP) | grep -E -q "^(vs|broadcom|mellanox|marvell-armhf)$"; then
Expand Down Expand Up @@ -67,6 +67,6 @@ jobs:
artifactName: 'sonic-buildimage.$(GROUP_NAME)$(GROUP_EXTNAME)'
publishPrefix: '$(Build.DefinitionName)/$(Build.SourceBranchName)/$(GROUP_NAME)'
- ${{ parameters.postSteps }}
- template: cleanup.yml
- template: .azure-pipelines/cleanup.yml@buildimage
jobGroups: ${{ parameters.jobGroups }}
buildSteps: ${{ parameters.buildSteps }}
7 changes: 7 additions & 0 deletions .azure-pipelines/cleanup.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
steps:
- script: |
set -x
# kill daemon process
ps $(cat /tmp/azp_daemon_kill_docker_pid)
sudo kill $(cat /tmp/azp_daemon_kill_docker_pid)
rm /tmp/azp_daemon_kill_docker_pid
if sudo [ -f /var/run/march/docker.pid ] ; then
pid=`sudo cat /var/run/march/docker.pid` ; sudo kill $pid
fi
Expand All @@ -11,4 +17,5 @@ steps:
pid=`sudo cat dockerfs/var/run/docker.pid` ; sudo kill $pid
fi
sudo rm -rf $(ls -A1)
condition: always()
displayName: "Clean Workspace"
24 changes: 24 additions & 0 deletions .azure-pipelines/template-daemon.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
steps:
- bash: |
(
while true
do
sleep 120
now=$(date +%s)
pids=$(ps -C docker -o pid,etime,args | grep "docker build" | cut -d" " -f2)
for pid in $pids
do
start=$(date --date="$(ls -dl /proc/$pid --time-style full-iso | awk '{print$6,$7}')" +%s)
time_s=$(($now-$start))
if [[ $time_s -gt $(DOCKER_BUILD_TIMEOUT) ]]; then
echo =========== $(date +%F%T) $time_s &>> target/daemon.log
ps $pid &>> target/daemon.log
sudo kill $pid
fi
done
done
) &
daemon_pid=$!
ps $daemon_pid
echo $daemon_pid >> /tmp/azp_daemon_kill_docker_pid
displayName: start daemon to kill hang docker
1 change: 1 addition & 0 deletions .azure-pipelines/template-variables.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ variables:
SONIC_BUILD_RETRY_COUNT: 3
SONIC_BUILD_RETRY_INTERVAL: 600
DOCKER_BUILDKIT: 0
DOCKER_BUILD_TIMEOUT: 3600
51 changes: 31 additions & 20 deletions Makefile.work
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@
# * GZ_COMPRESS_PROGRAM: Select pigz to reduce build time
# * Default: gzip
# * Values: pigz,gzip
# * UNATTENDED: Don't wait for interactive input from terminal, setting this
# * value to anything will enable it
# * Default: unset
# * Value: y
#
###############################################################################

Expand Down Expand Up @@ -495,6 +499,7 @@ SONIC_BUILD_INSTRUCTION := $(MAKE) \
MDEBUG=$(MDEBUG) \
PASSWORD=$(PASSWORD) \
USERNAME=$(USERNAME) \
CHANGE_DEFAULT_PASSWORD=$(CHANGE_DEFAULT_PASSWORD) \
SONIC_BUILD_JOBS=$(SONIC_BUILD_JOBS) \
SONIC_USE_DOCKER_BUILDKIT=$(SONIC_USE_DOCKER_BUILDKIT) \
VS_PREPARE_MEM=$(VS_PREPARE_MEM) \
Expand Down Expand Up @@ -558,6 +563,7 @@ endif

export MIRROR_URLS
export MIRROR_SECURITY_URLS
export SONIC_VERSION_CONTROL_COMPONENTS

%:: | sonic-build-hooks
ifneq ($(filter y, $(MULTIARCH_QEMU_ENVIRON) $(CROSS_BUILD_ENVIRON)),)
Expand Down Expand Up @@ -613,23 +619,28 @@ init :

.ONESHELL : reset
reset :
$(Q)echo && echo -n "Warning! All local changes will be lost. Proceed? [y/N]: "
$(Q)read ans && (
if [ $$ans == y ]; then
echo "Resetting local repository. Please wait...";
sudo rm -rf fsroot*;
if [ "$(MULTIARCH_QEMU_ENVIRON)" == y ] && [[ "$(CONFIGURED_ARCH)" == "armhf" || "$(CONFIGURED_ARCH)" == "arm64" ]]; then
echo "Stopping march $(CONFIGURED_ARCH) docker"
sudo kill -9 `sudo cat /var/run/march/docker.pid` || true
sudo rm -f /var/run/march/docker.pid || true
fi
git clean -xfdf;
git reset --hard;
git submodule foreach --recursive 'git clean -xfdf || true';
git submodule foreach --recursive 'git reset --hard || true';
git submodule foreach --recursive 'git remote update || true';
git submodule update --init --recursive;
echo "Reset complete!";
else
echo "Reset aborted";
fi )
$(Q)echo && (
if [ -z "$(UNATTENDED)" ]; then
echo -n "Warning! All local changes will be lost. Proceed? [y/N]: "
@read ans
else
ans=y
fi
if [ $$ans == y ]; then
echo "Resetting local repository. Please wait...";
sudo rm -rf fsroot*;
if [ "$(MULTIARCH_QEMU_ENVIRON)" == y ] && [[ "$(CONFIGURED_ARCH)" == "armhf" || "$(CONFIGURED_ARCH)" == "arm64" ]]; then
echo "Stopping march $(CONFIGURED_ARCH) docker"
sudo kill -9 `sudo cat /var/run/march/docker.pid` || true
sudo rm -f /var/run/march/docker.pid || true
fi
git clean -xfdf;
git reset --hard;
git submodule foreach --recursive 'git clean -xfdf || true';
git submodule foreach --recursive 'git reset --hard || true';
git submodule foreach --recursive 'git remote update || true';
git submodule update --init --recursive;
echo "Reset complete!";
else
echo "Reset aborted";
fi )
5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
*static analysis*:

[![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/)
[![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)

*master builds*:

[![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)
Expand Down
10 changes: 10 additions & 0 deletions build_debian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -704,6 +704,16 @@ sudo LANG=C chroot $FILESYSTEM_ROOT umount /proc || true
## Prepare empty directory to trigger mount move in initramfs-tools/mount_loop_root, implemented by patching
sudo mkdir $FILESYSTEM_ROOT/host


if [[ "$CHANGE_DEFAULT_PASSWORD" == "y" ]]; then
## Expire default password for exitsing users that can do login
default_users=$(cat $FILESYSTEM_ROOT/etc/passwd | grep "/home"| grep ":/bin/bash\|:/bin/sh" | awk -F ":" '{print $1}' 2> /dev/null)
for user in $default_users
do
sudo LANG=C chroot $FILESYSTEM_ROOT passwd -e ${user}
done
fi

## Compress most file system into squashfs file
sudo rm -f $ONIE_INSTALLER_PAYLOAD $FILESYSTEM_SQUASHFS
## Output the file system total size for diag purpose
Expand Down
27 changes: 26 additions & 1 deletion check_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ def main():
parser = argparse.ArgumentParser(description='test_login cmdline parser')
parser.add_argument('-u', default="admin", help='login user name')
parser.add_argument('-P', default="YourPaSsWoRd", help='login password')
parser.add_argument('-N', default="Test@2022", help='new password')
parser.add_argument('-p', type=int, default=9000, help='local port')

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

i = 0
while True:
Expand All @@ -36,7 +38,6 @@ def main():
# select default SONiC Image
p.expect(grub_selection)
p.sendline()

# bootup sonic image
while True:
i = p.expect([login_prompt, passwd_prompt, firsttime_prompt, cmd_prompt])
Expand All @@ -46,6 +47,30 @@ def main():
elif i == 1:
# send password
p.sendline(args.P)
# Check for password change prompt
try:
p.expect('Current password:', timeout=2)
except pexpect.TIMEOUT:
break
else:
# send old password for password prompt
p.sendline(args.P)
p.expect(passwd_change_prompt[1])
# send new password
p.sendline(args.N)
p.expect(passwd_change_prompt[2])
# retype new password
p.sendline(args.N)
time.sleep(1)
# Restore default password
p.sendline('passwd {}'.format(args.u))
p.expect(passwd_change_prompt[0])
p.sendline(args.N)
p.expect(passwd_change_prompt[1])
p.sendline(args.P)
p.expect(passwd_change_prompt[2])
p.sendline(args.P)
break
elif i == 2:
# fix a login timeout issue, caused by the login_prompt message mixed with the output message of the rc.local
time.sleep(1)
Expand Down
9 changes: 9 additions & 0 deletions device/arista/x86_64-arista_7050_qx32s/sensors.conf
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ bus "i2c-7" "SCD 0000:02:00.0 SMBus master 0 bus 5"
chip "k10temp-pci-00c3"
label temp1 "Cpu temp sensor"

chip "fam15h_power-pci-00c4"
ignore power1

chip "max6658-i2c-2-4c"
label temp1 "Board temp sensor"
set temp1_max 55
Expand All @@ -34,7 +37,13 @@ chip "pmbus-i2c-6-58"
label temp2 "Power supply 1 inlet temp sensor"
label temp3 "Power supply 1 sensor"

ignore fan2
ignore fan3

chip "pmbus-i2c-5-58"
label temp1 "Power supply 2 hotspot sensor"
label temp2 "Power supply 2 inlet temp sensor"
label temp3 "Power supply 2 sensor"

ignore fan2
ignore fan3
9 changes: 9 additions & 0 deletions device/arista/x86_64-arista_7050cx3_32s/sensors.conf
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ bus "i2c-14" "SCD 0000:02:00.0 SMBus master 1 bus 4"
chip "k10temp-pci-00c3"
label temp1 "Cpu temp sensor"

chip "fam15h_power-pci-00c4"
ignore power1

chip "max6658-i2c-2-4c"
label temp1 "Cpu board temp sensor"
set temp1_max 75
Expand All @@ -33,7 +36,13 @@ chip "pmbus-i2c-13-58"
label temp2 "Power supply 1 inlet temp sensor"
label temp3 "Power supply 1 sensor"

ignore fan2
ignore fan3

chip "pmbus-i2c-14-58"
label temp1 "Power supply 2 hotspot sensor"
label temp2 "Power supply 2 inlet temp sensor"
label temp3 "Power supply 2 sensor"

ignore fan2
ignore fan3
9 changes: 9 additions & 0 deletions device/arista/x86_64-arista_7060_cx32s/sensors.conf
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ bus "i2c-7" "SCD 0000:02:00.0 SMBus master 0 bus 5"
chip "k10temp-pci-00c3"
label temp1 "Cpu temp sensor"

chip "fam15h_power-pci-00c4"
ignore power1

chip "max6697-i2c-2-1a"
label temp1 "Board sensor"
set temp1_max 95
Expand Down Expand Up @@ -45,7 +48,13 @@ chip "pmbus-i2c-6-58"
label temp2 "Power supply 1 inlet temp sensor"
label temp3 "Power supply 1 exhaust temp sensor"

ignore fan2
ignore fan3

chip "pmbus-i2c-5-58"
label temp1 "Power supply 2 hotspot sensor"
label temp2 "Power supply 2 inlet temp sensor"
label temp3 "Power supply 2 exhaust temp sensor"

ignore fan2
ignore fan3
Loading

0 comments on commit 2a50b2d

Please sign in to comment.