Skip to content

Commit 7af10db

Browse files
yejianquanAzarack
authored andcommitted
Enable designating build id of KVM image (sonic-net#6424)
* Enable designating build id of KVM image Support switch kvm images in un-testbedv2 test jobs * Temporary comment dhcp_relay test since it relies on recent fix Approach What is the motivation for this PR? Enable designating build id of KVM image to avoid image issue keep affecting sonic-mgmt repo pull requests. How did you do it? Enable designating build id of KVM image to avoid image issue keep affecting sonic-mgmt repo pull requests. How did you verify/test it? Pipeline tests it. co-authorized by: [email protected]
1 parent b5074d0 commit 7af10db

File tree

4 files changed

+22
-7
lines changed

4 files changed

+22
-7
lines changed

.azure-pipelines/pr_test_scripts.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ t0:
1010
- container_checker/test_container_checker.py
1111
- cacl/test_cacl_application.py
1212
- cacl/test_cacl_function.py
13-
- dhcp_relay/test_dhcp_relay.py
13+
# - dhcp_relay/test_dhcp_relay.py
1414
- dhcp_relay/test_dhcpv6_relay.py
1515
- generic_config_updater/test_aaa.py
1616
- generic_config_updater/test_bgpl.py
@@ -62,7 +62,7 @@ t0:
6262
- test_procdockerstatsd.py
6363

6464
t0-2vlans:
65-
- dhcp_relay/test_dhcp_relay.py
65+
# - dhcp_relay/test_dhcp_relay.py
6666
- dhcp_relay/test_dhcpv6_relay.py
6767

6868
t0-sonic:

.azure-pipelines/run-test-scheduler-template.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ parameters:
2828

2929
steps:
3030
- script: |
31-
set -e
31+
set -ex
3232
3333
pip install PyYAML
3434
3535
rm -f new_test_plan_id.txt
36-
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 }} --deploy-mg-extra-params "${{ parameters.DEPLOY_MG_EXTRA_PARAMS }}"
36+
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 }}"
3737
TEST_PLAN_ID=`cat new_test_plan_id.txt`
3838
3939
echo "Created test plan $TEST_PLAN_ID"
@@ -47,6 +47,7 @@ steps:
4747
displayName: Trigger test
4848
4949
- script: |
50+
set -ex
5051
echo "Polling Test plan"
5152
echo "Preparing the testbed(add-topo, deploy-mg) may take 15-30 minutes. Before the testbed is ready, the progress of the test plan keeps displayed as 0, please be patient(We will improve the indication in a short time)"
5253
echo "If the progress keeps as 0 for more than 1 hour, please cancel and retry this pipeline"
@@ -59,6 +60,7 @@ steps:
5960
timeoutInMinutes: 300
6061
6162
- script: |
63+
set -ex
6264
echo "Try to cancel test plan $TEST_PLAN_ID, cancelling finished test plan has no effect."
6365
python ./.azure-pipelines/test_plan.py cancel -i $(TEST_PLAN_ID)
6466
condition: always()

.azure-pipelines/run-test-template.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ steps:
3636
project: build
3737
pipeline: 1
3838
artifact: sonic-buildimage.vs
39-
runVersion: 'latestFromBranch'
39+
runVersion: specific
40+
runId: $(KVM_BUILD_ID)
4041
runBranch: 'refs/heads/master'
4142
allowPartiallySucceededBuilds: true
4243
displayName: "Download sonic kvm image"

.azure-pipelines/test_plan.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def _get_token(self):
4848
except Exception as e:
4949
raise Exception("Get token failed with exception: {}".format(repr(e)))
5050

51-
def create(self, topology, test_plan_name="my_test_plan", deploy_mg_extra_params="", min_worker=1, max_worker=2, pr_id="unknown", scripts=[],
51+
def create(self, topology, test_plan_name="my_test_plan", deploy_mg_extra_params="", kvm_build_id="", min_worker=1, max_worker=2, pr_id="unknown", scripts=[],
5252
output=None):
5353
tp_url = "{}/test_plan".format(self.url)
5454
print("Creating test plan, topology: {}, name: {}, build info:{} {} {}".format(topology, test_plan_name, repo_name, pr_id, build_id))
@@ -83,7 +83,8 @@ def create(self, topology, test_plan_name="my_test_plan", deploy_mg_extra_params
8383
"extra_params": {
8484
"pull_request_id": pr_id,
8585
"build_id": build_id,
86-
"source_repo": repo_name
86+
"source_repo": repo_name,
87+
"kvm_build_id": kvm_build_id
8788
},
8889
"priority": 10,
8990
"requester": "pull request"
@@ -255,6 +256,16 @@ def poll(self, test_plan_id, interval=60, timeout=36000):
255256
required=False,
256257
help="Deploy minigraph extra params"
257258
)
259+
parser_create.add_argument(
260+
"--kvm-build-id",
261+
type=str,
262+
nargs='?',
263+
const='',
264+
dest="kvm_build_id",
265+
default="",
266+
required=False,
267+
help="KVM build id."
268+
)
258269

259270
parser_poll = subparsers.add_parser("poll", help="Poll test plan status.")
260271
parser_cancel = subparsers.add_parser("cancel", help="Cancel running test plan.")
@@ -338,6 +349,7 @@ def poll(self, test_plan_id, interval=60, timeout=36000):
338349
args.topology,
339350
test_plan_name=test_plan_name,
340351
deploy_mg_extra_params=args.deploy_mg_extra_params,
352+
kvm_build_id=args.kvm_build_id,
341353
min_worker=args.min_worker,
342354
max_worker=args.max_worker,
343355
pr_id=pr_id,

0 commit comments

Comments
 (0)