@@ -7,27 +7,40 @@ import (
77)
88
99type ImageScanExecutionHistory struct {
10- tableName struct {} `sql:"image_scan_execution_history" pg:",discard_unknown_columns"`
11- Id int `sql:"id,pk"`
12- Image string `sql:"image,notnull"` // Migrate to request Id in future
13- ImageHash string `sql:"image_hash,notnull"` // Migrate to request metadata
14- ExecutionTime time.Time `sql:"execution_time"`
15- ExecutedBy int `sql:"executed_by,notnull"`
16- RequestMetadataJson string `sql:"request_metadata_json"`
17- ExecutionHistoryDirectoryPath string `sql:"execution_history_directory_path"` // Deprecated
18- RequestId int `sql:"request_id "`
19- RequestType RequestType `sql:"request_type "`
10+ tableName struct {} `sql:"image_scan_execution_history" pg:",discard_unknown_columns"`
11+ Id int `sql:"id,pk"`
12+ Image string `sql:"image,notnull"`
13+ ImageHash string `sql:"image_hash,notnull"` // TODO Migrate to request metadata
14+ ExecutionTime time.Time `sql:"execution_time"`
15+ ExecutedBy int `sql:"executed_by,notnull"`
16+ SourceMetadataJson string `sql:"source_metadata_json"` // to have relevant info to process a scan for a given source type and subtype
17+ ExecutionHistoryDirectoryPath string `sql:"execution_history_directory_path"` // Deprecated
18+ SourceType SourceType `sql:"source_type "`
19+ SourceSubType SourceSubType `sql:"source_sub_type "`
2020}
2121
22- type RequestType int
22+ // multiple history rows for one source event
23+
24+ type SourceType int
25+
26+ const (
27+ Image SourceType = 1
28+ Code SourceType = 2
29+ Sbom SourceType = 3 // can be used in future for direct sbom scanning
30+ )
31+
32+ type SourceSubType int
2333
2434const (
25- Image = 1
26- CiWorkflow = 2
27- CdWorkflow = 3
28- ChartHistory = 4
35+ Ci SourceSubType = 1 // relevant for ci code(2,1) or ci built image(1,1)
36+ Manifest SourceSubType = 2 // relevant for devtron app deployment manifest/helm app manifest(2,2) or images retrieved from manifest(1,2))
2937)
3038
39+ //Refer image_scan_deploy_info table for source_type relation
40+ // ci workflow will have scans for ci-code and ci artifact
41+ // cd workflow will have scans for deployment manifest, manifest images
42+ // helm chart will have scans for manifest images and manifest
43+
3144type ImageScanHistoryRepository interface {
3245 Save (model * ImageScanExecutionHistory ) error
3346 FindAll () ([]* ImageScanExecutionHistory , error )
0 commit comments