You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by li...@apache.org on 2022/11/22 06:49:40 UTC
[incubator-devlake] branch main updated: fix(dora): modify naming (#3776)
This is an automated email from the ASF dual-hosted git repository.
likyh pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
The following commit(s) were added to refs/heads/main by this push:
new eb8424fc5 fix(dora): modify naming (#3776)
eb8424fc5 is described below
commit eb8424fc5ec0861e2220649a1e293f25480c178b
Author: Warren Chen <yi...@merico.dev>
AuthorDate: Tue Nov 22 14:49:36 2022 +0800
fix(dora): modify naming (#3776)
---
plugins/dora/tasks/change_lead_time_calculator.go | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/plugins/dora/tasks/change_lead_time_calculator.go b/plugins/dora/tasks/change_lead_time_calculator.go
index dd5f77bd3..1a66fc366 100644
--- a/plugins/dora/tasks/change_lead_time_calculator.go
+++ b/plugins/dora/tasks/change_lead_time_calculator.go
@@ -37,7 +37,7 @@ func CalculateChangeLeadTime(taskCtx core.SubTaskContext) errors.Error {
log := taskCtx.GetLogger()
data := taskCtx.GetData().(*DoraTaskData)
// construct a list of tuple[task, oldPipelineCommitSha, newPipelineCommitSha, taskFinishedDate]
- pipelineIdClauses := []dal.Clause{
+ deploymentClause := []dal.Clause{
dal.Select(`ct.id as task_id, cpc.commit_sha as new_deploy_commit_sha,
ct.finished_date as task_finished_date, cpc.repo_id as repo_id`),
dal.From(`cicd_tasks ct`),
@@ -47,22 +47,22 @@ func CalculateChangeLeadTime(taskCtx core.SubTaskContext) errors.Error {
devops.PRODUCTION, devops.DEPLOYMENT, devops.SUCCESS, data.Options.ProjectName, "cicd_scopes"),
dal.Orderby(`cpc.repo_id, ct.started_date `),
}
- deploymentPairList := make([]deploymentPair, 0)
- err := db.All(&deploymentPairList, pipelineIdClauses...)
+ deploymentDiffPairs := make([]deploymentPair, 0)
+ err := db.All(&deploymentDiffPairs, deploymentClause...)
if err != nil {
return err
}
- // deploymentPairList[i-1].NewDeployCommitSha is deploymentPairList[i].OldDeployCommitSha
+ // deploymentDiffPairs[i-1].NewDeployCommitSha is deploymentDiffPairs[i].OldDeployCommitSha
oldDeployCommitSha := ""
lastRepoId := ""
- for i := 0; i < len(deploymentPairList); i++ {
+ for i := 0; i < len(deploymentDiffPairs); i++ {
// if two deployments belong to different repo, let's skip
- if lastRepoId == deploymentPairList[i].RepoId {
- deploymentPairList[i].OldDeployCommitSha = oldDeployCommitSha
+ if lastRepoId == deploymentDiffPairs[i].RepoId {
+ deploymentDiffPairs[i].OldDeployCommitSha = oldDeployCommitSha
} else {
- lastRepoId = deploymentPairList[i].RepoId
+ lastRepoId = deploymentDiffPairs[i].RepoId
}
- oldDeployCommitSha = deploymentPairList[i].NewDeployCommitSha
+ oldDeployCommitSha = deploymentDiffPairs[i].NewDeployCommitSha
}
// get prs by repo project_name
@@ -119,7 +119,7 @@ func CalculateChangeLeadTime(taskCtx core.SubTaskContext) errors.Error {
projectPrMetric.ReviewTimespan = processNegativeValue(int64(pr.MergedDate.Sub(firstReview.CreatedDate).Minutes()))
projectPrMetric.FirstReviewId = firstReview.ReviewId
}
- deployment, err := getDeployment(pr.MergeCommitSha, pr.BaseRepoId, deploymentPairList, db)
+ deployment, err := getDeployment(pr.MergeCommitSha, pr.BaseRepoId, deploymentDiffPairs, db)
if err != nil {
return nil, err
}