You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2019/11/18 22:31:52 UTC

[GitHub] [incubator-pinot] jihaozh commented on a change in pull request #4829: [TE][notification] Jira Alerting improvements

jihaozh commented on a change in pull request #4829: [TE][notification] Jira Alerting improvements
URL: https://github.com/apache/incubator-pinot/pull/4829#discussion_r347643278
 
 

 ##########
 File path: thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/notification/commons/ThirdEyeJiraClient.java
 ##########
 @@ -135,33 +161,82 @@ public void reopenIssue(Issue issue) {
   public void updateIssue(Issue issue, JiraEntity jiraEntity) {
     IssueInput issueInput = new IssueInputBuilder()
         .setAssigneeName(jiraEntity.getAssignee())
-        .setFieldInput(new FieldInput(IssueFieldId.LABELS_FIELD, jiraEntity.getLabels()))
-        // TODO: Will test this in the subsequent PR and then enable it
-        //.setFieldInput(new FieldInput(IssueFieldId.ATTACHMENT_FIELD, jiraEntity.getSnapshot()))
+        .setFieldInput(new FieldInput(PROP_LABELS, jiraEntity.getLabels()))
         .build();
 
     String prevAssignee = issue.getAssignee() == null ? "unassigned" : issue.getAssignee().getName();
     LOG.info("Updating Jira {} with [assignee={}, labels={}]. Previous state [assignee={}, labels={}]", issue.getKey(),
         jiraEntity.getAssignee(), jiraEntity.getLabels(), prevAssignee, issue.getLabels());
     restClient.getIssueClient().updateIssue(issue.getKey(), issueInput).claim();
+    restClient.getIssueClient().addAttachments(issue.getAttachmentsUri(), jiraEntity.getSnapshot()).claim();
+  }
+
+  Iterable<CimProject> getProjectMetadata(JiraEntity jiraEntity) {
+    return restClient.getIssueClient().getCreateIssueMetadata(new GetCreateIssueMetadataOptionsBuilder()
+        .withProjectKeys(jiraEntity.getJiraProject())
+        .withIssueTypeIds(jiraEntity.getJiraIssueTypeId())
+        .withExpandedIssueTypesFields()
+        .build()).claim();
+  }
+
+  private Map<String, CimFieldInfo> getIssueRequiredCreateFields(JiraEntity jiraEntity) {
+    Map<String, CimFieldInfo> requiredCreateFields = new HashMap<>();
+    CimProject project = getProjectMetadata(jiraEntity).iterator().next();
+    CimIssueType issueType = project.getIssueTypes().iterator().next();
 
 Review comment:
   should we check `iterator().hasNext()` first?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org