This is an automated email from the ASF dual-hosted git repository.
klesh 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 0ecfbb030 Truncate name of timeline records to fit into database field
(#8372)
0ecfbb030 is described below
commit 0ecfbb0304fba4ac3084eaced883592760c64cd1
Author: Jonathan Mezach <[email protected]>
AuthorDate: Tue Apr 8 10:33:17 2025 +0200
Truncate name of timeline records to fit into database field (#8372)
* Add migration for making the name column longer
Signed-off-by: Jonathan Mezach <[email protected]>
* Truncate name instead
Signed-off-by: Jonathan Mezach <[email protected]>
* Handle scenario where string is shorter than 255 characters
Signed-off-by: Jonathan Mezach <[email protected]>
---------
Signed-off-by: Jonathan Mezach <[email protected]>
---
.../azuredevops_go/tasks/ci_cd_timeline_records_extractor.go | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git
a/backend/plugins/azuredevops_go/tasks/ci_cd_timeline_records_extractor.go
b/backend/plugins/azuredevops_go/tasks/ci_cd_timeline_records_extractor.go
index 1a93ce542..772915e1e 100644
--- a/backend/plugins/azuredevops_go/tasks/ci_cd_timeline_records_extractor.go
+++ b/backend/plugins/azuredevops_go/tasks/ci_cd_timeline_records_extractor.go
@@ -19,6 +19,7 @@ package tasks
import (
"encoding/json"
+
"github.com/apache/incubator-devlake/core/errors"
"github.com/apache/incubator-devlake/core/plugin"
"github.com/apache/incubator-devlake/helpers/pluginhelper/api"
@@ -41,6 +42,13 @@ var ExtractApiBuildRecordsMeta = plugin.SubTaskMeta{
},
}
+func truncateString(s string, maxLength int) string {
+ if len(s) > maxLength {
+ return s[:maxLength]
+ }
+ return s
+}
+
func ExtractApiTimelineTasks(taskCtx plugin.SubTaskContext) errors.Error {
rawDataSubTaskArgs, data := CreateRawDataSubTaskArgs(taskCtx,
RawTimelineRecordTable)
@@ -67,7 +75,7 @@ func ExtractApiTimelineTasks(taskCtx plugin.SubTaskContext)
errors.Error {
BuildId: input.AzuredevopsId,
ParentId: recordApi.ParentId,
Type: "",
- Name: recordApi.Name,
+ Name: truncateString(recordApi.Name,
255),
StartTime: recordApi.StartTime,
FinishTime: recordApi.FinishTime,
State: recordApi.State,