Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pipeline fix for enhanced reporting #7499

Merged
merged 2 commits into from
Oct 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion components/compliance-service/dao/pgdb/agents.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ package pgdb
type agent struct {
ID string `db:"id"`
Type string `db:"type"`
Status string `db:"Status"`
Status string `db:"status"`
}
24 changes: 12 additions & 12 deletions components/compliance-service/dao/pgdb/jobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ SELECT
j.id,
j.name,
j.type,
j.Status,
j.status,
j.start_time,
j.end_time,
j.timeout,
Expand Down Expand Up @@ -87,7 +87,7 @@ FROM jobs j
FROM (SELECT
r.node_id,
r.report_id,
r.Status,
r.status,
r.result,
r.start_time,
r.end_time) x)) AS results_agg,
Expand All @@ -103,7 +103,7 @@ SELECT
j.id,
j.name,
j.type,
j.Status,
j.status,
j.start_time,
j.end_time,
j.parent_id,
Expand Down Expand Up @@ -154,7 +154,7 @@ WHERE job_id = $1
`

const selectResultByJobAndNodeIds = `
SELECT job_id, Status, result, start_time, end_time, report_id
SELECT job_id, status, result, start_time, end_time, report_id
FROM results
WHERE job_id=$1 AND node_id=$2
ORDER BY start_time DESC
Expand All @@ -166,7 +166,7 @@ LIMIT 1;
const sqlGetOWCAScans = `
SELECT j.id, j.end_time
FROM jobs j
WHERE recurrence = '' AND type = 'exec' AND (end_time >= $1 OR Status = 'running');
WHERE recurrence = '' AND type = 'exec' AND (end_time >= $1 OR status = 'running');
`

const selectProfileIdsFromJobsProfilesByJobId = `
Expand Down Expand Up @@ -218,7 +218,7 @@ const postgresTimeFormat = "2006-01-02T15:04:05"
var jobsSortFields = map[string]string{
"name": "LOWER(j.name)",
"type": "LOWER(j.type)",
"Status": "LOWER(j.Status)",
"status": "LOWER(j.status)",
"start_time": "j.start_time",
"end_time": "j.end_time",
}
Expand All @@ -229,7 +229,7 @@ var jobFilterField = map[string]string{
"name": "name",
"parent_job": "parent_id",
"profile": "profile",
"Status": "Status",
"status": "status",
}

// job used to insert to db
Expand All @@ -243,7 +243,7 @@ type job struct {
Timeout int32 `db:"timeout"`
Retries int32 `db:"retries"`
RetriesLeft int32 `db:"retries_left"`
Status string `db:"Status"`
Status string `db:"status"`
Startime time.Time `db:"start_time"`
Endtime time.Time `db:"end_time"`
NodeSelectors json.RawMessage `db:"node_selectors"`
Expand Down Expand Up @@ -298,7 +298,7 @@ type ResultsRow struct {
JobID string `db:"job_id" json:"job_id,omitempty"`
NodeID string `db:"node_id" json:"node_id"`
ReportID string `db:"report_id" json:"report_id"`
Status string `db:"Status" json:"Status"`
Status string `db:"status" json:"status"`
Result string `db:"result" json:"result"`
StartTime time.Time `db:"start_time" json:"start_time"`
EndTime time.Time `db:"end_time" json:"end_time"`
Expand Down Expand Up @@ -423,7 +423,7 @@ func fromDBSelectJob(inSelectJob *jobSelectDetail) (jobs.Job, error) {
resultsNew[i] = &jobs.ResultsRow{
NodeId: item["node_id"],
ReportId: item["report_id"],
Status: item["Status"],
Status: item["status"],
Result: item["result"],
}

Expand Down Expand Up @@ -648,11 +648,11 @@ func validateJobFilters(filters []*common.Filter) error {
}
}
}
case "Status":
case "status":
for _, item := range filter.Values {
if item != "" {
if !isValidJobStatus(item) {
return &errorutils.InvalidError{Msg: fmt.Sprintf("Invalid Status filter: %s. Status must be one of the following: 'completed', 'failed', 'new', 'running', 'scheduled'", item)}
return &errorutils.InvalidError{Msg: fmt.Sprintf("Invalid status filter: %s. status must be one of the following: 'completed', 'failed', 'new', 'running', 'scheduled'", item)}
}
}
}
Expand Down