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/18 10:07:44 UTC

[GitHub] [incubator-devlake] warren830 opened a new pull request, #3760: fix(jenkins): update build stages logic

warren830 opened a new pull request, #3760:
URL: https://github.com/apache/incubator-devlake/pull/3760

   ### Summary
   According to issue #3757 , I checked related code, we should change the logic to update _tool_jenkins_builds.has_stages.
   Previously, the logic is bad.
   Right now, we can just loop all builds which has stages in _tool_jenkins_stages, and set its has_stages to `true`
   
   ### Does this close any open issues?
   Closes #3757 
   
   ### Screenshots
   Include any relevant screenshots here.
   
   ### Other Information
   Any other information that is important to this PR.
   


-- 
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


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

Posted by GitBox <gi...@apache.org>.
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


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

Posted by GitBox <gi...@apache.org>.
likyh commented on code in PR #3760:
URL: https://github.com/apache/incubator-devlake/pull/3760#discussion_r1026292164


##########
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:
   use inner join instead of `tjs.id is not null`?



-- 
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


[GitHub] [incubator-devlake] likyh merged pull request #3760: fix(jenkins): update build stages logic

Posted by GitBox <gi...@apache.org>.
likyh merged PR #3760:
URL: https://github.com/apache/incubator-devlake/pull/3760


-- 
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