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

[Nuctl] Introduce nuctl parse #3129

Merged
merged 9 commits into from
Jan 23, 2024
Merged

Conversation

rokatyy
Copy link
Contributor

@rokatyy rokatyy commented Jan 17, 2024

Jira - https://jira.iguazeng.com/browse/NUC-129
This PR introduces new nuctl command - nuctl parse

It is intended to parse any type that implements Report interface. In other words, for now it supports import functions/projects reports.

Usage example:

# To simply print the report in a beautified way 
nuctl parse --report-file-path <path-to-report>

# To simply print the report in a beautified way, but also filter by failed status
nuctl parse --report-file-path <path-to-report> --only-failed

# To print the report to a specific file in a beautified way
nuctl parse --report-file-path <path-to-report> --output-path <output_file>

Output example:

+----------+---------------+---------+--------------------------------------------------------------+--------------+
| TYPE     | NAME          | STATUS  | FAIL DESCRIPTION                                             | AUTO-FIXABLE |
+----------+---------------+---------+--------------------------------------------------------------+--------------+
| project  | default       | failed  | Import failed for some of the functions. Project: `default`. | false        |
| function | fff           | failed  | Function with the name: fff already exists                   | false        |
+----------+---------------+---------+--------------------------------------------------------------+--------------+
| project  | project-2     | failed  | Import failed for some of the functions                      | false        |
| function | function-name | success |                                                              |              |
| function | fff           | failed  | Function with the name: fff already exists                   | false        |
+----------+---------------+---------+--------------------------------------------------------------+--------------+

@github-actions github-actions bot added the nuctl label Jan 17, 2024
@rokatyy rokatyy marked this pull request as ready for review January 18, 2024 13:38
@rokatyy rokatyy changed the title [WIP][Nuctl] Introduce nuctl parse [Nuctl] Introduce nuctl parse Jan 18, 2024
pkg/nuctl/command/common/importreport.go Outdated Show resolved Hide resolved
pkg/nuctl/command/parse.go Outdated Show resolved Hide resolved
pkg/nuctl/command/parse.go Outdated Show resolved Hide resolved
pkg/nuctl/command/parse.go Outdated Show resolved Hide resolved
pkg/nuctl/command/parse.go Outdated Show resolved Hide resolved
pkg/nuctl/command/parse.go Outdated Show resolved Hide resolved
pkg/nuctl/command/parse.go Outdated Show resolved Hide resolved
@TomerShor
Copy link
Contributor

@rokatyy please add an example output in the description as well.

pkg/nuctl/command/common/importreport.go Outdated Show resolved Hide resolved
pkg/nuctl/command/parse.go Show resolved Hide resolved
pkg/nuctl/command/common/importreport.go Outdated Show resolved Hide resolved
pkg/nuctl/command/parse.go Outdated Show resolved Hide resolved

cmd.Flags().StringVar(&commandeer.reportFilePath, "report-file-path", "nuctl-import-report.json", "Path to report")
cmd.Flags().BoolVar(&commandeer.onlyFailed, "failed", false, "Show only failures")
cmd.Flags().StringVarP(&commandeer.outputPath, "output-path", "", "", "Path to save outputPath")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
cmd.Flags().StringVarP(&commandeer.outputPath, "output-path", "", "", "Path to save outputPath")
cmd.Flags().StringVarP(&commandeer.outputPath, "output-path", "", "", "File path to save the parsed report")

Copy link
Contributor

Choose a reason for hiding this comment

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

also - if parent folder doesn't exist it will fail. perhaps worth mentioning it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@TomerShor we raise a warning in that case

pkg/nuctl/test/project_test.go Outdated Show resolved Hide resolved
…report

# Conflicts:
#	pkg/nuctl/command/common/importreport.go
Copy link
Contributor

@TomerShor TomerShor left a comment

Choose a reason for hiding this comment

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

Looking good!

@TomerShor TomerShor merged commit b3368b1 into nuclio:development Jan 23, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants