Move flakegen scan id to outermost bin tool runner

This commit is contained in:
Kristen Newbury
2022-10-25 10:40:25 -04:00
parent 4285b7a834
commit d9116eba6a
2 changed files with 5 additions and 5 deletions

View File

@@ -109,10 +109,6 @@ external_info = ExternalInfo(
'deadbeef00', 'deadbeef00',
) )
# Replace scan id to guarantee unique - do not rely on external gen
flakegen1 = snowflake_id.Snowflake(1)
external_info.scan_id = flakegen1.next()
# #
# Add dataframes for base tables # Add dataframes for base tables
# #

6
bin/sarif-extract-scans-runner Normal file → Executable file
View File

@@ -80,6 +80,7 @@ import os
import sys import sys
import pickle import pickle
from datetime import datetime from datetime import datetime
from sarif_cli import snowflake_id
# #
# Handle arguments # Handle arguments
@@ -129,6 +130,9 @@ if use_successful_runs:
else: else:
successful_runs = set() successful_runs = set()
# Scan id guaranteed unique - do not rely on external info
flakegen1 = snowflake_id.Snowflake(0)
count = -1 count = -1
for path in paths: for path in paths:
count += 1 count += 1
@@ -143,7 +147,7 @@ for path in paths:
# #
scan_spec = { scan_spec = {
"project_id": abs(hash(project + component)), # pd.UInt64Dtype() "project_id": abs(hash(project + component)), # pd.UInt64Dtype()
"scan_id": int(os.path.getmtime(path)), # pd.Int64Dtype() "scan_id": flakegen1.next(), # pd.Int64Dtype()
"sarif_file_name": path, # pd.StringDtype() "sarif_file_name": path, # pd.StringDtype()
} }
scan_spec_file = os.path.join(project, component + ".scanspec") scan_spec_file = os.path.join(project, component + ".scanspec")