From f527318dc53f163ebcb7851801671df5d65a30ca Mon Sep 17 00:00:00 2001 From: Ji Bin Date: Sun, 31 Mar 2024 15:46:31 +0000 Subject: [PATCH] fix: refine process of actions field in Jenkins raw data Signed-off-by: Ji Bin --- backend/plugins/jenkins/tasks/build_extractor.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/backend/plugins/jenkins/tasks/build_extractor.go b/backend/plugins/jenkins/tasks/build_extractor.go index 287d2b788f9..dfa050a21c7 100644 --- a/backend/plugins/jenkins/tasks/build_extractor.go +++ b/backend/plugins/jenkins/tasks/build_extractor.go @@ -20,12 +20,13 @@ package tasks import ( "encoding/json" "fmt" + "strings" + "time" + "github.com/apache/incubator-devlake/core/errors" "github.com/apache/incubator-devlake/core/plugin" "github.com/apache/incubator-devlake/helpers/pluginhelper/api" "github.com/apache/incubator-devlake/plugins/jenkins/models" - "strings" - "time" ) // this struct should be moved to `gitub_api_common.go` @@ -75,6 +76,7 @@ func ExtractApiBuilds(taskCtx plugin.SubTaskContext) errors.Error { } // we also need to collect the commit info from the build which does not have changeSet // changeSet describes the changes that were made in the build + // process hudson.plugins.git.util.BuildData for _, a := range body.Actions { if a.LastBuiltRevision == nil { continue @@ -103,6 +105,9 @@ func ExtractApiBuilds(taskCtx plugin.SubTaskContext) errors.Error { results = append(results, &buildCommitRemoteUrl) } } + } + // process hudson.model.CauseAction + for _, a := range body.Actions { if len(a.Causes) > 0 { for _, cause := range a.Causes { if cause.UpstreamProject != "" {