Split kvmtest t0 job into two jobs and run in parallel (#10044)

Why I did it
Introduce 2 sub jobs for kvmtest t0 job in sonic-mgmt repo in PR Azure/sonic-mgmt#4861
But in sonic-buildimage repo, because section parameter is null, it always run the part 2 test scripts in kvmtest t0 job.
It missed the part 1 test scripts in kvmtest.sh.

How I did it
Split kvmtest t0 job into two sub jobs such as sonic-mgmt repo and run them in parallel to save time.

How to verify it
Submit PR will trigger the pipeline to run.

Signed-off-by: Zhaohui Sun <zhaohuisun@microsoft.com>
This commit is contained in:
Zhaohui Sun 2022-02-23 18:20:24 -08:00 committed by GitHub
parent 2d0b063191
commit 44028723ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 46 additions and 6 deletions

View File

@ -7,6 +7,9 @@ parameters:
type: string type: string
- name: ptf_name - name: ptf_name
type: string type: string
- name: section
type: string
default: ''
- name: image - name: image
type: string type: string
default: sonic-vs.img.gz default: sonic-vs.img.gz
@ -43,7 +46,7 @@ steps:
- script: | - script: |
rm -rf $(Build.ArtifactStagingDirectory)/* rm -rf $(Build.ArtifactStagingDirectory)/*
docker exec sonic-mgmt bash -c "/data/sonic-mgmt/tests/kvmtest.sh -en -T ${{ parameters.tbtype }} ${{ parameters.tbname }} ${{ parameters.dut }}" docker exec sonic-mgmt bash -c "/data/sonic-mgmt/tests/kvmtest.sh -en -T ${{ parameters.tbtype }} ${{ parameters.tbname }} ${{ parameters.dut }} ${{ parameters.section }}"
displayName: "Run tests" displayName: "Run tests"
- script: | - script: |
@ -75,17 +78,17 @@ steps:
condition: succeededOrFailed() condition: succeededOrFailed()
- publish: $(Build.ArtifactStagingDirectory)/kvmdump - publish: $(Build.ArtifactStagingDirectory)/kvmdump
artifact: sonic-buildimage.kvmtest.${{ parameters.tbtype}}.memdump@$(System.JobAttempt) artifact: sonic-buildimage.kvmtest.${{ parameters.tbtype}}${{ parameters.section }}.memdump@$(System.JobAttempt)
displayName: "Archive sonic kvm memdump" displayName: "Archive sonic kvm memdump"
condition: failed() condition: failed()
- publish: $(Build.ArtifactStagingDirectory)/logs - publish: $(Build.ArtifactStagingDirectory)/logs
artifact: sonic-buildimage.kvmtest.${{ parameters.tbtype }}.log@$(System.JobAttempt) artifact: sonic-buildimage.kvmtest.${{ parameters.tbtype }}${{ parameters.section }}.log@$(System.JobAttempt)
displayName: "Archive sonic kvm logs" displayName: "Archive sonic kvm logs"
condition: succeededOrFailed() condition: succeededOrFailed()
- task: PublishTestResults@2 - task: PublishTestResults@2
inputs: inputs:
testResultsFiles: '$(Build.ArtifactStagingDirectory)/logs/**/*.xml' testResultsFiles: '$(Build.ArtifactStagingDirectory)/logs/**/*.xml'
testRunTitle: kvmtest.${{ parameters.tbtype }} testRunTitle: kvmtest.${{ parameters.tbtype }}${{ parameters.section }}
condition: succeededOrFailed() condition: succeededOrFailed()

View File

@ -104,9 +104,9 @@ stages:
testResultsFiles: '**/tr.xml' testResultsFiles: '**/tr.xml'
testRunTitle: vstest testRunTitle: vstest
- job: - job: t0_part1
pool: sonictest pool: sonictest
displayName: "kvmtest-t0" displayName: "kvmtest-t0-part1"
timeoutInMinutes: 360 timeoutInMinutes: 360
steps: steps:
@ -116,6 +116,43 @@ stages:
tbname: vms-kvm-t0 tbname: vms-kvm-t0
ptf_name: ptf_vms6-1 ptf_name: ptf_vms6-1
tbtype: t0 tbtype: t0
section: part-1
- job: t0_part2
pool: sonictest
displayName: "kvmtest-t0-part2"
timeoutInMinutes: 360
steps:
- template: .azure-pipelines/run-test-template.yml
parameters:
dut: vlab-01
tbname: vms-kvm-t0
ptf_name: ptf_vms6-1
tbtype: t0
section: part-2
- job:
pool: sonictest
displayName: "kvmtest-t0"
timeoutInMinutes: 360
dependsOn:
- t0_part1
- t0_part2
condition: always()
variables:
resultOfPart1: $[ dependencies.t0_part1.result ]
resultOfPart2: $[ dependencies.t0_part2.result ]
steps:
- script: |
if [ $(resultOfPart1) == "Succeeded" ] && [ $(resultOfPart2) == "Succeeded" ]; then
echo "Both job kvmtest-t0-part1 and kvmtest-t0-part2 are passed."
exit 0
else
echo "Either job kvmtest-t0-part1 or job kvmtest-t0-part2 failed! Please check the detailed information."
exit 1
fi
- job: - job:
pool: sonictest-t1-lag pool: sonictest-t1-lag