-
Notifications
You must be signed in to change notification settings - Fork 552
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* feat(dora): add incident related tables * fix(ci): fix lint/e2e/test errors * fix(ci): fix unit test errors * feat(webhook): issues with type = "INCIDENT" will be stored/updated in table `incidents` * fix(incident): fix method `IsIncident` * feat(dora): add new option `DisableIssueToIncidentGenerator` * fix(dora): fix test
- Loading branch information
Showing
27 changed files
with
615 additions
and
50 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
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 ticket | ||
|
||
import ( | ||
"github.com/apache/incubator-devlake/core/models/domainlayer" | ||
"time" | ||
) | ||
|
||
// Incident comes from two tables: issues and pull_requests, it won't be produced from tool layer tables so far. | ||
// 1.From issues, all fields are the same with issues' record, include id field. | ||
// 2.From pull_requests, id field is pull_requests.id, other fields should be transformed or calculated. | ||
type Incident struct { | ||
domainlayer.DomainEntity | ||
Url string `gorm:"type:varchar(255)"` | ||
IncidentKey string `gorm:"type:varchar(255)"` // issue_key/pull_request_key | ||
Title string | ||
Description string | ||
Status string `gorm:"type:varchar(100)"` | ||
OriginalStatus string `gorm:"type:varchar(100)"` | ||
ResolutionDate *time.Time | ||
CreatedDate *time.Time | ||
UpdatedDate *time.Time | ||
LeadTimeMinutes *uint | ||
OriginalEstimateMinutes *int64 | ||
TimeSpentMinutes *int64 | ||
TimeRemainingMinutes *int64 | ||
CreatorId string `gorm:"type:varchar(255)"` | ||
CreatorName string `gorm:"type:varchar(255)"` | ||
ParentIncidentId string `gorm:"type:varchar(255)"` | ||
Priority string `gorm:"type:varchar(255)"` | ||
Severity string `gorm:"type:varchar(255)"` | ||
Urgency string `gorm:"type:varchar(255)"` | ||
Component string `gorm:"type:varchar(255)"` | ||
OriginalProject string `gorm:"type:varchar(255)"` | ||
} | ||
|
||
func (Incident) TableName() string { | ||
return "incidents" | ||
} |
32 changes: 32 additions & 0 deletions
32
backend/core/models/domainlayer/ticket/incident_assginee.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,32 @@ | ||
/* | ||
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 ticket | ||
|
||
import "github.com/apache/incubator-devlake/core/models/common" | ||
|
||
type IncidentAssignee struct { | ||
IncidentId string `gorm:"primaryKey;type:varchar(255)"` | ||
AssigneeId string `gorm:"primaryKey;type:varchar(255)"` | ||
AssigneeName string `gorm:"type:varchar(255)"` | ||
|
||
common.NoPKModel | ||
} | ||
|
||
func (IncidentAssignee) TableName() string { | ||
return "incident_assignees" | ||
} |
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
43 changes: 43 additions & 0 deletions
43
backend/core/models/migrationscripts/20240621_init_incidents_and_incident_assignees.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,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/core/context" | ||
"github.com/apache/incubator-devlake/core/errors" | ||
"github.com/apache/incubator-devlake/core/models/migrationscripts/archived" | ||
"github.com/apache/incubator-devlake/helpers/migrationhelper" | ||
) | ||
|
||
type initIncidentRelatedTables struct{} | ||
|
||
func (u *initIncidentRelatedTables) Up(basicRes context.BasicRes) errors.Error { | ||
return migrationhelper.AutoMigrateTables( | ||
basicRes, | ||
&archived.IncidentAssignee{}, | ||
&archived.Incident{}, | ||
) | ||
} | ||
|
||
func (*initIncidentRelatedTables) Version() uint64 { | ||
return 20240621152500 | ||
} | ||
|
||
func (*initIncidentRelatedTables) Name() string { | ||
return "init tables: incidents and incident_assignees" | ||
} |
39 changes: 39 additions & 0 deletions
39
backend/core/models/migrationscripts/20240621_rename_project_issue_metrics.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,39 @@ | ||
/* | ||
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/models/migrationscripts/archived" | ||
) | ||
|
||
type renameProjectIssueMetrics struct{} | ||
|
||
func (u *renameProjectIssueMetrics) Up(basicRes context.BasicRes) errors.Error { | ||
db := basicRes.GetDal() | ||
return db.RenameTable(archived.ProjectIssueMetric{}.TableName(), "project_incident_deployment_relationships") | ||
} | ||
|
||
func (*renameProjectIssueMetrics) Version() uint64 { | ||
return 20240621162000 | ||
} | ||
|
||
func (*renameProjectIssueMetrics) Name() string { | ||
return "rename project_issue_metrics to project_incident_deployment_relationships" | ||
} |
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,52 @@ | ||
/* | ||
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 archived | ||
|
||
import ( | ||
"time" | ||
) | ||
|
||
type Incident struct { | ||
DomainEntity | ||
Url string `gorm:"type:varchar(255)"` | ||
IncidentKey string `gorm:"type:varchar(255)"` // issue_key/pull_request_key | ||
Title string | ||
Description string | ||
Status string `gorm:"type:varchar(100)"` | ||
OriginalStatus string `gorm:"type:varchar(100)"` | ||
ResolutionDate *time.Time | ||
CreatedDate *time.Time | ||
UpdatedDate *time.Time | ||
LeadTimeMinutes *uint | ||
OriginalEstimateMinutes *int64 | ||
TimeSpentMinutes *int64 | ||
TimeRemainingMinutes *int64 | ||
CreatorId string `gorm:"type:varchar(255)"` | ||
CreatorName string `gorm:"type:varchar(255)"` | ||
ParentIncidentId string `gorm:"type:varchar(255)"` | ||
Priority string `gorm:"type:varchar(255)"` | ||
Severity string `gorm:"type:varchar(255)"` | ||
Urgency string `gorm:"type:varchar(255)"` | ||
Component string `gorm:"type:varchar(255)"` | ||
|
||
OriginalProject string `gorm:"type:varchar(255)"` | ||
} | ||
|
||
func (Incident) TableName() string { | ||
return "incidents" | ||
} |
Oops, something went wrong.