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

abeizn pushed a commit to branch feat-zk-release-v1.0
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git


The following commit(s) were added to refs/heads/feat-zk-release-v1.0 by this 
push:
     new 884a7d945 feat: temp jira issue trace test
884a7d945 is described below

commit 884a7d9456c3a673af94a26de3b9715a3b0897bb
Author: abeizn <[email protected]>
AuthorDate: Mon Sep 30 09:41:48 2024 +0800

    feat: temp jira issue trace test
---
 backend/plugins/jira/api/blueprint_v200.go         | 17 ++++++++++
 .../jira/models/migrationscripts/20240926_sss.go   | 36 ++++++++++++++++++++++
 .../jira/models/migrationscripts/register.go       |  1 +
 backend/plugins/jira/models/scope_config.go        |  1 +
 4 files changed, 55 insertions(+)

diff --git a/backend/plugins/jira/api/blueprint_v200.go 
b/backend/plugins/jira/api/blueprint_v200.go
index e3859286b..3281ff9e0 100644
--- a/backend/plugins/jira/api/blueprint_v200.go
+++ b/backend/plugins/jira/api/blueprint_v200.go
@@ -94,6 +94,23 @@ func makeDataSourcePipelinePlanV200(
                }
 
                stage = append(stage, task)
+               // add issue_trace stage
+               if scopeConfig == nil || scopeConfig.EnableIssueTrace == nil || 
*scopeConfig.EnableIssueTrace {
+                       j := i + 1
+                       if j == len(plan) {
+                               plan = append(plan, nil)
+                       }
+                       plan[j] = coreModels.PipelineStage{
+                               {
+                                       Plugin: "issue_trace",
+                                       Options: map[string]interface{}{
+                                               "plugin":       "issue_trace",
+                                               "connectionId": connection.ID,
+                                               "boardId":      scope.BoardId,
+                                       },
+                               },
+                       }
+               }
                plan[i] = stage
        }
 
diff --git a/backend/plugins/jira/models/migrationscripts/20240926_sss.go 
b/backend/plugins/jira/models/migrationscripts/20240926_sss.go
new file mode 100644
index 000000000..d7b5fa584
--- /dev/null
+++ b/backend/plugins/jira/models/migrationscripts/20240926_sss.go
@@ -0,0 +1,36 @@
+/*
+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/helpers/migrationhelper"
+)
+type jiraScopeConfig20240926 struct {
+       EnableIssueTrace *bool `json:"enableIssueTrace" gorm:"type:boolean"`
+}
+func (jiraScopeConfig20240926) TableName() string {
+       return "_tool_jira_scope_configs"
+}
+type addEnableIssueTrace20240926 struct{}
+func (script *addEnableIssueTrace20240926) Up(basicRes context.BasicRes) 
errors.Error {
+       return migrationhelper.AutoMigrateTables(basicRes, 
&jiraScopeConfig20240926{})
+}
+func (*addEnableIssueTrace20240926) Version() uint64 {
+       return 20240926142316
+}
+func (*addEnableIssueTrace20240926) Name() string {
+       return "add enable_issue_trace to scope config"
+}
\ No newline at end of file
diff --git a/backend/plugins/jira/models/migrationscripts/register.go 
b/backend/plugins/jira/models/migrationscripts/register.go
index 5f32aef7c..a77c90087 100644
--- a/backend/plugins/jira/models/migrationscripts/register.go
+++ b/backend/plugins/jira/models/migrationscripts/register.go
@@ -53,5 +53,6 @@ func All() []plugin.MigrationScript {
                new(addIssueFieldTable),
                new(changeIssueComponentType),
                new(flushJiraIssues),
+               new(addEnableIssueTrace20240926),
        }
 }
diff --git a/backend/plugins/jira/models/scope_config.go 
b/backend/plugins/jira/models/scope_config.go
index bb267a0f6..5135f6e5e 100644
--- a/backend/plugins/jira/models/scope_config.go
+++ b/backend/plugins/jira/models/scope_config.go
@@ -48,6 +48,7 @@ type JiraScopeConfig struct {
        RemotelinkRepoPattern      []CommitUrlPattern     
`mapstructure:"remotelinkRepoPattern,omitempty" json:"remotelinkRepoPattern" 
gorm:"type:json;serializer:json"`
        TypeMappings               map[string]TypeMapping 
`mapstructure:"typeMappings,omitempty" json:"typeMappings" 
gorm:"type:json;serializer:json"`
        ApplicationType            string                 
`mapstructure:"applicationType,omitempty" json:"applicationType" 
gorm:"type:varchar(255)"`
+       EnableIssueTrace           *bool                  
`mapstructure:"enableIssueTrace,omitempty" json:"enableIssueTrace" 
gorm:"type:boolean"`
 }
 
 func (r *JiraScopeConfig) SetConnectionId(c *JiraScopeConfig, connectionId 
uint64) {

Reply via email to