Skip to content

Commit

Permalink
Roll out the left PR checkers
Browse files Browse the repository at this point in the history
  • Loading branch information
yutongzhang-microsoft committed Jan 17, 2025
1 parent 0440654 commit 3cd1ced
Show file tree
Hide file tree
Showing 3 changed files with 169 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ steps:
exit 1
fi
PR_CHECKERS=$(echo "${TEST_SCRIPTS}" | jq -c 'keys')
PR_CHECKERS=$(echo "${TEST_SCRIPTS}" | jq -c 'keys' | sed 's/\[//;s/\]//' | sed "s/,/, /g" | sed "s/^/(/;s/\$/)/")
if [[ $? -ne 0 ]]; then
echo "##vso[task.complete result=Failed;]Get valid PR checkers fails."
Expand Down
15 changes: 9 additions & 6 deletions .azure-pipelines/impacted_area_testing/get_test_scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,6 @@ def collect_scripts_by_topology_type(features: str, location: str) -> dict:
# Note: The full path and name of files are stored in a list named "files"
scripts = []

# This is just for the first stage of rolling out
# To avoid the overuse of resource, we will ignore the PR which modifies the common part.
if features == "":
return {}

for feature in features.split(","):
feature_path = os.path.join(location, feature)
for root, dirs, script in os.walk(feature_path):
Expand Down Expand Up @@ -103,7 +98,15 @@ def collect_scripts_by_topology_type(features: str, location: str) -> dict:
except Exception as e:
raise Exception('Exception occurred while trying to get topology in {}, error {}'.format(s, e))

return {k: v for k, v in test_scripts_per_topology_type.items() if v}
test_scripts = {k: v for k, v in test_scripts_per_topology_type.items() if v}

# This is just for the first stage of rolling out
# To avoid the overuse of resource, we will ignore the PR which modifies the common part.
if features == "":
test_scripts.pop("t0")
test_scripts.pop("t1")

return test_scripts


def main(features, location):
Expand Down
186 changes: 159 additions & 27 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ stages:
value: $(Build.SourceBranchName)

jobs:
# Below are Impacted Area Based PR checkers
- job: get_impacted_area
displayName: "Get impacted area"
timeoutInMinutes: 240
Expand All @@ -85,7 +86,7 @@ stages:
- job: impacted_area_t0_elastictest
displayName: "impacted-area-kvmtest-t0 by Elastictest - optional"
dependsOn: get_impacted_area
condition: contains(dependencies.get_impacted_area.outputs['SetVariableTask.PR_CHECKERS'], 't0')
condition: in('t0', dependencies.get_impacted_area.outputs['SetVariableTask.PR_CHECKERS'])
variables:
TEST_SCRIPTS: $[ dependencies.get_impacted_area.outputs['SetVariableTask.TEST_SCRIPTS'] ]
timeoutInMinutes: 240
Expand All @@ -104,9 +105,165 @@ stages:
MIN_WORKER: $(INSTANCE_NUMBER)
MAX_WORKER: $(INSTANCE_NUMBER)
KVM_IMAGE_BRANCH: $(BUILD_BRANCH)
MGMT_BRANCH: $(BUILD_BRANCH)
MGMT_BRANCH: "master"
STOP_ON_FAILURE: "False"

- job: impacted_area_t0_2vlans_elastictest
displayName: "impacted-area-kvmtest-t0_2vlans by Elastictest - optional"
dependsOn: get_impacted_area
condition: in('t0-2vlans', dependencies.get_impacted_area.outputs['SetVariableTask.PR_CHECKERS'])
variables:
TEST_SCRIPTS: $[ dependencies.get_impacted_area.outputs['SetVariableTask.TEST_SCRIPTS'] ]
timeoutInMinutes: 240
continueOnError: true
pool: sonic-ubuntu-1c
steps:
- template: .azure-pipelines/impacted_area_testing/calculate-instance-numbers.yml
parameters:
TOPOLOGY: t0-2vlans
BUILD_BRANCH: $(BUILD_BRANCH)

- template: .azure-pipelines/run-test-elastictest-template.yml
parameters:
TOPOLOGY: t0
SCRIPTS: $(SCRIPTS)
MIN_WORKER: $(INSTANCE_NUMBER)
MAX_WORKER: $(INSTANCE_NUMBER)
DEPLOY_MG_EXTRA_PARAMS: "-e vlan_config=two_vlan_a"
KVM_IMAGE_BRANCH: $(BUILD_BRANCH)
MGMT_BRANCH: "master"
STOP_ON_FAILURE: "False"

- job: impacted_area_t1_lag_elastictest
displayName: "impacted-area-kvmtest-t1-lag by Elastictest - optional"
dependsOn: get_impacted_area
condition: in('t1', dependencies.get_impacted_area.outputs['SetVariableTask.PR_CHECKERS'])
variables:
TEST_SCRIPTS: $[ dependencies.get_impacted_area.outputs['SetVariableTask.TEST_SCRIPTS'] ]
timeoutInMinutes: 240
continueOnError: true
pool: sonic-ubuntu-1c
steps:
- template: .azure-pipelines/impacted_area_testing/calculate-instance-numbers.yml
parameters:
TOPOLOGY: t1
BUILD_BRANCH: $(BUILD_BRANCH)

- template: .azure-pipelines/run-test-elastictest-template.yml
parameters:
TOPOLOGY: t1-lag
SCRIPTS: $(SCRIPTS)
MIN_WORKER: $(INSTANCE_NUMBER)
MAX_WORKER: $(INSTANCE_NUMBER)
KVM_IMAGE_BRANCH: $(BUILD_BRANCH)
MGMT_BRANCH: "master"
STOP_ON_FAILURE: "False"

- job: impacted_area_dualtor_elastictest
displayName: "impacted-area-kvmtest-dualtor by Elastictest - optional"
dependsOn: get_impacted_area
condition: in('dualtor', dependencies.get_impacted_area.outputs['SetVariableTask.PR_CHECKERS'])
variables:
TEST_SCRIPTS: $[ dependencies.get_impacted_area.outputs['SetVariableTask.TEST_SCRIPTS'] ]
timeoutInMinutes: 240
continueOnError: true
pool: sonic-ubuntu-1c
steps:
- template: .azure-pipelines/impacted_area_testing/calculate-instance-numbers.yml
parameters:
TOPOLOGY: dualtor
BUILD_BRANCH: $(BUILD_BRANCH)

- template: .azure-pipelines/run-test-elastictest-template.yml
parameters:
TOPOLOGY: dualtor
SCRIPTS: $(SCRIPTS)
MIN_WORKER: $(INSTANCE_NUMBER)
MAX_WORKER: $(INSTANCE_NUMBER)
COMMON_EXTRA_PARAMS: "--disable_loganalyzer "
KVM_IMAGE_BRANCH: $(BUILD_BRANCH)
MGMT_BRANCH: "master"
STOP_ON_FAILURE: "False"

- job: impacted_area_multi_asic_elastictest
displayName: "impacted-area-kvmtest-multi_asic by Elastictest - optional"
dependsOn: get_impacted_area
condition: in('t1-multi-asic', dependencies.get_impacted_area.outputs['SetVariableTask.PR_CHECKERS'])
variables:
TEST_SCRIPTS: $[ dependencies.get_impacted_area.outputs['SetVariableTask.TEST_SCRIPTS'] ]
timeoutInMinutes: 240
continueOnError: true
pool: sonic-ubuntu-1c
steps:
- template: .azure-pipelines/impacted_area_testing/calculate-instance-numbers.yml
parameters:
TOPOLOGY: t1-multi-asic
BUILD_BRANCH: $(BUILD_BRANCH)

- template: .azure-pipelines/run-test-elastictest-template.yml
parameters:
TOPOLOGY: t1-8-lag
SCRIPTS: $(SCRIPTS)
MIN_WORKER: $(INSTANCE_NUMBER)
MAX_WORKER: $(INSTANCE_NUMBER)
NUM_ASIC: 4
KVM_IMAGE_BRANCH: $(BUILD_BRANCH)
MGMT_BRANCH: "master"
STOP_ON_FAILURE: "False"

- job: impacted_area_sonic_t0_elastictest
displayName: "impacted-area-kvmtest-sonic_t0 by Elastictest - optional"
dependsOn: get_impacted_area
condition: in('t0-sonic', dependencies.get_impacted_area.outputs['SetVariableTask.PR_CHECKERS'])
variables:
TEST_SCRIPTS: $[ dependencies.get_impacted_area.outputs['SetVariableTask.TEST_SCRIPTS'] ]
timeoutInMinutes: 240
continueOnError: true
pool: sonic-ubuntu-1c
steps:
- template: .azure-pipelines/impacted_area_testing/calculate-instance-numbers.yml
parameters:
TOPOLOGY: t0-sonic
BUILD_BRANCH: $(BUILD_BRANCH)

- template: .azure-pipelines/run-test-elastictest-template.yml
parameters:
TOPOLOGY: t0-64-32
SCRIPTS: $(SCRIPTS)
MIN_WORKER: $(INSTANCE_NUMBER)
MAX_WORKER: $(INSTANCE_NUMBER)
KVM_IMAGE_BRANCH: $(BUILD_BRANCH)
COMMON_EXTRA_PARAMS: "--neighbor_type=sonic "
VM_TYPE: vsonic
MGMT_BRANCH: "master"
STOP_ON_FAILURE: "False"

- job: impacted_area_dpu_elastictest
displayName: "impacted-area-kvmtest-dpu by Elastictest - optional"
dependsOn: get_impacted_area
condition: in('dpu', dependencies.get_impacted_area.outputs['SetVariableTask.PR_CHECKERS'])
variables:
TEST_SCRIPTS: $[ dependencies.get_impacted_area.outputs['SetVariableTask.TEST_SCRIPTS'] ]
timeoutInMinutes: 240
continueOnError: true
pool: sonic-ubuntu-1c
steps:
- template: .azure-pipelines/impacted_area_testing/calculate-instance-numbers.yml
parameters:
TOPOLOGY: dpu
BUILD_BRANCH: $(BUILD_BRANCH)

- template: .azure-pipelines/run-test-elastictest-template.yml
parameters:
TOPOLOGY: dpu
SCRIPTS: $(SCRIPTS)
MIN_WORKER: $(INSTANCE_NUMBER)
MAX_WORKER: $(INSTANCE_NUMBER)
KVM_IMAGE_BRANCH: $(BUILD_BRANCH)
MGMT_BRANCH: "master"
STOP_ON_FAILURE: "False"

# Below is the original PR checkers
- job: t0_elastictest
displayName: "kvmtest-t0 by Elastictest"
timeoutInMinutes: 240
Expand Down Expand Up @@ -151,31 +308,6 @@ stages:
KVM_IMAGE_BRANCH: $(BUILD_BRANCH)
MGMT_BRANCH: "master"

- job: impacted_area_t1_lag_elastictest
displayName: "impacted-area-kvmtest-t1-lag by Elastictest - optional"
dependsOn: get_impacted_area
condition: contains(dependencies.get_impacted_area.outputs['SetVariableTask.PR_CHECKERS'], 't1')
variables:
TEST_SCRIPTS: $[ dependencies.get_impacted_area.outputs['SetVariableTask.TEST_SCRIPTS'] ]
timeoutInMinutes: 240
continueOnError: true
pool: sonic-ubuntu-1c
steps:
- template: .azure-pipelines/impacted_area_testing/calculate-instance-numbers.yml
parameters:
TOPOLOGY: t1
BUILD_BRANCH: $(BUILD_BRANCH)

- template: .azure-pipelines/run-test-elastictest-template.yml
parameters:
TOPOLOGY: t1-lag
SCRIPTS: $(SCRIPTS)
MIN_WORKER: $(INSTANCE_NUMBER)
MAX_WORKER: $(INSTANCE_NUMBER)
KVM_IMAGE_BRANCH: $(BUILD_BRANCH)
MGMT_BRANCH: $(BUILD_BRANCH)
STOP_ON_FAILURE: "False"

- job: dualtor_elastictest
displayName: "kvmtest-dualtor-t0 by Elastictest"
timeoutInMinutes: 240
Expand Down

0 comments on commit 3cd1ced

Please sign in to comment.