@@ -1163,7 +1163,6 @@ def merge_into(
1163
1163
# Finally, upload the record to Rockset. The list of pending and failed
1164
1164
# checks are at the time of the merge
1165
1165
save_merge_record (
1166
- collection = ROCKSET_MERGES_COLLECTION ,
1167
1166
comment_id = comment_id ,
1168
1167
pr_num = self .pr_num ,
1169
1168
owner = self .org ,
@@ -1179,10 +1178,8 @@ def merge_into(
1179
1178
merge_base_sha = self .get_merge_base (),
1180
1179
merge_commit_sha = merge_commit_sha ,
1181
1180
is_failed = False ,
1182
- dry_run = dry_run ,
1183
1181
skip_mandatory_checks = skip_mandatory_checks ,
1184
1182
ignore_current = bool (ignore_current_checks ),
1185
- workspace = ROCKSET_MERGES_WORKSPACE ,
1186
1183
)
1187
1184
else :
1188
1185
print ("Missing comment ID or PR number, couldn't upload to Rockset" )
@@ -1489,7 +1486,6 @@ def checks_to_markdown_bullets(
1489
1486
1490
1487
@retries_decorator ()
1491
1488
def save_merge_record (
1492
- collection : str ,
1493
1489
comment_id : int ,
1494
1490
pr_num : int ,
1495
1491
owner : str ,
@@ -1505,59 +1501,44 @@ def save_merge_record(
1505
1501
merge_base_sha : str ,
1506
1502
merge_commit_sha : str = "" ,
1507
1503
is_failed : bool = False ,
1508
- dry_run : bool = False ,
1509
1504
skip_mandatory_checks : bool = False ,
1510
1505
ignore_current : bool = False ,
1511
1506
error : str = "" ,
1512
- workspace : str = "commons" ,
1513
1507
) -> None :
1514
1508
"""
1515
- This saves the merge records into Rockset, so we can query them (for fun and profit)
1509
+ This saves the merge records as a json, which can later be uploaded to s3
1516
1510
"""
1517
- if dry_run :
1518
- # Decide not to save the record to Rockset if dry-run is set to not pollute
1519
- # the collection
1520
- return
1521
-
1522
- try :
1523
- import rockset # type: ignore[import]
1524
-
1525
- # Prepare the record to be written into Rockset
1526
- data = [
1527
- {
1528
- "comment_id" : comment_id ,
1529
- "pr_num" : pr_num ,
1530
- "owner" : owner ,
1531
- "project" : project ,
1532
- "author" : author ,
1533
- "pending_checks" : pending_checks ,
1534
- "failed_checks" : failed_checks ,
1535
- "ignore_current_checks" : ignore_current_checks ,
1536
- "broken_trunk_checks" : broken_trunk_checks ,
1537
- "flaky_checks" : flaky_checks ,
1538
- "unstable_checks" : unstable_checks ,
1539
- "last_commit_sha" : last_commit_sha ,
1540
- "merge_base_sha" : merge_base_sha ,
1541
- "merge_commit_sha" : merge_commit_sha ,
1542
- "is_failed" : is_failed ,
1543
- "skip_mandatory_checks" : skip_mandatory_checks ,
1544
- "ignore_current" : ignore_current ,
1545
- "error" : error ,
1546
- }
1547
- ]
1548
1511
1549
- client = rockset .RocksetClient (
1550
- host = "api.usw2a1.rockset.com" , api_key = os .environ ["ROCKSET_API_KEY" ]
1551
- )
1552
- client .Documents .add_documents (
1553
- collection = collection ,
1554
- data = data ,
1555
- workspace = workspace ,
1556
- )
1512
+ # Prepare the record to be written into Rockset
1513
+ data = [
1514
+ {
1515
+ "comment_id" : comment_id ,
1516
+ "pr_num" : pr_num ,
1517
+ "owner" : owner ,
1518
+ "project" : project ,
1519
+ "author" : author ,
1520
+ "pending_checks" : pending_checks ,
1521
+ "failed_checks" : failed_checks ,
1522
+ "ignore_current_checks" : ignore_current_checks ,
1523
+ "broken_trunk_checks" : broken_trunk_checks ,
1524
+ "flaky_checks" : flaky_checks ,
1525
+ "unstable_checks" : unstable_checks ,
1526
+ "last_commit_sha" : last_commit_sha ,
1527
+ "merge_base_sha" : merge_base_sha ,
1528
+ "merge_commit_sha" : merge_commit_sha ,
1529
+ "is_failed" : is_failed ,
1530
+ "skip_mandatory_checks" : skip_mandatory_checks ,
1531
+ "ignore_current" : ignore_current ,
1532
+ "error" : error ,
1533
+ # This is a unique identifier for the record for deduping purposes
1534
+ # in rockset. Any unique string would work
1535
+ "_id" : f"{ project } -{ pr_num } -{ comment_id } -{ os .environ .get ('GITHUB_RUN_ID' )} " ,
1536
+ }
1537
+ ]
1538
+ repo_root = Path (__file__ ).resolve ().parent .parent .parent
1557
1539
1558
- except ModuleNotFoundError :
1559
- print ("Rockset is missing, no record will be saved" )
1560
- return
1540
+ with open (repo_root / "merge_record.json" , "w" ) as f :
1541
+ json .dump (data , f )
1561
1542
1562
1543
1563
1544
@retries_decorator (rc = [])
@@ -2374,7 +2355,6 @@ def handle_exception(e: Exception, title: str = "Merge failed") -> None:
2374
2355
# list of pending and failed checks here, but they are not really
2375
2356
# needed at the moment
2376
2357
save_merge_record (
2377
- collection = ROCKSET_MERGES_COLLECTION ,
2378
2358
comment_id = args .comment_id ,
2379
2359
pr_num = args .pr_num ,
2380
2360
owner = org ,
@@ -2389,11 +2369,9 @@ def handle_exception(e: Exception, title: str = "Merge failed") -> None:
2389
2369
last_commit_sha = pr .last_commit ().get ("oid" , "" ),
2390
2370
merge_base_sha = pr .get_merge_base (),
2391
2371
is_failed = True ,
2392
- dry_run = args .dry_run ,
2393
2372
skip_mandatory_checks = args .force ,
2394
2373
ignore_current = args .ignore_current ,
2395
2374
error = str (e ),
2396
- workspace = ROCKSET_MERGES_WORKSPACE ,
2397
2375
)
2398
2376
else :
2399
2377
print ("Missing comment ID or PR number, couldn't upload to Rockset" )
0 commit comments