You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by wa...@apache.org on 2022/11/07 09:42:56 UTC
[incubator-devlake] branch main updated: fix(framework): remove cicdPipelineRelationship (#3687)
This is an automated email from the ASF dual-hosted git repository.
warren 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 b4ba8199 fix(framework): remove cicdPipelineRelationship (#3687)
b4ba8199 is described below
commit b4ba81994d7f343ddb13d39fae71c43d9c17a3f6
Author: Warren Chen <yi...@merico.dev>
AuthorDate: Mon Nov 7 17:42:51 2022 +0800
fix(framework): remove cicdPipelineRelationship (#3687)
closes #3682
---
models/domainlayer/devops/cicd_pipeline.go | 12 ------
.../20221107_remove_cicd_pipeline_relation.go | 43 ++++++++++++++++++++++
models/migrationscripts/register.go | 1 +
plugins/jenkins/e2e/builds_test.go | 10 -----
.../cicd_pipeline_relationships.csv | 1 -
plugins/jenkins/tasks/build_cicd_convertor.go | 10 -----
6 files changed, 44 insertions(+), 33 deletions(-)
diff --git a/models/domainlayer/devops/cicd_pipeline.go b/models/domainlayer/devops/cicd_pipeline.go
index f59dd992..b89d8041 100644
--- a/models/domainlayer/devops/cicd_pipeline.go
+++ b/models/domainlayer/devops/cicd_pipeline.go
@@ -20,8 +20,6 @@ package devops
import (
"time"
- "github.com/apache/incubator-devlake/models/common"
-
"github.com/apache/incubator-devlake/models/domainlayer"
)
@@ -41,16 +39,6 @@ func (CICDPipeline) TableName() string {
return "cicd_pipelines"
}
-type CICDPipelineRelationship struct {
- ParentPipelineId string `gorm:"primaryKey;type:varchar(255)"`
- ChildPipelineId string `gorm:"primaryKey;type:varchar(255)"`
- common.NoPKModel
-}
-
-func (CICDPipelineRelationship) TableName() string {
- return "cicd_pipeline_relationships"
-}
-
const (
SUCCESS = "SUCCESS"
FAILURE = "FAILURE"
diff --git a/models/migrationscripts/20221107_remove_cicd_pipeline_relation.go b/models/migrationscripts/20221107_remove_cicd_pipeline_relation.go
new file mode 100644
index 00000000..ee4d8f72
--- /dev/null
+++ b/models/migrationscripts/20221107_remove_cicd_pipeline_relation.go
@@ -0,0 +1,43 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package migrationscripts
+
+import (
+ "github.com/apache/incubator-devlake/errors"
+ "github.com/apache/incubator-devlake/plugins/core"
+)
+
+type removeCicdPipelineRelation struct{}
+
+type CICDPipelineRelationship20221107 struct{}
+
+func (CICDPipelineRelationship20221107) TableName() string {
+ return "cicd_pipeline_relationships"
+}
+
+func (*removeCicdPipelineRelation) Up(basicRes core.BasicRes) errors.Error {
+ return basicRes.GetDal().DropTables(CICDPipelineRelationship20221107{})
+}
+
+func (*removeCicdPipelineRelation) Version() uint64 {
+ return 20221107000001
+}
+
+func (*removeCicdPipelineRelation) Name() string {
+ return "Remove cicd_pipeline_relation"
+}
diff --git a/models/migrationscripts/register.go b/models/migrationscripts/register.go
index 93f9718a..a15f8ca5 100644
--- a/models/migrationscripts/register.go
+++ b/models/migrationscripts/register.go
@@ -52,5 +52,6 @@ func All() []core.MigrationScript {
new(changeLeadTimeMinutesToInt64),
new(addRepoSnapshot),
new(createCollectorState),
+ new(removeCicdPipelineRelation),
}
}
diff --git a/plugins/jenkins/e2e/builds_test.go b/plugins/jenkins/e2e/builds_test.go
index 79178d99..15249c69 100644
--- a/plugins/jenkins/e2e/builds_test.go
+++ b/plugins/jenkins/e2e/builds_test.go
@@ -80,7 +80,6 @@ func TestJenkinsBuildsDataFlow(t *testing.T) {
dataflowTester.FlushTabler(&devops.CICDTask{})
dataflowTester.FlushTabler(&devops.CICDPipeline{})
dataflowTester.FlushTabler(&devops.CiCDPipelineCommit{})
- dataflowTester.FlushTabler(&devops.CICDPipelineRelationship{})
dataflowTester.Subtask(tasks.EnrichApiBuildWithStagesMeta, taskData)
dataflowTester.Subtask(tasks.ConvertBuildsToCICDMeta, taskData)
dataflowTester.Subtask(tasks.ConvertBuildReposMeta, taskData)
@@ -116,15 +115,6 @@ func TestJenkinsBuildsDataFlow(t *testing.T) {
),
)
- dataflowTester.VerifyTable(
- devops.CICDPipelineRelationship{},
- "./snapshot_tables/cicd_pipeline_relationships.csv",
- e2ehelper.ColumnWithRawData(
- "parent_pipeline_id",
- "child_pipeline_id",
- ),
- )
-
dataflowTester.VerifyTable(
devops.CiCDPipelineCommit{},
"./snapshot_tables/cicd_pipeline_commits.csv",
diff --git a/plugins/jenkins/e2e/snapshot_tables/cicd_pipeline_relationships.csv b/plugins/jenkins/e2e/snapshot_tables/cicd_pipeline_relationships.csv
deleted file mode 100644
index 91f497f3..00000000
--- a/plugins/jenkins/e2e/snapshot_tables/cicd_pipeline_relationships.csv
+++ /dev/null
@@ -1 +0,0 @@
-parent_pipeline_id,child_pipeline_id
diff --git a/plugins/jenkins/tasks/build_cicd_convertor.go b/plugins/jenkins/tasks/build_cicd_convertor.go
index 92772030..a2f3163b 100644
--- a/plugins/jenkins/tasks/build_cicd_convertor.go
+++ b/plugins/jenkins/tasks/build_cicd_convertor.go
@@ -108,16 +108,6 @@ func ConvertBuildsToCICD(taskCtx core.SubTaskContext) (err errors.Error) {
DurationSec: uint64(durationSec),
CreatedDate: jenkinsBuild.StartTime,
}
-
- if jenkinsBuild.TriggeredBy != "" {
- domainPipelineRelation := &devops.CICDPipelineRelationship{
- ParentPipelineId: buildIdGen.Generate(jenkinsBuild.ConnectionId,
- jenkinsBuild.TriggeredBy),
- ChildPipelineId: buildIdGen.Generate(jenkinsBuild.ConnectionId,
- jenkinsBuild.FullDisplayName),
- }
- results = append(results, domainPipelineRelation)
- }
jenkinsPipeline.RawDataOrigin = jenkinsBuild.RawDataOrigin
results = append(results, jenkinsPipeline)