2020-11-26 06:18:25 -06:00
|
|
|
# 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:
|
|
|
|
- main
|
|
|
|
|
2021-01-07 21:50:11 -06:00
|
|
|
pr:
|
|
|
|
- master
|
2020-11-26 06:18:25 -06:00
|
|
|
|
2021-01-07 21:50:11 -06:00
|
|
|
name: $(TeamProject)_$(Build.DefinitionName)_$(SourceBranchName)_$(Date:yyyyMMdd)$(Rev:.r)
|
2020-11-26 06:18:25 -06:00
|
|
|
|
2021-01-07 21:50:11 -06:00
|
|
|
resources:
|
|
|
|
repositories:
|
|
|
|
- repository: sonic-mgmt
|
|
|
|
type: github
|
|
|
|
name: Azure/sonic-mgmt
|
|
|
|
endpoint: build
|
|
|
|
|
|
|
|
stages:
|
|
|
|
- stage: Build
|
|
|
|
pool: sonicbld
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
- job:
|
|
|
|
displayName: "broadcom"
|
2021-01-12 08:01:59 -06:00
|
|
|
timeoutInMinutes: 600
|
2021-01-07 21:50:11 -06:00
|
|
|
steps:
|
|
|
|
- checkout: self
|
|
|
|
submodules: recursive
|
|
|
|
displayName: 'Checkout code'
|
|
|
|
|
|
|
|
- script: |
|
|
|
|
sudo modprobe overlay
|
|
|
|
CACHE_OPTIONS="SONIC_DPKG_CACHE_METHOD=rcache SONIC_DPKG_CACHE_SOURCE=/nfs/dpkg_cache/broadcom"
|
|
|
|
ENABLE_DOCKER_BASE_PULL=y make configure PLATFORM=broadcom
|
2021-01-13 12:30:49 -06:00
|
|
|
trap "sudo rm -rf fsroot" EXIT
|
2021-01-24 19:31:47 -06:00
|
|
|
make USERNAME=admin SONIC_BUILD_JOBS=$(nproc) $CACHE_OPTIONS target/sonic-broadcom.bin && \
|
|
|
|
ENABLE_SYNCD_RPC=y make USERNAME=admin SONIC_BUILD_JOBS=$(nproc) $CACHE_OPTIONS target/docker-syncd-brcm-rpc.gz
|
2021-01-07 21:50:11 -06:00
|
|
|
displayName: 'Build sonic image'
|
|
|
|
- publish: $(System.DefaultWorkingDirectory)/
|
|
|
|
artifact: sonic-buildimage.broadcom
|
|
|
|
displayName: "Archive sonic image"
|
|
|
|
|
2021-01-12 08:01:59 -06:00
|
|
|
- job:
|
|
|
|
displayName: "mellanox"
|
|
|
|
timeoutInMinutes: 600
|
|
|
|
steps:
|
|
|
|
- checkout: self
|
|
|
|
submodules: recursive
|
|
|
|
displayName: 'Checkout code'
|
|
|
|
|
|
|
|
- script: |
|
|
|
|
sudo modprobe overlay
|
|
|
|
CACHE_OPTIONS="SONIC_DPKG_CACHE_METHOD=rcache SONIC_DPKG_CACHE_SOURCE=/nfs/dpkg_cache/mellanox"
|
|
|
|
ENABLE_DOCKER_BASE_PULL=y make configure PLATFORM=mellanox
|
2021-01-13 12:30:49 -06:00
|
|
|
trap "sudo rm -rf fsroot" EXIT
|
2021-01-24 19:31:47 -06:00
|
|
|
make USERNAME=admin SONIC_BUILD_JOBS=$(nproc) $CACHE_OPTIONS target/sonic-mellanox.bin && \
|
|
|
|
ENABLE_SYNCD_RPC=y make USERNAME=admin SONIC_BUILD_JOBS=$(nproc) $CACHE_OPTIONS target/docker-syncd-mlnx-rpc.gz
|
2021-01-12 08:01:59 -06:00
|
|
|
displayName: 'Build sonic image'
|
|
|
|
- publish: $(System.DefaultWorkingDirectory)/
|
|
|
|
artifact: sonic-buildimage.mellanox
|
|
|
|
displayName: "Archive sonic image"
|
|
|
|
|
2021-01-07 21:50:11 -06:00
|
|
|
- job:
|
|
|
|
displayName: "kvm"
|
2021-01-12 08:01:59 -06:00
|
|
|
timeoutInMinutes: 600
|
2021-01-07 21:50:11 -06:00
|
|
|
steps:
|
|
|
|
- checkout: self
|
|
|
|
submodules: recursive
|
|
|
|
displayName: 'Checkout code'
|
|
|
|
|
|
|
|
- script: |
|
|
|
|
echo $(Build.BuildNumber)
|
|
|
|
sudo modprobe overlay
|
|
|
|
CACHE_OPTIONS="SONIC_DPKG_CACHE_METHOD=rcache SONIC_DPKG_CACHE_SOURCE=/nfs/dpkg_cache/vs"
|
|
|
|
ENABLE_DOCKER_BASE_PULL=y make configure PLATFORM=vs
|
2021-01-13 12:30:49 -06:00
|
|
|
trap "sudo rm -rf fsroot" EXIT
|
2021-01-19 11:35:19 -06:00
|
|
|
make USERNAME=admin SONIC_BUILD_JOBS=$(nproc) $CACHE_OPTIONS \
|
|
|
|
target/docker-sonic-vs.gz target/sonic-vs.img.gz && \
|
2021-01-24 23:01:19 -06:00
|
|
|
sudo cp target/sonic-vs.img.gz /nfs/azpl/kvmimage/sonic-vs.$(Build.BuildNumber).img.gz && \
|
|
|
|
sudo cp target/docker-sonic-vs.gz /nfs/azpl/kvmimage/docker-sonic-vs.$(Build.BuildNumber).gz
|
2021-01-07 21:50:11 -06:00
|
|
|
displayName: 'Build sonic image'
|
|
|
|
- publish: $(System.DefaultWorkingDirectory)/
|
|
|
|
artifact: sonic-buildimage.kvm
|
|
|
|
displayName: "Archive sonic image"
|
|
|
|
|
|
|
|
- stage: Test
|
|
|
|
pool: sonictest
|
|
|
|
variables:
|
|
|
|
- name: dut
|
|
|
|
value: vlab-01
|
|
|
|
- name: tbname
|
|
|
|
value: vms-kvm-t0
|
|
|
|
- name: inventory
|
|
|
|
value: veos_vtb
|
|
|
|
- name: testbed_file
|
|
|
|
value: vtestbed.csv
|
|
|
|
- name: ptf_name
|
|
|
|
value: ptf_vms6-1
|
|
|
|
|
|
|
|
jobs:
|
2021-01-24 23:01:19 -06:00
|
|
|
- job:
|
|
|
|
displayName: "vstest"
|
|
|
|
timeoutInMinutes: 60
|
|
|
|
steps:
|
|
|
|
- checkout: self
|
|
|
|
submodules: recursive
|
|
|
|
displayName: 'Checkout code'
|
|
|
|
|
|
|
|
- task: DownloadPipelineArtifact@2
|
|
|
|
inputs:
|
|
|
|
source: specific
|
|
|
|
project: build
|
|
|
|
pipeline: 9
|
|
|
|
artifacts: sonic-swss-common.amd64.ubuntu20_04
|
|
|
|
runVersion: 'latestFromBranch'
|
|
|
|
runBranch: 'refs/heads/master'
|
|
|
|
displayName: "Download sonic swss common deb packages"
|
|
|
|
|
|
|
|
- script: |
|
|
|
|
sudo dpkg -i --force-confask,confnew ../sonic-swss-common.amd64.ubuntu20_04/libswsscommon_1.0.0_amd64.deb
|
|
|
|
sudo dpkg -i ../sonic-swss-common.amd64.ubuntu20_04/python3-swsscommon_1.0.0_amd64.deb
|
|
|
|
sudo docker load -i /nfs/azpl/kvmimage/docker-sonic-vs.$(Build.BuildNumber).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} ." EXIT
|
|
|
|
pushd platform/vs/tests
|
|
|
|
sudo py.test -v --junitxml=tr.xml --imgname=docker-sonic-vs:$(Build.BuildNumber) && \
|
|
|
|
sudo rm /nfs/azpl/kvmimage/docker-sonic-vs.$(Build.BuildNumber).gz
|
|
|
|
displayName: "Run vs tests"
|
|
|
|
|
|
|
|
- task: PublishTestResults@2
|
|
|
|
inputs:
|
|
|
|
testResultsFiles: '**/tr.xml'
|
|
|
|
testRunTitle: vstest
|
|
|
|
|
2021-01-07 21:50:11 -06:00
|
|
|
- job:
|
|
|
|
displayName: "kvmtest"
|
|
|
|
timeoutInMinutes: 240
|
|
|
|
steps:
|
|
|
|
- script: |
|
|
|
|
sudo mkdir -p /data/sonic-vm/images
|
|
|
|
sudo cp -v /nfs/azpl/kvmimage/sonic-vs.$(Build.BuildNumber).img.gz /data/sonic-vm/images/sonic-vs.img.gz
|
|
|
|
sudo gzip -fd /data/sonic-vm/images/sonic-vs.img.gz
|
|
|
|
username=$(id -un)
|
|
|
|
sudo chown -R $username.$username /data/sonic-vm
|
|
|
|
pushd /data/sonic-mgmt
|
|
|
|
git remote update
|
|
|
|
git reset --hard origin/master
|
|
|
|
sed -i s/use_own_value/${username}/ ansible/veos_vtb
|
|
|
|
echo aaa > ansible/password.txt
|
|
|
|
docker exec sonic-mgmt bash -c "pushd /data/sonic-mgmt/ansible;./testbed-cli.sh -d /data/sonic-vm -m $(inventory) -t $(testbed_file) refresh-dut $(tbname) password.txt" && sleep 180
|
|
|
|
displayName: "Setup T0 testbed"
|
|
|
|
- script: |
|
|
|
|
pwd
|
|
|
|
username=$(id -un)
|
|
|
|
|
2021-01-18 23:26:41 -06:00
|
|
|
docker exec sonic-mgmt bash -c "/data/sonic-mgmt/tests/kvmtest.sh -en $(tbname) $(dut)"
|
2021-01-07 21:50:11 -06:00
|
|
|
|
|
|
|
# save dut state if test fails
|
|
|
|
if [ $? != 0 ]; then
|
|
|
|
virsh_version=$(virsh --version)
|
|
|
|
if [ $virsh_version == "6.0.0" ]; then
|
|
|
|
rm -rf kvmdump
|
|
|
|
mkdir -p kvmdump
|
|
|
|
virsh -c qemu:///system list
|
|
|
|
virsh -c qemu:///system save $(dut) kvmdump/$(dut).memdmp
|
|
|
|
virsh -c qemu:///system dumpxml $(dut) > kvmdump/$(dut).xml
|
|
|
|
img=$(virsh -c qemu:///system domblklist $(dut) | grep vda | awk '{print $2}')
|
|
|
|
cp $img kvmdump/$(dut).img
|
|
|
|
sudo chown -R $username.$username kvmdump
|
|
|
|
virsh -c qemu:///system undefine $(dut)
|
|
|
|
fi
|
|
|
|
|
|
|
|
rm -rf ptfdump
|
|
|
|
mkdir -p ptfdump
|
2021-01-18 23:26:41 -06:00
|
|
|
docker commit $(ptf_name) docker-ptf:$(Build.BuildNumber)
|
2021-01-07 21:50:11 -06:00
|
|
|
docker save docker-ptf:$(Build.BuildNumber) | gzip -c > ptfdump/docker-ptf-dump.gz
|
|
|
|
docker rmi docker-ptf:$(Build.BuildNumber)
|
|
|
|
|
|
|
|
exit 2
|
|
|
|
else
|
|
|
|
sudo rm /nfs/azpl/kvmimage/sonic-vs.$(Build.BuildNumber).img.gz
|
|
|
|
fi
|
|
|
|
displayName: "Run T0 tests"
|