This is an automated email from the ASF dual-hosted git repository.

klesh pushed a commit to branch fix-jenkins-primary-view-truncation
in repository https://gitbox.apache.org/repos/asf/devlake.git

commit fd392babab8277dd971910d7de759b7bc0d6397b
Author: Klesh Wong <[email protected]>
AuthorDate: Wed Jun 3 12:05:48 2026 +0800

    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 https://github.com/apache/devlake/issues/8897
---
 backend/plugins/jenkins/models/response.go | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/backend/plugins/jenkins/models/response.go 
b/backend/plugins/jenkins/models/response.go
index 643bec691..93eae397b 100644
--- a/backend/plugins/jenkins/models/response.go
+++ b/backend/plugins/jenkins/models/response.go
@@ -61,6 +61,11 @@ func (j Job) ToJenkinsJob() *JenkinsJob {
                }
        }
 
+       primaryView := j.URL + j.Path + j.Class
+       if len(primaryView) > 255 {
+               primaryView = primaryView[:255]
+       }
+
        return &JenkinsJob{
                FullName:    j.FullName,
                Name:        j.Name,
@@ -70,7 +75,7 @@ func (j Job) ToJenkinsJob() *JenkinsJob {
                Base:        j.Base,
                Url:         j.URL,
                Description: j.Description,
-               PrimaryView: j.URL + j.Path + j.Class,
+               PrimaryView: primaryView,
        }
 }
 

Reply via email to