sonic-buildimage-msft/azure-pipelines.yml

249 строки
7.4 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
- 202???
paths:
exclude:
- .github
pr:
branches:
include:
- master
- 202???
paths:
exclude:
- .github
name: $(TeamProject)_$(Build.DefinitionName)_$(SourceBranchName)_$(Date:yyyyMMdd)$(Rev:.r)
resources:
repositories:
- repository: sonic-mgmt
type: github
name: sonic-net/sonic-mgmt
ref: master
endpoint: sonic-net
- 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
- name: ENABLE_FIPS
value: y
stages:
- stage: BuildVS
pool: sonicbld-1es
jobs:
- template: .azure-pipelines/azure-pipelines-build.yml
parameters:
buildOptions: 'USERNAME=admin SONIC_BUILD_JOBS=$(nproc) BUILD_MULTIASIC_KVM=y ${{ variables.VERSION_CONTROL_OPTIONS }}'
jobGroups:
- name: vs
- stage: Build
pool: sonicbld-1es
variables:
INSTALL_DEBUG_TOOLS: y
dependsOn: []
jobs:
- template: .azure-pipelines/azure-pipelines-build.yml
parameters:
buildOptions: 'USERNAME=admin SONIC_BUILD_JOBS=$(nproc) ${{ variables.VERSION_CONTROL_OPTIONS }}'
jobGroups:
- name: broadcom
variables:
swi_image: yes
- name: mellanox
- name: marvell-arm64
pool: sonicbld-arm64
variables:
PLATFORM_ARCH: arm64
- 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
# For every test job:
# continueOnError: false means it's a required test job and will block merge if it fails
# continueOnError: true means it's an optional test job and will not block merge even though it fails(unless a required test job depends on its result)
jobs:
- job:
pool: sonictest
displayName: "vstest"
timeoutInMinutes: 60
steps:
- template: .azure-pipelines/cleanup.yml
- checkout: self
clean: true
submodules: recursive
displayName: 'Checkout code'
- script: |
sudo rm -rf ../target
sudo rm -rf ../*.deb
displayName: "Cleanup"
- task: DownloadPipelineArtifact@2
inputs:
source: specific
project: build
pipeline: 9
artifact: 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.vs
displayName: "Download sonic-buildimage.vs artifact"
- script: |
set -x
sudo apt-get update
sudo apt-get install libyang0.16 -y
sudo dpkg -i --force-confask,confnew ../libswsscommon_1.0.0_amd64.deb
sudo dpkg -i ../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: t0_elastictest
pool: sonic-ubuntu-1c
displayName: "kvmtest-t0 by Elastictest"
timeoutInMinutes: 240
continueOnError: false
steps:
- template: .azure-pipelines/run-test-elastictest-template.yml@sonic-mgmt
parameters:
TOPOLOGY: t0
MIN_WORKER: $(T0_INSTANCE_NUM)
MAX_WORKER: $(T0_INSTANCE_NUM)
MGMT_BRANCH: "202305"
- job: t0_2vlans_elastictest
pool: sonic-ubuntu-1c
displayName: "kvmtest-t0-2vlans by Elastictest"
timeoutInMinutes: 240
continueOnError: false
steps:
- template: .azure-pipelines/run-test-elastictest-template.yml@sonic-mgmt
parameters:
TOPOLOGY: t0
TEST_SET: t0-2vlans
MIN_WORKER: $(T0_2VLANS_INSTANCE_NUM)
MAX_WORKER: $(T0_2VLANS_INSTANCE_NUM)
MGMT_BRANCH: "202305"
DEPLOY_MG_EXTRA_PARAMS: "-e vlan_config=two_vlan_a"
- job: t1_lag_elastictest
pool: sonic-ubuntu-1c
displayName: "kvmtest-t1-lag by Elastictest"
timeoutInMinutes: 240
continueOnError: false
steps:
- template: .azure-pipelines/run-test-elastictest-template.yml@sonic-mgmt
parameters:
TOPOLOGY: t1-lag
MIN_WORKER: $(T1_LAG_INSTANCE_NUM)
MAX_WORKER: $(T1_LAG_INSTANCE_NUM)
MGMT_BRANCH: "202305"
- job: multi_asic_elastictest
displayName: "kvmtest-multi-asic-t1-lag by Elastictest"
pool: sonic-ubuntu-1c
timeoutInMinutes: 240
continueOnError: false
steps:
- template: .azure-pipelines/run-test-elastictest-template.yml@sonic-mgmt
parameters:
TOPOLOGY: t1-8-lag
TEST_SET: multi-asic-t1-lag
MIN_WORKER: $(MULTI_ASIC_INSTANCE_NUM)
MAX_WORKER: $(MULTI_ASIC_INSTANCE_NUM)
NUM_ASIC: 4
MGMT_BRANCH: "202305"
- job: dualtor_elastictest
pool: sonic-ubuntu-1c
displayName: "kvmtest-dualtor-t0 by Elastictest"
timeoutInMinutes: 240
continueOnError: false
steps:
- template: .azure-pipelines/run-test-elastictest-template.yml@sonic-mgmt
parameters:
TOPOLOGY: dualtor
MIN_WORKER: $(T0_DUALTOR_INSTANCE_NUM)
MAX_WORKER: $(T0_DUALTOR_INSTANCE_NUM)
MGMT_BRANCH: "202305"
COMMON_EXTRA_PARAMS: "--disable_loganalyzer "
- job: sonic_t0_elastictest
displayName: "kvmtest-t0-sonic by Elastictest"
pool: sonic-ubuntu-1c
timeoutInMinutes: 240
continueOnError: false
steps:
- template: .azure-pipelines/run-test-elastictest-template.yml@sonic-mgmt
parameters:
TOPOLOGY: t0-64-32
MIN_WORKER: $(T0_SONIC_INSTANCE_NUM)
MAX_WORKER: $(T0_SONIC_INSTANCE_NUM)
TEST_SET: t0-sonic
MGMT_BRANCH: "202305"
COMMON_EXTRA_PARAMS: "--neighbor_type=sonic "
VM_TYPE: vsonic
# - job: wan_elastictest
# displayName: "kvmtest-wan by Elastictest"
# pool: sonic-ubuntu-1c
# timeoutInMinutes: 240
# continueOnError: false
# steps:
# - template: .azure-pipelines/run-test-scheduler-template.yml
# parameters:
# TOPOLOGY: wan-pub
# MIN_WORKER: $(WAN_INSTANCE_NUM)
# MAX_WORKER: $(WAN_INSTANCE_NUM)
# COMMON_EXTRA_PARAMS: "--skip_sanity "