-
Notifications
You must be signed in to change notification settings - Fork 27
Introduce Jira Tasks #130
Introduce Jira Tasks #130
Conversation
parodos-model-api/pom.xml
Outdated
<groupId>com.atlassian.jira</groupId> | ||
<artifactId>jira-api</artifactId> | ||
<version>${atlassian.product.version}</version> | ||
<scope>provided</scope> |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.*; |
There was a problem hiding this comment.
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"); |
There was a problem hiding this comment.
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 :-)
There was a problem hiding this comment.
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())) { |
There was a problem hiding this comment.
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()) { |
There was a problem hiding this comment.
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()); |
There was a problem hiding this comment.
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()
?
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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
?
@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 |
parodos-model-api/pom.xml
Outdated
<groupId>com.atlassian.jira</groupId> | ||
<artifactId>jira-api</artifactId> | ||
<version>${atlassian.product.version}</version> | ||
<scope>provided</scope> |
There was a problem hiding this comment.
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"); |
There was a problem hiding this comment.
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()); |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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?
parodos-model-api/src/test/java/com/redhat/parodos/workflow/task/shell/ShellRunnerTaskTest.java
Outdated
Show resolved
Hide resolved
pom.xml
Outdated
@@ -63,6 +63,13 @@ | |||
<module>pattern-detection-library</module> | |||
<module>coverage</module> | |||
</modules> | |||
<dependencies> |
There was a problem hiding this comment.
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?
be8216e
to
1b358c4
Compare
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>
[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 |
Introduce Jira tasks that supports the following behaviour:
pass empty ID, with details:
{ id: "" , title: "title", description: "description" }
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