From c07447ae615b8a6489530e88ee5c9f11c05b4ec3 Mon Sep 17 00:00:00 2001 From: Chun'ang Li <39114813+lerry-lee@users.noreply.github.com> Date: Mon, 10 Jul 2023 10:47:40 +0800 Subject: [PATCH] Refine PR test template format (#15636) Why I did it Refine PR test template format. How I did it Refine PR test template format. How to verify it PR test executed normally. Signed-off-by: Chun'ang Li --- .../run-test-scheduler-template.yml | 112 +++++++++++++++--- azure-pipelines.yml | 30 +++-- 2 files changed, 111 insertions(+), 31 deletions(-) diff --git a/.azure-pipelines/run-test-scheduler-template.yml b/.azure-pipelines/run-test-scheduler-template.yml index 176866a8bc..7f33240be4 100644 --- a/.azure-pipelines/run-test-scheduler-template.yml +++ b/.azure-pipelines/run-test-scheduler-template.yml @@ -18,6 +18,10 @@ parameters: type: string default: 1 +- name: NUM_ASIC + type: number + default: 1 + - name: TEST_SET type: string default: "" @@ -34,13 +38,73 @@ parameters: type: string default: "ceos" +- name: TESTBED_NAME + type: string + default: "" + +- name: IMAGE_URL + type: string + default: "" + +- name: HWSKU + type: string + default: "" + +- name: TEST_PLAN_TYPE + type: string + default: "" + +- name: PLATFORM + type: string + default: "" + +- name: SCRIPTS + type: string + default: "" + +- name: FEATURES + type: string + default: "" + +- name: SCRIPTS_EXCLUDE + type: string + default: "" + +- name: FEATURES_EXCLUDE + type: string + default: "" + +- name: REPO_NAME + type: string + default: "" + - name: MGMT_BRANCH type: string - default: master + default: "" -- name: NUM_ASIC +- name: STOP_ON_FAILURE + type: string + default: "" + +- name: RETRY_TIMES + type: string + default: "" + +- name: DUMP_KVM_IF_FAIL + type: string + default: "True" + values: + - "True" + - "False" + +- name: REQUESTER + type: string + default: "" + +- name: MAX_RUN_TEST_MINUTES type: number - default: 1 + default: 480 + steps: - script: | @@ -53,12 +117,20 @@ steps: set -e pip install PyYAML rm -f new_test_plan_id.txt - python ./.azure-pipelines/test_plan.py create -t ${{ parameters.TOPOLOGY }} -o new_test_plan_id.txt \ - --min-worker ${{ parameters.MIN_WORKER }} --max-worker ${{ parameters.MAX_WORKER }} \ - --test-set ${{ parameters.TEST_SET }} --kvm-build-id $(KVM_BUILD_ID) \ - --deploy-mg-extra-params "${{ parameters.DEPLOY_MG_EXTRA_PARAMS }}" --common-extra-params "${{ parameters.COMMON_EXTRA_PARAMS }}" \ - --mgmt-branch ${{ parameters.MGMT_BRANCH }} --vm-type ${{ parameters.VM_TYPE }} \ + + python ./.azure-pipelines/test_plan.py create \ + -t ${{ parameters.TOPOLOGY }} \ + -o new_test_plan_id.txt \ + --min-worker ${{ parameters.MIN_WORKER }} \ + --max-worker ${{ parameters.MAX_WORKER }} \ + --test-set ${{ parameters.TEST_SET }} \ + --kvm-build-id $(KVM_BUILD_ID) \ + --deploy-mg-extra-params "${{ parameters.DEPLOY_MG_EXTRA_PARAMS }}" \ + --common-extra-params "${{ parameters.COMMON_EXTRA_PARAMS }}" \ + --mgmt-branch ${{ parameters.MGMT_BRANCH }} \ + --vm-type ${{ parameters.VM_TYPE }} \ --num-asic ${{ parameters.NUM_ASIC }} + TEST_PLAN_ID=`cat new_test_plan_id.txt` echo "Created test plan $TEST_PLAN_ID" @@ -104,18 +176,20 @@ steps: env: TESTBED_TOOLS_URL: $(TESTBED_TOOLS_URL) displayName: Run test + timeoutInMinutes: ${{ parameters.MAX_RUN_TEST_MINUTES }} - - script: | - set -e - echo "KVM dump" - echo "SONiC PR system-level test is powered by SONiC Elastictest, for any issue, please send email to sonicelastictest@microsoft.com" - echo "Runtime detailed progress at $(FRONTEND_URL)/scheduler/testplan/$TEST_PLAN_ID " - # When "KVMDUMP" finish, it changes into "FAILED", "CANCELLED" or "FINISHED" - python ./.azure-pipelines/test_plan.py poll -i "$(TEST_PLAN_ID)" --expected-state KVMDUMP - condition: succeededOrFailed() - env: - TESTBED_TOOLS_URL: $(TESTBED_TOOLS_URL) - displayName: KVM dump + - ${{ if eq(parameters.DUMP_KVM_IF_FAIL, 'True') }}: + - script: | + set -e + echo "KVM dump" + echo "SONiC PR system-level test is powered by SONiC Elastictest, for any issue, please send email to sonicelastictest@microsoft.com" + echo "Runtime detailed progress at $(FRONTEND_URL)/scheduler/testplan/$TEST_PLAN_ID " + # When "KVMDUMP" finish, it changes into "FAILED", "CANCELLED" or "FINISHED" + python ./.azure-pipelines/test_plan.py poll -i "$(TEST_PLAN_ID)" --expected-state KVMDUMP + condition: succeededOrFailed() + env: + TESTBED_TOOLS_URL: $(TESTBED_TOOLS_URL) + displayName: KVM dump - script: | set -e diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 6a5af16bc7..e7d8c3f3b0 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -157,6 +157,7 @@ stages: TOPOLOGY: t0 MIN_WORKER: $(T0_INSTANCE_NUM) MAX_WORKER: $(T0_INSTANCE_NUM) + MGMT_BRANCH: master - job: t0_2vlans_elastictest pool: ubuntu-20.04 @@ -170,6 +171,7 @@ stages: TEST_SET: t0-2vlans MIN_WORKER: $(T0_2VLANS_INSTANCE_NUM) MAX_WORKER: $(T0_2VLANS_INSTANCE_NUM) + MGMT_BRANCH: master DEPLOY_MG_EXTRA_PARAMS: "-e vlan_config=two_vlan_a" - job: t1_lag_elastictest @@ -183,6 +185,7 @@ stages: TOPOLOGY: t1-lag MIN_WORKER: $(T1_LAG_INSTANCE_NUM) MAX_WORKER: $(T1_LAG_INSTANCE_NUM) + MGMT_BRANCH: master - job: multi_asic_elastictest displayName: "kvmtest-multi-asic-t1-lag by Elastictest" @@ -197,6 +200,7 @@ stages: MIN_WORKER: $(MULTI_ASIC_INSTANCE_NUM) MAX_WORKER: $(MULTI_ASIC_INSTANCE_NUM) NUM_ASIC: 4 + MGMT_BRANCH: master - job: dualtor_elastictest pool: ubuntu-20.04 @@ -209,6 +213,7 @@ stages: TOPOLOGY: dualtor MIN_WORKER: $(T0_DUALTOR_INSTANCE_NUM) MAX_WORKER: $(T0_DUALTOR_INSTANCE_NUM) + MGMT_BRANCH: master COMMON_EXTRA_PARAMS: "--disable_loganalyzer " - job: sonic_t0_elastictest @@ -223,18 +228,19 @@ stages: MIN_WORKER: $(T0_SONIC_INSTANCE_NUM) MAX_WORKER: $(T0_SONIC_INSTANCE_NUM) TEST_SET: t0-sonic + MGMT_BRANCH: master COMMON_EXTRA_PARAMS: "--neighbor_type=sonic " VM_TYPE: vsonic - - job: wan_elastictest - displayName: "kvmtest-wan by Elastictest" - pool: ubuntu-20.04 - 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 " +# - job: wan_elastictest +# displayName: "kvmtest-wan by Elastictest" +# pool: ubuntu-20.04 +# 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 "