This is an automated email from the ASF dual-hosted git repository.

abeizn 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 381ab99d3 fix: remove gitextractor where skip collector (#5509)
381ab99d3 is described below

commit 381ab99d35055f2db934f581069438893c41a0ce
Author: abeizn <[email protected]>
AuthorDate: Fri Jun 16 17:42:08 2023 +0800

    fix: remove gitextractor where skip collector (#5509)
    
    * fix: remove gitextractor where skip collector
---
 backend/server/services/blueprint_makeplan_v200.go | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/backend/server/services/blueprint_makeplan_v200.go 
b/backend/server/services/blueprint_makeplan_v200.go
index eb2cc7ec4..6b84d11d8 100644
--- a/backend/server/services/blueprint_makeplan_v200.go
+++ b/backend/server/services/blueprint_makeplan_v200.go
@@ -65,7 +65,6 @@ func genPlanJsonV200(
        if err != nil {
                return nil, nil, err
        }
-
        // make plan for data-source plugins fist. generate plan for each
        // connections, then merge them into one legitimate plan and collect the
        // scopes produced by the data-source plugins
@@ -77,6 +76,7 @@ func genPlanJsonV200(
                        // jenkins may upgrade from v100 and its' scope is empty
                        return nil, nil, 
errors.Default.New(fmt.Sprintf("connections[%d].scopes is empty", i))
                }
+
                p, err := plugin.GetPlugin(connection.Plugin)
                if err != nil {
                        return nil, nil, err
@@ -100,6 +100,7 @@ func genPlanJsonV200(
                        )
                }
        }
+
        // skip collectors
        if skipCollectors {
                for i, plan := range sourcePlans {
@@ -116,6 +117,24 @@ func genPlanJsonV200(
                                }
                        }
                }
+
+               // remove gitextractor plugin if it's not the only task
+               for i, plan := range sourcePlans {
+                       for j, stage := range plan {
+                               newStage := make(plugin.PipelineStage, 0, 
len(stage))
+                               hasGitExtractor := false
+                               for _, task := range stage {
+                                       if task.Plugin != "gitextractor" {
+                                               newStage = append(newStage, 
task)
+                                       } else {
+                                               hasGitExtractor = true
+                                       }
+                               }
+                               if !hasGitExtractor || len(newStage) > 0 {
+                                       sourcePlans[i][j] = newStage
+                               }
+                       }
+               }
        }
 
        // make plans for metric plugins

Reply via email to