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-07 21:50:11 -06:00
|
|
|
make USERNAME=admin SONIC_BUILD_JOBS=$(nproc) $CACHE_OPTIONS target/sonic-broadcom.bin
|
|
|
|
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-12 08:01:59 -06:00
|
|
|
make USERNAME=admin SONIC_BUILD_JOBS=$(nproc) $CACHE_OPTIONS target/sonic-mellanox.bin
|
|
|
|
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-13 12:30:49 -06:00
|
|
|
sudo cp target/sonic-vs.img.gz /nfs/azpl/kvmimage/sonic-vs.$(Build.BuildNumber).img.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:
|
|
|
|
- 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"
|