dbfdab7c4e
introduce run-test template Signed-off-by: Guohan Lu <lguohan@gmail.com>
187 lines
5.9 KiB
YAML
187 lines
5.9 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
|
|
|
|
pr:
|
|
- master
|
|
|
|
name: $(TeamProject)_$(Build.DefinitionName)_$(SourceBranchName)_$(Date:yyyyMMdd)$(Rev:.r)
|
|
|
|
resources:
|
|
repositories:
|
|
- repository: sonic-mgmt
|
|
type: github
|
|
name: Azure/sonic-mgmt
|
|
endpoint: build
|
|
|
|
stages:
|
|
- stage: Build
|
|
pool: sonicbld
|
|
|
|
jobs:
|
|
- job:
|
|
displayName: "broadcom"
|
|
timeoutInMinutes: 600
|
|
steps:
|
|
- checkout: self
|
|
clean: true
|
|
submodules: recursive
|
|
displayName: 'Checkout code'
|
|
- script: |
|
|
git submodule foreach --recursive git clean -xfdf
|
|
git submodule foreach --recursive git reset --hard
|
|
git submodule update --init --recursive
|
|
displayName: 'reset submodules'
|
|
- 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
|
|
trap "sudo rm -rf fsroot" EXIT
|
|
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
|
|
displayName: 'Build sonic image'
|
|
- publish: $(System.DefaultWorkingDirectory)/
|
|
artifact: sonic-buildimage.broadcom
|
|
displayName: "Archive sonic image"
|
|
|
|
- job:
|
|
displayName: "mellanox"
|
|
timeoutInMinutes: 600
|
|
steps:
|
|
- checkout: self
|
|
clean: true
|
|
submodules: recursive
|
|
displayName: 'Checkout code'
|
|
|
|
- script: |
|
|
git submodule foreach --recursive git clean -xfdf
|
|
git submodule foreach --recursive git reset --hard
|
|
git submodule update --init --recursive
|
|
displayName: 'reset submodules'
|
|
- 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
|
|
trap "sudo rm -rf fsroot" EXIT
|
|
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
|
|
displayName: 'Build sonic image'
|
|
- publish: $(System.DefaultWorkingDirectory)/
|
|
artifact: sonic-buildimage.mellanox
|
|
displayName: "Archive sonic image"
|
|
|
|
- job:
|
|
displayName: "kvm"
|
|
timeoutInMinutes: 600
|
|
steps:
|
|
- checkout: self
|
|
clean: true
|
|
submodules: recursive
|
|
displayName: 'Checkout code'
|
|
|
|
- script: |
|
|
git submodule foreach --recursive git clean -xfdf
|
|
git submodule foreach --recursive git reset --hard
|
|
git submodule update --init --recursive
|
|
displayName: 'reset submodules'
|
|
- 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
|
|
trap "sudo rm -rf fsroot" EXIT
|
|
make USERNAME=admin SONIC_BUILD_JOBS=$(nproc) $CACHE_OPTIONS \
|
|
target/docker-sonic-vs.gz target/sonic-vs.img.gz target/docker-ptf.gz
|
|
displayName: 'Build sonic image'
|
|
- publish: $(System.DefaultWorkingDirectory)/
|
|
artifact: sonic-buildimage.kvm
|
|
displayName: "Archive sonic image"
|
|
|
|
- stage: Test
|
|
variables:
|
|
- 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:
|
|
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"
|
|
|
|
- task: DownloadPipelineArtifact@2
|
|
inputs:
|
|
artifact: sonic-buildimage.kvm
|
|
displayName: "Download sonic-buildimage.kvm artifact"
|
|
|
|
- script: |
|
|
set -x
|
|
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 ../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:
|
|
pool: sonictest
|
|
displayName: "kvmtest-t0"
|
|
timeoutInMinutes: 240
|
|
|
|
steps:
|
|
- template: .azure-pipelines/run-test-template.yml
|
|
parameters:
|
|
dut: vlab-01
|
|
tbname: vms-kvm-t0
|
|
ptf_name: ptf_vms6-1
|
|
tbtype: t0
|
|
|
|
- job:
|
|
pool: sonictest-t1-lag
|
|
displayName: "kvmtest-t1-lag"
|
|
timeoutInMinutes: 240
|
|
|
|
steps:
|
|
- template: .azure-pipelines/run-test-template.yml
|
|
parameters:
|
|
dut: vlab-03
|
|
tbname: vms-kvm-t1-lag
|
|
ptf_name: ptf_vms6-2
|
|
tbtype: t1-lag
|