Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace odo analyze command #4330

Merged

Conversation

msivasubramaniaan
Copy link
Collaborator

@msivasubramaniaan msivasubramaniaan commented Jul 30, 2024

Ref: #4320

@davthomp
@vrubezhny

Below are the things missed and I don't know how to handle below two items. Let me know if you have any idea.
https://github.com/devfile/alizer doesn't provide any checksum on the release, So the CLI on our extension downloaded each time
alizer devfile command not having "name" key in the response. But odo analyze does
Ex: {
devfile: "java-maven",
devfileRegistry: "Test1",
devfileVersion: "1.3.1",
name: "org-eclipse-lemminx",
}

@codecov-commenter
Copy link

codecov-commenter commented Jul 30, 2024

Codecov Report

Attention: Patch coverage is 66.66667% with 11 lines in your changes missing coverage. Please review.

Project coverage is 43.94%. Comparing base (da60441) to head (7b2a13b).
Report is 439 commits behind head on main.

Files Patch % Lines
.../webview/create-component/createComponentLoader.ts 42.85% 8 Missing ⚠️
src/downloadUtil/downloadBinaries.ts 50.00% 2 Missing ⚠️
src/alizer/alizerWrapper.ts 91.66% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #4330       +/-   ##
===========================================
+ Coverage   32.37%   43.94%   +11.57%     
===========================================
  Files          85       96       +11     
  Lines        6505     7759     +1254     
  Branches     1349     1660      +311     
===========================================
+ Hits         2106     3410     +1304     
+ Misses       4399     4349       -50     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@msivasubramaniaan msivasubramaniaan changed the title Added alizer analyze command Replace odo analyze command Jul 30, 2024
@datho7561
Copy link
Contributor

I still don't think I get the point of this PR. If we are removing odo completely, then we won't be able to work with Devfiles, so we won't need to analyze which one to use.

I understand using alizer instead of odo for #4235 , but that's not what this is.

@msivasubramaniaan
Copy link
Collaborator Author

I still don't think I get the point of this PR. If we are removing odo completely, then we won't be able to work with Devfiles, so we won't need to analyze which one to use.

I understand using alizer instead of odo for #4235 , but that's not what this is.

Hello @datho7561
As this PR for just replace odo analyze command with alizer devfile. It is common for both component creation using git import and #4235

Copy link
Contributor

@datho7561 datho7561 left a comment

Choose a reason for hiding this comment

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

From my manual testing, this seems good. I noticed two small things in the code.

const parse = JSON.parse(cliData.stdout) as AnalyzeResponse[];
return parse;
const parse = JSON.parse(cliData.stdout) as AlizerAnalyzeResponse[];
return [[...parse].shift()];
Copy link
Contributor

Choose a reason for hiding this comment

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

Shift returns the first element. Why not just return the first element (or undefined if there is no element) and change the return type to Promise<AlizerAnalyzeResponse> ?

@@ -194,13 +194,12 @@ export class Odo {
);
}

public async analyze(currentFolderPath: string): Promise<AnalyzeResponse[]> {
public async alizerAnalyze(currentFolderPath: Uri): Promise<AlizerAnalyzeResponse[]> {
Copy link
Contributor

Choose a reason for hiding this comment

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

It might be a good idea to move this function to it's own file, since it no longer uses odo, and this file contains wrappers around odo commands

Signed-off-by: msivasubramaniaan <[email protected]>
Copy link
Contributor

@vrubezhny vrubezhny left a comment

Choose a reason for hiding this comment

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

odoWrapper test also needs some attention.

@@ -100,12 +101,12 @@ suite('./odo/odoWrapper.ts', function () {
});

test('analyze()', async function () {
Copy link
Contributor

Choose a reason for hiding this comment

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

@msivasubramaniaan The test('analyze()', async function () { test case should probably also be moved out from test/integration/odoWrapper.test.ts into a separate test, shouldn't it?

Signed-off-by: msivasubramaniaan <[email protected]>
Signed-off-by: msivasubramaniaan <[email protected]>
Signed-off-by: msivasubramaniaan <[email protected]>
Signed-off-by: msivasubramaniaan <[email protected]>
Signed-off-by: msivasubramaniaan <[email protected]>
Signed-off-by: msivasubramaniaan <[email protected]>
Signed-off-by: msivasubramaniaan <[email protected]>
Signed-off-by: msivasubramaniaan <[email protected]>
@vrubezhny
Copy link
Contributor

vrubezhny commented Aug 10, 2024

@msivasubramaniaan The related test are still failing:

1) Create component from git URL
2) "after each" hook: context for "Create component from git URL"
3) "after all" hook: context for "Create component from template project"

The first one looks like is hanging out or take a very long time to complete, causing the following tests to fail too. But it could be also that some alizer related code failure causes it not to finish successfully.

Could you please take a look?

@msivasubramaniaan
Copy link
Collaborator Author

@datho7561 and @vrubezhny Moved odo analyze command and corresponding test cases as well. Please review and merge. Once this merged I will make the #4235 PR ready

vrubezhny
vrubezhny previously approved these changes Aug 13, 2024
Copy link
Contributor

@vrubezhny vrubezhny left a comment

Choose a reason for hiding this comment

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

Looks good to me. Thanks!

test/integration/alizerWrapper.test.ts Outdated Show resolved Hide resolved
res.devfileVersion === version &&
res.devfileRegistry === registry.name,
),
return Array.from(compDescriptions).filter(({ name, version }) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

if (foo) {
  return true;
}
return false;

is the same as

return foo;

If you find the first version easier to understand feel free to keep it, but I personally tend to prefer the second version.

Signed-off-by: msivasubramaniaan <[email protected]>
Signed-off-by: msivasubramaniaan <[email protected]>
Copy link
Contributor

@datho7561 datho7561 left a comment

Choose a reason for hiding this comment

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

Looks good to me. Thanks, Muthu!

@datho7561 datho7561 merged commit 44ebc51 into redhat-developer:main Aug 16, 2024
4 checks passed
@msivasubramaniaan msivasubramaniaan deleted the added-alizer-analyze-command branch August 16, 2024 14:31
@vrubezhny vrubezhny added this to the 1.16.0 milestone Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants