51e0b6ddd9
[Ci] Support to build sonic-swss-common for test - Microsoft ADO **(number only)**: 24341479
190 lines
5.7 KiB
YAML
190 lines
5.7 KiB
YAML
# Starter pipeline
|
|
# Start with a minimal pipeline that you can customize to build and deploy your code.
|
|
# Add steps that build, run tests, deploy, and more:
|
|
# https://aka.ms/yaml
|
|
|
|
trigger:
|
|
branches:
|
|
include:
|
|
- master
|
|
- 202012
|
|
paths:
|
|
exclude:
|
|
- .github
|
|
|
|
pr:
|
|
branches:
|
|
include:
|
|
- master
|
|
- 202012
|
|
paths:
|
|
exclude:
|
|
- .github
|
|
|
|
name: $(TeamProject)_$(Build.DefinitionName)_$(SourceBranchName)_$(Date:yyyyMMdd)$(Rev:.r)
|
|
|
|
resources:
|
|
repositories:
|
|
- repository: sonic-mgmt
|
|
type: github
|
|
name: sonic-net/sonic-mgmt
|
|
endpoint: sonic-net
|
|
ref: refs/heads/202012
|
|
- repository: buildimage
|
|
type: github
|
|
name: sonic-net/sonic-buildimage
|
|
endpoint: sonic-net
|
|
ref: master
|
|
|
|
variables:
|
|
- template: .azure-pipelines/azure-pipelines-repd-build-variables.yml@buildimage
|
|
- template: .azure-pipelines/template-variables.yml@buildimage
|
|
- name: CACHE_MODE
|
|
value: rcache
|
|
|
|
stages:
|
|
- stage: BuildVS
|
|
pool: sonicbld
|
|
variables:
|
|
CACHE_MODE: rcache
|
|
VERSION_CONTROL_OPTIONS: 'SONIC_VERSION_CONTROL_COMPONENTS=deb,py2,py3,web,git,docker'
|
|
jobs:
|
|
- template: .azure-pipelines/azure-pipelines-build.yml
|
|
parameters:
|
|
buildOptions: 'USERNAME=admin SONIC_BUILD_JOBS=$(nproc) ${{ variables.VERSION_CONTROL_OPTIONS }}'
|
|
jobGroups:
|
|
- name: vs
|
|
|
|
- stage: Build
|
|
pool: sonicbld
|
|
dependsOn: []
|
|
variables:
|
|
CACHE_MODE: rcache
|
|
VERSION_CONTROL_OPTIONS: 'SONIC_VERSION_CONTROL_COMPONENTS=deb,py2,py3,web,git,docker'
|
|
jobs:
|
|
- template: .azure-pipelines/azure-pipelines-build.yml
|
|
parameters:
|
|
buildOptions: 'USERNAME=admin SONIC_BUILD_JOBS=$(nproc) ${{ variables.VERSION_CONTROL_OPTIONS }}'
|
|
jobGroups:
|
|
- name: broadcom
|
|
- name: mellanox
|
|
- name: marvell-armhf
|
|
pool: sonicbld-armhf
|
|
timeoutInMinutes: 1200
|
|
variables:
|
|
PLATFORM_ARCH: armhf
|
|
|
|
- stage: Test
|
|
dependsOn: BuildVS
|
|
condition: and(succeeded(), and(ne(stageDependencies.BuildVS.outputs['vs.SetVar.SKIP_VSTEST'], 'YES'), in(dependencies.BuildVS.result, 'Succeeded', 'SucceededWithIssues')))
|
|
variables:
|
|
- group: SONiC-Elastictest
|
|
- name: inventory
|
|
value: veos_vtb
|
|
- name: testbed_file
|
|
value: vtestbed.csv
|
|
|
|
jobs:
|
|
- job:
|
|
pool: sonictest
|
|
displayName: "vstest"
|
|
timeoutInMinutes: 60
|
|
steps:
|
|
- checkout: self
|
|
clean: true
|
|
submodules: recursive
|
|
displayName: 'Checkout code'
|
|
|
|
- task: DownloadPipelineArtifact@2
|
|
inputs:
|
|
artifact: sonic-buildimage.vs
|
|
displayName: "Download sonic-buildimage.vs artifact"
|
|
|
|
- script: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y make libtool m4 autoconf dh-exec debhelper cmake pkg-config \
|
|
libhiredis-dev libnl-3-dev libnl-genl-3-dev libnl-route-3-dev libnl-nf-3-dev swig3.0 \
|
|
libpython2.7-dev libboost-dev libboost-serialization-dev uuid-dev libzmq5 libzmq3-dev python3-pip \
|
|
cmake libgtest-dev libgmock-dev libyang-dev
|
|
sudo pip3 install pytest
|
|
cd src/sonic-swss-common
|
|
./autogen.sh
|
|
dpkg-buildpackage -rfakeroot -us -uc -b -j$(nproc)
|
|
sudo dpkg -i --force-confask,confnew ../libswsscommon_*.deb
|
|
sudo dpkg -i ../python3-swsscommon_*.deb
|
|
displayName: "Compile sonic swss common"
|
|
|
|
- script: |
|
|
sudo docker load -i ../target/docker-sonic-vs.gz
|
|
docker tag docker-sonic-vs:latest docker-sonic-vs:$(Build.BuildNumber)
|
|
username=$(id -un)
|
|
|
|
trap "docker ps; docker images; ip netns list; \
|
|
docker rmi docker-sonic-vs:$(Build.BuildNumber); \
|
|
ip netns list | grep -E [-]srv[0-9]+ | awk '{print $1}' | xargs -I {} sudo ip netns delete {}; \
|
|
sudo chown -R ${username}.${username} .; \
|
|
sudo chown -R ${username}.${username} $(System.DefaultWorkingDirectory)" EXIT
|
|
pushd platform/vs/tests
|
|
sudo py.test -v --junitxml=tr.xml --imgname=docker-sonic-vs:$(Build.BuildNumber)
|
|
displayName: "Run vs tests"
|
|
|
|
- task: PublishTestResults@2
|
|
inputs:
|
|
testResultsFiles: '**/tr.xml'
|
|
testRunTitle: vstest
|
|
|
|
- job: t0_elastictest
|
|
pool: ubuntu-20.04
|
|
displayName: "kvmtest-t0 by Elastictest"
|
|
timeoutInMinutes: 240
|
|
continueOnError: false
|
|
steps:
|
|
- template: .azure-pipelines/run-test-scheduler-template.yml
|
|
parameters:
|
|
TOPOLOGY: t0
|
|
MIN_WORKER: $(T0_INSTANCE_NUM)
|
|
MAX_WORKER: $(T0_INSTANCE_NUM)
|
|
MGMT_BRANCH: 202012
|
|
|
|
- job: t0_2vlans_elastictest
|
|
pool: ubuntu-20.04
|
|
displayName: "kvmtest-t0-2vlans by Elastictest"
|
|
timeoutInMinutes: 240
|
|
continueOnError: false
|
|
steps:
|
|
- template: .azure-pipelines/run-test-scheduler-template.yml
|
|
parameters:
|
|
TOPOLOGY: t0
|
|
TEST_SET: t0-2vlans
|
|
MIN_WORKER: $(T0_2VLANS_INSTANCE_NUM)
|
|
MAX_WORKER: $(T0_2VLANS_INSTANCE_NUM)
|
|
DEPLOY_MG_EXTRA_PARAMS: "-e vlan_config=two_vlan_a"
|
|
MGMT_BRANCH: 202012
|
|
|
|
- job: t1_lag_elastictest
|
|
pool: ubuntu-20.04
|
|
displayName: "kvmtest-t1-lag by Elastictest"
|
|
timeoutInMinutes: 240
|
|
continueOnError: false
|
|
steps:
|
|
- template: .azure-pipelines/run-test-scheduler-template.yml
|
|
parameters:
|
|
TOPOLOGY: t1-lag
|
|
MIN_WORKER: $(T1_LAG_INSTANCE_NUM)
|
|
MAX_WORKER: $(T1_LAG_INSTANCE_NUM)
|
|
MGMT_BRANCH: 202012
|
|
|
|
- job: dualtor_elastictest
|
|
pool: ubuntu-20.04
|
|
displayName: "kvmtest-dualtor-t0 by Elastictest"
|
|
timeoutInMinutes: 240
|
|
continueOnError: false
|
|
steps:
|
|
- template: .azure-pipelines/run-test-scheduler-template.yml
|
|
parameters:
|
|
TOPOLOGY: dualtor
|
|
MIN_WORKER: $(T0_DUALTOR_INSTANCE_NUM)
|
|
MAX_WORKER: $(T0_DUALTOR_INSTANCE_NUM)
|
|
COMMON_EXTRA_PARAMS: "--disable_loganalyzer "
|
|
MGMT_BRANCH: 202012
|