Skip to content

Commit 1a75649

Browse files
APM-2488-Updated the test cases
1 parent 61a652c commit 1a75649

File tree

1 file changed

+57
-57
lines changed

1 file changed

+57
-57
lines changed
Lines changed: 57 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,65 @@
1-
# import os
2-
# import sys
3-
# from multiprocessing import Process
4-
# from trigger_pipelines import AzureDevOps
1+
import os
2+
import sys
3+
from multiprocessing import Process
4+
from trigger_pipelines import AzureDevOps
55

66

7-
# PULL_REQUEST_PIPELINES = {
8-
# "identity-service": {
9-
# "build": 27,
10-
# "pr": 54,
11-
# "branch": "refs/heads/master"
12-
# },
13-
# "canary-api": {
14-
# "build": 222,
15-
# "pr": 223,
16-
# "branch": "refs/heads/main"
17-
# },
18-
# "personal-demographics-service": {
19-
# "build": 140,
20-
# "pr": 144,
21-
# "branch": "refs/heads/master"
22-
# },
23-
# }
7+
PULL_REQUEST_PIPELINES = {
8+
"identity-service": {
9+
"build": 27,
10+
"pr": 54,
11+
"branch": "refs/heads/master"
12+
},
13+
"canary-api": {
14+
"build": 222,
15+
"pr": 223,
16+
"branch": "refs/heads/main"
17+
},
18+
"personal-demographics-service": {
19+
"build": 140,
20+
"pr": 144,
21+
"branch": "refs/heads/master"
22+
},
23+
}
2424

2525

26-
# def trigger_pipelines(pipeline_ids: dict, service: str):
27-
# azure_dev_ops = AzureDevOps()
28-
# build_status = azure_dev_ops.run_pipeline(
29-
# service=service,
30-
# pipeline_type="build",
31-
# pipeline_id=pipeline_ids["build"],
32-
# pipeline_branch=pipeline_ids["branch"]
33-
# )
34-
# if build_status != "succeeded":
35-
# sys.exit(1)
36-
# return
37-
# azure_dev_ops.run_pipeline(
38-
# service=service,
39-
# pipeline_type="pr",
40-
# pipeline_id=pipeline_ids["pr"],
41-
# pipeline_branch=pipeline_ids["branch"]
42-
# )
26+
def trigger_pipelines(pipeline_ids: dict, service: str):
27+
azure_dev_ops = AzureDevOps()
28+
build_status = azure_dev_ops.run_pipeline(
29+
service=service,
30+
pipeline_type="build",
31+
pipeline_id=pipeline_ids["build"],
32+
pipeline_branch=pipeline_ids["branch"]
33+
)
34+
if build_status != "succeeded":
35+
sys.exit(1)
36+
return
37+
azure_dev_ops.run_pipeline(
38+
service=service,
39+
pipeline_type="pr",
40+
pipeline_id=pipeline_ids["pr"],
41+
pipeline_branch=pipeline_ids["branch"]
42+
)
4343

4444

45-
# def main():
46-
# jobs = []
47-
# for service, pipeline_ids in PULL_REQUEST_PIPELINES.items():
48-
# process = Process(
49-
# target=trigger_pipelines,
50-
# args=(pipeline_ids, service,)
51-
# )
52-
# process.start()
53-
# jobs.append(process)
54-
# for process in jobs:
55-
# process.join()
56-
# # check return code of jobs and fail if there is a problem
57-
# for process in jobs:
58-
# if process.exitcode != 0:
59-
# print("A job failed")
60-
# sys.exit(1)
61-
# sys.exit(0)
45+
def main():
46+
jobs = []
47+
for service, pipeline_ids in PULL_REQUEST_PIPELINES.items():
48+
process = Process(
49+
target=trigger_pipelines,
50+
args=(pipeline_ids, service,)
51+
)
52+
process.start()
53+
jobs.append(process)
54+
for process in jobs:
55+
process.join()
56+
# check return code of jobs and fail if there is a problem
57+
for process in jobs:
58+
if process.exitcode != 0:
59+
print("A job failed")
60+
sys.exit(1)
61+
sys.exit(0)
6262

6363

64-
# if __name__ == "__main__":
65-
# main()
64+
if __name__ == "__main__":
65+
main()

0 commit comments

Comments
 (0)