klesh commented on code in PR #2401: URL: https://github.com/apache/incubator-devlake/pull/2401#discussion_r931083458
########## plugins/jira/tasks/epic_collector.go: ########## @@ -0,0 +1,145 @@ +/* +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 tasks + +import ( + "fmt" + "github.com/apache/incubator-devlake/plugins/core" + "github.com/apache/incubator-devlake/plugins/core/dal" + "strings" + + "encoding/json" + "github.com/apache/incubator-devlake/plugins/helper" + "io/ioutil" + "net/http" + "net/url" +) + +const RAW_EPIC_TABLE = "jira_api_epics" + +type JiraEpicParams struct { Review Comment: Why not use `JiraApiParams`? ########## plugins/jira/tasks/epic_collector.go: ########## @@ -0,0 +1,145 @@ +/* +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 tasks + +import ( + "fmt" + "github.com/apache/incubator-devlake/plugins/core" + "github.com/apache/incubator-devlake/plugins/core/dal" + "strings" + + "encoding/json" + "github.com/apache/incubator-devlake/plugins/helper" + "io/ioutil" + "net/http" + "net/url" +) + +const RAW_EPIC_TABLE = "jira_api_epics" + +type JiraEpicParams struct { + ConnectionId uint64 + BoardId uint64 +} + +var _ core.SubTaskEntryPoint = CollectIssues + +var CollectEpicsMeta = core.SubTaskMeta{ + Name: "collectEpics", + EntryPoint: CollectEpics, + EnabledByDefault: true, + Description: "collect Jira epics from all boards", + DomainTypes: []string{core.DOMAIN_TYPE_TICKET, core.DOMAIN_TYPE_CROSS}, +} + +func CollectEpics(taskCtx core.SubTaskContext) error { + db := taskCtx.GetDal() + data := taskCtx.GetData().(*JiraTaskData) + externalEpicKeys, err := GetEpicKeys(db, data) Review Comment: Loading all epic_keys is fine in most cases, but it could be a problem when the total number of epics grows too big. say 1000? Not sure if Jira API would take that many keys. Besides, it is pointless to send all the keys every time, since the max records we can get is 100. I suggest that we create an `Iterator` as the `Input` that returns 100 keys max each time. ########## plugins/jira/e2e/epic_test.go: ########## @@ -0,0 +1,82 @@ +package e2e Review Comment: Please add ASF header -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
