-
Notifications
You must be signed in to change notification settings - Fork 530
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(schema): add
original_status
and original_result
fields to a…
…ll related devops tables (#6476) * feat(schema): add `original_status` and `original_result` fields to all related devops tables * refactor(github): reduce some codes * fix(migration): revert changes on archived.CicdDeploymentCommit * fix(db): update `original_result` field * refactor(db): fix typo
- Loading branch information
Showing
52 changed files
with
787 additions
and
672 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
89 changes: 89 additions & 0 deletions
89
.../core/models/migrationscripts/20231116_add_original_status_and_result_to_devops_tables.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
/* | ||
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/core/context" | ||
"github.com/apache/incubator-devlake/core/errors" | ||
"github.com/apache/incubator-devlake/core/plugin" | ||
) | ||
|
||
var _ plugin.MigrationScript = (*addOriginalStatusAndResultToDevOpsTables)(nil) | ||
|
||
type cicdDeployment20231116 struct { | ||
OriginalStatus string `gorm:"type:varchar(100)"` | ||
OriginalResult string `gorm:"type:varchar(100)"` | ||
} | ||
|
||
func (cicdDeployment20231116) TableName() string { | ||
return "cicd_deployments" | ||
} | ||
|
||
type cicdDeploymentCommit20231116 struct { | ||
OriginalStatus string `gorm:"type:varchar(100)"` | ||
OriginalResult string `gorm:"type:varchar(100)"` | ||
} | ||
|
||
func (cicdDeploymentCommit20231116) TableName() string { | ||
return "cicd_deployment_commits" | ||
} | ||
|
||
type cicdPipeline20231116 struct { | ||
OriginalStatus string `gorm:"type:varchar(100)"` | ||
OriginalResult string `gorm:"type:varchar(100)"` | ||
} | ||
|
||
func (cicdPipeline20231116) TableName() string { | ||
return "cicd_pipelines" | ||
} | ||
|
||
type cicdTask20231116 struct { | ||
OriginalStatus string `gorm:"type:varchar(100)"` | ||
OriginalResult string `gorm:"type:varchar(100)"` | ||
} | ||
|
||
func (cicdTask20231116) TableName() string { | ||
return "cicd_tasks" | ||
} | ||
|
||
type addOriginalStatusAndResultToDevOpsTables struct{} | ||
|
||
func (u *addOriginalStatusAndResultToDevOpsTables) Up(basicRes context.BasicRes) errors.Error { | ||
db := basicRes.GetDal() | ||
if err := db.AutoMigrate(&cicdTask20231116{}); err != nil { | ||
return err | ||
} | ||
if err := db.AutoMigrate(&cicdPipeline20231116{}); err != nil { | ||
return err | ||
} | ||
if err := db.AutoMigrate(&cicdDeploymentCommit20231116{}); err != nil { | ||
return err | ||
} | ||
if err := db.AutoMigrate(&cicdDeployment20231116{}); err != nil { | ||
return err | ||
} | ||
return nil | ||
} | ||
|
||
func (*addOriginalStatusAndResultToDevOpsTables) Version() uint64 { | ||
return 20231116142100 | ||
} | ||
|
||
func (*addOriginalStatusAndResultToDevOpsTables) Name() string { | ||
return "add original status and original result to all related devops tables" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 15 additions & 15 deletions
30
backend/plugins/bamboo/e2e/snapshot_tables/cicd_deployment_commits.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
id,commit_sha,cicd_scope_id,cicd_deployment_id,name,result,status,environment,created_date,started_date,finished_date,duration_sec,ref_name,repo_id,repo_url,prev_success_deployment_commit_id | ||
bamboo:deployBuildWithVcsRevision:1:130001:622595,79b062bd53af15c701193c90b543386557cb7a3a,bamboo:BambooPlan:1:TEST-PLA2,bamboo:deployBuildWithVcsRevision:1:130001:622595,test_project2 - test_plan/release-1,SUCCESS,DONE,dev,2023-07-31T10:16:41.000+00:00,2023-07-31T10:16:41.000+00:00,2023-07-31T10:16:41.000+00:00,0,,622595,fake://127.0.0.1:8080/repos/622595, | ||
bamboo:deployBuildWithVcsRevision:1:130002:622595,79b062bd53af15c701193c90b543386557cb7a3a,bamboo:BambooPlan:1:TEST-PLA2,bamboo:deployBuildWithVcsRevision:1:130002:622595,test_project2 - test_plan/release-1,FAILURE,IN_PROGRESS,dev,2023-07-31T10:16:41.000+00:00,2023-07-31T10:16:41.000+00:00,2023-07-31T10:16:41.000+00:00,0,,622595,fake://127.0.0.1:8080/repos/622595, | ||
bamboo:deployBuildWithVcsRevision:1:130003:622595,79b062bd53af15c701193c90b543386557cb7a3a,bamboo:BambooPlan:1:TEST-PLA2,bamboo:deployBuildWithVcsRevision:1:130003:622595,test_project2 - test_plan/release-1,,IN_PROGRESS,dev,2023-07-31T10:16:41.000+00:00,2023-07-31T10:16:41.000+00:00,2023-07-31T10:16:41.000+00:00,0,,622595,fake://127.0.0.1:8080/repos/622595, | ||
bamboo:deployBuildWithVcsRevision:1:130004:622595,79b062bd53af15c701193c90b543386557cb7a3a,bamboo:BambooPlan:1:TEST-PLA2,bamboo:deployBuildWithVcsRevision:1:130004:622595,test_project2 - test_plan/release-1,,IN_PROGRESS,dev,2023-07-31T10:16:41.000+00:00,2023-07-31T10:16:41.000+00:00,2023-07-31T10:16:41.000+00:00,0,,622595,fake://127.0.0.1:8080/repos/622595, | ||
bamboo:deployBuildWithVcsRevision:1:130005:622595,79b062bd53af15c701193c90b543386557cb7a3a,bamboo:BambooPlan:1:TEST-PLA2,bamboo:deployBuildWithVcsRevision:1:130005:622595,test_project2 - test_plan/release-1,,OTHER,dev,2023-07-31T10:16:41.000+00:00,2023-07-31T10:16:41.000+00:00,2023-07-31T10:16:41.000+00:00,0,,622595,fake://127.0.0.1:8080/repos/622595, | ||
bamboo:deployBuildWithVcsRevision:1:130006:622595,79b062bd53af15c701193c90b543386557cb7a3a,bamboo:BambooPlan:1:TEST-PLA2,bamboo:deployBuildWithVcsRevision:1:130006:622595,test_project2 - test_plan/release-1,,OTHER,dev,2023-07-31T10:16:41.000+00:00,2023-07-31T10:16:41.000+00:00,2023-07-31T10:16:41.000+00:00,0,,622595,fake://127.0.0.1:8080/repos/622595, | ||
bamboo:deployBuildWithVcsRevision:1:130007:622595,79b062bd53af15c701193c90b543386557cb7a3a,bamboo:BambooPlan:1:TEST-PLA2,bamboo:deployBuildWithVcsRevision:1:130007:622595,test_project2 - test_plan/release-1,,OTHER,dev,2023-07-31T10:16:41.000+00:00,2023-07-31T10:16:41.000+00:00,2023-07-31T10:16:41.000+00:00,0,,622595,fake://127.0.0.1:8080/repos/622595, | ||
bamboo:deployBuildWithVcsRevision:1:130008:622595,79b062bd53af15c701193c90b543386557cb7a3a,bamboo:BambooPlan:1:TEST-PLA2,bamboo:deployBuildWithVcsRevision:1:130008:622595,test_project2 - test_plan/release-1,,OTHER,dev,2023-07-31T10:16:41.000+00:00,2023-07-31T10:16:41.000+00:00,2023-07-31T10:16:41.000+00:00,0,,622595,fake://127.0.0.1:8080/repos/622595, | ||
bamboo:deployBuildWithVcsRevision:1:1540100:622595,79b062bd53af15c701193c90b543386557cb7a3a,bamboo:BambooPlan:1:TEST-PLA2,bamboo:deployBuildWithVcsRevision:1:1540100:622595,test_project2 - test_plan/release-1,FAILURE,DONE,dev,2023-07-31T11:50:10.000+00:00,2023-07-31T11:50:10.000+00:00,2023-07-31T11:50:10.000+00:00,0,,622595,fake://127.0.0.1:8080/repos/622595, | ||
bamboo:deployBuildWithVcsRevision:1:1540101:622595,79b062bd53af15c701193c90b543386557cb7a3a,bamboo:BambooPlan:1:TEST-PLA2,bamboo:deployBuildWithVcsRevision:1:1540101:622595,test_project2 - test_plan/release-2,FAILURE,DONE,dev,2023-07-31T11:51:14.000+00:00,2023-07-31T11:51:14.000+00:00,2023-07-31T11:51:14.000+00:00,0,,622595,fake://127.0.0.1:8080/repos/622595, | ||
bamboo:deployBuildWithVcsRevision:1:1540102:622595,79b062bd53af15c701193c90b543386557cb7a3a,bamboo:BambooPlan:1:TEST-PLA2,bamboo:deployBuildWithVcsRevision:1:1540102:622595,test_project2 - test_plan/release-2,SUCCESS,DONE,dev,2023-07-31T11:52:32.000+00:00,2023-07-31T11:52:32.000+00:00,2023-07-31T11:52:32.000+00:00,0,,622595,fake://127.0.0.1:8080/repos/622595, | ||
bamboo:deployBuildWithVcsRevision:1:1540105:622595,79b062bd53af15c701193c90b543386557cb7a3a,bamboo:BambooPlan:1:TEST-PLA2,bamboo:deployBuildWithVcsRevision:1:1540105:622595,test_project2 - test_plan/release-2,SUCCESS,DONE,dev,2023-08-01T09:31:53.000+00:00,2023-08-01T09:31:53.000+00:00,2023-08-01T09:31:53.000+00:00,0,,622595,fake://127.0.0.1:8080/repos/622595, | ||
bamboo:deployBuildWithVcsRevision:1:1540106:622595,79b062bd53af15c701193c90b543386557cb7a3a,bamboo:BambooPlan:1:TEST-PLA2,bamboo:deployBuildWithVcsRevision:1:1540106:622595,test_project2 - test_plan/release-2,SUCCESS,DONE,dev,2023-08-01T09:32:00.000+00:00,2023-08-01T09:32:00.000+00:00,2023-08-01T09:32:00.000+00:00,0,,622595,fake://127.0.0.1:8080/repos/622595, | ||
bamboo:deployBuildWithVcsRevision:1:1540117:622595,79b062bd53af15c701193c90b543386557cb7a3a,bamboo:BambooPlan:1:TEST-PLA2,bamboo:deployBuildWithVcsRevision:1:1540117:622595,test_project2 - test_plan/release-3,SUCCESS,DONE,dev,2023-08-03T09:49:07.000+00:00,2023-08-03T09:49:07.000+00:00,2023-08-03T09:49:07.000+00:00,0,,622595,fake://127.0.0.1:8080/repos/622595, | ||
id,commit_sha,cicd_scope_id,cicd_deployment_id,name,result,status,original_status,original_result,environment,created_date,started_date,finished_date,duration_sec,ref_name,repo_id,repo_url,prev_success_deployment_commit_id | ||
bamboo:deployBuildWithVcsRevision:1:130001:622595,79b062bd53af15c701193c90b543386557cb7a3a,bamboo:BambooPlan:1:TEST-PLA2,bamboo:deployBuildWithVcsRevision:1:130001:622595,test_project2 - test_plan/release-1,SUCCESS,DONE,FINISHED,SUCCESS,dev,2023-07-31T10:16:41.000+00:00,2023-07-31T10:16:41.000+00:00,2023-07-31T10:16:41.000+00:00,0,,622595,fake://127.0.0.1:8080/repos/622595, | ||
bamboo:deployBuildWithVcsRevision:1:130002:622595,79b062bd53af15c701193c90b543386557cb7a3a,bamboo:BambooPlan:1:TEST-PLA2,bamboo:deployBuildWithVcsRevision:1:130002:622595,test_project2 - test_plan/release-1,FAILURE,IN_PROGRESS,IN_PROGRESS,FAILED,dev,2023-07-31T10:16:41.000+00:00,2023-07-31T10:16:41.000+00:00,2023-07-31T10:16:41.000+00:00,0,,622595,fake://127.0.0.1:8080/repos/622595, | ||
bamboo:deployBuildWithVcsRevision:1:130003:622595,79b062bd53af15c701193c90b543386557cb7a3a,bamboo:BambooPlan:1:TEST-PLA2,bamboo:deployBuildWithVcsRevision:1:130003:622595,test_project2 - test_plan/release-1,,IN_PROGRESS,PENDING,REPLACED,dev,2023-07-31T10:16:41.000+00:00,2023-07-31T10:16:41.000+00:00,2023-07-31T10:16:41.000+00:00,0,,622595,fake://127.0.0.1:8080/repos/622595, | ||
bamboo:deployBuildWithVcsRevision:1:130004:622595,79b062bd53af15c701193c90b543386557cb7a3a,bamboo:BambooPlan:1:TEST-PLA2,bamboo:deployBuildWithVcsRevision:1:130004:622595,test_project2 - test_plan/release-1,,IN_PROGRESS,QUEUED,SKIPPED,dev,2023-07-31T10:16:41.000+00:00,2023-07-31T10:16:41.000+00:00,2023-07-31T10:16:41.000+00:00,0,,622595,fake://127.0.0.1:8080/repos/622595, | ||
bamboo:deployBuildWithVcsRevision:1:130005:622595,79b062bd53af15c701193c90b543386557cb7a3a,bamboo:BambooPlan:1:TEST-PLA2,bamboo:deployBuildWithVcsRevision:1:130005:622595,test_project2 - test_plan/release-1,,OTHER,NOT_BUILT,NEVER,dev,2023-07-31T10:16:41.000+00:00,2023-07-31T10:16:41.000+00:00,2023-07-31T10:16:41.000+00:00,0,,622595,fake://127.0.0.1:8080/repos/622595, | ||
bamboo:deployBuildWithVcsRevision:1:130006:622595,79b062bd53af15c701193c90b543386557cb7a3a,bamboo:BambooPlan:1:TEST-PLA2,bamboo:deployBuildWithVcsRevision:1:130006:622595,test_project2 - test_plan/release-1,,OTHER,NOT_BUILT,QUEUED,dev,2023-07-31T10:16:41.000+00:00,2023-07-31T10:16:41.000+00:00,2023-07-31T10:16:41.000+00:00,0,,622595,fake://127.0.0.1:8080/repos/622595, | ||
bamboo:deployBuildWithVcsRevision:1:130007:622595,79b062bd53af15c701193c90b543386557cb7a3a,bamboo:BambooPlan:1:TEST-PLA2,bamboo:deployBuildWithVcsRevision:1:130007:622595,test_project2 - test_plan/release-1,,OTHER,NOT_BUILT,IN PROGRESS,dev,2023-07-31T10:16:41.000+00:00,2023-07-31T10:16:41.000+00:00,2023-07-31T10:16:41.000+00:00,0,,622595,fake://127.0.0.1:8080/repos/622595, | ||
bamboo:deployBuildWithVcsRevision:1:130008:622595,79b062bd53af15c701193c90b543386557cb7a3a,bamboo:BambooPlan:1:TEST-PLA2,bamboo:deployBuildWithVcsRevision:1:130008:622595,test_project2 - test_plan/release-1,,OTHER,NOT_BUILT,NOT BUILT,dev,2023-07-31T10:16:41.000+00:00,2023-07-31T10:16:41.000+00:00,2023-07-31T10:16:41.000+00:00,0,,622595,fake://127.0.0.1:8080/repos/622595, | ||
bamboo:deployBuildWithVcsRevision:1:1540100:622595,79b062bd53af15c701193c90b543386557cb7a3a,bamboo:BambooPlan:1:TEST-PLA2,bamboo:deployBuildWithVcsRevision:1:1540100:622595,test_project2 - test_plan/release-1,FAILURE,DONE,FINISHED,FAILED,dev,2023-07-31T11:50:10.000+00:00,2023-07-31T11:50:10.000+00:00,2023-07-31T11:50:10.000+00:00,0,,622595,fake://127.0.0.1:8080/repos/622595, | ||
bamboo:deployBuildWithVcsRevision:1:1540101:622595,79b062bd53af15c701193c90b543386557cb7a3a,bamboo:BambooPlan:1:TEST-PLA2,bamboo:deployBuildWithVcsRevision:1:1540101:622595,test_project2 - test_plan/release-2,FAILURE,DONE,FINISHED,FAILED,dev,2023-07-31T11:51:14.000+00:00,2023-07-31T11:51:14.000+00:00,2023-07-31T11:51:14.000+00:00,0,,622595,fake://127.0.0.1:8080/repos/622595, | ||
bamboo:deployBuildWithVcsRevision:1:1540102:622595,79b062bd53af15c701193c90b543386557cb7a3a,bamboo:BambooPlan:1:TEST-PLA2,bamboo:deployBuildWithVcsRevision:1:1540102:622595,test_project2 - test_plan/release-2,SUCCESS,DONE,FINISHED,SUCCESS,dev,2023-07-31T11:52:32.000+00:00,2023-07-31T11:52:32.000+00:00,2023-07-31T11:52:32.000+00:00,0,,622595,fake://127.0.0.1:8080/repos/622595, | ||
bamboo:deployBuildWithVcsRevision:1:1540105:622595,79b062bd53af15c701193c90b543386557cb7a3a,bamboo:BambooPlan:1:TEST-PLA2,bamboo:deployBuildWithVcsRevision:1:1540105:622595,test_project2 - test_plan/release-2,SUCCESS,DONE,FINISHED,SUCCESS,dev,2023-08-01T09:31:53.000+00:00,2023-08-01T09:31:53.000+00:00,2023-08-01T09:31:53.000+00:00,0,,622595,fake://127.0.0.1:8080/repos/622595, | ||
bamboo:deployBuildWithVcsRevision:1:1540106:622595,79b062bd53af15c701193c90b543386557cb7a3a,bamboo:BambooPlan:1:TEST-PLA2,bamboo:deployBuildWithVcsRevision:1:1540106:622595,test_project2 - test_plan/release-2,SUCCESS,DONE,FINISHED,SUCCESS,dev,2023-08-01T09:32:00.000+00:00,2023-08-01T09:32:00.000+00:00,2023-08-01T09:32:00.000+00:00,0,,622595,fake://127.0.0.1:8080/repos/622595, | ||
bamboo:deployBuildWithVcsRevision:1:1540117:622595,79b062bd53af15c701193c90b543386557cb7a3a,bamboo:BambooPlan:1:TEST-PLA2,bamboo:deployBuildWithVcsRevision:1:1540117:622595,test_project2 - test_plan/release-3,SUCCESS,DONE,FINISHED,SUCCESS,dev,2023-08-03T09:49:07.000+00:00,2023-08-03T09:49:07.000+00:00,2023-08-03T09:49:07.000+00:00,0,,622595,fake://127.0.0.1:8080/repos/622595, |
Oops, something went wrong.