This is an automated email from the ASF dual-hosted git repository.
lynwee pushed a commit to branch dev-9
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
The following commit(s) were added to refs/heads/dev-9 by this push:
new 437d070c7 feat(gitlab): calculate is_child field in convertor
437d070c7 is described below
commit 437d070c792953c5ac262557667c6c980b5dc756
Author: d4x1 <[email protected]>
AuthorDate: Fri Sep 6 15:28:06 2024 +0800
feat(gitlab): calculate is_child field in convertor
---
backend/plugins/gitlab/models/pipeline.go | 9 +++++++++
backend/plugins/gitlab/tasks/pipeline_detail_convertor.go | 3 ++-
backend/plugins/gitlab/tasks/pipeline_extractor.go | 4 ----
3 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/backend/plugins/gitlab/models/pipeline.go
b/backend/plugins/gitlab/models/pipeline.go
index b1de5ea03..1275c3ac5 100644
--- a/backend/plugins/gitlab/models/pipeline.go
+++ b/backend/plugins/gitlab/models/pipeline.go
@@ -23,6 +23,10 @@ import (
"github.com/apache/incubator-devlake/core/models/common"
)
+const (
+ PipelineSourceParentPipeline = "parent_pipeline"
+)
+
type GitlabPipeline struct {
ConnectionId uint64 `gorm:"primaryKey"`
@@ -50,6 +54,11 @@ type GitlabPipeline struct {
common.NoPKModel
}
+func (gitlabPipeline GitlabPipeline) GenerateIsChild() bool {
+ return gitlabPipeline.Source == PipelineSourceParentPipeline
+
+}
+
func (GitlabPipeline) TableName() string {
return "_tool_gitlab_pipelines"
}
diff --git a/backend/plugins/gitlab/tasks/pipeline_detail_convertor.go
b/backend/plugins/gitlab/tasks/pipeline_detail_convertor.go
index 1b652274f..aba33b0e4 100644
--- a/backend/plugins/gitlab/tasks/pipeline_detail_convertor.go
+++ b/backend/plugins/gitlab/tasks/pipeline_detail_convertor.go
@@ -104,7 +104,8 @@ func ConvertDetailPipelines(taskCtx plugin.SubTaskContext)
errors.Error {
Type: gitlabPipeline.Type,
DurationSec:
float64(gitlabPipeline.Duration),
// DisplayTitle: gitlabPipeline.Ref,
- Url: gitlabPipeline.WebUrl,
+ Url: gitlabPipeline.WebUrl,
+ IsChild: gitlabPipeline.GenerateIsChild(),
}
return []interface{}{
domainPipeline,
diff --git a/backend/plugins/gitlab/tasks/pipeline_extractor.go
b/backend/plugins/gitlab/tasks/pipeline_extractor.go
index 85b688d8c..d68035db1 100644
--- a/backend/plugins/gitlab/tasks/pipeline_extractor.go
+++ b/backend/plugins/gitlab/tasks/pipeline_extractor.go
@@ -41,10 +41,6 @@ type ApiDetailedStatus struct {
Favicon string
}
-const (
- PipelineSourceParentPipeline = "parent_pipeline"
-)
-
type ApiPipeline struct {
Id int `json:"id"`
Ref string