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

Fix errors in dora plugin #7858

Merged
merged 7 commits into from
Aug 7, 2024
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 backend/plugins/dora/impl/impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ func (p Dora) SubTaskMetas() []plugin.SubTaskMeta {
tasks.EnrichPrevSuccessDeploymentCommitMeta,
tasks.EnrichTaskEnvMeta,
tasks.CalculateChangeLeadTimeMeta,
tasks.ConnectIncidentToDeploymentMeta,
tasks.IssuesToIncidentsMeta,
tasks.ConnectIncidentToDeploymentMeta,
}
}

Expand Down
21 changes: 12 additions & 9 deletions backend/plugins/dora/tasks/incident_deploy_connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,21 @@ func ConnectIncidentToDeployment(taskCtx plugin.SubTaskContext) errors.Error {
logger.Info("delete previous project_incident_deployment_relationships")
// select all issues belongs to the board
clauses := []dal.Clause{
dal.Select(`i.*`),
dal.From(`incidents i`),
dal.Join(`left join project_mapping pm on pm.row_id = i.scope_id and pm.table = i.table`),
dal.Where("pm.project_name = ?", data.Options.ProjectName),
}

count, err := db.Count(clauses...)
if err != nil {
logger.Error(err, "count incidents")
} else {
logger.Info("incident count is %d", count)
}
//count, err := db.Count(
// dal.From(`incidents i`),
// dal.Join(`left join project_mapping pm on pm.row_id = i.scope_id and pm.table = i.table`),
// dal.Where("pm.project_name = ?", data.Options.ProjectName),
//)
//if err != nil {
// logger.Error(err, "count incidents")
//} else {
// logger.Info("incident count is %d", count)
//}

cursor, err := db.Cursor(clauses...)
if err != nil {
Expand All @@ -95,7 +98,7 @@ func ConnectIncidentToDeployment(taskCtx plugin.SubTaskContext) errors.Error {
},
ProjectName: data.Options.ProjectName,
}
logger.Info("get incident: %+v", incident.Id)
logger.Debug("get incident: %+v", incident.Id)
cicdDeploymentCommit := &devops.CicdDeploymentCommit{}
cicdDeploymentCommitClauses := []dal.Clause{
dal.Select("cicd_deployment_commits.cicd_deployment_id as id, cicd_deployment_commits.finished_date as finished_date"),
Expand Down Expand Up @@ -128,7 +131,7 @@ func ConnectIncidentToDeployment(taskCtx plugin.SubTaskContext) errors.Error {
projectIssueMetric.DeploymentId = scdc.Id
return []interface{}{projectIssueMetric}, nil
}
logger.Info("scdc.id is empty, incident will be ignored: %+v", incident.Id)
logger.Debug("scdc.id is empty, incident will be ignored: %+v", incident.Id)
return nil, nil
},
})
Expand Down
Loading