forked from mieliespoor/incubator-devlake
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add original_environment fields (apache#6889)
* feat(db): add original_envionment field to table cicd_deployments and cicd_deployment_commits * feat(plugins): add original_environment field * fix(e2e): fix e2e test * feat(gitlab): disable `CollectApiTriggerJobs` by default * fix(e2e): fix e2e errors
- Loading branch information
1 parent
a2f1ce1
commit 8a5a2c5
Showing
22 changed files
with
322 additions
and
229 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
81 changes: 81 additions & 0 deletions
81
backend/core/models/migrationscripts/20240129_add_original_environment.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,81 @@ | ||
/* | ||
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" | ||
"net/url" | ||
) | ||
|
||
var _ plugin.MigrationScript = (*addOriginalEnvironmentToCicdDeploymentsAndCicdDeploymentCommits)(nil) | ||
|
||
type cicdDeployment20240129 struct { | ||
OriginalEnvironment string `gorm:"type:varchar(255)"` | ||
} | ||
|
||
func (cicdDeployment20240129) TableName() string { | ||
return "cicd_deployments" | ||
} | ||
|
||
type cicdDeploymentCommit20240129 struct { | ||
OriginalEnvironment string `gorm:"type:varchar(255)"` | ||
} | ||
|
||
func (cicdDeploymentCommit cicdDeploymentCommit20240129) TableName() string { | ||
return "cicd_deployment_commits" | ||
} | ||
|
||
type addOriginalEnvironmentToCicdDeploymentsAndCicdDeploymentCommits struct{} | ||
|
||
func (*addOriginalEnvironmentToCicdDeploymentsAndCicdDeploymentCommits) Up(basicRes context.BasicRes) errors.Error { | ||
db := basicRes.GetDal() | ||
if err := db.AutoMigrate(&cicdDeployment20240129{}); err != nil { | ||
return err | ||
} | ||
if err := db.AutoMigrate(&cicdDeploymentCommit20240129{}); err != nil { | ||
return err | ||
} | ||
|
||
dbUrl := basicRes.GetConfig("DB_URL") | ||
if dbUrl == "" { | ||
return errors.BadInput.New("DB_URL is required") | ||
} | ||
u, errParse := url.Parse(dbUrl) | ||
if errParse != nil { | ||
return errors.Convert(errParse) | ||
} | ||
if u.Scheme == "mysql" { | ||
if err := db.Exec("alter table cicd_deployments modify original_environment varchar(255) after environment;"); err != nil { | ||
return err | ||
} | ||
if err := db.Exec("alter table cicd_deployment_commits modify original_environment varchar(255) after environment;"); err != nil { | ||
return err | ||
} | ||
} | ||
return nil | ||
} | ||
|
||
func (*addOriginalEnvironmentToCicdDeploymentsAndCicdDeploymentCommits) Version() uint64 { | ||
return 20240129150000 | ||
} | ||
|
||
func (*addOriginalEnvironmentToCicdDeploymentsAndCicdDeploymentCommits) Name() string { | ||
return "add original_environment to cicd_deployments and cicd_deployment_commits" | ||
} |
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
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,original_status,original_result,environment,created_date,queued_date,started_date,finished_date,duration_sec,queued_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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,original_environment,created_date,queued_date,started_date,finished_date,duration_sec,queued_duration_sec,commit_msg,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,2023-08-03T09:49:07.000+00:00,0,,,,622595,fake://127.0.0.1:8080/repos/622595, |
Oops, something went wrong.