You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by GitBox <gi...@apache.org> on 2022/11/20 11:39:50 UTC

[GitHub] [incubator-devlake] warren830 commented on a diff in pull request #3760: fix(jenkins): update build stages logic

warren830 commented on code in PR #3760:
URL: https://github.com/apache/incubator-devlake/pull/3760#discussion_r1027274290


##########
plugins/jenkins/tasks/build_stages_enricher.go:
##########
@@ -40,15 +36,14 @@ func EnrichApiBuildWithStages(taskCtx core.SubTaskContext) errors.Error {
 	data := taskCtx.GetData().(*JenkinsTaskData)
 	db := taskCtx.GetDal()
 	clauses := []dal.Clause{
-		dal.Select("distinct build_name"),
-		dal.From(&models.JenkinsStage{}),
-		dal.Join(`left join _tool_jenkins_builds tjb 
-						on _tool_jenkins_stages.build_name = tjb.full_display_name 
-						and _tool_jenkins_stages.connection_id = tjb.connection_id`),
-		dal.Where(`_tool_jenkins_stages.connection_id = ? 
-							and tjb.job_path = ? and tjb.job_name = ?`,
+		dal.Select("tjb.*"),
+		dal.From(`_tool_jenkins_builds tjb`),
+		dal.Join(`left join _tool_jenkins_stages tjs 
+						on tjs.build_name = tjb.full_display_name 
+						and tjs.connection_id = tjb.connection_id`),
+		dal.Where(`tjb.connection_id = ? 
+							and tjb.job_path = ? and tjb.job_name = ? and tjs.id is not null `,

Review Comment:
   Nice



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org