diff --git a/tools/rumble/cmd/legacy_csv.go b/tools/rumble/cmd/legacy_csv.go index 586c1afdae..44c3043e55 100644 --- a/tools/rumble/cmd/legacy_csv.go +++ b/tools/rumble/cmd/legacy_csv.go @@ -79,10 +79,8 @@ func (c *rumbleBase) generateCsv() error { if !strings.Contains(image, "cgr.dev") || strings.Contains(image, "cgr.dev/chainguard/") { csvRow := []string{ strconv.Itoa(i + 1), - r.(*cgbigquery.LegacyScan).Image, + fmt.Sprintf("%s:%s", r.(*cgbigquery.LegacyScan).Image, r.(*cgbigquery.LegacyScan).Tags), r.(*cgbigquery.LegacyScan).Scanner, - r.(*cgbigquery.LegacyScan).Scanner_version, - r.(*cgbigquery.LegacyScan).Scanner_db_version, r.(*cgbigquery.LegacyScan).Time, strconv.FormatInt(r.(*cgbigquery.LegacyScan).Low_cve_cnt, 10), strconv.FormatInt(r.(*cgbigquery.LegacyScan).Med_cve_cnt, 10), diff --git a/tools/rumble/pkg/bigquery/bigquery.go b/tools/rumble/pkg/bigquery/bigquery.go index eeda45be5b..7beaba1fd0 100644 --- a/tools/rumble/pkg/bigquery/bigquery.go +++ b/tools/rumble/pkg/bigquery/bigquery.go @@ -26,19 +26,18 @@ type BqClient struct { } type LegacyScan struct { - Row int64 - Image string - Scanner string - Scanner_version string - Scanner_db_version string - Time string - Low_cve_cnt int64 - Med_cve_cnt int64 - High_cve_cnt int64 - Crit_cve_cnt int64 - Unknown_cve_cnt int64 - Tot_cve_cnt int64 - Digest string + Row int64 + Image string + Tags string + Scanner string + Time string + Low_cve_cnt int64 + Med_cve_cnt int64 + High_cve_cnt int64 + Crit_cve_cnt int64 + Unknown_cve_cnt int64 + Tot_cve_cnt int64 + Digest string } type ImageScan struct { diff --git a/tools/rumble/pkg/bigquery/queries.go b/tools/rumble/pkg/bigquery/queries.go index bf7d711df4..19ab3800d4 100644 --- a/tools/rumble/pkg/bigquery/queries.go +++ b/tools/rumble/pkg/bigquery/queries.go @@ -9,7 +9,7 @@ const ( vulnsTable = "`cloudevents_grype_scan_results.rumble_vulns`" summaryTable = "`cloudevents_grype_scan_results.rumble_summary`" - LegacyCsvHeader = `f0_,image,scanner,scanner_version,scanner_db_version,time,low_cve_cnt,med_cve_cnt,high_cve_cnt,crit_cve_cnt,unknown_cve_cnt,tot_cve_cnt,digest` + LegacyCsvHeader = `f0_,image,scanner,time,low_cve_cnt,med_cve_cnt,high_cve_cnt,crit_cve_cnt,unknown_cve_cnt,tot_cve_cnt,digest` ImageScanCsvHeader = `image,package,vulnerability,version,type,s` AllVulnsQuery = ` @@ -17,7 +17,7 @@ SELECT DISTINCT vulnerability FROM ` + vulnsTable AffectedImagesQuery = ` -SELECT summ.image, summ.time as time, +SELECT scan.image, scan.time as time, FROM ` + vulnsTable + ` AS vulns INNER JOIN ` + summaryTable + ` AS scan ON scan.id = vulns.scan_id @@ -30,9 +30,8 @@ ORDER BY scan.image, scan.time SELECT ROW_NUMBER() OVER (ORDER BY time), image, + tags, scanner, - scanner_version, - scanner_db_version, FORMAT_DATETIME("%Y-%m-%d %H:%M:%S", DATE(time)) as time, low_cve_count as low_cve_cnt, med_cve_count as med_cve_cnt, @@ -41,7 +40,8 @@ SELECT unknown_cve_count as unknown_cve_cnt, low_cve_count + med_cve_count + high_cve_count + crit_cve_count + unknown_cve_count AS tot_cve_cnt, digest -FROM ` + summaryTable +FROM ` + summaryTable + ` +WHERE tags NOT LIKE '%latest-dev%'` ImageComparisonCsvQuery = ` WITH ruuuumble AS (