You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by wa...@apache.org on 2022/06/17 03:15:39 UTC

[incubator-devlake] branch release-v0.11-hotfix updated (94c41258 -> 23a63607)

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

warren pushed a change to branch release-v0.11-hotfix
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git


    from 94c41258 feat: collect jira status (#2182) (#2196)
     new b4d52c05 add jira issue label
     new 23a63607 fix(jira): minor bug (#2225)

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 plugins/jira/jira.go                               |  1 +
 plugins/jira/models/issue_label.go                 | 19 ++++++++++++
 ...Schemas20220614.go => updateSchemas20220616.go} | 34 ++++++++++------------
 plugins/jira/tasks/apiv2models/issue.go            |  2 +-
 plugins/jira/tasks/issue_extractor.go              |  9 ++++++
 5 files changed, 46 insertions(+), 19 deletions(-)
 create mode 100644 plugins/jira/models/issue_label.go
 copy plugins/jira/models/migrationscripts/{updateSchemas20220614.go => updateSchemas20220616.go} (60%)


[incubator-devlake] 01/02: add jira issue label

Posted by wa...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

warren pushed a commit to branch release-v0.11-hotfix
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git

commit b4d52c053cfa62d8c04ec5eb7d2471be032efbe0
Author: moon.li <mo...@paytm.com>
AuthorDate: Thu Jun 16 17:17:40 2022 +0800

    add jira issue label
    
    Signed-off-by: moon.li <mo...@paytm.com>
---
 plugins/jira/jira.go                               |  1 -
 plugins/jira/models/issue_label.go                 | 19 ++++++++
 .../migrationscripts/updateSchemas20220616.go      | 52 ++++++++++++++++++++++
 plugins/jira/tasks/apiv2models/issue.go            |  2 +-
 plugins/jira/tasks/issue_extractor.go              | 10 +++++
 5 files changed, 82 insertions(+), 2 deletions(-)

diff --git a/plugins/jira/jira.go b/plugins/jira/jira.go
index 6fe00730..92a9a9aa 100644
--- a/plugins/jira/jira.go
+++ b/plugins/jira/jira.go
@@ -156,7 +156,6 @@ func (plugin Jira) MigrationScripts() []migration.Script {
 		new(migrationscripts.UpdateSchemas20220525),
 		new(migrationscripts.UpdateSchemas20220526),
 		new(migrationscripts.UpdateSchemas20220527),
-		new(migrationscripts.UpdateSchemas20220614),
 	}
 }
 
diff --git a/plugins/jira/models/issue_label.go b/plugins/jira/models/issue_label.go
new file mode 100644
index 00000000..0f9cfbdd
--- /dev/null
+++ b/plugins/jira/models/issue_label.go
@@ -0,0 +1,19 @@
+package models
+
+import (
+	"github.com/apache/incubator-devlake/models/common"
+)
+
+// Please note that Issue Labels can also apply to Pull Requests.
+// Pull Requests are considered Issues in GitHub.
+
+type JiraIssueLabel struct {
+	ConnectionId uint64 `gorm:"primaryKey;autoIncrement:false"`
+	IssueId      uint64 `gorm:"primaryKey;autoIncrement:false"`
+	LabelName    string `gorm:"primaryKey;type:varchar(255)"`
+	common.NoPKModel
+}
+
+func (JiraIssueLabel) TableName() string {
+	return "_tool_jira_issue_labels"
+}
diff --git a/plugins/jira/models/migrationscripts/updateSchemas20220616.go b/plugins/jira/models/migrationscripts/updateSchemas20220616.go
new file mode 100644
index 00000000..a02f7fda
--- /dev/null
+++ b/plugins/jira/models/migrationscripts/updateSchemas20220616.go
@@ -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 migrationscripts
+
+import (
+	"context"
+	"github.com/apache/incubator-devlake/models/migrationscripts/archived"
+
+	"gorm.io/gorm"
+)
+
+type JiraIssueLabel0616 struct {
+	ConnectionId uint64 `gorm:"primaryKey;autoIncrement:false"`
+	IssueId      uint64 `gorm:"primaryKey;autoIncrement:false"`
+	LabelName    string `gorm:"primaryKey;type:varchar(255)"`
+	archived.NoPKModel
+}
+
+func (JiraIssueLabel0616) TableName() string {
+	return "_tool_jira_issue_labels"
+}
+
+type UpdateSchemas20220616 struct{}
+
+func (*UpdateSchemas20220616) Up(ctx context.Context, db *gorm.DB) error {
+
+	err := db.Migrator().AutoMigrate(JiraIssueLabel0616{})
+	return err
+}
+
+func (*UpdateSchemas20220616) Version() uint64 {
+	return 20220616154646
+}
+
+func (*UpdateSchemas20220616) Name() string {
+	return "add jira issue labels"
+}
diff --git a/plugins/jira/tasks/apiv2models/issue.go b/plugins/jira/tasks/apiv2models/issue.go
index c6a70d80..9efafde7 100644
--- a/plugins/jira/tasks/apiv2models/issue.go
+++ b/plugins/jira/tasks/apiv2models/issue.go
@@ -91,7 +91,7 @@ type Issue struct {
 			Name    string `json:"name"`
 			ID      uint64 `json:"id,string"`
 		} `json:"priority"`
-		Labels                        []interface{}      `json:"labels"`
+		Labels                        []string           `json:"labels"`
 		Timeestimate                  interface{}        `json:"timeestimate"`
 		Aggregatetimeoriginalestimate interface{}        `json:"aggregatetimeoriginalestimate"`
 		Versions                      []interface{}      `json:"versions"`
diff --git a/plugins/jira/tasks/issue_extractor.go b/plugins/jira/tasks/issue_extractor.go
index 62acc4f7..e0e235eb 100644
--- a/plugins/jira/tasks/issue_extractor.go
+++ b/plugins/jira/tasks/issue_extractor.go
@@ -135,6 +135,16 @@ func ExtractIssues(taskCtx core.SubTaskContext) error {
 				BoardId:      boardId,
 				IssueId:      issue.IssueId,
 			})
+			labels := apiIssue.Fields.Labels
+			for _, v := range labels {
+				issueLabel := &models.JiraIssueLabel{
+					IssueId:      issue.IssueId,
+					LabelName:    v,
+					ConnectionId: data.Options.ConnectionId,
+				}
+				results = append(results, issueLabel)
+			}
+			return results, nil
 			return results, nil
 		},
 	})


[incubator-devlake] 02/02: fix(jira): minor bug (#2225)

Posted by wa...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

warren pushed a commit to branch release-v0.11-hotfix
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git

commit 23a6360764caf434d80d7df577954d6716bc3ef5
Author: Warren Chen <yi...@merico.dev>
AuthorDate: Thu Jun 16 20:30:46 2022 +0800

    fix(jira): minor bug (#2225)
    
    closes #2218
---
 plugins/jira/jira.go                  | 2 ++
 plugins/jira/tasks/issue_extractor.go | 1 -
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/plugins/jira/jira.go b/plugins/jira/jira.go
index 92a9a9aa..5c10467a 100644
--- a/plugins/jira/jira.go
+++ b/plugins/jira/jira.go
@@ -156,6 +156,8 @@ func (plugin Jira) MigrationScripts() []migration.Script {
 		new(migrationscripts.UpdateSchemas20220525),
 		new(migrationscripts.UpdateSchemas20220526),
 		new(migrationscripts.UpdateSchemas20220527),
+		new(migrationscripts.UpdateSchemas20220614),
+		new(migrationscripts.UpdateSchemas20220616),
 	}
 }
 
diff --git a/plugins/jira/tasks/issue_extractor.go b/plugins/jira/tasks/issue_extractor.go
index e0e235eb..c4e9cca5 100644
--- a/plugins/jira/tasks/issue_extractor.go
+++ b/plugins/jira/tasks/issue_extractor.go
@@ -145,7 +145,6 @@ func ExtractIssues(taskCtx core.SubTaskContext) error {
 				results = append(results, issueLabel)
 			}
 			return results, nil
-			return results, nil
 		},
 	})