Skip to content
This repository has been archived by the owner on Jul 23, 2024. It is now read-only.

Introduce Jira Tasks #130

Merged
merged 1 commit into from
Apr 3, 2023

Conversation

rgolangh
Copy link
Contributor

@rgolangh rgolangh commented Mar 20, 2023

Introduce Jira tasks that supports the following behaviour:

  • create:
    pass empty ID, with details:
    { id: "" , title: "title", description: "description" }
  • update:
    specify ID, specify new title, new status, and new comments to add:
    {
    id: "PROJECT-123",
    title: "edited title",
    status: "new status (in-progress, refinement, closed, etc)",
    comments: [ "new comment to add" ],
    }

Returned value: new work report of type JiraWorkReport containing the
json object of the response (and the actual ticket)

Signed-off-by: Roy Golan rgolan@redhat.com

FLPATH-175

<groupId>com.atlassian.jira</groupId>
<artifactId>jira-api</artifactId>
<version>${atlassian.product.version}</version>
<scope>provided</scope>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why provided? which module should make sure this is available in runtime?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. This dependency should be part of the tasks jar.

import com.redhat.parodos.workflows.work.WorkStatus;
import lombok.extern.slf4j.Slf4j;

import java.util.*;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pls expand *

int timeoutInSeconds = DEFAULT_EXECUTION_TIMEOUT_IN_SECONDS;

JiraTaskParams(WorkContext workContext) {
this.id = (String) workContext.get("id");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the parameter names might be too generic in a context that may be shared among several tasks.
assuming I'm not mistaken here :-)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to come up with some best practices for naming

JiraTicket ticket = getTicketByID(p.id);

// title difference? update title (assuming ticket titles returning from jira are always non-blank)
if (ticket.title != p.title && (p.title != null && !p.title.isBlank())) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are you comparing the references? IIRC, should use equal() instead (or StringUtils.equal or whatever is trendy nowadays :-P )

}

// adding comments?
if (p.comment != null && !p.comment.isBlank()) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

StringUtils.isBlank(p.comment) ?


}

return new JiraWorkReport(workContext, WorkStatus.COMPLETED, new JiraTicket());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't return the populated ticket instead of new JiraTicket() ?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not to add it to workContext?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about adding jira package instead of reusing shell?

@rgolangh
Copy link
Contributor Author

@masayag this PR is still WIP, so expect tons of trash. no need to review atm. BUT the fact that Go made me think != for strings is okay in Java is hillarious 😢 😄 thanks for that catch

<groupId>com.atlassian.jira</groupId>
<artifactId>jira-api</artifactId>
<version>${atlassian.product.version}</version>
<scope>provided</scope>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. This dependency should be part of the tasks jar.

int timeoutInSeconds = DEFAULT_EXECUTION_TIMEOUT_IN_SECONDS;

JiraTaskParams(WorkContext workContext) {
this.id = (String) workContext.get("id");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to come up with some best practices for naming


}

return new JiraWorkReport(workContext, WorkStatus.COMPLETED, new JiraTicket());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not to add it to workContext?

private JiraTicket ticket;
public JiraWorkReport(WorkContext workContext, WorkStatus workStatus, JiraTicket jiraTicket) {
this.workContext = workContext;
this.workStatus = workStatus;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what do we want to do with jiraTicket here?

pom.xml Outdated
@@ -63,6 +63,13 @@
<module>pattern-detection-library</module>
<module>coverage</module>
</modules>
<dependencies>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not see any tests in root module. Why do we need it?

@rgolangh rgolangh force-pushed the add_jira_tasks branch 3 times, most recently from be8216e to 1b358c4 Compare March 30, 2023 13:02
Introduce Jira tasks that supports the following behaviour:
- create:
    pass empty ID, with details:
    { id: "" , title: "title", description: "description" }
- update:
    specify ID, specify new title, new status, and new comments to add:
    {
      id: "PROJECT-123",
      title: "edited title",
      status: "new status (in-progress, refinement, closed, etc)",
      comments: [ "new comment to add" ],
    }

Returned value: a new DefaultWorkReport containing a new
context with the JiraIssue under "issue" key.

Signed-off-by: Roy Golan <rgolan@redhat.com>
@rgolangh rgolangh changed the title WIP: Introduce Jira Tasks Introduce Jira Tasks Apr 3, 2023
@openshift-ci
Copy link

openshift-ci bot commented Apr 3, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: RichardW98

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved label Apr 3, 2023
@openshift-merge-robot openshift-merge-robot merged commit 359f431 into parodos-dev:main Apr 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants