-
Notifications
You must be signed in to change notification settings - Fork 26
MTA Assessment WF #354
MTA Assessment WF #354
Conversation
3598775
to
d8c74ed
Compare
24e0127
to
ee17910
Compare
ee17910
to
2c137ed
Compare
// this is the "migration issues" section from report from url.It assumed to be in | ||
// HTML format. In version 6.1 of MTA it can be | ||
// downloaded as csv and would be simpler to process, hopefully. | ||
URI uri = URI.create(reportURL).resolve("reports"); |
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.
should be "report"
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 actually needed to add a / in the end. but it works
return new DefaultWorkReport(WorkStatus.FAILED, workContext, | ||
new Exception("failed to parse report index. Missing reports/report_index_*")); | ||
} | ||
String migrationIssuesReport = downloadReport(uri.resolve(reportLinks.get(0).text())); |
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.
reportLinks.get(0) is <a href="reports/report_index_demo.html" style="float: left; margin-right: 5px; margin-top: 6px;"> *** </a>
, I think we only want "reports/report_index_demo.html"
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.
like mentioned on chat - I dropped the html rendering in favour of parsing the javascript data. all this code is gone now
} | ||
|
||
@Bean(name = "AnalyzeApplicationAssessment") | ||
@Assessment |
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.
should repoUrl and appName parameters be 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.
yeah I set them as workflow level params
.../java/com/redhat/parodos/examples/prebuilt/migrationtoolkit/MigrationAssessmentWorkflow.java
Outdated
Show resolved
Hide resolved
@rgolangh can we please finalize the PR this week? |
2c137ed
to
22a78fd
Compare
d58e4cd
to
134913f
Compare
Signed-off-by: Roy Golan <rgolan@redhat.com>
request.setMessageType("text"); | ||
request.setBody("Report URL: " + reportURL); | ||
request.subject("Migration Analysis Report Completed"); | ||
request.setUsernames(List.of("test")); |
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 this be the user that invoked the workflow instead of the default "test" value?
can be obtained by SecurityUtils.getUsername()
prettierrc.json
Outdated
@@ -0,0 +1 @@ | |||
{} |
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 is this file used for?
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.
that is a reminder to me that I didn't git ignore that yet!
|
||
@Configuration | ||
@Profile("local") |
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 is the reason to state a profile as part of the workflow-definition?
@@ -76,15 +78,24 @@ WorkFlowOption notSupportOption() { | |||
.setDescription("Non-Supported Workflow Steps").build(); | |||
} | |||
|
|||
@Bean | |||
WorkFlowOption analyzeOption() { | |||
return new WorkFlowOption.Builder("analyzeOption", "AnalyzeApplicationAssessment") |
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'd like to suggest adding a class named AnalysysConstants
or MTAConstants
that will list the constants used here and reduces the chances of misspelling the keys.
We don't have such a convention yet, but we have that as part of Move2kube and I find it useful.
public class MTAAnalysisReport { | ||
|
||
/** | ||
* migrationIssuesReport is assumed to be valid html. MTA 6.1 should supply a CSV as |
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 comment refers to migrationIssuesReport
but it is nowhere to be found in this PR.
could you update the comment and perhaps use javadoc style?
@@ -81,12 +71,16 @@ public SubmitAnalysisTask submitAnalysisTask(WorkFlow fetchReportURL) { | |||
} | |||
|
|||
@Bean | |||
public GetAnalysisTask getAnalysisTask() { | |||
return new GetAnalysisTask(URI.create(mtaUrl), "", messageConsumer()); | |||
public GetAnalysisTask getAnalysisTask(Notifier notifier) { |
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.
+100 for the Notifier. much more elegant and reusable.
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.context.annotation.Profile; | ||
|
||
import static com.redhat.parodos.workflows.workflow.SequentialFlow.Builder.aNewSequentialFlow; |
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.
no static imports should be allowed in the code. weird the checkstyle didn't fail for it.
it should be allowed only in tests (unless workflow-examples are excluded).
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?
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.
https://github.com/spring-projects/spring-framework/wiki/Code-Style#import-statements
Static imports should not be used in production code, but they should be used in test code, especially for things like import static org.assertj.core.api.Assertions.assertThat;.
workflow-example is considered to be production code
* An assessment workflow to analyze applications using Migration Toolkit for Applications | ||
* and return a move2kube option when needed. | ||
* <p> | ||
* This workflow will: - create an application with a name, and git repo URL - submit an |
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.
perhaps use
- tags to split into bullets to improve readability?
} | ||
|
||
@Bean("fetchReportURL") | ||
@Checker(cronExpression = "*/5 * * * * ?") |
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.
is 5s reasonable or should be a higher value?
public WorkReport execute(WorkContext workContext) { | ||
String reportURL; | ||
try { | ||
reportURL = getRequiredParameterValue("reportURL") + "/"; |
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.
is there a need to check the URL isn't already terminated by "/" ?
134913f
to
287a7ce
Compare
This is an assessment workflow which is based on the Migration Analysis infra workflow. The main differne is that the checker of that workflow downloads the html report and tries to extract a table of scores of issues found by the analysis. The ProcessAnalysisTask has a predicate passed in the constructor to test against the scores of the analysis and based on that the task returns the passOption or the defaultOption. The passOption is the next flow to invoke, that should be the move2kube. The flow is roughly: Start - Infra flow start - submit analysis report - End Start - Checker flow start - check report is ready - switch (is ready?) yes -> go to parse no -> go to check report is ready - parse - switch (match incidents on predicate) true - return pass option (move2kube) false - return default option - End Signed-off-by: Roy Golan <rgolan@redhat.com>
287a7ce
to
e67fa39
Compare
[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 |
[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 |
MTA Assessment Workflow