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

klesh 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 2aa0c948b fix: fix job loss id on remote (#5394)
2aa0c948b is described below

commit 2aa0c948bf77322320db2d7627aadc7fc6f1ec28
Author: mappjzc <[email protected]>
AuthorDate: Wed Jun 7 15:22:07 2023 +0800

    fix: fix job loss id on remote (#5394)
    
    Add FullName on ConvertApiScope.
    
    Nddtfjiang <[email protected]>
---
 backend/plugins/jenkins/models/response.go | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/backend/plugins/jenkins/models/response.go 
b/backend/plugins/jenkins/models/response.go
index 18390249a..42fd079f8 100644
--- a/backend/plugins/jenkins/models/response.go
+++ b/backend/plugins/jenkins/models/response.go
@@ -18,6 +18,8 @@ limitations under the License.
 package models
 
 import (
+       "strings"
+
        "github.com/apache/incubator-devlake/core/plugin"
 )
 
@@ -44,6 +46,23 @@ func (j Job) GroupName() string {
 }
 
 func (j Job) ConvertApiScope() plugin.ToolLayerScope {
+       if j.FullName == "" {
+               if j.Name != "" || j.Path != "" {
+                       beforeNames := strings.Split(j.Path, "/")
+                       befornName := ""
+                       for i, part := range beforeNames {
+                               if i%2 == 0 && part == "job" {
+                                       continue
+                               }
+                               if part == "" {
+                                       continue
+                               }
+                               befornName += part + "/"
+                       }
+                       j.FullName = befornName + j.Name
+               }
+       }
+
        return &JenkinsJob{
                FullName:    j.FullName,
                Name:        j.Name,

Reply via email to