Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
cytsai0409 authored Jul 24, 2023
2 parents 6dfe5d9 + 9129a7b commit c233485
Show file tree
Hide file tree
Showing 1,097 changed files with 127,314 additions and 14,707 deletions.
55 changes: 55 additions & 0 deletions .azure-pipelines/azure-pipelines-build-ubuntu-2004.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# C/C++ with GCC
# Build your C/C++ project with GCC using make.
# Add steps that publish test results, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/apps/c-cpp/gcc
pr: none

trigger:
batch: true
branches:
include:
- master

stages:
- stage: Build

jobs:
- job:
displayName: "amd64/ubuntu-20.04"
pool:
vmImage: 'ubuntu-20.04'

steps:
- checkout: self
submodules: true
- script: |
sudo apt-get update
sudo apt-get install -y make wget libtool m4 autoconf dh-exec libdebhelper-perl=13.6ubuntu1~bpo20.04.1 debhelper=13.6ubuntu1~bpo20.04.1 \
cmake pkg-config python3-pip python cmake libgtest-dev libgmock-dev libyang-dev \
debhelper-compat dh-elpa dh-sequence-python3 python3-all \
libpython3-all-dev python3-six xmlto unzip rake-compiler gem2deb pkg-php-tools \
ant default-jdk maven-repo-helper libguava-java
wget http://ftp.us.debian.org/debian/pool/main/libg/libgoogle-gson-java/libgoogle-gson-java_2.8.6-1+deb11u1_all.deb
sudo dpkg -i libgoogle-gson-java_2.8.6-1+deb11u1_all.deb
mkdir -p /tmp/artifacts
displayName: "Install dependencies"
- script: |
SONIC_CONFIG_MAKE_JOBS=$(nproc) CONFIGURED_ARCH=amd64 DEST=/tmp/artifacts make -f ../rules/protobuf.mk -f protobuf/Makefile
workingDirectory: src
displayName: "Build protobuf"
- script: |
sudo dpkg -i protobuf-compiler_3.21.12-3_amd64.deb libprotoc32_3.21.12-3_amd64.deb \
libprotobuf32_3.21.12-3_amd64.deb libprotobuf-dev_3.21.12-3_amd64.deb \
libprotobuf-lite32_3.21.12-3_amd64.deb
workingDirectory: /tmp/artifacts
displayName: "Install protobuf"
- script: |
dpkg-buildpackage -rfakeroot -b -us -uc
workingDirectory: src/sonic-dash-api
displayName: "Build sonic-dash-api"
- script: |
cp *.deb /tmp/artifacts
workingDirectory: src
- publish: /tmp/artifacts
artifact: sonic-buildimage.amd64.ubuntu20_04
displayName: "Archive sonic-buildimage debian packages for ubuntu20.04"
19 changes: 9 additions & 10 deletions .azure-pipelines/azure-pipelines-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,15 @@ jobs:
variables:
PLATFORM_ARCH: armhf

- name: marvell-arm64
${{ if not(parameters.qemuOrCrossBuild) }}:
pool: sonicbld-arm64
timeoutInMinutes: 2880
variables:
PLATFORM_ARCH: arm64

- name: marvell

- name: mellanox
variables:
dbg_image: yes
Expand Down Expand Up @@ -150,16 +159,6 @@ jobs:
pushd ./src/sonic-sairedis/SAI
git stash
popd
make $BUILD_OPTIONS ENABLE_SYNCD_RPC=y SAITHRIFT_V2=y target/docker-saiserverv2-brcm.gz
pushd ./src/sonic-sairedis/SAI
git stash
popd
fi
if [ $(GROUP_NAME) == barefoot ]; then
make $BUILD_OPTIONS SAITHRIFT_V2=y ENABLE_SYNCD_RPC=y target/docker-saiserverv2-bfn.gz
pushd ./src/sonic-sairedis/SAI
git stash
popd
fi
fi
if [ $(syncd_rpc_image) == yes ]; then
Expand Down
6 changes: 4 additions & 2 deletions .azure-pipelines/azure-pipelines-image-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@ jobs:
- template: .azure-pipelines/cleanup.yml@buildimage
- ${{ parameters.preSteps }}
- script: |
BUILD_OPTIONS="$(BUILD_OPTIONS)"
[ -n "$OVERRIDE_BUILD_OPTIONS" ] && OVERRIDE_BUILD_OPTIONS=$(OVERRIDE_BUILD_OPTIONS)
BUILD_OPTIONS="$(BUILD_OPTIONS) $OVERRIDE_BUILD_OPTIONS"
if [ -n "$(CACHE_MODE)" ] && echo $(PLATFORM_AZP) | grep -E -q "^(vs|broadcom|mellanox|marvell-armhf)$"; then
CACHE_OPTIONS="SONIC_DPKG_CACHE_METHOD=$(CACHE_MODE) SONIC_DPKG_CACHE_SOURCE=/nfs/dpkg_cache/$(PLATFORM_AZP)"
BUILD_OPTIONS="$(BUILD_OPTIONS) $CACHE_OPTIONS"
BUILD_OPTIONS="$BUILD_OPTIONS $CACHE_OPTIONS"
fi
echo $BUILD_OPTIONS
echo "##vso[task.setvariable variable=BUILD_OPTIONS]$BUILD_OPTIONS"
displayName: "Set cache options"
- checkout: self
Expand Down
133 changes: 101 additions & 32 deletions .azure-pipelines/run-test-scheduler-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ parameters:
type: string
default: 1

- name: NUM_ASIC
type: number
default: 1

- name: TEST_SET
type: string
default: ""
Expand All @@ -34,39 +38,103 @@ parameters:
type: string
default: "ceos"

- name: SPECIFIED_PARAMS
- name: TESTBED_NAME
type: string
default: ""

- name: IMAGE_URL
type: string
default: ""

- name: HWSKU
type: string
default: ""

- name: TEST_PLAN_TYPE
type: string
default: ""

- name: PLATFORM
type: string
default: ""

- name: SCRIPTS
type: string
default: ""

- name: FEATURES
type: string
default: ""

- name: SCRIPTS_EXCLUDE
type: string
default: ""

- name: FEATURES_EXCLUDE
type: string
default: "{}"
default: ""

- name: REPO_NAME
type: string
default: ""

- name: MGMT_BRANCH
type: string
default: master
default: ""

- name: NUM_ASIC
- name: STOP_ON_FAILURE
type: string
default: ""

- name: RETRY_TIMES
type: string
default: ""

- name: DUMP_KVM_IF_FAIL
type: string
default: "True"
values:
- "True"
- "False"

- name: REQUESTER
type: string
default: ""

- name: MAX_RUN_TEST_MINUTES
type: number
default: 1
default: 480


steps:
- script: |
set -e
wget -O ./.azure-pipelines/test_plan.py https://github.com/raw/sonic-net/sonic-mgmt/master/.azure-pipelines/test_plan.py
wget -O ./.azure-pipelines/pr_test_scripts.yaml https://github.com/raw/sonic-net/sonic-mgmt/master/.azure-pipelines/pr_test_scripts.yaml
displayName: Download TestbedV2 scripts
displayName: Download test plan scripts
- script: |
set -e
pip install PyYAML
rm -f new_test_plan_id.txt
python ./.azure-pipelines/test_plan.py create -t ${{ parameters.TOPOLOGY }} -o new_test_plan_id.txt \
--min-worker ${{ parameters.MIN_WORKER }} --max-worker ${{ parameters.MAX_WORKER }} \
--test-set ${{ parameters.TEST_SET }} --kvm-build-id $(KVM_BUILD_ID) \
--deploy-mg-extra-params "${{ parameters.DEPLOY_MG_EXTRA_PARAMS }}" --common-extra-params "${{ parameters.COMMON_EXTRA_PARAMS }}" \
--mgmt-branch ${{ parameters.MGMT_BRANCH }} --vm-type ${{ parameters.VM_TYPE }} --specified-params "${{ parameters.SPECIFIED_PARAMS }}" \
python ./.azure-pipelines/test_plan.py create \
-t ${{ parameters.TOPOLOGY }} \
-o new_test_plan_id.txt \
--min-worker ${{ parameters.MIN_WORKER }} \
--max-worker ${{ parameters.MAX_WORKER }} \
--test-set ${{ parameters.TEST_SET }} \
--kvm-build-id $(KVM_BUILD_ID) \
--deploy-mg-extra-params "${{ parameters.DEPLOY_MG_EXTRA_PARAMS }}" \
--common-extra-params "${{ parameters.COMMON_EXTRA_PARAMS }}" \
--mgmt-branch ${{ parameters.MGMT_BRANCH }} \
--vm-type ${{ parameters.VM_TYPE }} \
--num-asic ${{ parameters.NUM_ASIC }}
TEST_PLAN_ID=`cat new_test_plan_id.txt`
echo "Created test plan $TEST_PLAN_ID"
echo "Check https://www.testbed-tools.org/scheduler/testplan/$TEST_PLAN_ID for test plan status"
echo "Check $(FRONTEND_URL)/scheduler/testplan/$TEST_PLAN_ID for test plan status"
echo "##vso[task.setvariable variable=TEST_PLAN_ID]$TEST_PLAN_ID"
env:
TESTBED_TOOLS_URL: $(TESTBED_TOOLS_URL)
Expand All @@ -78,8 +146,8 @@ steps:
- script: |
set -e
echo "Lock testbed"
echo "TestbedV2 is just online and might not be stable enough, for any issue, please send email to sonictestbedtools@microsoft.com"
echo "Runtime detailed progress at https://www.testbed-tools.org/scheduler/testplan/$TEST_PLAN_ID "
echo "SONiC PR system-level test is powered by SONiC Elastictest, for any issue, please send email to sonicelastictest@microsoft.com"
echo "Runtime detailed progress at $(FRONTEND_URL)/scheduler/testplan/$TEST_PLAN_ID "
# When "LOCK_TESTBED" finish, it changes into "PREPARE_TESTBED"
python ./.azure-pipelines/test_plan.py poll -i "$(TEST_PLAN_ID)" --expected-state LOCK_TESTBED
env:
Expand All @@ -89,10 +157,9 @@ steps:
- script: |
set -e
echo "Prepare testbed"
echo "Preparing the testbed(add-topo, deploy-mg) may take 15-30 minutes. Before the testbed is ready, the progress of the test plan keeps displayed as 0, please be patient(We will improve the indication in a short time)"
echo "If the progress keeps as 0 for more than 1 hour, please cancel and retry this pipeline"
echo "TestbedV2 is just online and might not be stable enough, for any issue, please send email to sonictestbedtools@microsoft.com"
echo "Runtime detailed progress at https://www.testbed-tools.org/scheduler/testplan/$TEST_PLAN_ID "
echo "Preparing the testbed(add-topo, deploy-mg) may take 15-30 minutes. Before the testbed is ready, the progress of the test plan keeps displayed as 0, please be patient"
echo "SONiC PR system-level test is powered by SONiC Elastictest, for any issue, please send email to sonicelastictest@microsoft.com"
echo "Runtime detailed progress at $(FRONTEND_URL)/scheduler/testplan/$TEST_PLAN_ID "
# When "PREPARE_TESTBED" finish, it changes into "EXECUTING"
python ./.azure-pipelines/test_plan.py poll -i "$(TEST_PLAN_ID)" --expected-state PREPARE_TESTBED
env:
Expand All @@ -102,25 +169,27 @@ steps:
- script: |
set -e
echo "Run test"
echo "TestbedV2 is just online and might not be stable enough, for any issue, please send email to sonictestbedtools@microsoft.com"
echo "Runtime detailed progress at https://www.testbed-tools.org/scheduler/testplan/$TEST_PLAN_ID "
echo "SONiC PR system-level test is powered by SONiC Elastictest, for any issue, please send email to sonicelastictest@microsoft.com"
echo "Runtime detailed progress at $(FRONTEND_URL)/scheduler/testplan/$TEST_PLAN_ID "
# When "EXECUTING" finish, it changes into "KVMDUMP", "FAILED", "CANCELLED" or "FINISHED"
python ./.azure-pipelines/test_plan.py poll -i "$(TEST_PLAN_ID)" --expected-state EXECUTING
env:
TESTBED_TOOLS_URL: $(TESTBED_TOOLS_URL)
displayName: Run test
- script: |
set -e
echo "KVM dump"
echo "TestbedV2 is just online and might not be stable enough, for any issue, please send email to sonictestbedtools@microsoft.com"
echo "Runtime detailed progress at https://www.testbed-tools.org/scheduler/testplan/$TEST_PLAN_ID "
# When "KVMDUMP" finish, it changes into "FAILED", "CANCELLED" or "FINISHED"
python ./.azure-pipelines/test_plan.py poll -i "$(TEST_PLAN_ID)" --expected-state KVMDUMP
condition: succeededOrFailed()
env:
TESTBED_TOOLS_URL: $(TESTBED_TOOLS_URL)
displayName: KVM dump
timeoutInMinutes: ${{ parameters.MAX_RUN_TEST_MINUTES }}
- ${{ if eq(parameters.DUMP_KVM_IF_FAIL, 'True') }}:
- script: |
set -e
echo "KVM dump"
echo "SONiC PR system-level test is powered by SONiC Elastictest, for any issue, please send email to sonicelastictest@microsoft.com"
echo "Runtime detailed progress at $(FRONTEND_URL)/scheduler/testplan/$TEST_PLAN_ID "
# When "KVMDUMP" finish, it changes into "FAILED", "CANCELLED" or "FINISHED"
python ./.azure-pipelines/test_plan.py poll -i "$(TEST_PLAN_ID)" --expected-state KVMDUMP
condition: succeededOrFailed()
env:
TESTBED_TOOLS_URL: $(TESTBED_TOOLS_URL)
displayName: KVM dump
- script: |
set -e
Expand Down
1 change: 0 additions & 1 deletion .azure-pipelines/vstest-exclude
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
^platform
^.azure-pipelines
^files/build/versions
^sonic-slave-
1 change: 1 addition & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ If PR needs to be backported, then the PR must be tested against the base branch
- [ ] 202111
- [ ] 202205
- [ ] 202211
- [ ] 202305

#### Tested branch (Please provide the tested image version)

Expand Down
13 changes: 12 additions & 1 deletion .github/workflows/automerge_scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ jobs:
for ((i=0;i<$count;i++))
do
url=$(cat prs.log | jq -r ".[$i].url")
body=$(cat prs.log | jq -r ".[$i].body")
title=$(cat prs.log | jq -r ".[$i].title")
created_at=$(cat prs.log | jq -r ".[$i].createdAt")
echo PR: $(($i+1))/$count, URL: $url, createdAt: $created_at, now: $(date -u +"%FT%TZ")
[[ "$url" == "" ]] && continue
Expand All @@ -47,6 +49,11 @@ jobs:
# Others success flag: conclusion in SUCCESS,NEUTRAL
# Ignore Azure.sonic-buildimage stage check result. It may be set continueOnError
echo "$name" | grep "Azure.sonic-buildimage (" && continue
# rerun Azure.sonic-buildimage per day
if [[ "$name" == "Azure.sonic-buildimage" ]] && [[ "$conclusion" == "FAILURE" ]];then
completedAt=$(echo $check | jq -r '.completedAt')
[[ "$completedAt" < $(date --date "2 hour ago" -u +"%FT%TZ") ]] && [[ $(date -u +"%T") < "02:00:00" ]] && gh pr comment $url --body "/azp run Azure.sonic-buildimage"
fi
# Ignore Semgrep, it has issues.
[[ "$name" == "Semgrep" ]] && continue
if [[ "$state" == "SUCCESS" ]];then
Expand All @@ -63,6 +70,10 @@ jobs:
done
# merge the PR
echo ========Merging PR========
gh pr merge --rebase --admin -R sonic-net/sonic-buildimage $url || true
if echo $title | grep "^\[submodule\]";then
gh pr merge --squash --admin -R sonic-net/sonic-buildimage $url -b "$body" || true
else
gh pr merge --rebase --admin -R sonic-net/sonic-buildimage $url || true
fi
echo ========Finished PR========
done
3 changes: 0 additions & 3 deletions .github/workflows/label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ on:
- reopened
branches:
- master
- '202012'
- '202[1-9][0-9][0-9]'
- '20[3-9][0-9][0-9][0-9]'
paths:
- 'files/build/versions/**'

Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/pr_cherrypick_prestep.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:

jobs:
pre_cherry_pick:
if: github.event.pull_request.merged == true && ( (github.event.action == 'closed' && contains(join(github.event.pull_request.labels.*.name, ','), 'Approved for 20')) || (github.event.action == 'labeled' && startsWith(github.event.label.name, 'Approved for 20')) )
if: github.repository_owner == 'sonic-net' && github.event.pull_request.merged == true && ( (github.event.action == 'closed' && contains(join(github.event.pull_request.labels.*.name, ','), 'Approved for 20')) || (github.event.action == 'labeled' && startsWith(github.event.label.name, 'Approved for 20')) )
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand Down Expand Up @@ -39,6 +39,7 @@ jobs:
labels=$(echo $GITHUB_CONTEXT | jq -r ".event.label.name")
fi
title=$(echo $GITHUB_CONTEXT | jq -r ".event.pull_request.title")
body=$(echo $GITHUB_CONTEXT | jq -r ".event.pull_request.body")
echo =============================
echo SHA: $sha
echo PRID: $pr_id
Expand All @@ -50,6 +51,7 @@ jobs:
echo ${TOKEN} | gh auth login --with-token
echo author: $author
echo title: $title
echo body: "$body"
echo =============================
git config user.name mssonicbld
Expand Down Expand Up @@ -105,7 +107,7 @@ jobs:
else
# Create PR to release branch
git push mssonicbld HEAD:cherry/$branch/${pr_id} -f
result=$(gh pr create -R ${repository} -H mssonicbld:cherry/$branch/${pr_id} -B $branch -t "[action] [PR:$pr_id] $title" -b '' 2>&1)
result=$(gh pr create -R ${repository} -H mssonicbld:cherry/$branch/${pr_id} -B $branch -t "[action] [PR:$pr_id] $title" -b "$body" 2>&1)
echo $result | grep "already exists" && { echo $result; return 0; }
echo $result | grep github.com || { echo $result; return 1; }
new_pr_rul=$(echo $result | grep github.com)
Expand Down
Loading

0 comments on commit c233485

Please sign in to comment.