Skip to content

Commit

Permalink
fix: filter job summary in summarizer
Browse files Browse the repository at this point in the history
  • Loading branch information
artaasadi committed Dec 17, 2024
1 parent b058431 commit 84d4288
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 13 deletions.
13 changes: 8 additions & 5 deletions jobs/compliance-summarizer-job/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,14 @@ func (w *Worker) RunJob(ctx context.Context, j types2.Job) error {
w.logger.Info("Before adding resource finding", zap.String("platform_resource_id", f.PlatformResourceID),
zap.Any("resource", resource))
jd.AddComplianceResult(w.logger, j, f, resource)
addJobSummary(controlSummary, controlView, resourceView, f)
integrationsMap[f.IntegrationID] = true
totalControls[f.ControlID] = true
if f.ComplianceStatus == types.ComplianceStatusALARM {
failedControls[f.ControlID] = true

if f.ComplianceJobID == j.ComplianceJobID {
addJobSummary(controlSummary, controlView, resourceView, f)
integrationsMap[f.IntegrationID] = true
totalControls[f.ControlID] = true
if f.ComplianceStatus == types.ComplianceStatusALARM {
failedControls[f.ControlID] = true
}
}
}

Expand Down
9 changes: 5 additions & 4 deletions jobs/compliance-summarizer-job/types/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ package types
import "time"

type Job struct {
ID uint
RetryCount int
BenchmarkID string
CreatedAt time.Time
ID uint
ComplianceJobID uint
RetryCount int
BenchmarkID string
CreatedAt time.Time
}
9 changes: 5 additions & 4 deletions services/describe/schedulers/compliance/summarizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,10 +245,11 @@ func (s *JobScheduler) CreateSummarizer(benchmarkId string, jobId *uint, trigger

func (s *JobScheduler) triggerSummarizer(ctx context.Context, job model.ComplianceSummarizer) error {
summarizerJob := types2.Job{
ID: job.ID,
RetryCount: job.RetryCount,
BenchmarkID: job.BenchmarkID,
CreatedAt: job.CreatedAt,
ID: job.ID,
ComplianceJobID: job.ParentJobID,
RetryCount: job.RetryCount,
BenchmarkID: job.BenchmarkID,
CreatedAt: job.CreatedAt,
}
jobJson, err := json.Marshal(summarizerJob)
if err != nil {
Expand Down

0 comments on commit 84d4288

Please sign in to comment.