Skip to content

Commit ecb905d

Browse files
authored
fix(jenkins): truncate primary_view to fit varchar(255) column (#8899)
* fix(jenkins): truncate primary_view to fit varchar(255) column Fixes Error 1406 (22001): Data too long for column 'primary_view' by truncating the concatenated value to 255 characters before saving. Closes #8897 * ci: exclude generated mocks from golangci-lint
1 parent 31ea530 commit ecb905d

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

backend/.golangci.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@ linters:
243243
- third_party$
244244
- builtin$
245245
- examples$
246+
- mocks$
246247
formatters:
247248
enable:
248249
- gofmt

backend/plugins/jenkins/models/response.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ func (j Job) ToJenkinsJob() *JenkinsJob {
6161
}
6262
}
6363

64+
primaryView := j.URL + j.Path + j.Class
65+
if len(primaryView) > 255 {
66+
primaryView = primaryView[:255]
67+
}
68+
6469
return &JenkinsJob{
6570
FullName: j.FullName,
6671
Name: j.Name,
@@ -70,7 +75,7 @@ func (j Job) ToJenkinsJob() *JenkinsJob {
7075
Base: j.Base,
7176
Url: j.URL,
7277
Description: j.Description,
73-
PrimaryView: j.URL + j.Path + j.Class,
78+
PrimaryView: primaryView,
7479
}
7580
}
7681

0 commit comments

Comments
 (0)